|
@@ -8,6 +8,10 @@ from app.models.run import Run
|
|
|
from app.services.file.file import FileService
|
|
|
from app.services.assistant.assistant import AssistantService
|
|
|
import asyncio
|
|
|
+import nest_asyncio
|
|
|
+
|
|
|
+# 使得异步代码可以在已运行的事件循环中嵌套
|
|
|
+nest_asyncio.apply()
|
|
|
|
|
|
|
|
|
class FileSearchToolInput(BaseModel):
|
|
@@ -81,11 +85,6 @@ class FileSearchTool(BaseTool):
|
|
|
file_keys.append(file_key)
|
|
|
|
|
|
print(file_key)
|
|
|
- try:
|
|
|
- loop = asyncio.get_running_loop()
|
|
|
- self.loop = loop
|
|
|
- except Exception as e:
|
|
|
- print(e)
|
|
|
|
|
|
# self.loop = asyncio.get_event_loop()
|
|
|
files = self.loop.run_until_complete(
|