|
@@ -149,6 +149,13 @@ class ThreadRunner:
|
|
|
执行 run step
|
|
|
"""
|
|
|
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"
|
|
|
|
|
|
assistant_system_message = [msg_util.system_message(instruction)]
|
|
|
|
|
@@ -426,6 +433,13 @@ class ThreadRunner:
|
|
|
for content in message.content:
|
|
|
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 "
|
|
|
+
|
|
|
chat_messages.append(msg_util.new_message(role, message_content))
|
|
|
|
|
|
chat_messages.reverse() # 倒序排列,最新的消息在前面
|