mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-30 19:03:01 +01:00
Fix to continue showing retrieved documents in train of thought
This commit is contained in:
parent
a6f6e4f418
commit
6ad85e2275
1 changed files with 12 additions and 0 deletions
|
@ -21,6 +21,7 @@ from khoj.routers.helpers import (
|
|||
from khoj.utils.helpers import (
|
||||
ConversationCommand,
|
||||
function_calling_description_for_llm,
|
||||
is_none_or_empty,
|
||||
timer,
|
||||
)
|
||||
from khoj.utils.rawconfig import LocationData
|
||||
|
@ -189,6 +190,17 @@ async def execute_information_collection(
|
|||
defiltered_query = result[2]
|
||||
this_iteration.context = compiled_references
|
||||
|
||||
if not is_none_or_empty(compiled_references):
|
||||
try:
|
||||
headings = "\n- " + "\n- ".join(set([c.get("compiled", c).split("\n")[0] for c in compiled_references]))
|
||||
# Strip only leading # from headings
|
||||
headings = headings.replace("#", "")
|
||||
async for result in send_status_func(f"**Found Relevant Notes**: {headings}"):
|
||||
yield result
|
||||
except Exception as e:
|
||||
# TODO Get correct type for compiled across research notes extraction
|
||||
logger.error(f"Error extracting references: {e}", exc_info=True)
|
||||
|
||||
elif this_iteration.data_source == ConversationCommand.Online:
|
||||
async for result in search_online(
|
||||
this_iteration.query,
|
||||
|
|
Loading…
Reference in a new issue