diff --git a/app/service/chat/openai_chat_service.py b/app/service/chat/openai_chat_service.py index 2b2da4d..d2866a0 100644 --- a/app/service/chat/openai_chat_service.py +++ b/app/service/chat/openai_chat_service.py @@ -83,8 +83,13 @@ def _build_tools( names, functions = set(), [] for fc in function_declarations: if fc.get("name") not in names: - names.add(fc.get("name")) - functions.append(fc) + if fc.get("name")=="googleSearch": + # cherry开启内置搜索时,添加googleSearch工具 + tool["googleSearch"] = {} + else: + # 其他函数,添加到functionDeclarations中 + names.add(fc.get("name")) + functions.append(fc) tool["functionDeclarations"] = functions