From 7e4f2f8dc827036b79d03534c05cbcbbc70e7014 Mon Sep 17 00:00:00 2001 From: tanxing Date: Mon, 18 Aug 2025 14:16:07 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E8=AF=8D=EF=BC=8C=E7=A7=BB=E9=99=A4=E5=A4=9A=E4=BD=99=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deepsearcher/agent/deep_search.py | 4 +- main.py | 61 +------------------------------ 2 files changed, 4 insertions(+), 61 deletions(-) diff --git a/deepsearcher/agent/deep_search.py b/deepsearcher/agent/deep_search.py index 31bccdf..b3b21e7 100644 --- a/deepsearcher/agent/deep_search.py +++ b/deepsearcher/agent/deep_search.py @@ -91,7 +91,7 @@ REFLECT_PROMPT = """ SUMMARY_PROMPT = """ 你是一个内容分析专家 -请你综合已经提出的问题和检索到的信息,以原问题为中心,生成详细准确、层次分明、尽可能长的回答。 +请你综合已经提出的问题和检索到的信息,以原问题为中心,生成详细准确、层次分明(多级标题,从一级开始)、尽可能长的回答。 如果检索到的信息不足以回答问题,你应该使用你的知识来进行扩展补充。 注意,不要逐个回答问题,而是应该综合所有问题和信息,生成一个完整的回答。 同时,你应该根据提供的信息生成文内引用"[^index]"(markdown文内引用)。 @@ -149,7 +149,7 @@ class DeepSearch(BaseAgent): max_iter: The maximum number of iterations for the search process. route_collection: Whether to use a collection router for search. text_window_splitter: Whether to use text_window splitter. - enable_web_search: Whether to enable web search functionality. + web_search: Whether to enable web search functionality. **kwargs: Additional keyword arguments for customization. """ self.llm = llm diff --git a/main.py b/main.py index 4b34478..4c83a16 100644 --- a/main.py +++ b/main.py @@ -10,10 +10,10 @@ import os import asyncio import json import queue -from typing import AsyncGenerator +from collections.abc import AsyncGenerator from deepsearcher.configuration import Configuration, init_config -from deepsearcher.offline_loading import load_from_local_files, load_from_website +from deepsearcher.offline_loading import load_from_local_files from deepsearcher.online_query import query from deepsearcher.utils.message_stream import get_message_stream @@ -146,63 +146,6 @@ def load_files( raise HTTPException(status_code=500, detail=str(e)) -@app.post("/load-website/") -def load_website( - urls: str | list[str] = Body( - ..., - description="A list of URLs of websites to be loaded.", - examples=["https://milvus.io/docs/overview.md"], - ), - collection_name: str = Body( - None, - description="Optional name for the collection.", - examples=["my_collection"], - ), - collection_description: str = Body( - None, - description="Optional description for the collection.", - examples=["This is a test collection."], - ), - batch_size: int = Body( - None, - description="Optional batch size for the collection.", - examples=[256], - ), - force_rebuild: bool = Body( - False, - description="Whether to force rebuild the collection if it already exists.", - examples=[False], - ), -): - """ - Load website content into the vector database. - - Args: - urls (Union[str, List[str]]): URLs of websites to load. - collection_name (str, optional): Name for the collection. Defaults to None. - collection_description (str, optional): Description for the collection. Defaults to None. - batch_size (int, optional): Batch size for processing. Defaults to None. - force_rebuild (bool, optional): Whether to force rebuild the collection. Defaults to False. - - Returns: - dict: A dictionary containing a success message. - - Raises: - HTTPException: If loading website content fails. - """ - try: - load_from_website( - urls=urls, - collection_name=collection_name, - collection_description=collection_description, - batch_size=batch_size if batch_size is not None else 8, - force_rebuild=force_rebuild, - ) - return {"message": "成功加载"} - except Exception as e: - raise HTTPException(status_code=500, detail=str(e)) - - @app.get("/query-stream/") async def perform_query_stream( original_query: str = Query(