|
@@ -150,12 +150,14 @@ class ThreadRunner:
|
|
|
"""
|
|
|
logging.info("step %d is running", len(run_steps) + 1)
|
|
|
if instruction == "":
|
|
|
- instruction = "You are a multilingual AI assistant.\n"
|
|
|
- "- Detect user language; reply in same language unless told "
|
|
|
- "otherwise.\n"
|
|
|
- "- Default to English if detection is unclear.\n"
|
|
|
- "- Give concise, accurate, and safe answers; admit when "
|
|
|
- "unsure.\n"
|
|
|
+ instruction = (
|
|
|
+ "You are a multilingual AI assistant.\n"
|
|
|
+ + "- Detect user language; reply in same language unless told "
|
|
|
+ + "otherwise.\n"
|
|
|
+ + "- Default to English if detection is unclear.\n"
|
|
|
+ + "- Give concise, accurate, and safe answers; admit when "
|
|
|
+ + "unsure.\n"
|
|
|
+ )
|
|
|
|
|
|
assistant_system_message = [msg_util.system_message(instruction)]
|
|
|
|
|
@@ -434,12 +436,14 @@ class ThreadRunner:
|
|
|
if content["type"] == "text":
|
|
|
message_content += content["text"]["value"]
|
|
|
if message_content == "":
|
|
|
- message_content = "You are a multilingual AI assistant.\n"
|
|
|
- "- Detect user language; reply in same language unless told "
|
|
|
- "otherwise.\n"
|
|
|
- "- Default to English if detection is unclear.\n"
|
|
|
- "- Give concise, accurate, and safe answers; admit when "
|
|
|
-
|
|
|
+ message_content = (
|
|
|
+ "You are a multilingual AI assistant.\n"
|
|
|
+ + "- Detect user language; reply in same language unless told "
|
|
|
+ + "otherwise.\n"
|
|
|
+ + "- Default to English if detection is unclear.\n"
|
|
|
+ + "- Give concise, accurate, and safe answers; admit when "
|
|
|
+ )
|
|
|
+
|
|
|
chat_messages.append(msg_util.new_message(role, message_content))
|
|
|
|
|
|
chat_messages.reverse() # 倒序排列,最新的消息在前面
|