From f4a79b42516da771e26544deed05e92bad0e2499 Mon Sep 17 00:00:00 2001 From: Mats Rauhala Date: Thu, 11 Jun 2026 20:51:39 +0300 Subject: [PATCH] Format search results --- src/MyLib.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/MyLib.hs b/src/MyLib.hs index c49ada0..8dd5fc3 100644 --- a/src/MyLib.hs +++ b/src/MyLib.hs @@ -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