| 12345678910111213141516171819202122232425262728 | from typing import Typefrom pydantic import BaseModel, Fieldfrom app.core.tools.base_tool import BaseToolfrom config.llm import tool_settingsfrom sqlalchemy.orm import Sessionfrom app.models.run import Runfrom app.services.file.file import FileServiceclass FileContnetTool(BaseTool):    name: str = "file_content"    description: str = (        "读取文件的所有或者全部内容并返回给用户,这里每一次只允许触发一次"        "只有提到读取全部内容的时候才会返回全部内容,其他时候这个工具不会调用"        "和file_search工具不会同时使用,用了此工具就不会调用file_search"    )    file_ids: list[str] = []    args_schema: Type[BaseModel] = {}    def configure(self, session: Session, run: Run, **kwargs):        if run.file_ids is not None and len(run.file_ids) > 0:            self.file_ids = run.file_ids    def run(self) -> dict:        return FileService.retrieve_documents(ids=self.file_ids)
 |