jack 1 天之前
父节点
当前提交
43530175ce
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      app/services/run/run.py

+ 7 - 0
app/services/run/run.py

@@ -46,6 +46,8 @@ class RunService:
             body.temperature = db_asst.temperature
         if not body.top_p and db_asst.top_p:
             body.top_p = db_asst.top_p
+        if body.additional_instructions:
+            body.instructions = body.additional_instructions
 
         file_ids = []
         asst_file_ids = db_asst.file_ids
@@ -77,6 +79,11 @@ class RunService:
         # 去除重复的file_ids,这里要处理
         file_ids = list(set(file_ids))
 
+        if len(file_ids) > 0:
+            file_search_tool = {"type": "file_search"}
+            if file_search_tool not in body.tools:
+                body.tools.append(file_search_tool)
+
         # create run
         db_run = Run.model_validate(
             body.model_dump(by_alias=True),