From 4c8608dc6143ef9bd72e0eb6a0a572191b37fa2c Mon Sep 17 00:00:00 2001 From: takatost Date: Fri, 1 Sep 2023 10:31:42 +0800 Subject: [PATCH] feat: optimize conversation title generation output must be a valid JSON (#1077) --- api/core/prompt/prompts.py | 1 + .../generate_conversation_name_when_first_message_created.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/api/core/prompt/prompts.py b/api/core/prompt/prompts.py index 971c822e85..a26874d325 100644 --- a/api/core/prompt/prompts.py +++ b/api/core/prompt/prompts.py @@ -3,6 +3,7 @@ CONVERSATION_TITLE_PROMPT = """You need to decompose the user's input into "subj Notice: the language type user using is abundant, can be English, Chinese, EspaƱol, Arabic, Japanese, and etc. MAKE SURE your output is the SAME language as the user's input! Your output is restricted only to: (Input language) Intention + Subject(short as possible) +Your output MUST be a valid JSON. Tip: When the user's question is directed at you (the language model), you can add an emoji to make it more fun. diff --git a/api/events/event_handlers/generate_conversation_name_when_first_message_created.py b/api/events/event_handlers/generate_conversation_name_when_first_message_created.py index 9e84e74a93..4176f9dbbb 100644 --- a/api/events/event_handlers/generate_conversation_name_when_first_message_created.py +++ b/api/events/event_handlers/generate_conversation_name_when_first_message_created.py @@ -26,7 +26,7 @@ def handle(sender, **kwargs): conversation.name = name except: - conversation.name = 'New Chat' + conversation.name = 'New conversation' db.session.add(conversation) db.session.commit()