Format search results
This commit is contained in:
1 parent
f5197caa77
commit
f4a79b4251
1 file changed
+4
-2
+4
-2
@@ -7,7 +7,7 @@ module MyLib (defaultMain, test) where
|
||||
import AI
|
||||
import Control.Exception.Annotated.UnliftIO (Exception, SomeException, catch, throw)
|
||||
import Control.Lens (over, re, strict, view, (&), (.~), (^.))
|
||||
import Control.Monad (forever)
|
||||
import Control.Monad (forM_, forever)
|
||||
import Data.Aeson (decode, encode)
|
||||
import Data.Either (fromRight)
|
||||
import Data.Maybe (fromMaybe)
|
||||
@@ -215,7 +215,9 @@ defaultMain = do
|
||||
Search {verbose, query, limit, embeddingsDb} ->
|
||||
runWithDb (unHelpful embeddingsDb) (severity verbose) $ \db -> do
|
||||
entries <- search db (unHelpful query) (unHelpful $ unDefValue limit)
|
||||
liftIO $ mapM_ (\(score, _eid, u, _title) -> T.putStrLn $ T.pack $ printf "%.4f %s" (score :: Double) (T.unpack u)) entries
|
||||
liftIO $ forM_ entries $ \(score, _eid, u, t) -> do
|
||||
T.putStrLn $ T.pack $ printf "%.4f %s" (score :: Double) (T.unpack t)
|
||||
T.putStrLn $ T.pack $ printf " %s" (T.unpack u)
|
||||
Daemon {verbose, credentials, port, embeddingsDb} ->
|
||||
runDaemon (unHelpful $ unDefValue port) (unHelpful credentials) (severity verbose)
|
||||
where
|
||||
|
||||
Reference in new issue
Block a user