mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
Update conversation logs from /beta/summary API endpoint too
This commit is contained in:
@@ -47,6 +47,10 @@ def summarize_beta(q: str):
|
||||
model = state.processor_config.conversation.model
|
||||
api_key = state.processor_config.conversation.openai_api_key
|
||||
|
||||
# Load Conversation History
|
||||
chat_session = state.processor_config.conversation.chat_session
|
||||
meta_log = state.processor_config.conversation.meta_log
|
||||
|
||||
# Converse with OpenAI GPT
|
||||
result_list = search(q, n=1, t=SearchType.Org, r=True)
|
||||
collated_result = "\n".join([item.entry for item in result_list])
|
||||
@@ -58,6 +62,10 @@ def summarize_beta(q: str):
|
||||
gpt_response = str(e)
|
||||
status = 'error'
|
||||
|
||||
# Update Conversation History
|
||||
state.processor_config.conversation.chat_session = message_to_prompt(q, chat_session, gpt_message=gpt_response)
|
||||
state.processor_config.conversation.meta_log['chat'] = message_to_log(q, gpt_response, conversation_log=meta_log.get('chat', []))
|
||||
|
||||
return {'status': status, 'response': gpt_response}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user