From 461c81e14afd7ba871da78facf39309bbbf1af93 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Wed, 31 Dec 2025 14:40:27 +0800 Subject: [PATCH 001/335] Fix: KG search issue. (#12364) ### What problem does this PR solve? Close #12347 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- agent/tools/retrieval.py | 4 ++-- api/apps/chunk_app.py | 2 +- api/apps/sdk/dify_retrieval.py | 2 +- api/apps/sdk/doc.py | 2 +- api/apps/sdk/session.py | 2 +- api/db/services/dialog_service.py | 2 +- graphrag/search.py | 17 +++++++++-------- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/agent/tools/retrieval.py b/agent/tools/retrieval.py index 21df960befb..f024c42fa24 100644 --- a/agent/tools/retrieval.py +++ b/agent/tools/retrieval.py @@ -202,7 +202,7 @@ def _resolve_manual_filter(flt: dict) -> dict: kbinfos["chunks"] = settings.retriever.retrieval_by_children(kbinfos["chunks"], [kb.tenant_id for kb in kbs]) if self._param.use_kg: - ck = settings.kg_retriever.retrieval(query, + ck = await settings.kg_retriever.retrieval(query, [kb.tenant_id for kb in kbs], kb_ids, embd_mdl, @@ -215,7 +215,7 @@ def _resolve_manual_filter(flt: dict) -> dict: kbinfos = {"chunks": [], "doc_aggs": []} if self._param.use_kg and kbs: - ck = settings.kg_retriever.retrieval(query, [kb.tenant_id for kb in kbs], filtered_kb_ids, embd_mdl, + ck = await settings.kg_retriever.retrieval(query, [kb.tenant_id for kb in kbs], filtered_kb_ids, embd_mdl, LLMBundle(kbs[0].tenant_id, LLMType.CHAT)) if self.check_if_canceled("Retrieval processing"): return diff --git a/api/apps/chunk_app.py b/api/apps/chunk_app.py index f5b248fd5ef..1a7bed0c63c 100644 --- a/api/apps/chunk_app.py +++ b/api/apps/chunk_app.py @@ -381,7 +381,7 @@ async def _retrieval(): rank_feature=labels ) if use_kg: - ck = settings.kg_retriever.retrieval(_question, + ck = await settings.kg_retriever.retrieval(_question, tenant_ids, kb_ids, embd_mdl, diff --git a/api/apps/sdk/dify_retrieval.py b/api/apps/sdk/dify_retrieval.py index 7a11688ddcb..91f1c9a8fb7 100644 --- a/api/apps/sdk/dify_retrieval.py +++ b/api/apps/sdk/dify_retrieval.py @@ -150,7 +150,7 @@ async def retrieval(tenant_id): ) if use_kg: - ck = settings.kg_retriever.retrieval(question, + ck = await settings.kg_retriever.retrieval(question, [tenant_id], [kb_id], embd_mdl, diff --git a/api/apps/sdk/doc.py b/api/apps/sdk/doc.py index bef03d38ec4..db8a97b6822 100644 --- a/api/apps/sdk/doc.py +++ b/api/apps/sdk/doc.py @@ -1579,7 +1579,7 @@ async def retrieval_test(tenant_id): if cks: ranks["chunks"] = cks if use_kg: - ck = settings.kg_retriever.retrieval(question, [k.tenant_id for k in kbs], kb_ids, embd_mdl, LLMBundle(kb.tenant_id, LLMType.CHAT)) + ck = await settings.kg_retriever.retrieval(question, [k.tenant_id for k in kbs], kb_ids, embd_mdl, LLMBundle(kb.tenant_id, LLMType.CHAT)) if ck["content_with_weight"]: ranks["chunks"].insert(0, ck) diff --git a/api/apps/sdk/session.py b/api/apps/sdk/session.py index f9615e36ba1..e76560ccfcc 100644 --- a/api/apps/sdk/session.py +++ b/api/apps/sdk/session.py @@ -1116,7 +1116,7 @@ async def _retrieval(): local_doc_ids, rerank_mdl=rerank_mdl, highlight=req.get("highlight"), rank_feature=labels ) if use_kg: - ck = settings.kg_retriever.retrieval(_question, tenant_ids, kb_ids, embd_mdl, + ck = await settings.kg_retriever.retrieval(_question, tenant_ids, kb_ids, embd_mdl, LLMBundle(kb.tenant_id, LLMType.CHAT)) if ck["content_with_weight"]: ranks["chunks"].insert(0, ck) diff --git a/api/db/services/dialog_service.py b/api/db/services/dialog_service.py index 4bc24210b20..33b50730ff4 100644 --- a/api/db/services/dialog_service.py +++ b/api/db/services/dialog_service.py @@ -421,7 +421,7 @@ async def async_chat(dialog, messages, stream=True, **kwargs): kbinfos["chunks"].extend(tav_res["chunks"]) kbinfos["doc_aggs"].extend(tav_res["doc_aggs"]) if prompt_config.get("use_kg"): - ck = settings.kg_retriever.retrieval(" ".join(questions), tenant_ids, dialog.kb_ids, embd_mdl, + ck = await settings.kg_retriever.retrieval(" ".join(questions), tenant_ids, dialog.kb_ids, embd_mdl, LLMBundle(dialog.tenant_id, LLMType.CHAT)) if ck["content_with_weight"]: kbinfos["chunks"].insert(0, ck) diff --git a/graphrag/search.py b/graphrag/search.py index 7bb46b6b9a0..728588b8731 100644 --- a/graphrag/search.py +++ b/graphrag/search.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import asyncio import json import logging from collections import defaultdict @@ -32,21 +33,21 @@ class KGSearch(Dealer): - def _chat(self, llm_bdl, system, history, gen_conf): + async def _chat(self, llm_bdl, system, history, gen_conf): response = get_llm_cache(llm_bdl.llm_name, system, history, gen_conf) if response: return response - response = llm_bdl.chat(system, history, gen_conf) + response = await llm_bdl.async_chat(system, history, gen_conf) if response.find("**ERROR**") >= 0: raise Exception(response) set_llm_cache(llm_bdl.llm_name, system, response, history, gen_conf) return response - def query_rewrite(self, llm, question, idxnms, kb_ids): + async def query_rewrite(self, llm, question, idxnms, kb_ids): ty2ents = get_entity_type2samples(idxnms, kb_ids) hint_prompt = PROMPTS["minirag_query2kwd"].format(query=question, TYPE_POOL=json.dumps(ty2ents, ensure_ascii=False, indent=2)) - result = self._chat(llm, hint_prompt, [{"role": "user", "content": "Output:"}], {}) + result = await self._chat(llm, hint_prompt, [{"role": "user", "content": "Output:"}], {}) try: keywords_data = json_repair.loads(result) type_keywords = keywords_data.get("answer_type_keywords", []) @@ -138,7 +139,7 @@ def get_relevant_ents_by_types(self, types, filters, idxnms, kb_ids, N=56): idxnms, kb_ids) return self._ent_info_from_(es_res, 0) - def retrieval(self, question: str, + async def retrieval(self, question: str, tenant_ids: str | list[str], kb_ids: list[str], emb_mdl, @@ -158,7 +159,7 @@ def retrieval(self, question: str, idxnms = [index_name(tid) for tid in tenant_ids] ty_kwds = [] try: - ty_kwds, ents = self.query_rewrite(llm, qst, [index_name(tid) for tid in tenant_ids], kb_ids) + ty_kwds, ents = await self.query_rewrite(llm, qst, [index_name(tid) for tid in tenant_ids], kb_ids) logging.info(f"Q: {qst}, Types: {ty_kwds}, Entities: {ents}") except Exception as e: logging.exception(e) @@ -334,5 +335,5 @@ def _community_retrieval_(self, entities, condition, kb_ids, idxnms, topn, max_t embed_bdl = LLMBundle(args.tenant_id, LLMType.EMBEDDING, kb.embd_id) kg = KGSearch(settings.docStoreConn) - print(kg.retrieval({"question": args.question, "kb_ids": [kb_id]}, - search.index_name(kb.tenant_id), [kb_id], embed_bdl, llm_bdl)) + print(asyncio.run(kg.retrieval({"question": args.question, "kb_ids": [kb_id]}, + search.index_name(kb.tenant_id), [kb_id], embed_bdl, llm_bdl))) From c2ee2bf7fef2ef66525938ae91464c0c1190d6d0 Mon Sep 17 00:00:00 2001 From: buua436 Date: Wed, 31 Dec 2025 14:40:49 +0800 Subject: [PATCH 002/335] Feat: add Zendesk data source integration with configuration and sync capabilities (#12344) ### What problem does this PR solve? issue: #12313 change: add Zendesk data source integration with configuration and sync capabilities ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- common/constants.py | 1 + common/data_source/__init__.py | 4 +- common/data_source/config.py | 7 +- common/data_source/utils.py | 98 +++ common/data_source/zendesk_connector.py | 667 ++++++++++++++++++ rag/svr/sync_data_source.py | 92 ++- web/src/assets/svg/data-source/zendesk.svg | 8 + .../data-source/constant/index.tsx | 49 ++ 8 files changed, 921 insertions(+), 5 deletions(-) create mode 100644 common/data_source/zendesk_connector.py create mode 100644 web/src/assets/svg/data-source/zendesk.svg diff --git a/common/constants.py b/common/constants.py index 23a75505941..d99c0995272 100644 --- a/common/constants.py +++ b/common/constants.py @@ -133,6 +133,7 @@ class FileSource(StrEnum): GITHUB = "github" GITLAB = "gitlab" IMAP = "imap" + ZENDESK = "zendesk" class PipelineTaskType(StrEnum): PARSE = "Parse" diff --git a/common/data_source/__init__.py b/common/data_source/__init__.py index 2619e779dcd..9fed196ab6e 100644 --- a/common/data_source/__init__.py +++ b/common/data_source/__init__.py @@ -39,6 +39,7 @@ from .airtable_connector import AirtableConnector from .asana_connector import AsanaConnector from .imap_connector import ImapConnector +from .zendesk_connector import ZendeskConnector from .config import BlobType, DocumentSource from .models import Document, TextSection, ImageSection, BasicExpertInfo from .exceptions import ( @@ -76,5 +77,6 @@ "UnexpectedValidationError", "AirtableConnector", "AsanaConnector", - "ImapConnector" + "ImapConnector", + "ZendeskConnector", ] diff --git a/common/data_source/config.py b/common/data_source/config.py index bca13b5bed6..64b30a0518e 100644 --- a/common/data_source/config.py +++ b/common/data_source/config.py @@ -58,8 +58,9 @@ class DocumentSource(str, Enum): GITHUB = "github" GITLAB = "gitlab" IMAP = "imap" + ZENDESK = "zendesk" + - class FileOrigin(str, Enum): """File origins""" CONNECTOR = "connector" @@ -271,6 +272,10 @@ class HtmlBasedConnectorTransformLinksStrategy(str, Enum): os.environ.get("IMAP_CONNECTOR_SIZE_THRESHOLD", 10 * 1024 * 1024) ) +ZENDESK_CONNECTOR_SKIP_ARTICLE_LABELS = os.environ.get( + "ZENDESK_CONNECTOR_SKIP_ARTICLE_LABELS", "" +).split(",") + _USER_NOT_FOUND = "Unknown Confluence User" _COMMENT_EXPANSION_FIELDS = ["body.storage.value"] diff --git a/common/data_source/utils.py b/common/data_source/utils.py index f69ecbd7863..da500f055ca 100644 --- a/common/data_source/utils.py +++ b/common/data_source/utils.py @@ -1149,3 +1149,101 @@ def parallel_yield(gens: list[Iterator[R]], max_workers: int = 10) -> Iterator[R future_to_index[executor.submit(_next_or_none, ind, gens[ind])] = next_ind next_ind += 1 del future_to_index[future] + +F = TypeVar("F", bound=Callable[..., Any]) + +class _RateLimitDecorator: + """Builds a generic wrapper/decorator for calls to external APIs that + prevents making more than `max_calls` requests per `period` + + Implementation inspired by the `ratelimit` library: + https://github.com/tomasbasham/ratelimit. + + NOTE: is not thread safe. + """ + + def __init__( + self, + max_calls: int, + period: float, # in seconds + sleep_time: float = 2, # in seconds + sleep_backoff: float = 2, # applies exponential backoff + max_num_sleep: int = 0, + ): + self.max_calls = max_calls + self.period = period + self.sleep_time = sleep_time + self.sleep_backoff = sleep_backoff + self.max_num_sleep = max_num_sleep + + self.call_history: list[float] = [] + self.curr_calls = 0 + + def __call__(self, func: F) -> F: + @wraps(func) + def wrapped_func(*args: list, **kwargs: dict[str, Any]) -> Any: + # cleanup calls which are no longer relevant + self._cleanup() + + # check if we've exceeded the rate limit + sleep_cnt = 0 + while len(self.call_history) == self.max_calls: + sleep_time = self.sleep_time * (self.sleep_backoff**sleep_cnt) + logging.warning( + f"Rate limit exceeded for function {func.__name__}. " + f"Waiting {sleep_time} seconds before retrying." + ) + time.sleep(sleep_time) + sleep_cnt += 1 + if self.max_num_sleep != 0 and sleep_cnt >= self.max_num_sleep: + raise RateLimitTriedTooManyTimesError( + f"Exceeded '{self.max_num_sleep}' retries for function '{func.__name__}'" + ) + + self._cleanup() + + # add the current call to the call history + self.call_history.append(time.monotonic()) + return func(*args, **kwargs) + + return cast(F, wrapped_func) + + def _cleanup(self) -> None: + curr_time = time.monotonic() + time_to_expire_before = curr_time - self.period + self.call_history = [ + call_time + for call_time in self.call_history + if call_time > time_to_expire_before + ] + +rate_limit_builder = _RateLimitDecorator + +def retry_builder( + tries: int = 20, + delay: float = 0.1, + max_delay: float | None = 60, + backoff: float = 2, + jitter: tuple[float, float] | float = 1, + exceptions: type[Exception] | tuple[type[Exception], ...] = (Exception,), +) -> Callable[[F], F]: + """Builds a generic wrapper/decorator for calls to external APIs that + may fail due to rate limiting, flakes, or other reasons. Applies exponential + backoff with jitter to retry the call.""" + + def retry_with_default(func: F) -> F: + @retry( + tries=tries, + delay=delay, + max_delay=max_delay, + backoff=backoff, + jitter=jitter, + logger=logging.getLogger(__name__), + exceptions=exceptions, + ) + def wrapped_func(*args: list, **kwargs: dict[str, Any]) -> Any: + return func(*args, **kwargs) + + return cast(F, wrapped_func) + + return retry_with_default \ No newline at end of file diff --git a/common/data_source/zendesk_connector.py b/common/data_source/zendesk_connector.py new file mode 100644 index 00000000000..85b3426fe3f --- /dev/null +++ b/common/data_source/zendesk_connector.py @@ -0,0 +1,667 @@ +import copy +import logging +import time +from collections.abc import Callable +from collections.abc import Iterator +from typing import Any + +import requests +from pydantic import BaseModel +from requests.exceptions import HTTPError +from typing_extensions import override + +from common.data_source.config import ZENDESK_CONNECTOR_SKIP_ARTICLE_LABELS, DocumentSource +from common.data_source.exceptions import ConnectorValidationError, CredentialExpiredError, InsufficientPermissionsError +from common.data_source.html_utils import parse_html_page_basic +from common.data_source.interfaces import CheckpointOutput, CheckpointOutputWrapper, CheckpointedConnector, IndexingHeartbeatInterface, SlimConnectorWithPermSync +from common.data_source.models import BasicExpertInfo, ConnectorCheckpoint, ConnectorFailure, Document, DocumentFailure, GenerateSlimDocumentOutput, SecondsSinceUnixEpoch, SlimDocument +from common.data_source.utils import retry_builder, time_str_to_utc,rate_limit_builder + +MAX_PAGE_SIZE = 30 # Zendesk API maximum +MAX_AUTHOR_MAP_SIZE = 50_000 # Reset author map cache if it gets too large +_SLIM_BATCH_SIZE = 1000 + + +class ZendeskCredentialsNotSetUpError(PermissionError): + def __init__(self) -> None: + super().__init__( + "Zendesk Credentials are not set up, was load_credentials called?" + ) + + +class ZendeskClient: + def __init__( + self, + subdomain: str, + email: str, + token: str, + calls_per_minute: int | None = None, + ): + self.base_url = f"https://{subdomain}.zendesk.com/api/v2" + self.auth = (f"{email}/token", token) + self.make_request = request_with_rate_limit(self, calls_per_minute) + + +def request_with_rate_limit( + client: ZendeskClient, max_calls_per_minute: int | None = None +) -> Callable[[str, dict[str, Any]], dict[str, Any]]: + @retry_builder() + @( + rate_limit_builder(max_calls=max_calls_per_minute, period=60) + if max_calls_per_minute + else lambda x: x + ) + def make_request(endpoint: str, params: dict[str, Any]) -> dict[str, Any]: + response = requests.get( + f"{client.base_url}/{endpoint}", auth=client.auth, params=params + ) + + if response.status_code == 429: + retry_after = response.headers.get("Retry-After") + if retry_after is not None: + # Sleep for the duration indicated by the Retry-After header + time.sleep(int(retry_after)) + + elif ( + response.status_code == 403 + and response.json().get("error") == "SupportProductInactive" + ): + return response.json() + + response.raise_for_status() + return response.json() + + return make_request + + +class ZendeskPageResponse(BaseModel): + data: list[dict[str, Any]] + meta: dict[str, Any] + has_more: bool + + +def _get_content_tag_mapping(client: ZendeskClient) -> dict[str, str]: + content_tags: dict[str, str] = {} + params = {"page[size]": MAX_PAGE_SIZE} + + try: + while True: + data = client.make_request("guide/content_tags", params) + + for tag in data.get("records", []): + content_tags[tag["id"]] = tag["name"] + + # Check if there are more pages + if data.get("meta", {}).get("has_more", False): + params["page[after]"] = data["meta"]["after_cursor"] + else: + break + + return content_tags + except Exception as e: + raise Exception(f"Error fetching content tags: {str(e)}") + + +def _get_articles( + client: ZendeskClient, start_time: int | None = None, page_size: int = MAX_PAGE_SIZE +) -> Iterator[dict[str, Any]]: + params = {"page[size]": page_size, "sort_by": "updated_at", "sort_order": "asc"} + if start_time is not None: + params["start_time"] = start_time + + while True: + data = client.make_request("help_center/articles", params) + for article in data["articles"]: + yield article + + if not data.get("meta", {}).get("has_more"): + break + params["page[after]"] = data["meta"]["after_cursor"] + + +def _get_article_page( + client: ZendeskClient, + start_time: int | None = None, + after_cursor: str | None = None, + page_size: int = MAX_PAGE_SIZE, +) -> ZendeskPageResponse: + params = {"page[size]": page_size, "sort_by": "updated_at", "sort_order": "asc"} + if start_time is not None: + params["start_time"] = start_time + if after_cursor is not None: + params["page[after]"] = after_cursor + + data = client.make_request("help_center/articles", params) + return ZendeskPageResponse( + data=data["articles"], + meta=data["meta"], + has_more=bool(data["meta"].get("has_more", False)), + ) + + +def _get_tickets( + client: ZendeskClient, start_time: int | None = None +) -> Iterator[dict[str, Any]]: + params = {"start_time": start_time or 0} + + while True: + data = client.make_request("incremental/tickets.json", params) + for ticket in data["tickets"]: + yield ticket + + if not data.get("end_of_stream", False): + params["start_time"] = data["end_time"] + else: + break + + +# TODO: maybe these don't need to be their own functions? +def _get_tickets_page( + client: ZendeskClient, start_time: int | None = None +) -> ZendeskPageResponse: + params = {"start_time": start_time or 0} + + # NOTE: for some reason zendesk doesn't seem to be respecting the start_time param + # in my local testing with very few tickets. We'll look into it if this becomes an + # issue in larger deployments + data = client.make_request("incremental/tickets.json", params) + if data.get("error") == "SupportProductInactive": + raise ValueError( + "Zendesk Support Product is not active for this account, No tickets to index" + ) + return ZendeskPageResponse( + data=data["tickets"], + meta={"end_time": data["end_time"]}, + has_more=not bool(data.get("end_of_stream", False)), + ) + + +def _fetch_author( + client: ZendeskClient, author_id: str | int +) -> BasicExpertInfo | None: + # Skip fetching if author_id is invalid + # cast to str to avoid issues with zendesk changing their types + if not author_id or str(author_id) == "-1": + return None + + try: + author_data = client.make_request(f"users/{author_id}", {}) + user = author_data.get("user") + return ( + BasicExpertInfo(display_name=user.get("name"), email=user.get("email")) + if user and user.get("name") and user.get("email") + else None + ) + except requests.exceptions.HTTPError: + # Handle any API errors gracefully + return None + + +def _article_to_document( + article: dict[str, Any], + content_tags: dict[str, str], + author_map: dict[str, BasicExpertInfo], + client: ZendeskClient, +) -> tuple[dict[str, BasicExpertInfo] | None, Document]: + author_id = article.get("author_id") + if not author_id: + author = None + else: + author = ( + author_map.get(author_id) + if author_id in author_map + else _fetch_author(client, author_id) + ) + + new_author_mapping = {author_id: author} if author_id and author else None + + updated_at = article.get("updated_at") + update_time = time_str_to_utc(updated_at) if updated_at else None + + text = parse_html_page_basic(article.get("body") or "") + blob = text.encode("utf-8", errors="replace") + # Build metadata + metadata: dict[str, str | list[str]] = { + "labels": [str(label) for label in article.get("label_names", []) if label], + "content_tags": [ + content_tags[tag_id] + for tag_id in article.get("content_tag_ids", []) + if tag_id in content_tags + ], + } + + # Remove empty values + metadata = {k: v for k, v in metadata.items() if v} + + return new_author_mapping, Document( + id=f"article:{article['id']}", + source=DocumentSource.ZENDESK, + semantic_identifier=article["title"], + extension=".txt", + blob=blob, + size_bytes=len(blob), + doc_updated_at=update_time, + primary_owners=[author] if author else None, + metadata=metadata, + ) + + +def _get_comment_text( + comment: dict[str, Any], + author_map: dict[str, BasicExpertInfo], + client: ZendeskClient, +) -> tuple[dict[str, BasicExpertInfo] | None, str]: + author_id = comment.get("author_id") + if not author_id: + author = None + else: + author = ( + author_map.get(author_id) + if author_id in author_map + else _fetch_author(client, author_id) + ) + + new_author_mapping = {author_id: author} if author_id and author else None + + comment_text = f"Comment{' by ' + author.display_name if author and author.display_name else ''}" + comment_text += f"{' at ' + comment['created_at'] if comment.get('created_at') else ''}:\n{comment['body']}" + + return new_author_mapping, comment_text + + +def _ticket_to_document( + ticket: dict[str, Any], + author_map: dict[str, BasicExpertInfo], + client: ZendeskClient, +) -> tuple[dict[str, BasicExpertInfo] | None, Document]: + submitter_id = ticket.get("submitter") + if not submitter_id: + submitter = None + else: + submitter = ( + author_map.get(submitter_id) + if submitter_id in author_map + else _fetch_author(client, submitter_id) + ) + + new_author_mapping = ( + {submitter_id: submitter} if submitter_id and submitter else None + ) + + updated_at = ticket.get("updated_at") + update_time = time_str_to_utc(updated_at) if updated_at else None + + metadata: dict[str, str | list[str]] = {} + if status := ticket.get("status"): + metadata["status"] = status + if priority := ticket.get("priority"): + metadata["priority"] = priority + if tags := ticket.get("tags"): + metadata["tags"] = tags + if ticket_type := ticket.get("type"): + metadata["ticket_type"] = ticket_type + + # Fetch comments for the ticket + comments_data = client.make_request(f"tickets/{ticket.get('id')}/comments", {}) + comments = comments_data.get("comments", []) + + comment_texts = [] + for comment in comments: + new_author_mapping, comment_text = _get_comment_text( + comment, author_map, client + ) + if new_author_mapping: + author_map.update(new_author_mapping) + comment_texts.append(comment_text) + + comments_text = "\n\n".join(comment_texts) + + subject = ticket.get("subject") + full_text = f"Ticket Subject:\n{subject}\n\nComments:\n{comments_text}" + + blob = full_text.encode("utf-8", errors="replace") + return new_author_mapping, Document( + id=f"zendesk_ticket_{ticket['id']}", + blob=blob, + extension=".txt", + size_bytes=len(blob), + source=DocumentSource.ZENDESK, + semantic_identifier=f"Ticket #{ticket['id']}: {subject or 'No Subject'}", + doc_updated_at=update_time, + primary_owners=[submitter] if submitter else None, + metadata=metadata, + ) + + +class ZendeskConnectorCheckpoint(ConnectorCheckpoint): + # We use cursor-based paginated retrieval for articles + after_cursor_articles: str | None + + # We use timestamp-based paginated retrieval for tickets + next_start_time_tickets: int | None + + cached_author_map: dict[str, BasicExpertInfo] | None + cached_content_tags: dict[str, str] | None + + +class ZendeskConnector( + SlimConnectorWithPermSync, CheckpointedConnector[ZendeskConnectorCheckpoint] +): + def __init__( + self, + content_type: str = "articles", + calls_per_minute: int | None = None, + ) -> None: + self.content_type = content_type + self.subdomain = "" + # Fetch all tags ahead of time + self.content_tags: dict[str, str] = {} + self.calls_per_minute = calls_per_minute + + def load_credentials(self, credentials: dict[str, Any]) -> dict[str, Any] | None: + # Subdomain is actually the whole URL + subdomain = ( + credentials["zendesk_subdomain"] + .replace("https://", "") + .split(".zendesk.com")[0] + ) + self.subdomain = subdomain + + self.client = ZendeskClient( + subdomain, + credentials["zendesk_email"], + credentials["zendesk_token"], + calls_per_minute=self.calls_per_minute, + ) + return None + + @override + def load_from_checkpoint( + self, + start: SecondsSinceUnixEpoch, + end: SecondsSinceUnixEpoch, + checkpoint: ZendeskConnectorCheckpoint, + ) -> CheckpointOutput[ZendeskConnectorCheckpoint]: + if self.client is None: + raise ZendeskCredentialsNotSetUpError() + if checkpoint.cached_content_tags is None: + checkpoint.cached_content_tags = _get_content_tag_mapping(self.client) + return checkpoint # save the content tags to the checkpoint + self.content_tags = checkpoint.cached_content_tags + + if self.content_type == "articles": + checkpoint = yield from self._retrieve_articles(start, end, checkpoint) + return checkpoint + elif self.content_type == "tickets": + checkpoint = yield from self._retrieve_tickets(start, end, checkpoint) + return checkpoint + else: + raise ValueError(f"Unsupported content_type: {self.content_type}") + + def _retrieve_articles( + self, + start: SecondsSinceUnixEpoch | None, + end: SecondsSinceUnixEpoch | None, + checkpoint: ZendeskConnectorCheckpoint, + ) -> CheckpointOutput[ZendeskConnectorCheckpoint]: + checkpoint = copy.deepcopy(checkpoint) + # This one is built on the fly as there may be more many more authors than tags + author_map: dict[str, BasicExpertInfo] = checkpoint.cached_author_map or {} + after_cursor = checkpoint.after_cursor_articles + doc_batch: list[Document] = [] + + response = _get_article_page( + self.client, + start_time=int(start) if start else None, + after_cursor=after_cursor, + ) + articles = response.data + has_more = response.has_more + after_cursor = response.meta.get("after_cursor") + for article in articles: + if ( + article.get("body") is None + or article.get("draft") + or any( + label in ZENDESK_CONNECTOR_SKIP_ARTICLE_LABELS + for label in article.get("label_names", []) + ) + ): + continue + + try: + new_author_map, document = _article_to_document( + article, self.content_tags, author_map, self.client + ) + except Exception as e: + logging.error(f"Error processing article {article['id']}: {e}") + yield ConnectorFailure( + failed_document=DocumentFailure( + document_id=f"{article.get('id')}", + document_link=article.get("html_url", ""), + ), + failure_message=str(e), + exception=e, + ) + continue + + if new_author_map: + author_map.update(new_author_map) + updated_at = document.doc_updated_at + updated_ts = updated_at.timestamp() if updated_at else None + if updated_ts is not None: + if start is not None and updated_ts <= start: + continue + if end is not None and updated_ts > end: + continue + + doc_batch.append(document) + + if not has_more: + yield from doc_batch + checkpoint.has_more = False + return checkpoint + + # Sometimes no documents are retrieved, but the cursor + # is still updated so the connector makes progress. + yield from doc_batch + checkpoint.after_cursor_articles = after_cursor + + last_doc_updated_at = doc_batch[-1].doc_updated_at if doc_batch else None + checkpoint.has_more = bool( + end is None + or last_doc_updated_at is None + or last_doc_updated_at.timestamp() <= end + ) + checkpoint.cached_author_map = ( + author_map if len(author_map) <= MAX_AUTHOR_MAP_SIZE else None + ) + return checkpoint + + def _retrieve_tickets( + self, + start: SecondsSinceUnixEpoch | None, + end: SecondsSinceUnixEpoch | None, + checkpoint: ZendeskConnectorCheckpoint, + ) -> CheckpointOutput[ZendeskConnectorCheckpoint]: + checkpoint = copy.deepcopy(checkpoint) + if self.client is None: + raise ZendeskCredentialsNotSetUpError() + + author_map: dict[str, BasicExpertInfo] = checkpoint.cached_author_map or {} + + doc_batch: list[Document] = [] + next_start_time = int(checkpoint.next_start_time_tickets or start or 0) + ticket_response = _get_tickets_page(self.client, start_time=next_start_time) + + tickets = ticket_response.data + has_more = ticket_response.has_more + next_start_time = ticket_response.meta["end_time"] + for ticket in tickets: + if ticket.get("status") == "deleted": + continue + + try: + new_author_map, document = _ticket_to_document( + ticket=ticket, + author_map=author_map, + client=self.client, + ) + except Exception as e: + logging.error(f"Error processing ticket {ticket['id']}: {e}") + yield ConnectorFailure( + failed_document=DocumentFailure( + document_id=f"{ticket.get('id')}", + document_link=ticket.get("url", ""), + ), + failure_message=str(e), + exception=e, + ) + continue + + if new_author_map: + author_map.update(new_author_map) + + updated_at = document.doc_updated_at + updated_ts = updated_at.timestamp() if updated_at else None + + if updated_ts is not None: + if start is not None and updated_ts <= start: + continue + if end is not None and updated_ts > end: + continue + + doc_batch.append(document) + + if not has_more: + yield from doc_batch + checkpoint.has_more = False + return checkpoint + + yield from doc_batch + checkpoint.next_start_time_tickets = next_start_time + last_doc_updated_at = doc_batch[-1].doc_updated_at if doc_batch else None + checkpoint.has_more = bool( + end is None + or last_doc_updated_at is None + or last_doc_updated_at.timestamp() <= end + ) + checkpoint.cached_author_map = ( + author_map if len(author_map) <= MAX_AUTHOR_MAP_SIZE else None + ) + return checkpoint + + def retrieve_all_slim_docs_perm_sync( + self, + start: SecondsSinceUnixEpoch | None = None, + end: SecondsSinceUnixEpoch | None = None, + callback: IndexingHeartbeatInterface | None = None, + ) -> GenerateSlimDocumentOutput: + slim_doc_batch: list[SlimDocument] = [] + if self.content_type == "articles": + articles = _get_articles( + self.client, start_time=int(start) if start else None + ) + for article in articles: + slim_doc_batch.append( + SlimDocument( + id=f"article:{article['id']}", + ) + ) + if len(slim_doc_batch) >= _SLIM_BATCH_SIZE: + yield slim_doc_batch + slim_doc_batch = [] + elif self.content_type == "tickets": + tickets = _get_tickets( + self.client, start_time=int(start) if start else None + ) + for ticket in tickets: + slim_doc_batch.append( + SlimDocument( + id=f"zendesk_ticket_{ticket['id']}", + ) + ) + if len(slim_doc_batch) >= _SLIM_BATCH_SIZE: + yield slim_doc_batch + slim_doc_batch = [] + else: + raise ValueError(f"Unsupported content_type: {self.content_type}") + if slim_doc_batch: + yield slim_doc_batch + + @override + def validate_connector_settings(self) -> None: + if self.client is None: + raise ZendeskCredentialsNotSetUpError() + + try: + _get_article_page(self.client, start_time=0) + except HTTPError as e: + # Check for HTTP status codes + if e.response.status_code == 401: + raise CredentialExpiredError( + "Your Zendesk credentials appear to be invalid or expired (HTTP 401)." + ) from e + elif e.response.status_code == 403: + raise InsufficientPermissionsError( + "Your Zendesk token does not have sufficient permissions (HTTP 403)." + ) from e + elif e.response.status_code == 404: + raise ConnectorValidationError( + "Zendesk resource not found (HTTP 404)." + ) from e + else: + raise ConnectorValidationError( + f"Unexpected Zendesk error (status={e.response.status_code}): {e}" + ) from e + + @override + def validate_checkpoint_json( + self, checkpoint_json: str + ) -> ZendeskConnectorCheckpoint: + return ZendeskConnectorCheckpoint.model_validate_json(checkpoint_json) + + @override + def build_dummy_checkpoint(self) -> ZendeskConnectorCheckpoint: + return ZendeskConnectorCheckpoint( + after_cursor_articles=None, + next_start_time_tickets=None, + cached_author_map=None, + cached_content_tags=None, + has_more=True, + ) + + +if __name__ == "__main__": + import os + + connector = ZendeskConnector(content_type="articles") + connector.load_credentials( + { + "zendesk_subdomain": os.environ["ZENDESK_SUBDOMAIN"], + "zendesk_email": os.environ["ZENDESK_EMAIL"], + "zendesk_token": os.environ["ZENDESK_TOKEN"], + } + ) + + current = time.time() + one_day_ago = current - 24 * 60 * 60 # 1 day + + checkpoint = connector.build_dummy_checkpoint() + + while checkpoint.has_more: + gen = connector.load_from_checkpoint( + one_day_ago, current, checkpoint + ) + + wrapper = CheckpointOutputWrapper() + any_doc = False + + for document, failure, next_checkpoint in wrapper(gen): + if document: + print("got document:", document.id) + any_doc = True + + checkpoint = next_checkpoint + if any_doc: + break \ No newline at end of file diff --git a/rag/svr/sync_data_source.py b/rag/svr/sync_data_source.py index c8a2fa9e088..8a4a6ab8a0b 100644 --- a/rag/svr/sync_data_source.py +++ b/rag/svr/sync_data_source.py @@ -49,7 +49,8 @@ WebDAVConnector, AirtableConnector, AsanaConnector, - ImapConnector + ImapConnector, + ZendeskConnector, ) from common.constants import FileSource, TaskStatus from common.data_source.config import INDEX_BATCH_SIZE @@ -915,7 +916,7 @@ async def async_wrapper(): ) return async_wrapper() - + class IMAP(SyncBase): SOURCE_NAME: str = FileSource.IMAP @@ -971,6 +972,10 @@ def document_batches(): if pending_docs: yield pending_docs + async def async_wrapper(): + for batch in document_batches(): + yield batch + logging.info( "Connect to IMAP: host(%s) port(%s) user(%s) folder(%s) %s", self.conf["imap_host"], @@ -979,7 +984,87 @@ def document_batches(): self.conf["imap_mailbox"], begin_info ) - return document_batches() + return async_wrapper() + +class Zendesk(SyncBase): + + SOURCE_NAME: str = FileSource.ZENDESK + async def _generate(self, task: dict): + self.connector = ZendeskConnector(content_type=self.conf.get("zendesk_content_type")) + self.connector.load_credentials(self.conf["credentials"]) + + end_time = datetime.now(timezone.utc).timestamp() + if task["reindex"] == "1" or not task.get("poll_range_start"): + start_time = 0 + begin_info = "totally" + else: + start_time = task["poll_range_start"].timestamp() + begin_info = f"from {task['poll_range_start']}" + + raw_batch_size = ( + self.conf.get("sync_batch_size") + or self.conf.get("batch_size") + or INDEX_BATCH_SIZE + ) + try: + batch_size = int(raw_batch_size) + except (TypeError, ValueError): + batch_size = INDEX_BATCH_SIZE + + if batch_size <= 0: + batch_size = INDEX_BATCH_SIZE + + def document_batches(): + checkpoint = self.connector.build_dummy_checkpoint() + pending_docs = [] + iterations = 0 + iteration_limit = 100_000 + + while checkpoint.has_more: + wrapper = CheckpointOutputWrapper() + doc_generator = wrapper( + self.connector.load_from_checkpoint( + start_time, end_time, checkpoint + ) + ) + + for document, failure, next_checkpoint in doc_generator: + if failure is not None: + logging.warning( + "Zendesk connector failure: %s", + getattr(failure, "failure_message", failure), + ) + continue + + if document is not None: + pending_docs.append(document) + if len(pending_docs) >= batch_size: + yield pending_docs + pending_docs = [] + + if next_checkpoint is not None: + checkpoint = next_checkpoint + + iterations += 1 + if iterations > iteration_limit: + raise RuntimeError( + "Too many iterations while loading Zendesk documents." + ) + + if pending_docs: + yield pending_docs + + async def async_wrapper(): + for batch in document_batches(): + yield batch + + logging.info( + "Connect to Zendesk: subdomain(%s) %s", + self.conf['credentials'].get("zendesk_subdomain"), + begin_info, + ) + + return async_wrapper() class Gitlab(SyncBase): @@ -1043,6 +1128,7 @@ async def _generate(self, task: dict): FileSource.AIRTABLE: Airtable, FileSource.ASANA: Asana, FileSource.IMAP: IMAP, + FileSource.ZENDESK: Zendesk, FileSource.GITHUB: Github, FileSource.GITLAB: Gitlab, } diff --git a/web/src/assets/svg/data-source/zendesk.svg b/web/src/assets/svg/data-source/zendesk.svg new file mode 100644 index 00000000000..cc7edc68ce2 --- /dev/null +++ b/web/src/assets/svg/data-source/zendesk.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/web/src/pages/user-setting/data-source/constant/index.tsx b/web/src/pages/user-setting/data-source/constant/index.tsx index 9538b5650f1..804ecc2ebbb 100644 --- a/web/src/pages/user-setting/data-source/constant/index.tsx +++ b/web/src/pages/user-setting/data-source/constant/index.tsx @@ -29,6 +29,7 @@ export enum DataSourceKey { ASANA = 'asana', IMAP = 'imap', GITHUB = 'github', + ZENDESK = 'zendesk', // SHAREPOINT = 'sharepoint', // SLACK = 'slack', // TEAMS = 'teams', @@ -133,6 +134,11 @@ export const generateDataSourceInfo = (t: TFunction) => { description: t(`setting.${DataSourceKey.IMAP}Description`), icon: , }, + [DataSourceKey.ZENDESK]: { + name: 'Zendesk', + description: t(`setting.${DataSourceKey.ZENDESK}Description`), + icon: , + }, }; }; @@ -822,6 +828,36 @@ export const DataSourceFormFields = { required: false, }, ], + [DataSourceKey.ZENDESK]: [ + { + label: 'Zendesk Domain', + name: 'config.credentials.zendesk_subdomain', + type: FormFieldType.Text, + required: true, + }, + { + label: 'Zendesk Email', + name: 'config.credentials.zendesk_email', + type: FormFieldType.Text, + required: true, + }, + { + label: 'Zendesk Token', + name: 'config.credentials.zendesk_token', + type: FormFieldType.Password, + required: true, + }, + { + label: 'Content', + name: 'config.zendesk_content_type', + type: FormFieldType.Segmented, + required: true, + options: [ + { label: 'Articles', value: 'articles' }, + { label: 'Tickets', value: 'tickets' }, + ], + }, + ], }; export const DataSourceFormDefaultValues = { @@ -1076,4 +1112,17 @@ export const DataSourceFormDefaultValues = { }, }, }, + [DataSourceKey.ZENDESK]: { + name: '', + source: DataSourceKey.ZENDESK, + config: { + name: '', + zendesk_content_type: 'articles', + credentials: { + zendesk_subdomain: '', + zendesk_email: '', + zendesk_token: '', + }, + }, + }, }; From 05e5244d94558b5e05cb5ad5a7844c0164caa082 Mon Sep 17 00:00:00 2001 From: Jin Hai Date: Wed, 31 Dec 2025 14:42:53 +0800 Subject: [PATCH 003/335] Refactor docs of RAGFlow admin (#12361) ### What problem does this PR solve? as title ### Type of change - [x] Documentation Update Signed-off-by: Jin Hai --- docs/guides/admin/_category_.json | 8 ++++ .../admin_cli.md} | 40 ++----------------- docs/guides/admin/admin_service.md | 39 ++++++++++++++++++ .../admin_ui.md} | 4 +- 4 files changed, 53 insertions(+), 38 deletions(-) create mode 100644 docs/guides/admin/_category_.json rename docs/guides/{manage_users_and_services.md => admin/admin_cli.md} (90%) create mode 100644 docs/guides/admin/admin_service.md rename docs/guides/{accessing_admin_ui.md => admin/admin_ui.md} (97%) diff --git a/docs/guides/admin/_category_.json b/docs/guides/admin/_category_.json new file mode 100644 index 00000000000..590d6208357 --- /dev/null +++ b/docs/guides/admin/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "Administration", + "position": 6, + "link": { + "type": "generated-index", + "description": "RAGFlow administration" + } +} diff --git a/docs/guides/manage_users_and_services.md b/docs/guides/admin/admin_cli.md similarity index 90% rename from docs/guides/manage_users_and_services.md rename to docs/guides/admin/admin_cli.md index 0ec0b112d2c..8123473a2e1 100644 --- a/docs/guides/manage_users_and_services.md +++ b/docs/guides/admin/admin_cli.md @@ -1,43 +1,11 @@ --- -sidebar_position: 6 -slug: /manage_users_and_services +sidebar_position: 2 +slug: /admin_cli --- +# Admin CLI -# Admin CLI and Admin Service - - - -The Admin CLI and Admin Service form a client-server architectural suite for RAGFlow system administration. The Admin CLI serves as an interactive command-line interface that receives instructions and displays execution results from the Admin Service in real-time. This duo enables real-time monitoring of system operational status, supporting visibility into RAGFlow Server services and dependent components including MySQL, Elasticsearch, Redis, and MinIO. In administrator mode, they provide user management capabilities that allow viewing users and performing critical operations—such as user creation, password updates, activation status changes, and comprehensive user data deletion—even when corresponding web interface functionalities are disabled. - - - -## Starting the Admin Service - -### Launching from source code - -1. Before start Admin Service, please make sure RAGFlow system is already started. - -2. Launch from source code: - - ```bash - python admin/server/admin_server.py - ``` - - The service will start and listen for incoming connections from the CLI on the configured port. - -### Using docker image - -1. Before startup, please configure the `docker_compose.yml` file to enable admin server: - - ```bash - command: - - --enable-adminserver - ``` - -2. Start the containers, the service will start and listen for incoming connections from the CLI on the configured port. - - +The RAGFlow Admin CLI is a command-line-based system administration tool that offers administrators an efficient and flexible method for system interaction and control. Operating on a client-server architecture, it communicates in real-time with the Admin Service, receiving administrator commands and dynamically returning execution results. ## Using the Admin CLI diff --git a/docs/guides/admin/admin_service.md b/docs/guides/admin/admin_service.md new file mode 100644 index 00000000000..7e5f1302577 --- /dev/null +++ b/docs/guides/admin/admin_service.md @@ -0,0 +1,39 @@ +--- +sidebar_position: 0 +slug: /admin_service +--- + + +# Admin Service + +The Admin Service is the core backend management service of the RAGFlow system, providing comprehensive system administration capabilities through centralized API interfaces for managing and controlling the entire platform. Adopting a client-server architecture, it supports access and operations via both a Web UI and an Admin CLI, ensuring flexible and efficient execution of administrative tasks. + +The core functions of the Admin Service include real-time monitoring of the operational status of the RAGFlow server and its critical dependent components—such as MySQL, Elasticsearch, Redis, and MinIO—along with full-featured user management. In administrator mode, it enables key operations such as viewing user information, creating users, updating passwords, modifying activation status, and performing complete user data deletion. These functions remain accessible via the Admin CLI even when the web management interface is disabled, ensuring the system stays under control at all times. + +With its unified interface design, the Admin Service combines the convenience of visual administration with the efficiency and stability of command-line operations, serving as a crucial foundation for the reliable operation and secure management of the RAGFlow system. + +## Starting the Admin Service + +### Launching from source code + +1. Before start Admin Service, please make sure RAGFlow system is already started. + +2. Launch from source code: + + ```bash + python admin/server/admin_server.py + ``` + + The service will start and listen for incoming connections from the CLI on the configured port. + +### Using docker image + +1. Before startup, please configure the `docker_compose.yml` file to enable admin server: + + ```bash + command: + - --enable-adminserver + ``` + +2. Start the containers, the service will start and listen for incoming connections from the CLI on the configured port. + diff --git a/docs/guides/accessing_admin_ui.md b/docs/guides/admin/admin_ui.md similarity index 97% rename from docs/guides/accessing_admin_ui.md rename to docs/guides/admin/admin_ui.md index aafd6e99703..148257ae56c 100644 --- a/docs/guides/accessing_admin_ui.md +++ b/docs/guides/admin/admin_ui.md @@ -1,6 +1,6 @@ --- -sidebar_position: 7 -slug: /accessing_admin_ui +sidebar_position: 1 +slug: /admin_ui --- # Admin UI From 4af4c36e607191402e393816c8be553b50472a6b Mon Sep 17 00:00:00 2001 From: writinwaters <93570324+writinwaters@users.noreply.github.com> Date: Wed, 31 Dec 2025 16:43:56 +0800 Subject: [PATCH 004/335] Docs: Added v0.23.1 release notes (#12371) ### What problem does this PR solve? ### Type of change - [x] Documentation Update --- docs/release_notes.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/release_notes.md b/docs/release_notes.md index c55fc7839b0..0379219438d 100644 --- a/docs/release_notes.md +++ b/docs/release_notes.md @@ -12,11 +12,17 @@ Key features, improvements and bug fixes in the latest releases. Released on December 31, 2025. +### Improvements + +- Memory: Enhances the stability of memory extraction when all memory types are selected. +- RAG: Refines the context window extraction strategy for images and tables. + ### Fixed issues -- Resolved an issue where the RAGFlow Server would fail to start if an empty memory object existed, and corrected the inability to delete a newly created empty Memory. -- Improved the stability of memory extraction across all memory types after selection. -- Fixed MDX file parsing support. +- Memory: + - The RAGFlow server failed to start if an empty memory object existed. + - Unable to delete a newly created empty Memory. +- RAG: MDX file parsing was not supported. ### Data sources From dcdc1b0ec7a9f0a94b6b11437dd5ca58b2f54a04 Mon Sep 17 00:00:00 2001 From: Yingfeng Date: Wed, 31 Dec 2025 17:02:34 +0800 Subject: [PATCH 005/335] Fix urls for basic docs (#12372) ### Type of change - [x] Documentation Update --- docs/basics/agent_context_engine.md | 4 ++-- docs/basics/rag.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/basics/agent_context_engine.md b/docs/basics/agent_context_engine.md index c00531e2843..f2fe93d8443 100644 --- a/docs/basics/agent_context_engine.md +++ b/docs/basics/agent_context_engine.md @@ -1,6 +1,6 @@ --- sidebar_position: 2 -slug: /what_is_agent_context_engine +slug: /what-is-agent-context-engine --- # What is Agent context engine? @@ -58,4 +58,4 @@ We left behind the label of “yet another RAG system” long ago. From DeepDoc We believe tomorrow’s enterprise AI advantage will hinge not on who owns the largest model, but on who can feed that model the highest-quality, most real-time, and most relevant context. An Agentic Context Engine is the critical infrastructure that turns this vision into reality. -In the paradigm shift from “hand-crafted prompts” to “intelligent context,” RAGFlow is determined to be the most steadfast propeller and enabler. We invite every developer, enterprise, and researcher who cares about the future of AI agents to follow RAGFlow’s journey—so together we can witness and build the cornerstone of the next-generation AI stack. \ No newline at end of file +In the paradigm shift from “hand-crafted prompts” to “intelligent context,” RAGFlow is determined to be the most steadfast propeller and enabler. We invite every developer, enterprise, and researcher who cares about the future of AI agents to follow RAGFlow’s journey—so together we can witness and build the cornerstone of the next-generation AI stack. diff --git a/docs/basics/rag.md b/docs/basics/rag.md index 90054ed56bd..4cf2e7997a0 100644 --- a/docs/basics/rag.md +++ b/docs/basics/rag.md @@ -1,6 +1,6 @@ --- sidebar_position: 1 -slug: /what_is_rag +slug: /what-is-rag --- # What is Retreival-Augmented-Generation (RAG)? @@ -104,4 +104,4 @@ The evolution of RAG is unfolding along several clear paths: 3. Towards context engineering 2.0 Current RAG can be viewed as Context Engineering 1.0, whose core is assembling static knowledge context for single Q&A tasks. The forthcoming Context Engineering 2.0 will extend with RAG technology at its core, becoming a system that automatically and dynamically assembles comprehensive context for agents. The context fused by this system will come not only from documents but also include interaction memory, available tools/skills, and real-time environmental information. This marks the transition of agent development from a "handicraft workshop" model to the industrial starting point of automated context engineering. -The essence of RAG is to build a dedicated, efficient, and trustworthy external data interface for large language models; its core is Retrieval, not Generation. Starting from the practical need to solve private data access, its technical depth is reflected in the optimization of retrieval for complex unstructured data. With its deep integration into agent architectures and its development towards automated context engineering, RAG is evolving from a technology that improves Q&A quality into the core infrastructure for building the next generation of trustworthy, controllable, and scalable intelligent applications. \ No newline at end of file +The essence of RAG is to build a dedicated, efficient, and trustworthy external data interface for large language models; its core is Retrieval, not Generation. Starting from the practical need to solve private data access, its technical depth is reflected in the optimization of retrieval for complex unstructured data. With its deep integration into agent architectures and its development towards automated context engineering, RAG is evolving from a technology that improves Q&A quality into the core infrastructure for building the next generation of trustworthy, controllable, and scalable intelligent applications. From 6a664fea3b5cb5c760b31adf9781f3640c6280eb Mon Sep 17 00:00:00 2001 From: writinwaters <93570324+writinwaters@users.noreply.github.com> Date: Wed, 31 Dec 2025 17:10:15 +0800 Subject: [PATCH 006/335] Docs: Updated v0.23.0 release notes (#12374) ### What problem does this PR solve? ### Type of change - [x] Documentation Update --- docs/release_notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/release_notes.md b/docs/release_notes.md index 0379219438d..98d5dfbe060 100644 --- a/docs/release_notes.md +++ b/docs/release_notes.md @@ -17,6 +17,7 @@ Released on December 31, 2025. - Memory: Enhances the stability of memory extraction when all memory types are selected. - RAG: Refines the context window extraction strategy for images and tables. + ### Fixed issues - Memory: @@ -56,6 +57,7 @@ Released on December 27, 2025. ### Improvements +- RAG: Accelerates GraphRAG generation significantly. - Bumps RAGFlow's document engine, [Infinity](https://github.com/infiniflow/infinity) to v0.6.15 (backward compatible). ### Data sources From 7d4d687dde7cdee5c39fcf61a835b4f8ff34d341 Mon Sep 17 00:00:00 2001 From: Magicbook1108 Date: Wed, 31 Dec 2025 17:18:30 +0800 Subject: [PATCH 007/335] Feat: Bitbucket connector (#12332) ### What problem does this PR solve? Feat: Bitbucket connector NOT READY TO MERGE ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- common/constants.py | 1 + common/data_source/bitbucket/__init__.py | 0 common/data_source/bitbucket/connector.py | 388 ++++++++++++++++++ common/data_source/bitbucket/utils.py | 288 +++++++++++++ common/data_source/config.py | 4 + .../cross_connector_utils/__init__.py | 0 .../rate_limit_wrapper.py | 126 ++++++ .../cross_connector_utils/retry_wrapper.py | 88 ++++ common/data_source/github/connector.py | 2 +- common/data_source/gmail_connector.py | 4 +- common/data_source/google_util/util.py | 36 -- common/data_source/utils.py | 38 +- rag/res/synonym.json | 3 +- rag/svr/sync_data_source.py | 64 +++ web/src/assets/svg/data-source/bitbucket.svg | 7 + web/src/locales/de.ts | 13 + web/src/locales/en.ts | 14 +- web/src/locales/ru.ts | 13 + web/src/locales/zh-traditional.ts | 10 + web/src/locales/zh.ts | 9 + .../component/blob-token-field.tsx | 247 ----------- .../data-source/component/box-token-field.tsx | 3 - .../component/confluence-token-field.tsx | 200 --------- .../constant/bitbucket-constant.tsx | 83 ++++ .../constant/confluence-constant.tsx | 121 ++++++ .../data-source/constant/index.tsx | 87 ++-- 26 files changed, 1294 insertions(+), 555 deletions(-) create mode 100644 common/data_source/bitbucket/__init__.py create mode 100644 common/data_source/bitbucket/connector.py create mode 100644 common/data_source/bitbucket/utils.py create mode 100644 common/data_source/cross_connector_utils/__init__.py create mode 100644 common/data_source/cross_connector_utils/rate_limit_wrapper.py create mode 100644 common/data_source/cross_connector_utils/retry_wrapper.py create mode 100644 web/src/assets/svg/data-source/bitbucket.svg delete mode 100644 web/src/pages/user-setting/data-source/component/blob-token-field.tsx delete mode 100644 web/src/pages/user-setting/data-source/component/confluence-token-field.tsx create mode 100644 web/src/pages/user-setting/data-source/constant/bitbucket-constant.tsx create mode 100644 web/src/pages/user-setting/data-source/constant/confluence-constant.tsx diff --git a/common/constants.py b/common/constants.py index d99c0995272..4aea764b2c1 100644 --- a/common/constants.py +++ b/common/constants.py @@ -133,6 +133,7 @@ class FileSource(StrEnum): GITHUB = "github" GITLAB = "gitlab" IMAP = "imap" + BITBUCKET = "bitbucket" ZENDESK = "zendesk" class PipelineTaskType(StrEnum): diff --git a/common/data_source/bitbucket/__init__.py b/common/data_source/bitbucket/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/common/data_source/bitbucket/connector.py b/common/data_source/bitbucket/connector.py new file mode 100644 index 00000000000..f355a8945fc --- /dev/null +++ b/common/data_source/bitbucket/connector.py @@ -0,0 +1,388 @@ +from __future__ import annotations + +import copy +from collections.abc import Callable +from collections.abc import Iterator +from datetime import datetime +from datetime import timezone +from typing import Any +from typing import TYPE_CHECKING + +from typing_extensions import override + +from common.data_source.config import INDEX_BATCH_SIZE +from common.data_source.config import DocumentSource +from common.data_source.config import REQUEST_TIMEOUT_SECONDS +from common.data_source.exceptions import ( + ConnectorMissingCredentialError, + CredentialExpiredError, + InsufficientPermissionsError, + UnexpectedValidationError, +) +from common.data_source.interfaces import CheckpointedConnector +from common.data_source.interfaces import CheckpointOutput +from common.data_source.interfaces import IndexingHeartbeatInterface +from common.data_source.interfaces import SecondsSinceUnixEpoch +from common.data_source.interfaces import SlimConnectorWithPermSync +from common.data_source.models import ConnectorCheckpoint +from common.data_source.models import ConnectorFailure +from common.data_source.models import DocumentFailure +from common.data_source.models import SlimDocument +from common.data_source.bitbucket.utils import ( + build_auth_client, + list_repositories, + map_pr_to_document, + paginate, + PR_LIST_RESPONSE_FIELDS, + SLIM_PR_LIST_RESPONSE_FIELDS, +) + +if TYPE_CHECKING: + import httpx + + +class BitbucketConnectorCheckpoint(ConnectorCheckpoint): + """Checkpoint state for resumable Bitbucket PR indexing. + + Fields: + repos_queue: Materialized list of repository slugs to process. + current_repo_index: Index of the repository currently being processed. + next_url: Bitbucket "next" URL for continuing pagination within the current repo. + """ + + repos_queue: list[str] = [] + current_repo_index: int = 0 + next_url: str | None = None + + +class BitbucketConnector( + CheckpointedConnector[BitbucketConnectorCheckpoint], + SlimConnectorWithPermSync, +): + """Connector for indexing Bitbucket Cloud pull requests. + + Args: + workspace: Bitbucket workspace ID. + repositories: Comma-separated list of repository slugs to index. + projects: Comma-separated list of project keys to index all repositories within. + batch_size: Max number of documents to yield per batch. + """ + + def __init__( + self, + workspace: str, + repositories: str | None = None, + projects: str | None = None, + batch_size: int = INDEX_BATCH_SIZE, + ) -> None: + self.workspace = workspace + self._repositories = ( + [s.strip() for s in repositories.split(",") if s.strip()] + if repositories + else None + ) + self._projects: list[str] | None = ( + [s.strip() for s in projects.split(",") if s.strip()] if projects else None + ) + self.batch_size = batch_size + self.email: str | None = None + self.api_token: str | None = None + + def load_credentials(self, credentials: dict[str, Any]) -> dict[str, Any] | None: + """Load API token-based credentials. + + Expects a dict with keys: `bitbucket_email`, `bitbucket_api_token`. + """ + self.email = credentials.get("bitbucket_email") + self.api_token = credentials.get("bitbucket_api_token") + if not self.email or not self.api_token: + raise ConnectorMissingCredentialError("Bitbucket") + return None + + def _client(self) -> httpx.Client: + """Build an authenticated HTTP client or raise if credentials missing.""" + if not self.email or not self.api_token: + raise ConnectorMissingCredentialError("Bitbucket") + return build_auth_client(self.email, self.api_token) + + def _iter_pull_requests_for_repo( + self, + client: httpx.Client, + repo_slug: str, + params: dict[str, Any] | None = None, + start_url: str | None = None, + on_page: Callable[[str | None], None] | None = None, + ) -> Iterator[dict[str, Any]]: + base = f"https://api.bitbucket.org/2.0/repositories/{self.workspace}/{repo_slug}/pullrequests" + yield from paginate( + client, + base, + params, + start_url=start_url, + on_page=on_page, + ) + + def _build_params( + self, + fields: str = PR_LIST_RESPONSE_FIELDS, + start: SecondsSinceUnixEpoch | None = None, + end: SecondsSinceUnixEpoch | None = None, + ) -> dict[str, Any]: + """Build Bitbucket fetch params. + + Always include OPEN, MERGED, and DECLINED PRs. If both ``start`` and + ``end`` are provided, apply a single updated_on time window. + """ + + def _iso(ts: SecondsSinceUnixEpoch) -> str: + return datetime.fromtimestamp(ts, tz=timezone.utc).isoformat() + + def _tc_epoch( + lower_epoch: SecondsSinceUnixEpoch | None, + upper_epoch: SecondsSinceUnixEpoch | None, + ) -> str | None: + if lower_epoch is not None and upper_epoch is not None: + lower_iso = _iso(lower_epoch) + upper_iso = _iso(upper_epoch) + return f'(updated_on > "{lower_iso}" AND updated_on <= "{upper_iso}")' + return None + + params: dict[str, Any] = {"fields": fields, "pagelen": 50} + time_clause = _tc_epoch(start, end) + q = '(state = "OPEN" OR state = "MERGED" OR state = "DECLINED")' + if time_clause: + q = f"{q} AND {time_clause}" + params["q"] = q + return params + + def _iter_target_repositories(self, client: httpx.Client) -> Iterator[str]: + """Yield repository slugs based on configuration. + + Priority: + - repositories list + - projects list (list repos by project key) + - workspace (all repos) + """ + if self._repositories: + for slug in self._repositories: + yield slug + return + if self._projects: + for project_key in self._projects: + for repo in list_repositories(client, self.workspace, project_key): + slug_val = repo.get("slug") + if isinstance(slug_val, str) and slug_val: + yield slug_val + return + for repo in list_repositories(client, self.workspace, None): + slug_val = repo.get("slug") + if isinstance(slug_val, str) and slug_val: + yield slug_val + + @override + def load_from_checkpoint( + self, + start: SecondsSinceUnixEpoch, + end: SecondsSinceUnixEpoch, + checkpoint: BitbucketConnectorCheckpoint, + ) -> CheckpointOutput[BitbucketConnectorCheckpoint]: + """Resumable PR ingestion across repos and pages within a time window. + + Yields Documents (or ConnectorFailure for per-PR mapping failures) and returns + an updated checkpoint that records repo position and next page URL. + """ + new_checkpoint = copy.deepcopy(checkpoint) + + with self._client() as client: + # Materialize target repositories once + if not new_checkpoint.repos_queue: + # Preserve explicit order; otherwise ensure deterministic ordering + repos_list = list(self._iter_target_repositories(client)) + new_checkpoint.repos_queue = sorted(set(repos_list)) + new_checkpoint.current_repo_index = 0 + new_checkpoint.next_url = None + + repos = new_checkpoint.repos_queue + if not repos or new_checkpoint.current_repo_index >= len(repos): + new_checkpoint.has_more = False + return new_checkpoint + + repo_slug = repos[new_checkpoint.current_repo_index] + + first_page_params = self._build_params( + fields=PR_LIST_RESPONSE_FIELDS, + start=start, + end=end, + ) + + def _on_page(next_url: str | None) -> None: + new_checkpoint.next_url = next_url + + for pr in self._iter_pull_requests_for_repo( + client, + repo_slug, + params=first_page_params, + start_url=new_checkpoint.next_url, + on_page=_on_page, + ): + try: + document = map_pr_to_document(pr, self.workspace, repo_slug) + yield document + except Exception as e: + pr_id = pr.get("id") + pr_link = ( + f"https://bitbucket.org/{self.workspace}/{repo_slug}/pull-requests/{pr_id}" + if pr_id is not None + else None + ) + yield ConnectorFailure( + failed_document=DocumentFailure( + document_id=( + f"{DocumentSource.BITBUCKET.value}:{self.workspace}:{repo_slug}:pr:{pr_id}" + if pr_id is not None + else f"{DocumentSource.BITBUCKET.value}:{self.workspace}:{repo_slug}:pr:unknown" + ), + document_link=pr_link, + ), + failure_message=f"Failed to process Bitbucket PR: {e}", + exception=e, + ) + + # Advance to next repository (if any) and set has_more accordingly + new_checkpoint.current_repo_index += 1 + new_checkpoint.next_url = None + new_checkpoint.has_more = new_checkpoint.current_repo_index < len(repos) + + return new_checkpoint + + @override + def build_dummy_checkpoint(self) -> BitbucketConnectorCheckpoint: + """Create an initial checkpoint with work remaining.""" + return BitbucketConnectorCheckpoint(has_more=True) + + @override + def validate_checkpoint_json( + self, checkpoint_json: str + ) -> BitbucketConnectorCheckpoint: + """Validate and deserialize a checkpoint instance from JSON.""" + return BitbucketConnectorCheckpoint.model_validate_json(checkpoint_json) + + def retrieve_all_slim_docs_perm_sync( + self, + start: SecondsSinceUnixEpoch | None = None, + end: SecondsSinceUnixEpoch | None = None, + callback: IndexingHeartbeatInterface | None = None, + ) -> Iterator[list[SlimDocument]]: + """Return only document IDs for all existing pull requests.""" + batch: list[SlimDocument] = [] + params = self._build_params( + fields=SLIM_PR_LIST_RESPONSE_FIELDS, + start=start, + end=end, + ) + with self._client() as client: + for slug in self._iter_target_repositories(client): + for pr in self._iter_pull_requests_for_repo( + client, slug, params=params + ): + pr_id = pr["id"] + doc_id = f"{DocumentSource.BITBUCKET.value}:{self.workspace}:{slug}:pr:{pr_id}" + batch.append(SlimDocument(id=doc_id)) + if len(batch) >= self.batch_size: + yield batch + batch = [] + if callback: + if callback.should_stop(): + # Note: this is not actually used for permission sync yet, just pruning + raise RuntimeError( + "bitbucket_pr_sync: Stop signal detected" + ) + callback.progress("bitbucket_pr_sync", len(batch)) + if batch: + yield batch + + def validate_connector_settings(self) -> None: + """Validate Bitbucket credentials and workspace access by probing a lightweight endpoint. + + Raises: + CredentialExpiredError: on HTTP 401 + InsufficientPermissionsError: on HTTP 403 + UnexpectedValidationError: on any other failure + """ + try: + with self._client() as client: + url = f"https://api.bitbucket.org/2.0/repositories/{self.workspace}" + resp = client.get( + url, + params={"pagelen": 1, "fields": "pagelen"}, + timeout=REQUEST_TIMEOUT_SECONDS, + ) + if resp.status_code == 401: + raise CredentialExpiredError( + "Invalid or expired Bitbucket credentials (HTTP 401)." + ) + if resp.status_code == 403: + raise InsufficientPermissionsError( + "Insufficient permissions to access Bitbucket workspace (HTTP 403)." + ) + if resp.status_code < 200 or resp.status_code >= 300: + raise UnexpectedValidationError( + f"Unexpected Bitbucket error (status={resp.status_code})." + ) + except Exception as e: + # Network or other unexpected errors + if isinstance( + e, + ( + CredentialExpiredError, + InsufficientPermissionsError, + UnexpectedValidationError, + ConnectorMissingCredentialError, + ), + ): + raise + raise UnexpectedValidationError( + f"Unexpected error while validating Bitbucket settings: {e}" + ) + +if __name__ == "__main__": + bitbucket = BitbucketConnector( + workspace="" + ) + + bitbucket.load_credentials({ + "bitbucket_email": "", + "bitbucket_api_token": "", + }) + + bitbucket.validate_connector_settings() + print("Credentials validated successfully.") + + start_time = datetime.fromtimestamp(0, tz=timezone.utc) + end_time = datetime.now(timezone.utc) + + for doc_batch in bitbucket.retrieve_all_slim_docs_perm_sync( + start=start_time.timestamp(), + end=end_time.timestamp(), + ): + for doc in doc_batch: + print(doc) + + + bitbucket_checkpoint = bitbucket.build_dummy_checkpoint() + + while bitbucket_checkpoint.has_more: + gen = bitbucket.load_from_checkpoint( + start=start_time.timestamp(), + end=end_time.timestamp(), + checkpoint=bitbucket_checkpoint, + ) + + while True: + try: + doc = next(gen) + print(doc) + except StopIteration as e: + bitbucket_checkpoint = e.value + break + \ No newline at end of file diff --git a/common/data_source/bitbucket/utils.py b/common/data_source/bitbucket/utils.py new file mode 100644 index 00000000000..4667a960066 --- /dev/null +++ b/common/data_source/bitbucket/utils.py @@ -0,0 +1,288 @@ +from __future__ import annotations + +import time +from collections.abc import Callable +from collections.abc import Iterator +from datetime import datetime +from datetime import timezone +from typing import Any + +import httpx + +from common.data_source.config import REQUEST_TIMEOUT_SECONDS, DocumentSource +from common.data_source.cross_connector_utils.rate_limit_wrapper import ( + rate_limit_builder, +) +from common.data_source.utils import sanitize_filename +from common.data_source.models import BasicExpertInfo, Document +from common.data_source.cross_connector_utils.retry_wrapper import retry_builder + +# Fields requested from Bitbucket PR list endpoint to ensure rich PR data +PR_LIST_RESPONSE_FIELDS: str = ",".join( + [ + "next", + "page", + "pagelen", + "values.author", + "values.close_source_branch", + "values.closed_by", + "values.comment_count", + "values.created_on", + "values.description", + "values.destination", + "values.draft", + "values.id", + "values.links", + "values.merge_commit", + "values.participants", + "values.reason", + "values.rendered", + "values.reviewers", + "values.source", + "values.state", + "values.summary", + "values.task_count", + "values.title", + "values.type", + "values.updated_on", + ] +) + +# Minimal fields for slim retrieval (IDs only) +SLIM_PR_LIST_RESPONSE_FIELDS: str = ",".join( + [ + "next", + "page", + "pagelen", + "values.id", + ] +) + + +# Minimal fields for repository list calls +REPO_LIST_RESPONSE_FIELDS: str = ",".join( + [ + "next", + "page", + "pagelen", + "values.slug", + "values.full_name", + "values.project.key", + ] +) + + +class BitbucketRetriableError(Exception): + """Raised for retriable Bitbucket conditions (429, 5xx).""" + + +class BitbucketNonRetriableError(Exception): + """Raised for non-retriable Bitbucket client errors (4xx except 429).""" + + +@retry_builder( + tries=6, + delay=1, + backoff=2, + max_delay=30, + exceptions=(BitbucketRetriableError, httpx.RequestError), +) +@rate_limit_builder(max_calls=60, period=60) +def bitbucket_get( + client: httpx.Client, url: str, params: dict[str, Any] | None = None +) -> httpx.Response: + """Perform a GET against Bitbucket with retry and rate limiting. + + Retries on 429 and 5xx responses, and on transport errors. Honors + `Retry-After` header for 429 when present by sleeping before retrying. + """ + try: + response = client.get(url, params=params, timeout=REQUEST_TIMEOUT_SECONDS) + except httpx.RequestError: + # Allow retry_builder to handle retries of transport errors + raise + + try: + response.raise_for_status() + except httpx.HTTPStatusError as e: + status = e.response.status_code if e.response is not None else None + if status == 429: + retry_after = e.response.headers.get("Retry-After") if e.response else None + if retry_after is not None: + try: + time.sleep(int(retry_after)) + except (TypeError, ValueError): + pass + raise BitbucketRetriableError("Bitbucket rate limit exceeded (429)") from e + if status is not None and 500 <= status < 600: + raise BitbucketRetriableError(f"Bitbucket server error: {status}") from e + if status is not None and 400 <= status < 500: + raise BitbucketNonRetriableError(f"Bitbucket client error: {status}") from e + # Unknown status, propagate + raise + + return response + + +def build_auth_client(email: str, api_token: str) -> httpx.Client: + """Create an authenticated httpx client for Bitbucket Cloud API.""" + return httpx.Client(auth=(email, api_token), http2=True) + + +def paginate( + client: httpx.Client, + url: str, + params: dict[str, Any] | None = None, + start_url: str | None = None, + on_page: Callable[[str | None], None] | None = None, +) -> Iterator[dict[str, Any]]: + """Iterate over paginated Bitbucket API responses yielding individual values. + + Args: + client: Authenticated HTTP client. + url: Base collection URL (first page when start_url is None). + params: Query params for the first page. + start_url: If provided, start from this absolute URL (ignores params). + on_page: Optional callback invoked after each page with the next page URL. + """ + next_url = start_url or url + # If resuming from a next URL, do not pass params again + query = params.copy() if params else None + query = None if start_url else query + while next_url: + resp = bitbucket_get(client, next_url, params=query) + data = resp.json() + values = data.get("values", []) + for item in values: + yield item + next_url = data.get("next") + if on_page is not None: + on_page(next_url) + # only include params on first call, next_url will contain all necessary params + query = None + + +def list_repositories( + client: httpx.Client, workspace: str, project_key: str | None = None +) -> Iterator[dict[str, Any]]: + """List repositories in a workspace, optionally filtered by project key.""" + base_url = f"https://api.bitbucket.org/2.0/repositories/{workspace}" + params: dict[str, Any] = { + "fields": REPO_LIST_RESPONSE_FIELDS, + "pagelen": 100, + # Ensure deterministic ordering + "sort": "full_name", + } + if project_key: + params["q"] = f'project.key="{project_key}"' + yield from paginate(client, base_url, params) + + +def map_pr_to_document(pr: dict[str, Any], workspace: str, repo_slug: str) -> Document: + """Map a Bitbucket pull request JSON to Onyx Document.""" + pr_id = pr["id"] + title = pr.get("title") or f"PR {pr_id}" + description = pr.get("description") or "" + state = pr.get("state") + draft = pr.get("draft", False) + author = pr.get("author", {}) + reviewers = pr.get("reviewers", []) + participants = pr.get("participants", []) + + link = pr.get("links", {}).get("html", {}).get("href") or ( + f"https://bitbucket.org/{workspace}/{repo_slug}/pull-requests/{pr_id}" + ) + + created_on = pr.get("created_on") + updated_on = pr.get("updated_on") + updated_dt = ( + datetime.fromisoformat(updated_on.replace("Z", "+00:00")).astimezone( + timezone.utc + ) + if isinstance(updated_on, str) + else None + ) + + source_branch = pr.get("source", {}).get("branch", {}).get("name", "") + destination_branch = pr.get("destination", {}).get("branch", {}).get("name", "") + + approved_by = [ + _get_user_name(p.get("user", {})) for p in participants if p.get("approved") + ] + + primary_owner = None + if author: + primary_owner = BasicExpertInfo( + display_name=_get_user_name(author), + ) + + # secondary_owners = [ + # BasicExpertInfo(display_name=_get_user_name(r)) for r in reviewers + # ] or None + + reviewer_names = [_get_user_name(r) for r in reviewers] + + # Create a concise summary of key PR info + created_date = created_on.split("T")[0] if created_on else "N/A" + updated_date = updated_on.split("T")[0] if updated_on else "N/A" + content_text = ( + "Pull Request Information:\n" + f"- Pull Request ID: {pr_id}\n" + f"- Title: {title}\n" + f"- State: {state or 'N/A'} {'(Draft)' if draft else ''}\n" + ) + if state == "DECLINED": + content_text += f"- Reason: {pr.get('reason', 'N/A')}\n" + content_text += ( + f"- Author: {_get_user_name(author) if author else 'N/A'}\n" + f"- Reviewers: {', '.join(reviewer_names) if reviewer_names else 'N/A'}\n" + f"- Branch: {source_branch} -> {destination_branch}\n" + f"- Created: {created_date}\n" + f"- Updated: {updated_date}" + ) + if description: + content_text += f"\n\nDescription:\n{description}" + + metadata: dict[str, str | list[str]] = { + "object_type": "PullRequest", + "workspace": workspace, + "repository": repo_slug, + "pr_key": f"{workspace}/{repo_slug}#{pr_id}", + "id": str(pr_id), + "title": title, + "state": state or "", + "draft": str(bool(draft)), + "link": link, + "author": _get_user_name(author) if author else "", + "reviewers": reviewer_names, + "approved_by": approved_by, + "comment_count": str(pr.get("comment_count", "")), + "task_count": str(pr.get("task_count", "")), + "created_on": created_on or "", + "updated_on": updated_on or "", + "source_branch": source_branch, + "destination_branch": destination_branch, + "closed_by": ( + _get_user_name(pr.get("closed_by", {})) if pr.get("closed_by") else "" + ), + "close_source_branch": str(bool(pr.get("close_source_branch", False))), + } + + name = sanitize_filename(title, "md") + + return Document( + id=f"{DocumentSource.BITBUCKET.value}:{workspace}:{repo_slug}:pr:{pr_id}", + blob=content_text.encode("utf-8"), + source=DocumentSource.BITBUCKET, + extension=".md", + semantic_identifier=f"#{pr_id}: {name}", + size_bytes=len(content_text.encode("utf-8")), + doc_updated_at=updated_dt, + primary_owners=[primary_owner] if primary_owner else None, + # secondary_owners=secondary_owners, + metadata=metadata, + ) + + +def _get_user_name(user: dict[str, Any]) -> str: + return user.get("display_name") or user.get("nickname") or "unknown" \ No newline at end of file diff --git a/common/data_source/config.py b/common/data_source/config.py index 64b30a0518e..84342329476 100644 --- a/common/data_source/config.py +++ b/common/data_source/config.py @@ -13,6 +13,9 @@ def get_current_tz_offset() -> int: return round(time_diff.total_seconds() / 3600) +# Default request timeout, mostly used by connectors +REQUEST_TIMEOUT_SECONDS = int(os.environ.get("REQUEST_TIMEOUT_SECONDS") or 60) + ONE_MINUTE = 60 ONE_HOUR = 3600 ONE_DAY = ONE_HOUR * 24 @@ -58,6 +61,7 @@ class DocumentSource(str, Enum): GITHUB = "github" GITLAB = "gitlab" IMAP = "imap" + BITBUCKET = "bitbucket" ZENDESK = "zendesk" diff --git a/common/data_source/cross_connector_utils/__init__.py b/common/data_source/cross_connector_utils/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/common/data_source/cross_connector_utils/rate_limit_wrapper.py b/common/data_source/cross_connector_utils/rate_limit_wrapper.py new file mode 100644 index 00000000000..bc0e0b470d6 --- /dev/null +++ b/common/data_source/cross_connector_utils/rate_limit_wrapper.py @@ -0,0 +1,126 @@ +import time +import logging +from collections.abc import Callable +from functools import wraps +from typing import Any +from typing import cast +from typing import TypeVar + +import requests + +F = TypeVar("F", bound=Callable[..., Any]) + + +class RateLimitTriedTooManyTimesError(Exception): + pass + + +class _RateLimitDecorator: + """Builds a generic wrapper/decorator for calls to external APIs that + prevents making more than `max_calls` requests per `period` + + Implementation inspired by the `ratelimit` library: + https://github.com/tomasbasham/ratelimit. + + NOTE: is not thread safe. + """ + + def __init__( + self, + max_calls: int, + period: float, # in seconds + sleep_time: float = 2, # in seconds + sleep_backoff: float = 2, # applies exponential backoff + max_num_sleep: int = 0, + ): + self.max_calls = max_calls + self.period = period + self.sleep_time = sleep_time + self.sleep_backoff = sleep_backoff + self.max_num_sleep = max_num_sleep + + self.call_history: list[float] = [] + self.curr_calls = 0 + + def __call__(self, func: F) -> F: + @wraps(func) + def wrapped_func(*args: list, **kwargs: dict[str, Any]) -> Any: + # cleanup calls which are no longer relevant + self._cleanup() + + # check if we've exceeded the rate limit + sleep_cnt = 0 + while len(self.call_history) == self.max_calls: + sleep_time = self.sleep_time * (self.sleep_backoff**sleep_cnt) + logging.warning( + f"Rate limit exceeded for function {func.__name__}. " + f"Waiting {sleep_time} seconds before retrying." + ) + time.sleep(sleep_time) + sleep_cnt += 1 + if self.max_num_sleep != 0 and sleep_cnt >= self.max_num_sleep: + raise RateLimitTriedTooManyTimesError( + f"Exceeded '{self.max_num_sleep}' retries for function '{func.__name__}'" + ) + + self._cleanup() + + # add the current call to the call history + self.call_history.append(time.monotonic()) + return func(*args, **kwargs) + + return cast(F, wrapped_func) + + def _cleanup(self) -> None: + curr_time = time.monotonic() + time_to_expire_before = curr_time - self.period + self.call_history = [ + call_time + for call_time in self.call_history + if call_time > time_to_expire_before + ] + + +rate_limit_builder = _RateLimitDecorator + + +"""If you want to allow the external service to tell you when you've hit the rate limit, +use the following instead""" + +R = TypeVar("R", bound=Callable[..., requests.Response]) + + +def wrap_request_to_handle_ratelimiting( + request_fn: R, default_wait_time_sec: int = 30, max_waits: int = 30 +) -> R: + def wrapped_request(*args: list, **kwargs: dict[str, Any]) -> requests.Response: + for _ in range(max_waits): + response = request_fn(*args, **kwargs) + if response.status_code == 429: + try: + wait_time = int( + response.headers.get("Retry-After", default_wait_time_sec) + ) + except ValueError: + wait_time = default_wait_time_sec + + time.sleep(wait_time) + continue + + return response + + raise RateLimitTriedTooManyTimesError(f"Exceeded '{max_waits}' retries") + + return cast(R, wrapped_request) + + +_rate_limited_get = wrap_request_to_handle_ratelimiting(requests.get) +_rate_limited_post = wrap_request_to_handle_ratelimiting(requests.post) + + +class _RateLimitedRequest: + get = _rate_limited_get + post = _rate_limited_post + + +rl_requests = _RateLimitedRequest \ No newline at end of file diff --git a/common/data_source/cross_connector_utils/retry_wrapper.py b/common/data_source/cross_connector_utils/retry_wrapper.py new file mode 100644 index 00000000000..a055847975d --- /dev/null +++ b/common/data_source/cross_connector_utils/retry_wrapper.py @@ -0,0 +1,88 @@ +from collections.abc import Callable +import logging +from logging import Logger +from typing import Any +from typing import cast +from typing import TypeVar +import requests +from retry import retry + +from common.data_source.config import REQUEST_TIMEOUT_SECONDS + + +F = TypeVar("F", bound=Callable[..., Any]) +logger = logging.getLogger(__name__) + +def retry_builder( + tries: int = 20, + delay: float = 0.1, + max_delay: float | None = 60, + backoff: float = 2, + jitter: tuple[float, float] | float = 1, + exceptions: type[Exception] | tuple[type[Exception], ...] = (Exception,), +) -> Callable[[F], F]: + """Builds a generic wrapper/decorator for calls to external APIs that + may fail due to rate limiting, flakes, or other reasons. Applies exponential + backoff with jitter to retry the call.""" + + def retry_with_default(func: F) -> F: + @retry( + tries=tries, + delay=delay, + max_delay=max_delay, + backoff=backoff, + jitter=jitter, + logger=cast(Logger, logger), + exceptions=exceptions, + ) + def wrapped_func(*args: list, **kwargs: dict[str, Any]) -> Any: + return func(*args, **kwargs) + + return cast(F, wrapped_func) + + return retry_with_default + + +def request_with_retries( + method: str, + url: str, + *, + data: dict[str, Any] | None = None, + headers: dict[str, Any] | None = None, + params: dict[str, Any] | None = None, + timeout: int = REQUEST_TIMEOUT_SECONDS, + stream: bool = False, + tries: int = 8, + delay: float = 1, + backoff: float = 2, +) -> requests.Response: + @retry(tries=tries, delay=delay, backoff=backoff, logger=cast(Logger, logger)) + def _make_request() -> requests.Response: + response = requests.request( + method=method, + url=url, + data=data, + headers=headers, + params=params, + timeout=timeout, + stream=stream, + ) + try: + response.raise_for_status() + except requests.exceptions.HTTPError: + logging.exception( + "Request failed:\n%s", + { + "method": method, + "url": url, + "data": data, + "headers": headers, + "params": params, + "timeout": timeout, + "stream": stream, + }, + ) + raise + return response + + return _make_request() \ No newline at end of file diff --git a/common/data_source/github/connector.py b/common/data_source/github/connector.py index 2e6d5f2af93..6a9b96740bc 100644 --- a/common/data_source/github/connector.py +++ b/common/data_source/github/connector.py @@ -19,7 +19,7 @@ from github.PullRequest import PullRequest from pydantic import BaseModel from typing_extensions import override -from common.data_source.google_util.util import sanitize_filename +from common.data_source.utils import sanitize_filename from common.data_source.config import DocumentSource, GITHUB_CONNECTOR_BASE_URL from common.data_source.exceptions import ( ConnectorMissingCredentialError, diff --git a/common/data_source/gmail_connector.py b/common/data_source/gmail_connector.py index e64db984714..1421f9f4bf1 100644 --- a/common/data_source/gmail_connector.py +++ b/common/data_source/gmail_connector.py @@ -8,10 +8,10 @@ from common.data_source.google_util.auth import get_google_creds from common.data_source.google_util.constant import DB_CREDENTIALS_PRIMARY_ADMIN_KEY, MISSING_SCOPES_ERROR_STR, SCOPE_INSTRUCTIONS, USER_FIELDS from common.data_source.google_util.resource import get_admin_service, get_gmail_service -from common.data_source.google_util.util import _execute_single_retrieval, execute_paginated_retrieval, sanitize_filename, clean_string +from common.data_source.google_util.util import _execute_single_retrieval, execute_paginated_retrieval, clean_string from common.data_source.interfaces import LoadConnector, PollConnector, SecondsSinceUnixEpoch, SlimConnectorWithPermSync from common.data_source.models import BasicExpertInfo, Document, ExternalAccess, GenerateDocumentsOutput, GenerateSlimDocumentOutput, SlimDocument, TextSection -from common.data_source.utils import build_time_range_query, clean_email_and_extract_name, get_message_body, is_mail_service_disabled_error, gmail_time_str_to_utc +from common.data_source.utils import build_time_range_query, clean_email_and_extract_name, get_message_body, is_mail_service_disabled_error, gmail_time_str_to_utc, sanitize_filename # Constants for Gmail API fields THREAD_LIST_FIELDS = "nextPageToken, threads(id)" diff --git a/common/data_source/google_util/util.py b/common/data_source/google_util/util.py index b1f0162a4cb..187c06d6d84 100644 --- a/common/data_source/google_util/util.py +++ b/common/data_source/google_util/util.py @@ -191,42 +191,6 @@ def get_credentials_from_env(email: str, oauth: bool = False, source="drive") -> DB_CREDENTIALS_AUTHENTICATION_METHOD: "uploaded", } -def sanitize_filename(name: str, extension: str = "txt") -> str: - """ - Soft sanitize for MinIO/S3: - - Replace only prohibited characters with a space. - - Preserve readability (no ugly underscores). - - Collapse multiple spaces. - """ - if name is None: - return f"file.{extension}" - - name = str(name).strip() - - # Characters that MUST NOT appear in S3/MinIO object keys - # Replace them with a space (not underscore) - forbidden = r'[\\\?\#\%\*\:\|\<\>"]' - name = re.sub(forbidden, " ", name) - - # Replace slashes "/" (S3 interprets as folder) with space - name = name.replace("/", " ") - - # Collapse multiple spaces into one - name = re.sub(r"\s+", " ", name) - - # Trim both ends - name = name.strip() - - # Enforce reasonable max length - if len(name) > 200: - base, ext = os.path.splitext(name) - name = base[:180].rstrip() + ext - - if not os.path.splitext(name)[1]: - name += f".{extension}" - - return name - def clean_string(text: str | None) -> str | None: """ diff --git a/common/data_source/utils.py b/common/data_source/utils.py index da500f055ca..1866f949770 100644 --- a/common/data_source/utils.py +++ b/common/data_source/utils.py @@ -1150,6 +1150,42 @@ def parallel_yield(gens: list[Iterator[R]], max_workers: int = 10) -> Iterator[R next_ind += 1 del future_to_index[future] + +def sanitize_filename(name: str, extension: str = "txt") -> str: + """ + Soft sanitize for MinIO/S3: + - Replace only prohibited characters with a space. + - Preserve readability (no ugly underscores). + - Collapse multiple spaces. + """ + if name is None: + return f"file.{extension}" + + name = str(name).strip() + + # Characters that MUST NOT appear in S3/MinIO object keys + # Replace them with a space (not underscore) + forbidden = r'[\\\?\#\%\*\:\|\<\>"]' + name = re.sub(forbidden, " ", name) + + # Replace slashes "/" (S3 interprets as folder) with space + name = name.replace("/", " ") + + # Collapse multiple spaces into one + name = re.sub(r"\s+", " ", name) + + # Trim both ends + name = name.strip() + + # Enforce reasonable max length + if len(name) > 200: + base, ext = os.path.splitext(name) + name = base[:180].rstrip() + ext + + if not os.path.splitext(name)[1]: + name += f".{extension}" + + return name F = TypeVar("F", bound=Callable[..., Any]) class _RateLimitDecorator: @@ -1246,4 +1282,4 @@ def wrapped_func(*args: list, **kwargs: dict[str, Any]) -> Any: return cast(F, wrapped_func) - return retry_with_default \ No newline at end of file + return retry_with_default diff --git a/rag/res/synonym.json b/rag/res/synonym.json index 0473031550b..ea61b9e1c17 100644 --- a/rag/res/synonym.json +++ b/rag/res/synonym.json @@ -10542,6 +10542,5 @@ "周五": ["礼拜五", "星期五"], "周六": ["礼拜六", "星期六"], "周日": ["礼拜日", "星期日", "星期天", "礼拜天"], -"上班": "办公", -"HELO":"agn" +"上班": "办公" } diff --git a/rag/svr/sync_data_source.py b/rag/svr/sync_data_source.py index 8a4a6ab8a0b..81478ab9ba8 100644 --- a/rag/svr/sync_data_source.py +++ b/rag/svr/sync_data_source.py @@ -54,11 +54,13 @@ ) from common.constants import FileSource, TaskStatus from common.data_source.config import INDEX_BATCH_SIZE +from common.data_source.models import ConnectorFailure from common.data_source.confluence_connector import ConfluenceConnector from common.data_source.gmail_connector import GmailConnector from common.data_source.box_connector import BoxConnector from common.data_source.github.connector import GithubConnector from common.data_source.gitlab_connector import GitlabConnector +from common.data_source.bitbucket.connector import BitbucketConnector from common.data_source.interfaces import CheckpointOutputWrapper from common.log_utils import init_root_logger from common.signal_utils import start_tracemalloc_and_snapshot, stop_tracemalloc @@ -1107,6 +1109,67 @@ async def _generate(self, task: dict): logging.info("Connect to Gitlab: ({}) {}".format(self.conf["project_name"], begin_info)) return document_generator + +class Bitbucket(SyncBase): + SOURCE_NAME: str = FileSource.BITBUCKET + + async def _generate(self, task: dict): + self.connector = BitbucketConnector( + workspace=self.conf.get("workspace"), + repositories=self.conf.get("repository_slugs"), + projects=self.conf.get("projects"), + ) + + self.connector.load_credentials( + { + "bitbucket_email": self.conf["credentials"].get("bitbucket_account_email"), + "bitbucket_api_token": self.conf["credentials"].get("bitbucket_api_token"), + } + ) + + if task["reindex"] == "1" or not task["poll_range_start"]: + start_time = datetime.fromtimestamp(0, tz=timezone.utc) + begin_info = "totally" + else: + start_time = task.get("poll_range_start") + begin_info = f"from {start_time}" + + end_time = datetime.now(timezone.utc) + + def document_batches(): + checkpoint = self.connector.build_dummy_checkpoint() + + while checkpoint.has_more: + gen = self.connector.load_from_checkpoint( + start=start_time.timestamp(), + end=end_time.timestamp(), + checkpoint=checkpoint) + + while True: + try: + item = next(gen) + if isinstance(item, ConnectorFailure): + logging.exception( + "Bitbucket connector failure: %s", + item.failure_message) + break + yield [item] + except StopIteration as e: + checkpoint = e.value + break + + async def async_wrapper(): + for batch in document_batches(): + yield batch + + logging.info( + "Connect to Bitbucket: workspace(%s), %s", + self.conf.get("workspace"), + begin_info, + ) + + return async_wrapper() + func_factory = { FileSource.S3: S3, FileSource.R2: R2, @@ -1131,6 +1194,7 @@ async def _generate(self, task: dict): FileSource.ZENDESK: Zendesk, FileSource.GITHUB: Github, FileSource.GITLAB: Gitlab, + FileSource.BITBUCKET: Bitbucket, } diff --git a/web/src/assets/svg/data-source/bitbucket.svg b/web/src/assets/svg/data-source/bitbucket.svg new file mode 100644 index 00000000000..894ed83bfea --- /dev/null +++ b/web/src/assets/svg/data-source/bitbucket.svg @@ -0,0 +1,7 @@ + + \ No newline at end of file diff --git a/web/src/locales/de.ts b/web/src/locales/de.ts index c9cd09b52d6..4297ad73e01 100644 --- a/web/src/locales/de.ts +++ b/web/src/locales/de.ts @@ -947,6 +947,19 @@ Beispiel: Virtual Hosted Style`, 'Laden Sie das OAuth-JSON hoch, das von der Google Console generiert wurde. Wenn es nur Client-Anmeldeinformationen enthält, führen Sie die browserbasierte Überprüfung einmal durch, um langlebige Refresh-Token zu erstellen.', dropboxDescription: 'Verbinden Sie Ihre Dropbox, um Dateien und Ordner von einem ausgewählten Konto zu synchronisieren.', + bitbucketDescription: + 'Bitbucket verbinden, um PR-Inhalte zu synchronisieren.', + zendeskDescription: + 'Verbinden Sie Ihr Zendesk, um Tickets, Artikel und andere Inhalte zu synchronisieren.', + bitbucketTopWorkspaceTip: + 'Der zu indizierende Bitbucket-Workspace (z. B. "atlassian" aus https://bitbucket.org/atlassian/workspace )', + bitbucketWorkspaceTip: + 'Dieser Connector indiziert alle Repositories im Workspace.', + bitbucketProjectsTip: 'Kommagetrennte Projekt-Keys, z. B.: PROJ1,PROJ2', + bitbucketRepositorySlugsTip: + 'Kommagetrennte Repository-Slugs, z. B.: repo-one,repo-two', + connectorNameTip: + 'Geben Sie einen aussagekräftigen Namen für den Connector an', boxDescription: 'Verbinden Sie Ihr Box-Laufwerk, um Dateien und Ordner zu synchronisieren.', githubDescription: diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index 3915660acbb..385dae580c6 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -879,6 +879,7 @@ This auto-tagging feature enhances retrieval by adding another layer of domain-s cropImage: 'Crop image', selectModelPlaceholder: 'Select model', configureModelTitle: 'Configure model', + connectorNameTip: 'A descriptive name for the connector', confluenceIsCloudTip: 'Check if this is a Confluence Cloud instance, uncheck for Confluence Server/Data Center', confluenceWikiBaseUrlTip: @@ -923,7 +924,9 @@ Example: Virtual Hosted Style`, google_driveTokenTip: 'Upload the OAuth token JSON generated from the OAuth helper or Google Cloud Console. You may also upload a client_secret JSON from an "installed" or "web" application. If this is your first sync, a browser window will open to complete the OAuth consent. If the JSON already contains a refresh token, it will be reused automatically.', google_drivePrimaryAdminTip: - 'Email address that has access to the Drive content being synced.', + 'Email address that has access to the Drive content being synced', + zendeskDescription: + 'Connect your Zendesk to sync tickets, articles, and other content.', google_driveMyDriveEmailsTip: 'Comma-separated emails whose "My Drive" contents should be indexed (include the primary admin).', google_driveSharedFoldersTip: @@ -934,7 +937,16 @@ Example: Virtual Hosted Style`, 'Upload the OAuth JSON generated from Google Console. If it only contains client credentials, run the browser-based verification once to mint long-lived refresh tokens.', dropboxDescription: 'Connect your Dropbox to sync files and folders from a chosen account.', + bitbucketDescription: 'Connect Bitbucket to sync PR content.', + bitbucketTopWorkspaceTip: + 'The Bitbucket workspace to index (e.g., "atlassian" from https://bitbucket.org/atlassian/workspace ).', + bitbucketRepositorySlugsTip: + 'Comma separated repository slugs. E.g., repo-one,repo-two', + bitbucketProjectsTip: 'Comma separated project keys. E.g., PROJ1,PROJ2', + bitbucketWorkspaceTip: + 'This connector will index all repositories in the workspace.', boxDescription: 'Connect your Box drive to sync files and folders.', + githubDescription: 'Connect GitHub to sync pull requests and issues for retrieval.', airtableDescription: diff --git a/web/src/locales/ru.ts b/web/src/locales/ru.ts index 37ff431a9f7..2744b10d4f8 100644 --- a/web/src/locales/ru.ts +++ b/web/src/locales/ru.ts @@ -731,6 +731,7 @@ export default { newDocs: 'Новые документы', timeStarted: 'Время начала', log: 'Лог', + connectorNameTip: 'Укажите понятное имя для коннектора', confluenceDescription: 'Интегрируйте ваше рабочее пространство Confluence для поиска документации.', s3Description: @@ -747,6 +748,18 @@ export default { 'Синхронизируйте страницы и базы данных из Notion для извлечения знаний.', boxDescription: 'Подключите ваш диск Box для синхронизации файлов и папок.', + bitbucketDescription: + 'Подключите Bitbucket для синхронизации содержимого PR.', + zendeskDescription: + 'Подключите Zendesk для синхронизации тикетов, статей и другого контента.', + bitbucketTopWorkspaceTip: + 'Рабочее пространство Bitbucket для индексации (например, "atlassian" из https://bitbucket.org/atlassian/workspace )', + bitbucketWorkspaceTip: + 'Этот коннектор проиндексирует все репозитории в рабочем пространстве.', + bitbucketProjectsTip: + 'Ключи проектов через запятую, например: PROJ1,PROJ2', + bitbucketRepositorySlugsTip: + 'Слоги репозиториев через запятую, например: repo-one,repo-two', githubDescription: 'Подключите GitHub для синхронизации содержимого Pull Request и Issue для поиска.', airtableDescription: diff --git a/web/src/locales/zh-traditional.ts b/web/src/locales/zh-traditional.ts index e72449f4d24..8eb147351ff 100644 --- a/web/src/locales/zh-traditional.ts +++ b/web/src/locales/zh-traditional.ts @@ -726,6 +726,16 @@ export default { view: '查看', modelsToBeAddedTooltip: '若您的模型供應商未列於此處,但宣稱與 OpenAI 相容,可透過選擇「OpenAI-API-compatible」卡片來設定相關模型。', + dropboxDescription: '連接 Dropbox,同步指定帳號下的文件與文件夾。', + bitbucketDescription: '連接 Bitbucket,同步 PR 內容。', + zendeskDescription: '連接 Zendesk,同步工單、文章及其他內容。', + bitbucketTopWorkspaceTip: + '要索引的 Bitbucket 工作區(例如:https://bitbucket.org/atlassian/workspace 中的 "atlassian")', + bitbucketWorkspaceTip: '此連接器將索引工作區下的所有倉庫。', + bitbucketRepositorySlugsTip: + '以英文逗號分隔的倉庫 slug,例如:repo-one,repo-two', + bitbucketProjectsTip: '以英文逗號分隔的項目鍵,例如:PROJ1,PROJ2', + connectorNameTip: '為連接器填寫一個有意義的名稱', }, message: { registered: '註冊成功', diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts index 903987e2dff..96d36a31268 100644 --- a/web/src/locales/zh.ts +++ b/web/src/locales/zh.ts @@ -53,6 +53,7 @@ export default { noData: '暂无数据', bedrockCredentialsHint: '提示:Access Key / Secret Key 可留空,以启用 AWS IAM 自动验证。', + zendeskDescription: '连接 Zendesk,同步工单、文章及其他内容。', promptPlaceholder: '请输入或使用 / 快速插入变量。', selected: '已选择', }, @@ -864,6 +865,14 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于 '请上传由 Google Console 生成的 OAuth JSON。如果仅包含 client credentials,请通过浏览器授权一次以获取长期有效的刷新 Token。', dropboxDescription: '连接 Dropbox,同步指定账号下的文件与文件夹。', boxDescription: '连接你的 Box 云盘以同步文件和文件夹。', + bitbucketDescription: '连接 Bitbucket,同步 PR 内容。', + bitbucketTopWorkspaceTip: + '要索引的 Bitbucket 工作区(例如:https://bitbucket.org/atlassian/workspace 中的 "atlassian")', + bitbucketWorkspaceTip: '该连接器将索引工作区下的所有仓库。', + bitbucketProjectsTip: '用英文逗号分隔的项目 key,例如:PROJ1,PROJ2', + bitbucketRepositorySlugsTip: + '用英文逗号分隔的仓库 slug,例如:repo-one,repo-two', + connectorNameTip: '为连接器命名', githubDescription: '连接 GitHub,可同步 Pull Request 与 Issue 内容用于检索。', airtableDescription: '连接 Airtable,同步指定工作区下指定表格中的文件。', diff --git a/web/src/pages/user-setting/data-source/component/blob-token-field.tsx b/web/src/pages/user-setting/data-source/component/blob-token-field.tsx deleted file mode 100644 index 11fe22804f5..00000000000 --- a/web/src/pages/user-setting/data-source/component/blob-token-field.tsx +++ /dev/null @@ -1,247 +0,0 @@ -import { useEffect, useMemo, useState } from 'react'; -import { useFormContext } from 'react-hook-form'; - -import { SelectWithSearch } from '@/components/originui/select-with-search'; -import { RAGFlowFormItem } from '@/components/ragflow-form'; -import { Input } from '@/components/ui/input'; -import { Segmented } from '@/components/ui/segmented'; -import { t } from 'i18next'; - -// UI-only auth modes for S3 -// access_key: Access Key ID + Secret -// iam_role: only Role ARN -// assume_role: no input fields (uses environment role) -type AuthMode = 'access_key' | 'iam_role' | 'assume_role'; -type BlobMode = 's3' | 's3_compatible'; - -const modeOptions = [ - { label: 'S3', value: 's3' }, - { label: 'S3 Compatible', value: 's3_compatible' }, -]; - -const authOptions = [ - { label: 'Access Key', value: 'access_key' }, - { label: 'IAM Role', value: 'iam_role' }, - { label: 'Assume Role', value: 'assume_role' }, -]; - -const addressingOptions = [ - { label: 'Virtual Hosted Style', value: 'virtual' }, - { label: 'Path Style', value: 'path' }, -]; - -const deriveInitialAuthMode = (credentials: any): AuthMode => { - const authMethod = credentials?.authentication_method; - if (authMethod === 'iam_role') return 'iam_role'; - if (authMethod === 'assume_role') return 'assume_role'; - if (credentials?.aws_role_arn) return 'iam_role'; - if (credentials?.aws_access_key_id || credentials?.aws_secret_access_key) - return 'access_key'; - return 'access_key'; -}; - -const deriveInitialMode = (bucketType?: string): BlobMode => - bucketType === 's3_compatible' ? 's3_compatible' : 's3'; - -const BlobTokenField = () => { - const form = useFormContext(); - const credentials = form.watch('config.credentials'); - const watchedBucketType = form.watch('config.bucket_type'); - - const [mode, setMode] = useState( - deriveInitialMode(watchedBucketType), - ); - const [authMode, setAuthMode] = useState(() => - deriveInitialAuthMode(credentials), - ); - - // Keep bucket_type in sync with UI mode - useEffect(() => { - const nextMode = deriveInitialMode(watchedBucketType); - setMode((prev) => (prev === nextMode ? prev : nextMode)); - }, [watchedBucketType]); - - useEffect(() => { - form.setValue('config.bucket_type', mode, { shouldDirty: true }); - // Default addressing style for compatible mode - if ( - mode === 's3_compatible' && - !form.getValues('config.credentials.addressing_style') - ) { - form.setValue('config.credentials.addressing_style', 'virtual', { - shouldDirty: false, - }); - } - if (mode === 's3_compatible' && authMode !== 'access_key') { - setAuthMode('access_key'); - } - // Persist authentication_method for backend - const nextAuthMethod: AuthMode = - mode === 's3_compatible' ? 'access_key' : authMode; - form.setValue('config.credentials.authentication_method', nextAuthMethod, { - shouldDirty: true, - }); - // Clear errors for fields that are not relevant in the current mode/auth selection - const inactiveFields: string[] = []; - if (mode === 's3_compatible') { - inactiveFields.push('config.credentials.aws_role_arn'); - } else { - if (authMode === 'iam_role') { - inactiveFields.push('config.credentials.aws_access_key_id'); - inactiveFields.push('config.credentials.aws_secret_access_key'); - } - if (authMode === 'assume_role') { - inactiveFields.push('config.credentials.aws_access_key_id'); - inactiveFields.push('config.credentials.aws_secret_access_key'); - inactiveFields.push('config.credentials.aws_role_arn'); - } - } - if (inactiveFields.length) { - form.clearErrors(inactiveFields as any); - } - }, [form, mode, authMode]); - - const isS3 = mode === 's3'; - const requiresAccessKey = - authMode === 'access_key' || mode === 's3_compatible'; - const requiresRoleArn = isS3 && authMode === 'iam_role'; - - // Help text for assume role (no inputs) - const assumeRoleNote = useMemo( - () => t('No credentials required. Uses the default environment role.'), - [t], - ); - - return ( -
-
-
Mode
- setMode(val as BlobMode)} - className="w-full" - itemClassName="flex-1 justify-center" - /> -
- - {isS3 && ( -
-
Authentication
- setAuthMode(val as AuthMode)} - className="w-full" - itemClassName="flex-1 justify-center" - /> -
- )} - - {requiresAccessKey && ( - - requiresAccessKey - ? Boolean(val) || 'Access Key ID is required' - : true, - }} - > - {(field) => ( - - )} - - )} - - {requiresAccessKey && ( - - requiresAccessKey - ? Boolean(val) || 'Secret Access Key is required' - : true, - }} - > - {(field) => ( - - )} - - )} - - {requiresRoleArn && ( - - requiresRoleArn ? Boolean(val) || 'Role ARN is required' : true, - }} - > - {(field) => ( - - )} - - )} - - {isS3 && authMode === 'assume_role' && ( -
- {assumeRoleNote} -
- )} - - {mode === 's3_compatible' && ( -
- - {(field) => ( - field.onChange(val)} - /> - )} - - - - {(field) => ( - - )} - -
- )} -
- ); -}; - -export default BlobTokenField; diff --git a/web/src/pages/user-setting/data-source/component/box-token-field.tsx b/web/src/pages/user-setting/data-source/component/box-token-field.tsx index 3bb805868f6..b482c25aa9a 100644 --- a/web/src/pages/user-setting/data-source/component/box-token-field.tsx +++ b/web/src/pages/user-setting/data-source/component/box-token-field.tsx @@ -131,7 +131,6 @@ const BoxTokenField = ({ value, onChange }: BoxTokenFieldProps) => { const finalValue: Record = { ...rest, - // 确保客户端配置字段有值(优先后端返回,其次当前输入) client_id: rest.client_id ?? clientId.trim(), client_secret: rest.client_secret ?? clientSecret.trim(), }; @@ -146,8 +145,6 @@ const BoxTokenField = ({ value, onChange }: BoxTokenFieldProps) => { finalValue.authorization_code = code; } - // access_token / refresh_token 由后端返回,已在 ...rest 中带上,无需额外 state - onChange(JSON.stringify(finalValue)); message.success('Box authorization completed.'); clearWebState(); diff --git a/web/src/pages/user-setting/data-source/component/confluence-token-field.tsx b/web/src/pages/user-setting/data-source/component/confluence-token-field.tsx deleted file mode 100644 index 6c7e201d4a8..00000000000 --- a/web/src/pages/user-setting/data-source/component/confluence-token-field.tsx +++ /dev/null @@ -1,200 +0,0 @@ -import { useCallback, useEffect, useMemo, useState } from 'react'; -import { ControllerRenderProps, useFormContext } from 'react-hook-form'; - -import { Checkbox } from '@/components/ui/checkbox'; -import { Input } from '@/components/ui/input'; -import { cn } from '@/lib/utils'; -import { debounce } from 'lodash'; - -/* ---------------- Token Field ---------------- */ - -export type ConfluenceTokenFieldProps = ControllerRenderProps & { - fieldType: 'username' | 'token'; - placeholder?: string; - disabled?: boolean; -}; - -const ConfluenceTokenField = ({ - fieldType, - value, - onChange, - placeholder, - disabled, - ...rest -}: ConfluenceTokenFieldProps) => { - return ( -
- onChange(e.target.value)} - placeholder={ - placeholder || - (fieldType === 'token' - ? 'Enter your Confluence access token' - : 'Confluence username or email') - } - disabled={disabled} - {...rest} - /> -
- ); -}; - -/* ---------------- Indexing Mode Field ---------------- */ - -type ConfluenceIndexingMode = 'everything' | 'space' | 'page'; - -export type ConfluenceIndexingModeFieldProps = ControllerRenderProps; - -export const ConfluenceIndexingModeField = ( - fieldProps: ControllerRenderProps, -) => { - const { value, onChange, disabled } = fieldProps; - const [mode, setMode] = useState( - value || 'everything', - ); - const { watch, setValue } = useFormContext(); - - useEffect(() => setMode(value), [value]); - - const spaceValue = watch('config.space'); - const pageIdValue = watch('config.page_id'); - const indexRecursively = watch('config.index_recursively'); - - useEffect(() => { - if (!value) onChange('everything'); - }, [value, onChange]); - - const handleModeChange = useCallback( - (nextMode?: string) => { - let normalized: ConfluenceIndexingMode = 'everything'; - if (nextMode) { - normalized = nextMode as ConfluenceIndexingMode; - setMode(normalized); - onChange(normalized); - } else { - setMode(mode); - normalized = mode; - onChange(mode); - // onChange(mode); - } - if (normalized === 'everything') { - setValue('config.space', ''); - setValue('config.page_id', ''); - setValue('config.index_recursively', false); - } else if (normalized === 'space') { - setValue('config.page_id', ''); - setValue('config.index_recursively', false); - } else if (normalized === 'page') { - setValue('config.space', ''); - } - }, - [mode, onChange, setValue], - ); - - const debouncedHandleChange = useMemo( - () => - debounce(() => { - handleModeChange(); - }, 300), - [handleModeChange], - ); - - return ( -
-
- {INDEX_MODE_OPTIONS.map((option) => { - const isActive = option.value === mode; - return ( - - ); - })} -
- - {mode === 'everything' && ( -

- This connector will index all pages the provided credentials have - access to. -

- )} - - {mode === 'space' && ( -
-
- Space Key -
- { - const value = e.target.value; - setValue('config.space', value); - debouncedHandleChange(); - }} - placeholder="e.g. KB" - disabled={disabled} - /> -

- The Confluence space key to index. -

-
- )} - - {mode === 'page' && ( -
-
Page ID
- { - setValue('config.page_id', e.target.value); - debouncedHandleChange(); - }} - placeholder="e.g. 123456" - disabled={disabled} - /> -

- The Confluence page ID to index. -

- -
- { - setValue('config.index_recursively', Boolean(checked)); - debouncedHandleChange(); - }} - disabled={disabled} - /> - - Index child pages recursively - -
-
- )} -
- ); -}; - -const INDEX_MODE_OPTIONS = [ - { label: 'Everything', value: 'everything' }, - { label: 'Space', value: 'space' }, - { label: 'Page', value: 'page' }, -]; - -export default ConfluenceTokenField; diff --git a/web/src/pages/user-setting/data-source/constant/bitbucket-constant.tsx b/web/src/pages/user-setting/data-source/constant/bitbucket-constant.tsx new file mode 100644 index 00000000000..83f33c07fde --- /dev/null +++ b/web/src/pages/user-setting/data-source/constant/bitbucket-constant.tsx @@ -0,0 +1,83 @@ +import { FilterFormField, FormFieldType } from '@/components/dynamic-form'; +import { TFunction } from 'i18next'; + +export const bitbucketConstant = (t: TFunction) => [ + { + label: 'Bitbucket Account Email', + name: 'config.credentials.bitbucket_account_email', + type: FormFieldType.Email, + required: true, + }, + { + label: 'Bitbucket API Token', + name: 'config.credentials.bitbucket_api_token', + type: FormFieldType.Password, + required: true, + }, + { + label: 'Workspace', + name: 'config.workspace', + type: FormFieldType.Text, + required: true, + tooltip: t('setting.bitbucketTopWorkspaceTip'), + }, + { + label: 'Index Mode', + name: 'config.index_mode', + type: FormFieldType.Segmented, + options: [ + { label: 'Repositories', value: 'repositories' }, + { label: 'Project(s)', value: 'projects' }, + { label: 'Workspace', value: 'workspace' }, + ], + }, + { + label: 'Repository Slugs', + name: 'config.repository_slugs', + type: FormFieldType.Text, + customValidate: (val: string, formValues: any) => { + const index_mode = formValues?.config?.index_mode; + if (!val && index_mode === 'repositories') { + return 'Repository Slugs is required'; + } + return true; + }, + shouldRender: (formValues: any) => { + const index_mode = formValues?.config?.index_mode; + return index_mode === 'repositories'; + }, + tooltip: t('setting.bitbucketRepositorySlugsTip'), + }, + { + label: 'Projects', + name: 'config.projects', + type: FormFieldType.Text, + customValidate: (val: string, formValues: any) => { + const index_mode = formValues?.config?.index_mode; + if (!val && index_mode === 'projects') { + return 'Projects is required'; + } + return true; + }, + shouldRender: (formValues: any) => { + const index_mode = formValues?.config?.index_mode; + console.log('formValues.config', formValues?.config); + return index_mode === 'projects'; + }, + tooltip: t('setting.bitbucketProjectsTip'), + }, + { + name: FilterFormField + '.tip', + label: ' ', + type: FormFieldType.Custom, + shouldRender: (formValues: any) => { + const index_mode = formValues?.config?.index_mode; + return index_mode === 'workspace'; + }, + render: () => ( +
+ {t('setting.bitbucketWorkspaceTip')} +
+ ), + }, +]; diff --git a/web/src/pages/user-setting/data-source/constant/confluence-constant.tsx b/web/src/pages/user-setting/data-source/constant/confluence-constant.tsx new file mode 100644 index 00000000000..48e2da47cd3 --- /dev/null +++ b/web/src/pages/user-setting/data-source/constant/confluence-constant.tsx @@ -0,0 +1,121 @@ +import { FilterFormField, FormFieldType } from '@/components/dynamic-form'; +import { TFunction } from 'i18next'; + +export const confluenceConstant = (t: TFunction) => [ + { + label: 'Confluence Username', + name: 'config.credentials.confluence_username', + type: FormFieldType.Text, + required: true, + tooltip: t('setting.connectorNameTip'), + }, + { + label: 'Confluence Access Token', + name: 'config.credentials.confluence_access_token', + type: FormFieldType.Password, + required: true, + }, + { + label: 'Wiki Base URL', + name: 'config.wiki_base', + type: FormFieldType.Text, + required: false, + tooltip: t('setting.confluenceWikiBaseUrlTip'), + }, + { + label: 'Is Cloud', + name: 'config.is_cloud', + type: FormFieldType.Checkbox, + required: false, + tooltip: t('setting.confluenceIsCloudTip'), + }, + { + label: 'Index Mode', + name: 'config.index_mode', + type: FormFieldType.Segmented, + options: [ + { label: 'Everything', value: 'everything' }, + { label: 'Space', value: 'space' }, + { label: 'Page', value: 'page' }, + ], + }, + { + name: 'config.page_id', + label: 'Page ID', + type: FormFieldType.Text, + customValidate: (val: string, formValues: any) => { + const index_mode = formValues?.config?.index_mode; + console.log('index_mode', index_mode, val); + if (!val && index_mode === 'page') { + return 'Page ID is required'; + } + return true; + }, + shouldRender: (formValues: any) => { + const index_mode = formValues?.config?.index_mode; + return index_mode === 'page'; + }, + }, + { + name: 'config.space', + label: 'Space Key', + type: FormFieldType.Text, + customValidate: (val: string, formValues: any) => { + const index_mode = formValues?.config?.index_mode; + if (!val && index_mode === 'space') { + return 'Space Key is required'; + } + return true; + }, + shouldRender: (formValues: any) => { + const index_mode = formValues?.config?.index_mode; + return index_mode === 'space'; + }, + }, + { + name: 'config.index_recursively', + label: 'Index Recursively', + type: FormFieldType.Checkbox, + shouldRender: (formValues: any) => { + const index_mode = formValues?.config?.index_mode; + return index_mode === 'page'; + }, + }, + { + name: FilterFormField + '.tip', + label: ' ', + type: FormFieldType.Custom, + shouldRender: (formValues: any) => { + const index_mode = formValues?.config?.index_mode; + return index_mode === 'everything'; + }, + render: () => ( +
+ { + 'This choice will index all pages the provided credentials have access to.' + } +
+ ), + }, + { + label: 'Space Key', + name: 'config.space', + type: FormFieldType.Text, + required: false, + hidden: true, + }, + { + label: 'Page ID', + name: 'config.page_id', + type: FormFieldType.Text, + required: false, + hidden: true, + }, + { + label: 'Index Recursively', + name: 'config.index_recursively', + type: FormFieldType.Checkbox, + required: false, + hidden: true, + }, +]; diff --git a/web/src/pages/user-setting/data-source/constant/index.tsx b/web/src/pages/user-setting/data-source/constant/index.tsx index 804ecc2ebbb..8b9193c1804 100644 --- a/web/src/pages/user-setting/data-source/constant/index.tsx +++ b/web/src/pages/user-setting/data-source/constant/index.tsx @@ -4,11 +4,13 @@ import { t, TFunction } from 'i18next'; import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import BoxTokenField from '../component/box-token-field'; -import { ConfluenceIndexingModeField } from '../component/confluence-token-field'; import GmailTokenField from '../component/gmail-token-field'; import GoogleDriveTokenField from '../component/google-drive-token-field'; import { IDataSourceInfoMap } from '../interface'; +import { bitbucketConstant } from './bitbucket-constant'; +import { confluenceConstant } from './confluence-constant'; import { S3Constant } from './s3-constant'; + export enum DataSourceKey { CONFLUENCE = 'confluence', S3 = 's3', @@ -29,6 +31,7 @@ export enum DataSourceKey { ASANA = 'asana', IMAP = 'imap', GITHUB = 'github', + BITBUCKET = 'bitbucket', ZENDESK = 'zendesk', // SHAREPOINT = 'sharepoint', // SLACK = 'slack', @@ -134,6 +137,11 @@ export const generateDataSourceInfo = (t: TFunction) => { description: t(`setting.${DataSourceKey.IMAP}Description`), icon: , }, + [DataSourceKey.BITBUCKET]: { + name: 'Bitbucket', + description: t(`setting.${DataSourceKey.BITBUCKET}Description`), + icon: , + }, [DataSourceKey.ZENDESK]: { name: 'Zendesk', description: t(`setting.${DataSourceKey.ZENDESK}Description`), @@ -294,67 +302,7 @@ export const DataSourceFormFields = { }, ], - [DataSourceKey.CONFLUENCE]: [ - { - label: 'Confluence Username', - name: 'config.credentials.confluence_username', - type: FormFieldType.Text, - required: true, - tooltip: 'A descriptive name for the connector.', - }, - { - label: 'Confluence Access Token', - name: 'config.credentials.confluence_access_token', - type: FormFieldType.Password, - required: true, - }, - { - label: 'Wiki Base URL', - name: 'config.wiki_base', - type: FormFieldType.Text, - required: false, - tooltip: t('setting.confluenceWikiBaseUrlTip'), - }, - { - label: 'Is Cloud', - name: 'config.is_cloud', - type: FormFieldType.Checkbox, - required: false, - tooltip: t('setting.confluenceIsCloudTip'), - }, - { - label: 'Index Method', - name: 'config.index_mode', - type: FormFieldType.Text, - required: false, - horizontal: true, - labelClassName: 'self-start pt-4', - render: (fieldProps: any) => ( - - ), - }, - { - label: 'Space Key', - name: 'config.space', - type: FormFieldType.Text, - required: false, - hidden: true, - }, - { - label: 'Page ID', - name: 'config.page_id', - type: FormFieldType.Text, - required: false, - hidden: true, - }, - { - label: 'Index Recursively', - name: 'config.index_recursively', - type: FormFieldType.Checkbox, - required: false, - hidden: true, - }, - ], + [DataSourceKey.CONFLUENCE]: confluenceConstant(t), [DataSourceKey.GOOGLE_DRIVE]: [ { label: 'Primary Admin Email', @@ -828,6 +776,7 @@ export const DataSourceFormFields = { required: false, }, ], + [DataSourceKey.BITBUCKET]: bitbucketConstant(t), [DataSourceKey.ZENDESK]: [ { label: 'Zendesk Domain', @@ -919,6 +868,7 @@ export const DataSourceFormDefaultValues = { wiki_base: '', is_cloud: true, space: '', + page_id: '', credentials: { confluence_username: '', confluence_access_token: '', @@ -1112,6 +1062,19 @@ export const DataSourceFormDefaultValues = { }, }, }, + [DataSourceKey.BITBUCKET]: { + name: '', + source: DataSourceKey.BITBUCKET, + config: { + workspace: '', + index_mode: 'workspace', + repository_slugs: '', + projects: '', + }, + credentials: { + bitbucket_api_token: '', + }, + }, [DataSourceKey.ZENDESK]: { name: '', source: DataSourceKey.ZENDESK, From 365f9b01ae171d6fb34f272007d0567fba534cd1 Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Wed, 31 Dec 2025 17:19:04 +0800 Subject: [PATCH 008/335] Fix: metadata data synchronization issues; add memory tab in home page (#12368) ### What problem does this PR solve? fix: metadata data synchronization issues; add memory tab in home page ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- .../configuration/common-item.tsx | 13 +- .../pages/dataset/dataset-setting/hooks.ts | 5 +- .../pages/dataset/dataset-setting/index.tsx | 158 ++++++++++-------- web/src/pages/home/applications.tsx | 10 ++ web/src/pages/home/memory-list.tsx | 79 +++++++++ 5 files changed, 186 insertions(+), 79 deletions(-) create mode 100644 web/src/pages/home/memory-list.tsx diff --git a/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx b/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx index 0aae7ae0ad3..9a6af0ccf52 100644 --- a/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx +++ b/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx @@ -25,13 +25,14 @@ import { useComposeLlmOptionsByModelTypes } from '@/hooks/use-llm-request'; import { cn } from '@/lib/utils'; import { t } from 'i18next'; import { Settings } from 'lucide-react'; -import { useCallback, useEffect, useMemo, useState } from 'react'; +import { useCallback, useContext, useEffect, useMemo, useState } from 'react'; import { ControllerRenderProps, FieldValues, useFormContext, } from 'react-hook-form'; -import { useLocation } from 'umi'; +import { history, useLocation } from 'umi'; +import { DataSetContext } from '..'; import { MetadataType, useManageMetadata, @@ -371,6 +372,7 @@ export function AutoMetadata({ // get metadata field const location = useLocation(); const form = useFormContext(); + const datasetContext = useContext(DataSetContext); const { manageMetadataVisible, showManageMetadataModal, @@ -394,13 +396,14 @@ export function AutoMetadata({ const locationState = location.state as | { openMetadata?: boolean } | undefined; - if (locationState?.openMetadata) { + if (locationState?.openMetadata && !datasetContext?.loading) { setTimeout(() => { handleClickOpenMetadata(); - }, 100); + }, 0); locationState.openMetadata = false; + history.replace({ ...location }, locationState); } - }, [location, handleClickOpenMetadata]); + }, [location, handleClickOpenMetadata, datasetContext]); const autoMetadataField: FormFieldConfig = { name: 'parser_config.enable_metadata', diff --git a/web/src/pages/dataset/dataset-setting/hooks.ts b/web/src/pages/dataset/dataset-setting/hooks.ts index db67bda212f..66f510eac6d 100644 --- a/web/src/pages/dataset/dataset-setting/hooks.ts +++ b/web/src/pages/dataset/dataset-setting/hooks.ts @@ -37,7 +37,8 @@ export function useHasParsedDocument(isEdit?: boolean) { export const useFetchKnowledgeConfigurationOnMount = ( form: UseFormReturn, any, undefined>, ) => { - const { data: knowledgeDetails } = useFetchKnowledgeBaseConfiguration(); + const { data: knowledgeDetails, loading } = + useFetchKnowledgeBaseConfiguration(); useEffect(() => { const parser_config = { @@ -71,7 +72,7 @@ export const useFetchKnowledgeConfigurationOnMount = ( form.reset(formValues); }, [form, knowledgeDetails]); - return knowledgeDetails; + return { knowledgeDetails, loading }; }; export const useSelectKnowledgeDetailsLoading = () => diff --git a/web/src/pages/dataset/dataset-setting/index.tsx b/web/src/pages/dataset/dataset-setting/index.tsx index 81fbc4c53e8..b3d9f87a297 100644 --- a/web/src/pages/dataset/dataset-setting/index.tsx +++ b/web/src/pages/dataset/dataset-setting/index.tsx @@ -7,11 +7,11 @@ import { Form } from '@/components/ui/form'; import { FormLayout } from '@/constants/form'; import { DocumentParserType } from '@/constants/knowledge'; import { PermissionRole } from '@/constants/permission'; -import { IConnector } from '@/interfaces/database/knowledge'; +import { IConnector, IKnowledge } from '@/interfaces/database/knowledge'; import { useDataSourceInfo } from '@/pages/user-setting/data-source/constant'; import { IDataSourceBase } from '@/pages/user-setting/data-source/interface'; import { zodResolver } from '@hookform/resolvers/zod'; -import { useEffect, useState } from 'react'; +import { createContext, useEffect, useState } from 'react'; import { useForm, useWatch } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import { z } from 'zod'; @@ -35,6 +35,10 @@ const enum DocumentType { DeepDOC = 'DeepDOC', PlainText = 'Plain Text', } +export const DataSetContext = createContext<{ + loading: boolean; + knowledgeDetails: IKnowledge; +}>({ loading: false, knowledgeDetails: {} as IKnowledge }); const initialEntityTypes = [ 'organization', @@ -102,7 +106,8 @@ export default function DatasetSettings() { }, }); const { dataSourceInfo } = useDataSourceInfo(); - const knowledgeDetails = useFetchKnowledgeConfigurationOnMount(form); + const { knowledgeDetails, loading: datasetSettingLoading } = + useFetchKnowledgeConfigurationOnMount(form); // const [pipelineData, setPipelineData] = useState(); const [sourceData, setSourceData] = useState(); const [graphRagGenerateData, setGraphRagGenerateData] = @@ -254,81 +259,90 @@ export default function DatasetSettings() { description={t('knowledgeConfiguration.titleDescription')} >
-
- -
- -
- {t('knowledgeConfiguration.baseInfo')} -
- + + + +
+ +
+ {t('knowledgeConfiguration.baseInfo')} +
+ - -
- {t('knowledgeConfiguration.dataPipeline')} -
- - {parseType === 1 && ( - - )} - {parseType === 2 && ( - - )} + +
+ {t('knowledgeConfiguration.dataPipeline')} +
+ + {parseType === 1 && ( + + )} + {parseType === 2 && ( + + )} - {/* */} - {parseType === 1 && } + {/* */} + {parseType === 1 && } - {/* */} - - - -
- {t('knowledgeConfiguration.globalIndex')} -
- - handleDeletePipelineTask(GenerateType.KnowledgeGraph) - } - > - - handleDeletePipelineTask(GenerateType.Raptor)} - > -
-
-
- - -
- - -
- {parseType === 1 && } -
+ + + +
+ {t('knowledgeConfiguration.globalIndex')} +
+ + handleDeletePipelineTask(GenerateType.KnowledgeGraph) + } + > + + + handleDeletePipelineTask(GenerateType.Raptor) + } + > +
+
+
+ + +
+ + +
+ {parseType === 1 && } +
+
); diff --git a/web/src/pages/home/applications.tsx b/web/src/pages/home/applications.tsx index 5686fc04f6b..2c3dfa68261 100644 --- a/web/src/pages/home/applications.tsx +++ b/web/src/pages/home/applications.tsx @@ -10,18 +10,21 @@ import { useNavigate } from 'umi'; import { Agents } from './agent-list'; import { SeeAllAppCard } from './application-card'; import { ChatList } from './chat-list'; +import { MemoryList } from './memory-list'; import { SearchList } from './search-list'; const IconMap = { [Routes.Chats]: 'chats', [Routes.Searches]: 'searches', [Routes.Agents]: 'agents', + [Routes.Memories]: 'memory', }; const EmptyTypeMap = { [Routes.Chats]: EmptyCardType.Chat, [Routes.Searches]: EmptyCardType.Search, [Routes.Agents]: EmptyCardType.Agent, + [Routes.Memories]: EmptyCardType.Memory, }; export function Applications() { @@ -47,6 +50,7 @@ export function Applications() { { value: Routes.Chats, label: t('chat.chatApps') }, { value: Routes.Searches, label: t('search.searchApps') }, { value: Routes.Agents, label: t('header.flow') }, + { value: Routes.Memories, label: t('memories.memory') }, ], [t], ); @@ -96,6 +100,12 @@ export function Applications() { setLoading={(loading: boolean) => setLoading(loading)} > )} + {val === Routes.Memories && ( + setListLength(length)} + setLoading={(loading: boolean) => setLoading(loading)} + > + )} {listLength > 0 && ( handleNavigate({ isCreate: false })} diff --git a/web/src/pages/home/memory-list.tsx b/web/src/pages/home/memory-list.tsx new file mode 100644 index 00000000000..1bc1fb059db --- /dev/null +++ b/web/src/pages/home/memory-list.tsx @@ -0,0 +1,79 @@ +import { HomeCard } from '@/components/home-card'; +import { MoreButton } from '@/components/more-button'; +import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks'; +import { useEffect } from 'react'; +import { AddOrEditModal } from '../memories/add-or-edit-modal'; +import { useFetchMemoryList, useRenameMemory } from '../memories/hooks'; +import { ICreateMemoryProps } from '../memories/interface'; +import { MemoryDropdown } from '../memories/memory-dropdown'; + +export function MemoryList({ + setListLength, + setLoading, +}: { + setListLength: (length: number) => void; + setLoading?: (loading: boolean) => void; +}) { + const { data, refetch: refetchList, isLoading } = useFetchMemoryList(); + const { navigateToMemory } = useNavigatePage(); + // const { + // openCreateModal, + // showSearchRenameModal, + // hideSearchRenameModal, + // searchRenameLoading, + // onSearchRenameOk, + // initialSearchName, + // } = useRenameSearch(); + const { + openCreateModal, + showMemoryRenameModal, + hideMemoryModal, + searchRenameLoading, + onMemoryRenameOk, + initialMemory, + } = useRenameMemory(); + const onMemoryConfirm = (data: ICreateMemoryProps) => { + onMemoryRenameOk(data, () => { + refetchList(); + }); + }; + + useEffect(() => { + setListLength(data?.data?.memory_list?.length || 0); + setLoading?.(isLoading || false); + }, [data, setListLength, isLoading, setLoading]); + return ( + <> + {data?.data.memory_list.slice(0, 10).map((x) => ( + + + + } + > + ))} + {openCreateModal && ( + + )} + + ); +} From 96810b7d976791fe31529ae0c891a8c66175a686 Mon Sep 17 00:00:00 2001 From: Magicbook1108 Date: Wed, 31 Dec 2025 19:00:00 +0800 Subject: [PATCH 009/335] Fix: webdav connector (#12380) ### What problem does this PR solve? fix webdav #11422 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- common/data_source/__init__.py | 2 - common/data_source/webdav_connector.py | 79 +++++++++++++++----------- rag/svr/sync_data_source.py | 9 ++- 3 files changed, 54 insertions(+), 36 deletions(-) diff --git a/common/data_source/__init__.py b/common/data_source/__init__.py index 9fed196ab6e..97ce3f18e49 100644 --- a/common/data_source/__init__.py +++ b/common/data_source/__init__.py @@ -34,7 +34,6 @@ from .jira.connector import JiraConnector from .sharepoint_connector import SharePointConnector from .teams_connector import TeamsConnector -from .webdav_connector import WebDAVConnector from .moodle_connector import MoodleConnector from .airtable_connector import AirtableConnector from .asana_connector import AsanaConnector @@ -62,7 +61,6 @@ "JiraConnector", "SharePointConnector", "TeamsConnector", - "WebDAVConnector", "MoodleConnector", "BlobType", "DocumentSource", diff --git a/common/data_source/webdav_connector.py b/common/data_source/webdav_connector.py index f8e61578900..ec06a64e192 100644 --- a/common/data_source/webdav_connector.py +++ b/common/data_source/webdav_connector.py @@ -82,10 +82,6 @@ def load_credentials(self, credentials: dict[str, Any]) -> dict[str, Any] | None base_url=self.base_url, auth=(username, password) ) - - # Test connection - self.client.exists(self.remote_path) - except Exception as e: logging.error(f"Failed to connect to WebDAV server: {e}") raise ConnectorMissingCredentialError( @@ -308,60 +304,79 @@ def poll_source( yield batch def validate_connector_settings(self) -> None: - """Validate WebDAV connector settings - - Raises: - ConnectorMissingCredentialError: If credentials are not loaded - ConnectorValidationError: If settings are invalid + """Validate WebDAV connector settings. + + Validation should exercise the same code-paths used by the connector + (directory listing / PROPFIND), avoiding exists() which may probe with + methods that differ across servers. """ if self.client is None: - raise ConnectorMissingCredentialError( - "WebDAV credentials not loaded." - ) + raise ConnectorMissingCredentialError("WebDAV credentials not loaded.") if not self.base_url: - raise ConnectorValidationError( - "No base URL was provided in connector settings." - ) + raise ConnectorValidationError("No base URL was provided in connector settings.") + + # Normalize directory path: for collections, many servers behave better with trailing '/' + test_path = self.remote_path or "/" + if not test_path.startswith("/"): + test_path = f"/{test_path}" + if test_path != "/" and not test_path.endswith("/"): + test_path = f"{test_path}/" try: - if not self.client.exists(self.remote_path): - raise ConnectorValidationError( - f"Remote path '{self.remote_path}' does not exist on WebDAV server." - ) + # Use the same behavior as real sync: list directory with details (PROPFIND) + self.client.ls(test_path, detail=True) except Exception as e: - error_message = str(e) - - if "401" in error_message or "unauthorized" in error_message.lower(): - raise CredentialExpiredError( - "WebDAV credentials appear invalid or expired." - ) - - if "403" in error_message or "forbidden" in error_message.lower(): + # Prefer structured status codes if present on the exception/response + status = None + for attr in ("status_code", "code"): + v = getattr(e, attr, None) + if isinstance(v, int): + status = v + break + if status is None: + resp = getattr(e, "response", None) + v = getattr(resp, "status_code", None) + if isinstance(v, int): + status = v + + # If we can classify by status code, do it + if status == 401: + raise CredentialExpiredError("WebDAV credentials appear invalid or expired.") + if status == 403: raise InsufficientPermissionsError( f"Insufficient permissions to access path '{self.remote_path}' on WebDAV server." ) - - if "404" in error_message or "not found" in error_message.lower(): + if status == 404: raise ConnectorValidationError( f"Remote path '{self.remote_path}' does not exist on WebDAV server." ) + # Fallback: avoid brittle substring matching that caused false positives. + # Provide the original exception for diagnosis. raise ConnectorValidationError( - f"Unexpected WebDAV client error: {e}" + f"WebDAV validation failed for path '{test_path}': {repr(e)}" ) + if __name__ == "__main__": credentials_dict = { "username": os.environ.get("WEBDAV_USERNAME"), "password": os.environ.get("WEBDAV_PASSWORD"), } + credentials_dict = { + "username": "user", + "password": "pass", + } + + + connector = WebDAVConnector( - base_url=os.environ.get("WEBDAV_URL") or "https://webdav.example.com", - remote_path=os.environ.get("WEBDAV_PATH") or "/", + base_url="http://172.17.0.1:8080/", + remote_path="/", ) try: diff --git a/rag/svr/sync_data_source.py b/rag/svr/sync_data_source.py index 81478ab9ba8..c1aa3e3e991 100644 --- a/rag/svr/sync_data_source.py +++ b/rag/svr/sync_data_source.py @@ -46,7 +46,6 @@ MoodleConnector, JiraConnector, DropboxConnector, - WebDAVConnector, AirtableConnector, AsanaConnector, ImapConnector, @@ -55,6 +54,7 @@ from common.constants import FileSource, TaskStatus from common.data_source.config import INDEX_BATCH_SIZE from common.data_source.models import ConnectorFailure +from common.data_source.webdav_connector import WebDAVConnector from common.data_source.confluence_connector import ConfluenceConnector from common.data_source.gmail_connector import GmailConnector from common.data_source.box_connector import BoxConnector @@ -696,7 +696,12 @@ async def _generate(self, task: dict): self.conf.get("remote_path", "/"), begin_info )) - return document_batch_generator + + async def async_wrapper(): + for document_batch in document_batch_generator: + yield document_batch + + return async_wrapper() class Moodle(SyncBase): From 10c28c5ecd8891d7f02974a85c372e092d4690e1 Mon Sep 17 00:00:00 2001 From: balibabu Date: Wed, 31 Dec 2025 19:00:37 +0800 Subject: [PATCH 010/335] Feat: Refactoring the documentation page using shadcn. #10427 (#12376) ### What problem does this PR solve? Feat: Refactoring the documentation page using shadcn. #10427 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- .../api-service/chat-api-key-modal/index.tsx | 120 +++++++------ .../chat-overview-modal/anchor.tsx | 93 ++++++++++ .../chat-overview-modal/api-content.tsx | 45 +---- .../backend-service-api.tsx | 41 ++--- .../api-service/chat-overview-modal/index.tsx | 31 ---- .../chat-overview-modal/markdown-toc.tsx | 27 ++- .../api-service/embed-modal/index.less | 21 --- .../api-service/embed-modal/index.tsx | 170 ------------------ web/src/components/api-service/hooks.ts | 34 ---- .../pages/user-setting/setting-api/index.tsx | 2 +- .../setting-model/langfuse/index.tsx | 6 +- 11 files changed, 204 insertions(+), 386 deletions(-) create mode 100644 web/src/components/api-service/chat-overview-modal/anchor.tsx delete mode 100644 web/src/components/api-service/chat-overview-modal/index.tsx delete mode 100644 web/src/components/api-service/embed-modal/index.less delete mode 100644 web/src/components/api-service/embed-modal/index.tsx diff --git a/web/src/components/api-service/chat-api-key-modal/index.tsx b/web/src/components/api-service/chat-api-key-modal/index.tsx index 2497f0fa26e..e597c9985e0 100644 --- a/web/src/components/api-service/chat-api-key-modal/index.tsx +++ b/web/src/components/api-service/chat-api-key-modal/index.tsx @@ -1,11 +1,23 @@ import CopyToClipboard from '@/components/copy-to-clipboard'; +import { Button } from '@/components/ui/button'; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, +} from '@/components/ui/dialog'; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from '@/components/ui/table'; import { useTranslate } from '@/hooks/common-hooks'; import { IModalProps } from '@/interfaces/common'; -import { IToken } from '@/interfaces/database/chat'; import { formatDate } from '@/utils/date'; -import { DeleteOutlined } from '@ant-design/icons'; -import type { TableProps } from 'antd'; -import { Button, Modal, Space, Table } from 'antd'; +import { Trash2 } from 'lucide-react'; import { useOperateApiKey } from '../hooks'; const ChatApiKeyModal = ({ @@ -17,57 +29,59 @@ const ChatApiKeyModal = ({ useOperateApiKey(idKey, dialogId); const { t } = useTranslate('chat'); - const columns: TableProps['columns'] = [ - { - title: 'Token', - dataIndex: 'token', - key: 'token', - render: (text) => {text}, - }, - { - title: t('created'), - dataIndex: 'create_date', - key: 'create_date', - render: (text) => formatDate(text), - }, - { - title: t('action'), - key: 'action', - render: (_, record) => ( - - - removeToken(record.token)} /> - - ), - }, - ]; - return ( <> - - - - + + + + {t('apiKey')} + +
+ {listLoading ? ( +
Loading...
+ ) : ( +
+ + + Token + {t('created')} + {t('action')} + + + + {tokenList?.map((tokenItem) => ( + + + {tokenItem.token} + + {formatDate(tokenItem.create_date)} + +
+ + +
+
+
+ ))} +
+
+ )} + + + + ); }; diff --git a/web/src/components/api-service/chat-overview-modal/anchor.tsx b/web/src/components/api-service/chat-overview-modal/anchor.tsx new file mode 100644 index 00000000000..ed6f13507e9 --- /dev/null +++ b/web/src/components/api-service/chat-overview-modal/anchor.tsx @@ -0,0 +1,93 @@ +import React, { useSyncExternalStore } from 'react'; + +export interface AnchorItem { + key: string; + href: string; + title: string; + children?: AnchorItem[]; +} + +interface SimpleAnchorProps { + items: AnchorItem[]; + className?: string; + style?: React.CSSProperties; +} + +// Subscribe to URL hash changes +const subscribeHash = (callback: () => void) => { + window.addEventListener('hashchange', callback); + return () => window.removeEventListener('hashchange', callback); +}; + +const getHash = () => window.location.hash; + +const Anchor: React.FC = ({ + items, + className = '', + style = {}, +}) => { + // Sync with URL hash changes, to highlight the active item + const hash = useSyncExternalStore(subscribeHash, getHash); + + // Handle menu item click + const handleClick = ( + e: React.MouseEvent, + href: string, + ) => { + e.preventDefault(); + const targetId = href.replace('#', ''); + const targetElement = document.getElementById(targetId); + + if (targetElement) { + // Update URL hash (triggers hashchange event) + window.location.hash = href; + // Smooth scroll to target + targetElement.scrollIntoView({ behavior: 'smooth', block: 'start' }); + } + }; + + if (items.length === 0) return null; + + return ( + + ); +}; + +export default Anchor; diff --git a/web/src/components/api-service/chat-overview-modal/api-content.tsx b/web/src/components/api-service/chat-overview-modal/api-content.tsx index ebdc36581be..9e12aac45f8 100644 --- a/web/src/components/api-service/chat-overview-modal/api-content.tsx +++ b/web/src/components/api-service/chat-overview-modal/api-content.tsx @@ -1,52 +1,26 @@ import { useIsDarkTheme } from '@/components/theme-provider'; -import { useSetModalState, useTranslate } from '@/hooks/common-hooks'; +import { useSetModalState } from '@/hooks/common-hooks'; import { LangfuseCard } from '@/pages/user-setting/setting-model/langfuse'; import apiDoc from '@parent/docs/references/http_api_reference.md'; import MarkdownPreview from '@uiw/react-markdown-preview'; -import { Button, Card, Flex, Space } from 'antd'; import ChatApiKeyModal from '../chat-api-key-modal'; -import { usePreviewChat } from '../hooks'; import BackendServiceApi from './backend-service-api'; import MarkdownToc from './markdown-toc'; -const ApiContent = ({ - id, - idKey, - hideChatPreviewCard = false, -}: { - id?: string; - idKey: string; - hideChatPreviewCard?: boolean; -}) => { - const { t } = useTranslate('chat'); +const ApiContent = ({ id, idKey }: { id?: string; idKey: string }) => { const { visible: apiKeyVisible, hideModal: hideApiKeyModal, showModal: showApiKeyModal, } = useSetModalState(); - // const { embedVisible, hideEmbedModal, showEmbedModal, embedToken } = - // useShowEmbedModal(idKey); - - const { handlePreview } = usePreviewChat(idKey); const isDarkTheme = useIsDarkTheme(); return (
- +
- {!hideChatPreviewCard && ( - - - - - {/* */} - - - - )} +
@@ -54,7 +28,8 @@ const ApiContent = ({ source={apiDoc} wrapperElement={{ 'data-color-mode': isDarkTheme ? 'dark' : 'light' }} > - +
+ {apiKeyVisible && ( )} - {/* {embedVisible && ( - - )} */} -
); }; diff --git a/web/src/components/api-service/chat-overview-modal/backend-service-api.tsx b/web/src/components/api-service/chat-overview-modal/backend-service-api.tsx index 2524000c1d8..07a2811c995 100644 --- a/web/src/components/api-service/chat-overview-modal/backend-service-api.tsx +++ b/web/src/components/api-service/chat-overview-modal/backend-service-api.tsx @@ -1,33 +1,28 @@ -import { Button, Card, Flex, Space, Typography } from 'antd'; +import { Button } from '@/components/ui/button'; +import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; +import { CopyToClipboardWithText } from '@/components/copy-to-clipboard'; import { useTranslate } from '@/hooks/common-hooks'; -import styles from './index.less'; - -const { Paragraph } = Typography; const BackendServiceApi = ({ show }: { show(): void }) => { const { t } = useTranslate('chat'); return ( - - RAGFlow API - - - } - > - - {t('backendServiceApi')} - - {location.origin} - - + + +
+ RAGFlow API + +
+
+ +
+ {t('backendServiceApi')} + +
+
); }; diff --git a/web/src/components/api-service/chat-overview-modal/index.tsx b/web/src/components/api-service/chat-overview-modal/index.tsx deleted file mode 100644 index f31b05c8226..00000000000 --- a/web/src/components/api-service/chat-overview-modal/index.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { useTranslate } from '@/hooks/common-hooks'; -import { IModalProps } from '@/interfaces/common'; -import { Modal } from 'antd'; -import ApiContent from './api-content'; - -const ChatOverviewModal = ({ - visible, - hideModal, - id, - idKey, -}: IModalProps & { id: string; name?: string; idKey: string }) => { - const { t } = useTranslate('chat'); - - return ( - <> - - - - - ); -}; - -export default ChatOverviewModal; diff --git a/web/src/components/api-service/chat-overview-modal/markdown-toc.tsx b/web/src/components/api-service/chat-overview-modal/markdown-toc.tsx index 498026b09b7..7234f5a8ff3 100644 --- a/web/src/components/api-service/chat-overview-modal/markdown-toc.tsx +++ b/web/src/components/api-service/chat-overview-modal/markdown-toc.tsx @@ -1,21 +1,27 @@ -import { Anchor } from 'antd'; -import type { AnchorLinkItemProps } from 'antd/es/anchor/Anchor'; import React, { useEffect, useState } from 'react'; +import Anchor, { AnchorItem } from './anchor'; interface MarkdownTocProps { content: string; } const MarkdownToc: React.FC = ({ content }) => { - const [items, setItems] = useState([]); + const [items, setItems] = useState([]); useEffect(() => { const generateTocItems = () => { const headings = document.querySelectorAll( '.wmde-markdown h2, .wmde-markdown h3', ); - const tocItems: AnchorLinkItemProps[] = []; - let currentH2Item: AnchorLinkItemProps | null = null; + + // If headings haven't rendered yet, wait for next frame + if (headings.length === 0) { + requestAnimationFrame(generateTocItems); + return; + } + + const tocItems: AnchorItem[] = []; + let currentH2Item: AnchorItem | null = null; headings.forEach((heading) => { const title = heading.textContent || ''; @@ -23,7 +29,7 @@ const MarkdownToc: React.FC = ({ content }) => { const isH2 = heading.tagName.toLowerCase() === 'h2'; if (id && title) { - const item: AnchorLinkItemProps = { + const item: AnchorItem = { key: id, href: `#${id}`, title, @@ -48,7 +54,10 @@ const MarkdownToc: React.FC = ({ content }) => { setItems(tocItems.slice(1)); }; - setTimeout(generateTocItems, 100); + // Use requestAnimationFrame to ensure execution after DOM rendering + requestAnimationFrame(() => { + requestAnimationFrame(generateTocItems); + }); }, [content]); return ( @@ -56,7 +65,7 @@ const MarkdownToc: React.FC = ({ content }) => { className="markdown-toc bg-bg-base text-text-primary shadow shadow-text-secondary" style={{ position: 'fixed', - right: 20, + right: 30, top: 100, bottom: 150, width: 200, @@ -66,7 +75,7 @@ const MarkdownToc: React.FC = ({ content }) => { zIndex: 1000, }} > - + ); }; diff --git a/web/src/components/api-service/embed-modal/index.less b/web/src/components/api-service/embed-modal/index.less deleted file mode 100644 index 2c85068ca57..00000000000 --- a/web/src/components/api-service/embed-modal/index.less +++ /dev/null @@ -1,21 +0,0 @@ -.codeCard { - .clearCardBody(); -} - -.codeText { - padding: 10px; - background-color: #ffffff09; -} - -.id { - .linkText(); -} - -.darkBg { - background-color: rgb(69, 68, 68); -} - -.darkId { - color: white; - .darkBg(); -} diff --git a/web/src/components/api-service/embed-modal/index.tsx b/web/src/components/api-service/embed-modal/index.tsx deleted file mode 100644 index f4cb49ea106..00000000000 --- a/web/src/components/api-service/embed-modal/index.tsx +++ /dev/null @@ -1,170 +0,0 @@ -import CopyToClipboard from '@/components/copy-to-clipboard'; -import HighLightMarkdown from '@/components/highlight-markdown'; -import { SharedFrom } from '@/constants/chat'; -import { useTranslate } from '@/hooks/common-hooks'; -import { IModalProps } from '@/interfaces/common'; -import { - Card, - Checkbox, - Form, - Modal, - Select, - Tabs, - TabsProps, - Typography, -} from 'antd'; -import { useMemo, useState } from 'react'; - -import { useIsDarkTheme } from '@/components/theme-provider'; -import { - LanguageAbbreviation, - LanguageAbbreviationMap, -} from '@/constants/common'; -import { cn } from '@/lib/utils'; -import styles from './index.less'; - -const { Paragraph, Link } = Typography; - -const EmbedModal = ({ - visible, - hideModal, - token = '', - form, - beta = '', - isAgent, -}: IModalProps & { - token: string; - form: SharedFrom; - beta: string; - isAgent: boolean; -}) => { - const { t } = useTranslate('chat'); - const isDarkTheme = useIsDarkTheme(); - - const [visibleAvatar, setVisibleAvatar] = useState(false); - const [locale, setLocale] = useState(''); - - const languageOptions = useMemo(() => { - return Object.values(LanguageAbbreviation).map((x) => ({ - label: LanguageAbbreviationMap[x], - value: x, - })); - }, []); - - const generateIframeSrc = () => { - let src = `${location.origin}/chat/share?shared_id=${token}&from=${form}&auth=${beta}`; - if (visibleAvatar) { - src += '&visible_avatar=1'; - } - if (locale) { - src += `&locale=${locale}`; - } - return src; - }; - - const iframeSrc = generateIframeSrc(); - - const text = ` - ~~~ html - -~~~ - `; - - const items: TabsProps['items'] = [ - { - key: '1', - label: t('fullScreenTitle'), - children: ( - } - className={styles.codeCard} - > -
-

Option:

- - - setVisibleAvatar(e.target.checked)} - > - - - - - - - - - - label={t('modelName')} - name="llm_name" - rules={[{ required: true, message: t('volcModelNameMessage') }]} - > - - - - label={t('addEndpointID')} - name="endpoint_id" - rules={[{ required: true, message: t('endpointIDMessage') }]} - > - - - - label={t('addArkApiKey')} - name="ark_api_key" - rules={[{ required: true, message: t('ArkApiKeyMessage') }]} - > - - - - label={t('maxTokens')} - name="max_tokens" - rules={[ - { required: true, message: t('maxTokensMessage') }, - { - type: 'number', - message: t('maxTokensInvalidMessage'), - }, - ({}) => ({ - validator(_, value) { - if (value < 0) { - return Promise.reject(new Error(t('maxTokensMinMessage'))); - } - return Promise.resolve(); - }, - }), - ]} - > - - - +
+ + {t('ollamaLink', { name: llmFactory })} + +
+ { + hideModal?.(); + }} + /> + { + handleOk(values); + }} + /> +
+
+ ); }; diff --git a/web/src/pages/user-setting/setting-model/modal/yiyan-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/yiyan-modal/index.tsx index 6991b9a3cc4..511f9607765 100644 --- a/web/src/pages/user-setting/setting-model/modal/yiyan-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/yiyan-modal/index.tsx @@ -1,18 +1,15 @@ -import { useTranslate } from '@/hooks/common-hooks'; +import { + DynamicForm, + FormFieldConfig, + FormFieldType, +} from '@/components/dynamic-form'; +import { Modal } from '@/components/ui/modal/modal'; +import { useCommonTranslation, useTranslate } from '@/hooks/common-hooks'; import { IModalProps } from '@/interfaces/common'; import { IAddLlmRequestBody } from '@/interfaces/request/llm'; -import { Form, Input, InputNumber, Modal, Select } from 'antd'; -import omit from 'lodash/omit'; +import { FieldValues } from 'react-hook-form'; import { LLMHeader } from '../../components/llm-header'; -type FieldType = IAddLlmRequestBody & { - vision: boolean; - yiyan_ak: string; - yiyan_sk: string; -}; - -const { Option } = Select; - const YiyanModal = ({ visible, hideModal, @@ -20,111 +17,115 @@ const YiyanModal = ({ loading, llmFactory, }: IModalProps & { llmFactory: string }) => { - const [form] = Form.useForm(); - const { t } = useTranslate('setting'); + const { t: tc } = useCommonTranslation(); + + const fields: FormFieldConfig[] = [ + { + name: 'model_type', + label: t('modelType'), + type: FormFieldType.Select, + required: true, + options: [ + { label: 'chat', value: 'chat' }, + { label: 'embedding', value: 'embedding' }, + { label: 'rerank', value: 'rerank' }, + ], + defaultValue: 'chat', + }, + { + name: 'llm_name', + label: t('modelName'), + type: FormFieldType.Text, + required: true, + placeholder: t('yiyanModelNameMessage'), + }, + { + name: 'yiyan_ak', + label: t('addyiyanAK'), + type: FormFieldType.Text, + required: true, + placeholder: t('yiyanAKMessage'), + }, + { + name: 'yiyan_sk', + label: t('addyiyanSK'), + type: FormFieldType.Text, + required: true, + placeholder: t('yiyanSKMessage'), + }, + { + name: 'max_tokens', + label: t('maxTokens'), + type: FormFieldType.Number, + required: true, + placeholder: t('maxTokensTip'), + validation: { + min: 0, + }, + }, + ]; + + const handleOk = async (values?: FieldValues) => { + if (!values) return; - const handleOk = async () => { - const values = await form.validateFields(); const modelType = values.model_type === 'chat' && values.vision ? 'image2text' : values.model_type; - const data = { - ...omit(values, ['vision']), - model_type: modelType, + const data: IAddLlmRequestBody = { llm_factory: llmFactory, - max_tokens: values.max_tokens, + llm_name: values.llm_name as string, + model_type: modelType, + api_key: { + yiyan_ak: values.yiyan_ak, + yiyan_sk: values.yiyan_sk, + }, + max_tokens: values.max_tokens as number, }; - console.info(data); - onOk?.(data); - }; + console.info(data); - const handleKeyDown = async (e: React.KeyboardEvent) => { - if (e.key === 'Enter') { - await handleOk(); - } + await onOk?.(data); }; return ( } - open={visible} - onOk={handleOk} - onCancel={hideModal} - okButtonProps={{ loading }} - confirmLoading={loading} + open={visible || false} + onOpenChange={(open) => !open && hideModal?.()} + maskClosable={false} + footer={
} > -
{ + console.log(data); + }} + defaultValues={ + { + model_type: 'chat', + vision: false, + } as FieldValues + } + labelClassName="font-normal" > - - label={t('modelType')} - name="model_type" - initialValue={'chat'} - rules={[{ required: true, message: t('modelTypeMessage') }]} - > - - - - label={t('modelName')} - name="llm_name" - rules={[{ required: true, message: t('yiyanModelNameMessage') }]} - > - + { + hideModal?.(); + }} /> - - - label={t('addyiyanAK')} - name="yiyan_ak" - rules={[{ required: true, message: t('yiyanAKMessage') }]} - > - - - - label={t('addyiyanSK')} - name="yiyan_sk" - rules={[{ required: true, message: t('yiyanSKMessage') }]} - > - - - - label={t('maxTokens')} - name="max_tokens" - rules={[ - { required: true, message: t('maxTokensMessage') }, - { - type: 'number', - message: t('maxTokensInvalidMessage'), - }, - ({}) => ({ - validator(_, value) { - if (value < 0) { - return Promise.reject(new Error(t('maxTokensMinMessage'))); - } - return Promise.resolve(); - }, - }), - ]} - > - { + handleOk(values); + }} /> - - +
+
); }; From 4cd45264921e06cc3bb9adc46cfecd67e524d171 Mon Sep 17 00:00:00 2001 From: Yongteng Lei Date: Mon, 5 Jan 2026 09:55:43 +0800 Subject: [PATCH 032/335] Feat: PDF vision figure parser supports reading context (#12416) ### What problem does this PR solve? PDF vision figure parser supports reading context. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- deepdoc/parser/figure_parser.py | 49 +++++++++-- rag/app/manual.py | 7 +- rag/app/naive.py | 9 +- rag/app/paper.py | 8 +- rag/nlp/__init__.py | 65 +++++++++++---- rag/prompts/generator.py | 6 ++ .../vision_llm_figure_describe_prompt.md | 82 +++++++++++++++---- ...llm_figure_describe_prompt_with_context.md | 82 +++++++++++++++++++ 8 files changed, 265 insertions(+), 43 deletions(-) create mode 100644 rag/prompts/vision_llm_figure_describe_prompt_with_context.md diff --git a/deepdoc/parser/figure_parser.py b/deepdoc/parser/figure_parser.py index 8dfcd02d2c5..86b05690cea 100644 --- a/deepdoc/parser/figure_parser.py +++ b/deepdoc/parser/figure_parser.py @@ -14,6 +14,7 @@ # limitations under the License. # from concurrent.futures import ThreadPoolExecutor, as_completed +import logging from PIL import Image @@ -21,7 +22,8 @@ from api.db.services.llm_service import LLMBundle from common.connection_utils import timeout from rag.app.picture import vision_llm_chunk as picture_vision_llm_chunk -from rag.prompts.generator import vision_llm_figure_describe_prompt +from rag.prompts.generator import vision_llm_figure_describe_prompt, vision_llm_figure_describe_prompt_with_context +from rag.nlp import append_context2table_image4pdf def vision_figure_parser_figure_data_wrapper(figures_data_without_positions): @@ -84,20 +86,36 @@ def vision_figure_parser_figure_xlsx_wrapper(images,callback=None, **kwargs): def vision_figure_parser_pdf_wrapper(tbls, callback=None, **kwargs): if not tbls: return [] + sections = kwargs.get("sections") + parser_config = kwargs.get("parser_config", {}) + context_size = max(0, int(parser_config.get("image_context_size", 0) or 0)) try: vision_model = LLMBundle(kwargs["tenant_id"], LLMType.IMAGE2TEXT) callback(0.7, "Visual model detected. Attempting to enhance figure extraction...") except Exception: vision_model = None if vision_model: + def is_figure_item(item): - return ( - isinstance(item[0][0], Image.Image) and - isinstance(item[0][1], list) - ) + return isinstance(item[0][0], Image.Image) and isinstance(item[0][1], list) + figures_data = [item for item in tbls if is_figure_item(item)] + figure_contexts = [] + if sections and figures_data and context_size > 0: + figure_contexts = append_context2table_image4pdf( + sections, + figures_data, + context_size, + return_context=True, + ) try: - docx_vision_parser = VisionFigureParser(vision_model=vision_model, figures_data=figures_data, **kwargs) + docx_vision_parser = VisionFigureParser( + vision_model=vision_model, + figures_data=figures_data, + figure_contexts=figure_contexts, + context_size=context_size, + **kwargs, + ) boosted_figures = docx_vision_parser(callback=callback) tbls = [item for item in tbls if not is_figure_item(item)] tbls.extend(boosted_figures) @@ -112,6 +130,8 @@ def is_figure_item(item): class VisionFigureParser: def __init__(self, vision_model, figures_data, *args, **kwargs): self.vision_model = vision_model + self.figure_contexts = kwargs.get("figure_contexts") or [] + self.context_size = max(0, int(kwargs.get("context_size", 0) or 0)) self._extract_figures_info(figures_data) assert len(self.figures) == len(self.descriptions) assert not self.positions or (len(self.figures) == len(self.positions)) @@ -156,10 +176,25 @@ def __call__(self, **kwargs): @timeout(30, 3) def process(figure_idx, figure_binary): + context_above = "" + context_below = "" + if figure_idx < len(self.figure_contexts): + context_above, context_below = self.figure_contexts[figure_idx] + if context_above or context_below: + prompt = vision_llm_figure_describe_prompt_with_context( + context_above=context_above, + context_below=context_below, + ) + logging.info(f"[VisionFigureParser] figure={figure_idx} context_size={self.context_size} context_above_len={len(context_above)} context_below_len={len(context_below)} prompt=with_context") + logging.info(f"[VisionFigureParser] figure={figure_idx} context_above_snippet={context_above[:512]}") + logging.info(f"[VisionFigureParser] figure={figure_idx} context_below_snippet={context_below[:512]}") + else: + prompt = vision_llm_figure_describe_prompt() + logging.info(f"[VisionFigureParser] figure={figure_idx} context_size={self.context_size} context_len=0 prompt=default") description_text = picture_vision_llm_chunk( binary=figure_binary, vision_model=self.vision_model, - prompt=vision_llm_figure_describe_prompt(), + prompt=prompt, callback=callback, ) return figure_idx, description_text diff --git a/rag/app/manual.py b/rag/app/manual.py index 0c85e89496c..8a39bffecea 100644 --- a/rag/app/manual.py +++ b/rag/app/manual.py @@ -314,7 +314,12 @@ def tag(pn, left, right, top, bottom): tk_cnt = num_tokens_from_string(txt) if sec_id > -1: last_sid = sec_id - tbls = vision_figure_parser_pdf_wrapper(tbls=tbls, callback=callback, **kwargs) + tbls = vision_figure_parser_pdf_wrapper( + tbls=tbls, + sections=sections, + callback=callback, + **kwargs, + ) res = tokenize_table(tbls, doc, eng) res.extend(tokenize_chunks(chunks, doc, eng, pdf_parser)) table_ctx = max(0, int(parser_config.get("table_context_size", 0) or 0)) diff --git a/rag/app/naive.py b/rag/app/naive.py index 7aa8c8c7630..c2e028b3417 100644 --- a/rag/app/naive.py +++ b/rag/app/naive.py @@ -55,9 +55,12 @@ def by_deepdoc(filename, binary=None, from_page=0, to_page=100000, lang="Chinese callback=callback ) - tables = vision_figure_parser_pdf_wrapper(tbls=tables, - callback=callback, - **kwargs) + tables = vision_figure_parser_pdf_wrapper( + tbls=tables, + sections=sections, + callback=callback, + **kwargs, + ) return sections, tables, pdf_parser diff --git a/rag/app/paper.py b/rag/app/paper.py index 4317c7a1d7d..b34e7d95ed2 100644 --- a/rag/app/paper.py +++ b/rag/app/paper.py @@ -166,6 +166,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, pdf_parser = Pdf() paper = pdf_parser(filename if not binary else binary, from_page=from_page, to_page=to_page, callback=callback) + sections = paper.get("sections", []) else: kwargs.pop("parse_method", None) kwargs.pop("mineru_llm_name", None) @@ -192,7 +193,12 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, } tbls = paper["tables"] - tbls = vision_figure_parser_pdf_wrapper(tbls=tbls, callback=callback, **kwargs) + tbls = vision_figure_parser_pdf_wrapper( + tbls=tbls, + sections=sections, + callback=callback, + **kwargs, + ) paper["tables"] = tbls else: raise NotImplementedError("file type not supported yet(pdf supported)") diff --git a/rag/nlp/__init__.py b/rag/nlp/__init__.py index 9c613e8ced8..b41bf7ead30 100644 --- a/rag/nlp/__init__.py +++ b/rag/nlp/__init__.py @@ -667,17 +667,42 @@ def extract_position(ck): return chunks -def append_context2table_image4pdf(sections: list, tabls: list, table_context_size=0): +def append_context2table_image4pdf(sections: list, tabls: list, table_context_size=0, return_context=False): from deepdoc.parser import PdfParser if table_context_size <=0: - return tabls + return [] if return_context else tabls page_bucket = defaultdict(list) - for i, (txt, poss) in enumerate(sections): - poss = PdfParser.extract_positions(poss) + for i, item in enumerate(sections): + if isinstance(item, (tuple, list)): + if len(item) > 2: + txt, _sec_id, poss = item[0], item[1], item[2] + else: + txt = item[0] if item else "" + poss = item[1] if len(item) > 1 else "" + else: + txt = item + poss = "" + # Normal: (text, "@@...##") from naive parser -> poss is a position tag string. + # Manual: (text, sec_id, poss_list) -> poss is a list of (page, left, right, top, bottom). + # Paper: (text_with_@@tag, layoutno) -> poss is layoutno; parse from txt when it contains @@ tags. + if isinstance(poss, list): + poss = poss + elif isinstance(poss, str): + if "@@" not in poss and isinstance(txt, str) and "@@" in txt: + poss = txt + poss = PdfParser.extract_positions(poss) + else: + if isinstance(txt, str) and "@@" in txt: + poss = PdfParser.extract_positions(txt) + else: + poss = [] + if isinstance(txt, str) and "@@" in txt: + txt = re.sub(r"@@[0-9-]+\t[0-9.\t]+##", "", txt).strip() for page, left, right, top, bottom in poss: - page = page[0] - page_bucket[page].append(((left, top, right, bottom), txt)) + if isinstance(page, list): + page = page[0] if page else 0 + page_bucket[page].append(((left, right, top, bottom), txt)) def upper_context(page, i): txt = "" @@ -720,9 +745,10 @@ def lower_context(page, i): return txt res = [] + contexts = [] for (img, tb), poss in tabls: - page, left, top, right, bott = poss[0] - _page, _left, _top, _right, _bott = poss[-1] + page, left, right, top, bott = poss[0] + _page, _left, _right, _top, _bott = poss[-1] if isinstance(tb, list): tb = "\n".join(tb) @@ -736,23 +762,34 @@ def lower_context(page, i): i = 0 blks = page_bucket.get(page, []) continue - tb = upper_context(page, i) + tb + lower_context(page+1, 0) + upper = upper_context(page, i) + lower = lower_context(page + 1, 0) + tb = upper + tb + lower + contexts.append((upper.strip(), lower.strip())) break - (_, t, r, b), txt = blks[i] + (_, _, t, b), txt = blks[i] if b > top: break - (_, _t, _r, _b), _txt = blks[i+1] + (_, _, _t, _b), _txt = blks[i+1] if _t < _bott: i += 1 continue - tb = upper_context(page, i) + tb + lower_context(page, i) + upper = upper_context(page, i) + lower = lower_context(page, i) + tb = upper + tb + lower + contexts.append((upper.strip(), lower.strip())) break if _tb == tb: - tb = upper_context(page, -1) + tb + lower_context(page+1, 0) + upper = upper_context(page, -1) + lower = lower_context(page + 1, 0) + tb = upper + tb + lower + contexts.append((upper.strip(), lower.strip())) + if len(contexts) < len(res) + 1: + contexts.append(("", "")) res.append(((img, tb), poss)) - return res + return contexts if return_context else res def add_positions(d, poss): diff --git a/rag/prompts/generator.py b/rag/prompts/generator.py index b429960eb36..7c071466317 100644 --- a/rag/prompts/generator.py +++ b/rag/prompts/generator.py @@ -158,6 +158,7 @@ def memory_prompt(message_list, max_tokens): QUESTION_PROMPT_TEMPLATE = load_prompt("question_prompt") VISION_LLM_DESCRIBE_PROMPT = load_prompt("vision_llm_describe_prompt") VISION_LLM_FIGURE_DESCRIBE_PROMPT = load_prompt("vision_llm_figure_describe_prompt") +VISION_LLM_FIGURE_DESCRIBE_PROMPT_WITH_CONTEXT = load_prompt("vision_llm_figure_describe_prompt_with_context") STRUCTURED_OUTPUT_PROMPT = load_prompt("structured_output_prompt") ANALYZE_TASK_SYSTEM = load_prompt("analyze_task_system") @@ -321,6 +322,11 @@ def vision_llm_figure_describe_prompt() -> str: return template.render() +def vision_llm_figure_describe_prompt_with_context(context_above: str, context_below: str) -> str: + template = PROMPT_JINJA_ENV.from_string(VISION_LLM_FIGURE_DESCRIBE_PROMPT_WITH_CONTEXT) + return template.render(context_above=context_above, context_below=context_below) + + def tool_schema(tools_description: list[dict], complete_task=False): if not tools_description: return "" diff --git a/rag/prompts/vision_llm_figure_describe_prompt.md b/rag/prompts/vision_llm_figure_describe_prompt.md index 7e528564145..db17b44efec 100644 --- a/rag/prompts/vision_llm_figure_describe_prompt.md +++ b/rag/prompts/vision_llm_figure_describe_prompt.md @@ -1,24 +1,72 @@ ## ROLE + You are an expert visual data analyst. ## GOAL -Analyze the image and provide a comprehensive description of its content. Focus on identifying the type of visual data representation (e.g., bar chart, pie chart, line graph, table, flowchart), its structure, and any text captions or labels included in the image. + +Analyze the image and produce a textual representation strictly based on what is visible in the image. + +## DECISION RULE (CRITICAL) + +First, determine whether the image contains an explicit visual data representation with enumerable data units forming a coherent dataset. + +Enumerable data units are clearly separable, repeatable elements intended for comparison, measurement, or aggregation, such as: + +- rows or columns in a table +- individual bars in a bar chart +- identifiable data points or series in a line graph +- labeled segments in a pie chart + +The mere presence of numbers, icons, UI elements, or labels does NOT qualify unless they together form such a dataset. ## TASKS -1. Describe the overall structure of the visual representation. Specify if it is a chart, graph, table, or diagram. -2. Identify and extract any axes, legends, titles, or labels present in the image. Provide the exact text where available. -3. Extract the data points from the visual elements (e.g., bar heights, line graph coordinates, pie chart segments, table rows and columns). -4. Analyze and explain any trends, comparisons, or patterns shown in the data. -5. Capture any annotations, captions, or footnotes, and explain their relevance to the image. -6. Only include details that are explicitly present in the image. If an element (e.g., axis, legend, or caption) does not exist or is not visible, do not mention it. - -## OUTPUT FORMAT (Include only sections relevant to the image content) -- Visual Type: [Type] -- Title: [Title text, if available] -- Axes / Legends / Labels: [Details, if available] -- Data Points: [Extracted data] -- Trends / Insights: [Analysis and interpretation] -- Captions / Annotations: [Text and relevance, if available] - -> Ensure high accuracy, clarity, and completeness in your analysis, and include only the information present in the image. Avoid unnecessary statements about missing elements. +1. Inspect the image and determine which output mode applies based on the decision rule. +2. Follow the output rules strictly. +3. Include only content that is explicitly visible in the image. +4. Do not infer intent, functionality, process logic, or meaning beyond what is visually or textually shown. + +## OUTPUT RULES (STRICT) + +- Produce output in **exactly one** of the two modes defined below. +- Do NOT mention, label, or reference the modes in the output. +- Do NOT combine content from both modes. +- Do NOT explain or justify the choice of mode. +- Do NOT add any headings, titles, or commentary beyond what the mode requires. + +--- + +## MODE 1: STRUCTURED VISUAL DATA OUTPUT + +(Use only if the image contains enumerable data units forming a coherent dataset.) + +Output **only** the following fields, in list form. +Do NOT add free-form paragraphs or additional sections. + +- Visual Type: +- Title: +- Axes / Legends / Labels: +- Data Points: +- Captions / Annotations: + +--- + +## MODE 2: GENERAL FIGURE CONTENT + +(Use only if the image does NOT contain enumerable data units.) + +Write the content directly, starting from the first sentence. +Do NOT add any introductory labels, titles, headings, or prefixes. + +Requirements: + +- Describe visible regions and components in a stable order (e.g., top-to-bottom, left-to-right). +- Explicitly name interface elements or visual objects exactly as they appear (e.g., tabs, panels, buttons, icons, input fields). +- Transcribe all visible text verbatim; do not paraphrase, summarize, or reinterpret labels. +- Describe spatial grouping, containment, and alignment of elements. +- Do NOT interpret intent, behavior, workflows, gameplay rules, or processes. +- Do NOT describe the figure as a chart, diagram, process, phase, or sequence unless such words explicitly appear in the image text. +- Avoid narrative or stylistic language unless it is a dominant and functional visual element. + +Use concise, information-dense sentences. +Do not use bullet lists or structured fields in this mode. diff --git a/rag/prompts/vision_llm_figure_describe_prompt_with_context.md b/rag/prompts/vision_llm_figure_describe_prompt_with_context.md new file mode 100644 index 00000000000..6843f7e7ef7 --- /dev/null +++ b/rag/prompts/vision_llm_figure_describe_prompt_with_context.md @@ -0,0 +1,82 @@ +## ROLE + +You are an expert visual data analyst. + +## GOAL + +Analyze the image and produce a textual representation strictly based on what is visible in the image. +Surrounding context may be used only for minimal clarification or disambiguation of terms that appear in the image, not as a source of new information. + +## CONTEXT (ABOVE) + +{{ context_above }} + +## CONTEXT (BELOW) + +{{ context_below }} + +## DECISION RULE (CRITICAL) + +First, determine whether the image contains an explicit visual data representation with enumerable data units forming a coherent dataset. + +Enumerable data units are clearly separable, repeatable elements intended for comparison, measurement, or aggregation, such as: + +- rows or columns in a table +- individual bars in a bar chart +- identifiable data points or series in a line graph +- labeled segments in a pie chart + +The mere presence of numbers, icons, UI elements, or labels does NOT qualify unless they together form such a dataset. + +## TASKS + +1. Inspect the image and determine which output mode applies based on the decision rule. +2. Use surrounding context only to disambiguate terms that appear in the image. +3. Follow the output rules strictly. +4. Include only content that is explicitly visible in the image. +5. Do not infer intent, functionality, process logic, or meaning beyond what is visually or textually shown. + +## OUTPUT RULES (STRICT) + +- Produce output in **exactly one** of the two modes defined below. +- Do NOT mention, label, or reference the modes in the output. +- Do NOT combine content from both modes. +- Do NOT explain or justify the choice of mode. +- Do NOT add any headings, titles, or commentary beyond what the mode requires. + +--- + +## MODE 1: STRUCTURED VISUAL DATA OUTPUT + +(Use only if the image contains enumerable data units forming a coherent dataset.) + +Output **only** the following fields, in list form. +Do NOT add free-form paragraphs or additional sections. + +- Visual Type: +- Title: +- Axes / Legends / Labels: +- Data Points: +- Captions / Annotations: + +--- + +## MODE 2: GENERAL FIGURE CONTENT + +(Use only if the image does NOT contain enumerable data units.) + +Write the content directly, starting from the first sentence. +Do NOT add any introductory labels, titles, headings, or prefixes. + +Requirements: + +- Describe visible regions and components in a stable order (e.g., top-to-bottom, left-to-right). +- Explicitly name interface elements or visual objects exactly as they appear (e.g., tabs, panels, buttons, icons, input fields). +- Transcribe all visible text verbatim; do not paraphrase, summarize, or reinterpret labels. +- Describe spatial grouping, containment, and alignment of elements. +- Do NOT interpret intent, behavior, workflows, gameplay rules, or processes. +- Do NOT describe the figure as a chart, diagram, process, phase, or sequence unless such words explicitly appear in the image text. +- Avoid narrative or stylistic language unless it is a dominant and functional visual element. + +Use concise, information-dense sentences. +Do not use bullet lists or structured fields in this mode. From 606f4e6c9e2792781f5712176927b575bedefc6a Mon Sep 17 00:00:00 2001 From: Liu An Date: Mon, 5 Jan 2026 10:02:42 +0800 Subject: [PATCH 033/335] Refa: improve TOC building with better error handling (#12427) ### What problem does this PR solve? Refactor TOC building logic to use enumerate instead of while loop, add comprehensive error handling for missing/invalid chunk_id values, and improve logging with more specific error messages. The changes make the code more robust against malformed TOC data while maintaining the same functionality for valid inputs. ### Type of change - [x] Refactoring --- rag/svr/task_executor.py | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/rag/svr/task_executor.py b/rag/svr/task_executor.py index 6dc2f929e8b..360d1c9596d 100644 --- a/rag/svr/task_executor.py +++ b/rag/svr/task_executor.py @@ -512,19 +512,29 @@ def build_TOC(task, docs, progress_callback): toc: list[dict] = asyncio.run( run_toc_from_text([d["content_with_weight"] for d in docs], chat_mdl, progress_callback)) logging.info("------------ T O C -------------\n" + json.dumps(toc, ensure_ascii=False, indent=' ')) - ii = 0 - while ii < len(toc): + for ii, item in enumerate(toc): try: - idx = int(toc[ii]["chunk_id"]) - del toc[ii]["chunk_id"] - toc[ii]["ids"] = [docs[idx]["id"]] - if ii == len(toc) - 1: - break - for jj in range(idx + 1, int(toc[ii + 1]["chunk_id"]) + 1): - toc[ii]["ids"].append(docs[jj]["id"]) + chunk_val = item.pop("chunk_id", None) + if chunk_val is None or str(chunk_val).strip() == "": + logging.warning(f"Index {ii}: chunk_id is missing or empty. Skipping.") + continue + curr_idx = int(chunk_val) + if curr_idx >= len(docs): + logging.error(f"Index {ii}: chunk_id {curr_idx} exceeds docs length {len(docs)}.") + continue + item["ids"] = [docs[curr_idx]["id"]] + if ii + 1 < len(toc): + next_chunk_val = toc[ii + 1].get("chunk_id", "") + if str(next_chunk_val).strip() != "": + next_idx = int(next_chunk_val) + for jj in range(curr_idx + 1, min(next_idx + 1, len(docs))): + item["ids"].append(docs[jj]["id"]) + else: + logging.warning(f"Index {ii + 1}: next chunk_id is empty, range fill skipped.") + except (ValueError, TypeError) as e: + logging.error(f"Index {ii}: Data conversion error - {e}") except Exception as e: - logging.exception(e) - ii += 1 + logging.exception(f"Index {ii}: Unexpected error - {e}") if toc: d = copy.deepcopy(docs[-1]) From 81f9296d790e68400c6a70f4f309e196daf9a6d8 Mon Sep 17 00:00:00 2001 From: lif <1835304752@qq.com> Date: Mon, 5 Jan 2026 11:27:19 +0800 Subject: [PATCH 034/335] Fix: handle invalid img_id format in chunk update (#12422) ## Summary - Fix ValueError when updating chunk with invalid/empty `img_id` format - Add validation before splitting `img_id` by hyphen - Use `split("-", 1)` to handle object names containing hyphens ## Test plan - [x] Verify chunk update works with valid `img_id` (format: `bucket-objectname`) - [x] Verify chunk update doesn't crash with empty `img_id` - [x] Verify chunk update doesn't crash when `img_id` has no hyphen - [x] Verify ruff check passes Fixes #12035 Signed-off-by: majiayu000 <1835304752@qq.com> --- api/apps/chunk_app.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/apps/chunk_app.py b/api/apps/chunk_app.py index 00580b95893..d902fa2612d 100644 --- a/api/apps/chunk_app.py +++ b/api/apps/chunk_app.py @@ -178,8 +178,9 @@ def _set_sync(): # update image image_base64 = req.get("image_base64", None) - if image_base64: - bkt, name = req.get("img_id", "-").split("-") + img_id = req.get("img_id", "") + if image_base64 and img_id and "-" in img_id: + bkt, name = img_id.split("-", 1) image_binary = base64.b64decode(image_base64) settings.STORAGE_IMPL.put(bkt, name, image_binary) return get_json_result(data=True) From 92780c486a950d0932cb3e3f7d7cf81da2cc85dc Mon Sep 17 00:00:00 2001 From: Jin Hai Date: Mon, 5 Jan 2026 13:26:22 +0800 Subject: [PATCH 035/335] Add list configs and environments (#12438) ### What problem does this PR solve? 1. list configs; 3. list envs; ``` admin> list configs; +-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+ | extra | host | id | name | port | service_type | +-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+ | {} | 0.0.0.0 | 0 | ragflow_0 | 9380 | ragflow_server | | {'meta_type': 'mysql', 'password': 'infini_rag_flow', 'username': 'root'} | localhost | 1 | mysql | 5455 | meta_data | | {'password': 'infini_rag_flow', 'store_type': 'minio', 'user': 'rag_flow'} | localhost | 2 | minio | 9000 | file_store | | {'password': 'infini_rag_flow', 'retrieval_type': 'elasticsearch', 'username': 'elastic'} | localhost | 3 | elasticsearch | 1200 | retrieval | | {'db_name': 'default_db', 'retrieval_type': 'infinity'} | localhost | 4 | infinity | 23817 | retrieval | | {'database': 1, 'mq_type': 'redis', 'password': 'infini_rag_flow'} | localhost | 5 | redis | 6379 | message_queue | | {'message_queue_type': 'redis'} | | 6 | task_executor | 0 | task_executor | +-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+ admin> list envs; +-------------------------+------------------+ | env | value | +-------------------------+------------------+ | DOC_ENGINE | elasticsearch | | DEFAULT_SUPERUSER_EMAIL | admin@ragflow.io | | DB_TYPE | mysql | | DEVICE | cpu | | STORAGE_IMPL | MINIO | +-------------------------+------------------+ admin> ``` ### Type of change - [x] New Feature (non-breaking change which adds functionality) Signed-off-by: Jin Hai --- admin/client/admin_client.py | 34 ++++++++++++++++++++++++++++++++++ admin/server/routes.py | 26 +++++++++++++++++++++++++- admin/server/services.py | 36 ++++++++++++++++++++++++++++++++++-- 3 files changed, 93 insertions(+), 3 deletions(-) diff --git a/admin/client/admin_client.py b/admin/client/admin_client.py index 10078350529..174cd5857a0 100644 --- a/admin/client/admin_client.py +++ b/admin/client/admin_client.py @@ -58,6 +58,8 @@ | set_variable | show_variable | list_variables + | list_configs + | list_environments // meta command definition meta_command: "\\" meta_command_name [meta_args] @@ -103,6 +105,8 @@ VERSION: "VERSION"i VAR: "VAR"i VARS: "VARS"i +CONFIGS: "CONFIGS"i +ENVS: "ENVS"i list_services: LIST SERVICES ";" show_service: SHOW SERVICE NUMBER ";" @@ -137,6 +141,8 @@ set_variable: SET VAR identifier identifier ";" show_variable: SHOW VAR identifier ";" list_variables: LIST VARS ";" +list_configs: LIST CONFIGS ";" +list_environments: LIST ENVS ";" show_version: SHOW VERSION ";" @@ -284,6 +290,12 @@ def show_variable(self, items): def list_variables(self, items): return {"type": "list_variables"} + def list_configs(self, items): + return {"type": "list_configs"} + + def list_environments(self, items): + return {"type": "list_environments"} + def action_list(self, items): return items @@ -648,6 +660,10 @@ def execute_command(self, parsed_command: Dict[str, Any]): self._show_variable(command_dict) case "list_variables": self._list_variables(command_dict) + case "list_configs": + self._list_configs(command_dict) + case "list_environments": + self._list_environments(command_dict) case "meta": self._handle_meta_command(command_dict) case _: @@ -840,6 +856,24 @@ def _list_variables(self, command): else: print(f"Fail to list variables, code: {res_json['code']}, message: {res_json['message']}") + def _list_configs(self, command): + url = f"http://{self.host}:{self.port}/api/v1/admin/configs" + response = self.session.get(url) + res_json = response.json() + if response.status_code == 200: + self._print_table_simple(res_json["data"]) + else: + print(f"Fail to list variables, code: {res_json['code']}, message: {res_json['message']}") + + def _list_environments(self, command): + url = f"http://{self.host}:{self.port}/api/v1/admin/environments" + response = self.session.get(url) + res_json = response.json() + if response.status_code == 200: + self._print_table_simple(res_json["data"]) + else: + print(f"Fail to list variables, code: {res_json['code']}, message: {res_json['message']}") + def _handle_list_datasets(self, command): username_tree: Tree = command["user_name"] user_name: str = username_tree.children[0].strip("'\"") diff --git a/admin/server/routes.py b/admin/server/routes.py index fcf75e485dd..ec63dbfe193 100644 --- a/admin/server/routes.py +++ b/admin/server/routes.py @@ -21,7 +21,7 @@ from auth import login_verify, login_admin, check_admin_auth from responses import success_response, error_response -from services import UserMgr, ServiceMgr, UserServiceMgr, SettingsMgr +from services import UserMgr, ServiceMgr, UserServiceMgr, SettingsMgr, ConfigMgr, EnvironmentsMgr from roles import RoleMgr from api.common.exceptions import AdminException from common.versions import get_ragflow_version @@ -449,6 +449,30 @@ def get_variable(): except Exception as e: return error_response(str(e), 500) +@admin_bp.route('/configs', methods=['GET']) +@login_required +@check_admin_auth +def get_config(): + try: + res = list(ConfigMgr.get_all()) + return success_response(res) + except AdminException as e: + return error_response(str(e), 400) + except Exception as e: + return error_response(str(e), 500) + +@admin_bp.route('/environments', methods=['GET']) +@login_required +@check_admin_auth +def get_environments(): + try: + res = list(EnvironmentsMgr.get_all()) + return success_response(res) + except AdminException as e: + return error_response(str(e), 400) + except Exception as e: + return error_response(str(e), 500) + @admin_bp.route('/version', methods=['GET']) @login_required @check_admin_auth diff --git a/admin/server/services.py b/admin/server/services.py index fe23996fff3..a3e29a51c47 100644 --- a/admin/server/services.py +++ b/admin/server/services.py @@ -306,5 +306,37 @@ def update_by_name(name: str, value: str): elif len(settings) > 1: raise AdminException(f"Can't update more than 1 setting: {name}") else: - raise AdminException(f"No sett" - f"ing: {name}") \ No newline at end of file + raise AdminException(f"No setting: {name}") + +class ConfigMgr: + + @staticmethod + def get_all(): + result = [] + configs = SERVICE_CONFIGS.configs + for config in configs: + config_dict = config.to_dict() + result.append(config_dict) + return result + +class EnvironmentsMgr: + @staticmethod + def get_all(): + result = [] + + env_kv = {"env": "DOC_ENGINE", "value": os.getenv('DOC_ENGINE')} + result.append(env_kv) + + env_kv = {"env": "DEFAULT_SUPERUSER_EMAIL", "value": os.getenv("DEFAULT_SUPERUSER_EMAIL", "admin@ragflow.io")} + result.append(env_kv) + + env_kv = {"env": "DB_TYPE", "value": os.getenv("DB_TYPE", "mysql")} + result.append(env_kv) + + env_kv = {"env": "DEVICE", "value": os.getenv("DEVICE", "cpu")} + result.append(env_kv) + + env_kv = {"env": "STORAGE_IMPL", "value": os.getenv("STORAGE_IMPL", "MINIO")} + result.append(env_kv) + + return result From 42461bc378be9d823875bd929bbaef0e2e17d6a6 Mon Sep 17 00:00:00 2001 From: Jin Hai Date: Mon, 5 Jan 2026 13:26:33 +0800 Subject: [PATCH 036/335] Update admin doc (#12439) ### What problem does this PR solve? update for 'list configs' and 'list envs' ### Type of change - [x] Documentation Update Signed-off-by: Jin Hai --- docs/guides/admin/admin_cli.md | 49 ++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/docs/guides/admin/admin_cli.md b/docs/guides/admin/admin_cli.md index adc2cdfb16f..5a6cc3b0b66 100644 --- a/docs/guides/admin/admin_cli.md +++ b/docs/guides/admin/admin_cli.md @@ -118,7 +118,7 @@ Commands are case-insensitive and must be terminated with a semicolon(;). - [Example](#example-revoke-admin) `LIST VARS` -- List all system configurations and settings. +- List all system settings. - [Example](#example-list-vars) `SHOW VAR ` @@ -129,6 +129,14 @@ Commands are case-insensitive and must be terminated with a semicolon(;). - Set the value for a specified configuration item. - [Example](#example-set-var) +`LIST CONFIGS` +- List all system configurations. +- [Example](#example-list-configs) + +`LIST ENVS` +- List all system environments which can accessed by Admin service. +- [Example](#example-list-environments) + ### Meta-Commands - \? or \help @@ -400,7 +408,7 @@ Revoke successfully! -- List all system configurations and settings. +- List all system settings. ``` admin> list vars; @@ -443,6 +451,43 @@ Set variable successfully ``` + + +- List all system configurations. + +``` +admin> list configs; ++-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+ +| extra | host | id | name | port | service_type | ++-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+ +| {} | 0.0.0.0 | 0 | ragflow_0 | 9380 | ragflow_server | +| {'meta_type': 'mysql', 'password': 'infini_rag_flow', 'username': 'root'} | localhost | 1 | mysql | 5455 | meta_data | +| {'password': 'infini_rag_flow', 'store_type': 'minio', 'user': 'rag_flow'} | localhost | 2 | minio | 9000 | file_store | +| {'password': 'infini_rag_flow', 'retrieval_type': 'elasticsearch', 'username': 'elastic'} | localhost | 3 | elasticsearch | 1200 | retrieval | +| {'db_name': 'default_db', 'retrieval_type': 'infinity'} | localhost | 4 | infinity | 23817 | retrieval | +| {'database': 1, 'mq_type': 'redis', 'password': 'infini_rag_flow'} | localhost | 5 | redis | 6379 | message_queue | +| {'message_queue_type': 'redis'} | | 6 | task_executor | 0 | task_executor | ++-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+ +``` + + + +- List all system environments which can accessed by Admin service. + +``` +admin> list envs; ++-------------------------+------------------+ +| env | value | ++-------------------------+------------------+ +| DOC_ENGINE | elasticsearch | +| DEFAULT_SUPERUSER_EMAIL | admin@ragflow.io | +| DB_TYPE | mysql | +| DEVICE | cpu | +| STORAGE_IMPL | MINIO | ++-------------------------+------------------+ +``` + + - Show help information. From 4e9407b4ae1505c9a5548dc90a9b008c0fe02b96 Mon Sep 17 00:00:00 2001 From: balibabu Date: Mon, 5 Jan 2026 14:09:55 +0800 Subject: [PATCH 037/335] Refactor: Refactoring AzureOpenAIModal using shadcn. #10427 (#12436) ### What problem does this PR solve? Refactor: Refactoring AzureOpenAIModal using shadcn. #10427 ### Type of change - [x] Refactoring --- web/src/components/dynamic-form.tsx | 9 +- .../components/setting-title/index.tsx | 40 --- .../setting-locale/translation-table.tsx | 262 +++++++++++++++--- .../modal/azure-openai-modal/index.tsx | 261 +++++++++-------- 4 files changed, 348 insertions(+), 224 deletions(-) delete mode 100644 web/src/pages/user-setting/components/setting-title/index.tsx diff --git a/web/src/components/dynamic-form.tsx b/web/src/components/dynamic-form.tsx index 7bd4083fb51..6ef736a4029 100644 --- a/web/src/components/dynamic-form.tsx +++ b/web/src/components/dynamic-form.tsx @@ -187,20 +187,23 @@ export const generateSchema = (fields: FormFieldConfig[]): ZodSchema => { // Handle required fields if (field.required) { + const requiredMessage = + field.validation?.message || `${field.label} is required`; + if (field.type === FormFieldType.Checkbox) { fieldSchema = (fieldSchema as z.ZodBoolean).refine( (val) => val === true, { - message: `${field.label} is required`, + message: requiredMessage, }, ); } else if (field.type === FormFieldType.Tag) { fieldSchema = (fieldSchema as z.ZodArray).min(1, { - message: `${field.label} is required`, + message: requiredMessage, }); } else { fieldSchema = (fieldSchema as z.ZodString).min(1, { - message: `${field.label} is required`, + message: requiredMessage, }); } } diff --git a/web/src/pages/user-setting/components/setting-title/index.tsx b/web/src/pages/user-setting/components/setting-title/index.tsx deleted file mode 100644 index 3fd4f424a25..00000000000 --- a/web/src/pages/user-setting/components/setting-title/index.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { useTranslate } from '@/hooks/common-hooks'; -import { SettingOutlined } from '@ant-design/icons'; -import { Button, Flex, Typography } from 'antd'; - -const { Title, Paragraph } = Typography; - -interface IProps { - title: string; - description: string; - showRightButton?: boolean; - clickButton?: () => void; -} - -const SettingTitle = ({ - title, - description, - clickButton, - showRightButton = false, -}: IProps) => { - const { t } = useTranslate('setting'); - - return ( - -
- {title} - {description} -
- {showRightButton && ( - - )} -
- ); -}; - -export default SettingTitle; diff --git a/web/src/pages/user-setting/setting-locale/translation-table.tsx b/web/src/pages/user-setting/setting-locale/translation-table.tsx index b064b699b4a..923855b6abc 100644 --- a/web/src/pages/user-setting/setting-locale/translation-table.tsx +++ b/web/src/pages/user-setting/setting-locale/translation-table.tsx @@ -1,6 +1,14 @@ -import { Table } from 'antd'; -import type { ColumnsType } from 'antd/es/table'; -import React from 'react'; +import { RAGFlowPagination } from '@/components/ui/ragflow-pagination'; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from '@/components/ui/table'; +import { ArrowDown, ArrowUp, ArrowUpDown } from 'lucide-react'; +import { useMemo, useState } from 'react'; type TranslationTableRow = { key: string; @@ -12,56 +20,218 @@ interface TranslationTableProps { languages: string[]; } +type FilterType = 'all' | 'show_empty' | 'show_non_empty'; +type SortOrder = 'asc' | 'desc' | null; + +interface ColumnState { + key: string; + sortOrder: SortOrder; + filter: FilterType; +} + const TranslationTable: React.FC = ({ data, languages, }) => { - // Define columns dynamically based on languages - const columns: ColumnsType = [ - { - title: 'Key', - dataIndex: 'key', - key: 'key', - fixed: 'left', - width: 200, - sorter: (a, b) => a.key.localeCompare(b.key), // Sorting by key - }, - ...languages.map((lang) => ({ - title: lang, - dataIndex: lang, - key: lang, - sorter: (a: any, b: any) => a[lang].localeCompare(b[lang]), // Sorting by language - // Example filter for each language - filters: [ - { - text: 'Show Empty', - value: 'show_empty', - }, - { - text: 'Show Non-Empty', - value: 'show_non_empty', - }, - ], - onFilter: (value: any, record: any) => { - if (value === 'show_empty') { - return !record[lang]; // Show rows with empty translations - } - if (value === 'show_non_empty') { - return record[lang] && record[lang].length > 0; // Show rows with non-empty translations + const [columnStates, setColumnStates] = useState( + [{ key: 'key', sortOrder: null, filter: 'all' as FilterType }].concat( + languages.map((lang) => ({ + key: lang, + sortOrder: null, + filter: 'all' as FilterType, + })), + ), + ); + + const [currentPage, setCurrentPage] = useState(1); + const [pageSize, setPageSize] = useState(10); + + // Get the active sort column + const activeSortColumn = useMemo(() => { + return columnStates.find((col) => col.sortOrder !== null); + }, [columnStates]); + + // Apply sorting and filtering + const processedData = useMemo(() => { + let filtered = [...data]; + + // Apply filters for all columns + columnStates.forEach((colState) => { + if (colState.filter !== 'all') { + filtered = filtered.filter((record) => { + const value = record[colState.key]; + if (colState.filter === 'show_empty') { + return !value || value.length === 0; + } + if (colState.filter === 'show_non_empty') { + return value && value.length > 0; + } + return true; + }); + } + }); + + // Apply sorting + if (activeSortColumn && activeSortColumn.sortOrder) { + filtered.sort((a, b) => { + const aValue = a[activeSortColumn.key] || ''; + const bValue = b[activeSortColumn.key] || ''; + const comparison = String(aValue).localeCompare(String(bValue)); + return activeSortColumn.sortOrder === 'asc' ? comparison : -comparison; + }); + } + + return filtered; + }, [data, columnStates, activeSortColumn]); + + // Apply pagination + const paginatedData = useMemo(() => { + const start = (currentPage - 1) * pageSize; + const end = start + pageSize; + return processedData.slice(start, end); + }, [processedData, currentPage, pageSize]); + + const handleSort = (columnKey: string) => { + setColumnStates((prev) => + prev.map((col) => { + if (col.key === columnKey) { + let newOrder: SortOrder = 'asc'; + if (col.sortOrder === 'asc') { + newOrder = 'desc'; + } else if (col.sortOrder === 'desc') { + newOrder = null; + } + return { ...col, sortOrder: newOrder }; } - return true; - }, - })), - ]; + return { ...col, sortOrder: null }; + }), + ); + }; + + const handleFilter = (columnKey: string, filter: FilterType) => { + setColumnStates((prev) => + prev.map((col) => (col.key === columnKey ? { ...col, filter } : col)), + ); + setCurrentPage(1); + }; + + const renderSortIcon = (columnKey: string) => { + const colState = columnStates.find((col) => col.key === columnKey); + const sortOrder = colState?.sortOrder; + + if (sortOrder === 'asc') { + return ; + } else if (sortOrder === 'desc') { + return ; + } else { + return ; + } + }; + + const handlePageChange = (page: number, size: number) => { + setCurrentPage(page); + setPageSize(size); + }; return ( - +
+
+
+ + + handleSort('key')} + > +
+ Key + {renderSortIcon('key')} +
+
+ {languages.map((lang) => { + const colState = columnStates.find((col) => col.key === lang)!; + return ( + +
+
handleSort(lang)} + > + {lang} + {renderSortIcon(lang)} +
+
+ + + +
+
+
+ ); + })} +
+
+ + {paginatedData.length > 0 ? ( + paginatedData.map((record) => ( + + + {record.key} + + {languages.map((lang) => ( + + {record[lang] || ''} + + ))} + + )) + ) : ( + + + No data + + + )} + +
+ + + ); }; diff --git a/web/src/pages/user-setting/setting-model/modal/azure-openai-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/azure-openai-modal/index.tsx index 1bc44695f28..f08770e07d6 100644 --- a/web/src/pages/user-setting/setting-model/modal/azure-openai-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/azure-openai-modal/index.tsx @@ -1,17 +1,15 @@ -import { useTranslate } from '@/hooks/common-hooks'; +import { + DynamicForm, + FormFieldConfig, + FormFieldType, +} from '@/components/dynamic-form'; +import { Modal } from '@/components/ui/modal/modal'; +import { useCommonTranslation, useTranslate } from '@/hooks/common-hooks'; import { IModalProps } from '@/interfaces/common'; import { IAddLlmRequestBody } from '@/interfaces/request/llm'; -import { Form, Input, InputNumber, Modal, Select, Switch } from 'antd'; -import omit from 'lodash/omit'; +import { FieldValues } from 'react-hook-form'; import { LLMHeader } from '../../components/llm-header'; -type FieldType = IAddLlmRequestBody & { - api_version: string; - vision: boolean; -}; - -const { Option } = Select; - const AzureOpenAIModal = ({ visible, hideModal, @@ -19,150 +17,143 @@ const AzureOpenAIModal = ({ loading, llmFactory, }: IModalProps & { llmFactory: string }) => { - const [form] = Form.useForm(); - const { t } = useTranslate('setting'); + const { t: tg } = useCommonTranslation(); + + const fields: FormFieldConfig[] = [ + { + name: 'model_type', + label: t('modelType'), + type: FormFieldType.Select, + required: true, + options: [ + { label: 'chat', value: 'chat' }, + { label: 'embedding', value: 'embedding' }, + { label: 'image2text', value: 'image2text' }, + ], + defaultValue: 'embedding', + validation: { + message: t('modelTypeMessage'), + }, + }, + { + name: 'api_base', + label: t('addLlmBaseUrl'), + type: FormFieldType.Text, + required: true, + placeholder: t('baseUrlNameMessage'), + validation: { + message: t('baseUrlNameMessage'), + }, + }, + { + name: 'api_key', + label: t('apiKey'), + type: FormFieldType.Text, + required: false, + placeholder: t('apiKeyMessage'), + }, + { + name: 'llm_name', + label: t('modelName'), + type: FormFieldType.Text, + required: true, + placeholder: t('modelNameMessage'), + defaultValue: 'gpt-3.5-turbo', + validation: { + message: t('modelNameMessage'), + }, + }, + { + name: 'api_version', + label: t('apiVersion'), + type: FormFieldType.Text, + required: false, + placeholder: t('apiVersionMessage'), + defaultValue: '2024-02-01', + }, + { + name: 'max_tokens', + label: t('maxTokens'), + type: FormFieldType.Number, + required: true, + placeholder: t('maxTokensTip'), + validation: { + min: 0, + message: t('maxTokensMessage'), + }, + }, + { + name: 'vision', + label: t('vision'), + type: FormFieldType.Switch, + defaultValue: false, + dependencies: ['model_type'], + shouldRender: (formValues: any) => { + return formValues?.model_type === 'chat'; + }, + }, + ]; + + const handleOk = async (values?: FieldValues) => { + if (!values) return; - const handleOk = async () => { - const values = await form.validateFields(); const modelType = values.model_type === 'chat' && values.vision ? 'image2text' : values.model_type; - const data = { - ...omit(values, ['vision']), - model_type: modelType, + const data: IAddLlmRequestBody & { api_version?: string } = { llm_factory: llmFactory, - max_tokens: values.max_tokens, + llm_name: values.llm_name as string, + model_type: modelType, + api_base: values.api_base as string, + api_key: values.api_key as string | undefined, + max_tokens: values.max_tokens as number, + api_version: values.api_version as string, }; - console.info(data); - onOk?.(data); - }; - const optionsMap = { - Default: [ - { value: 'chat', label: 'chat' }, - { value: 'embedding', label: 'embedding' }, - { value: 'image2text', label: 'image2text' }, - ], - }; - const getOptions = () => { - return optionsMap.Default; - }; - const handleKeyDown = async (e: React.KeyboardEvent) => { - if (e.key === 'Enter') { - await handleOk(); - } + await onOk?.(data); }; return ( } - open={visible} - onOk={handleOk} - onCancel={hideModal} - okButtonProps={{ loading }} + open={visible || false} + onOpenChange={(open) => !open && hideModal?.()} + maskClosable={false} + footer={
} > -
{ + console.log(data); + }} + defaultValues={ + { + model_type: 'embedding', + llm_name: 'gpt-3.5-turbo', + api_version: '2024-02-01', + vision: false, + } as FieldValues + } + labelClassName="font-normal" > - - label={t('modelType')} - name="model_type" - initialValue={'embedding'} - rules={[{ required: true, message: t('modelTypeMessage') }]} - > - - - - label={t('addLlmBaseUrl')} - name="api_base" - rules={[{ required: true, message: t('baseUrlNameMessage') }]} - > - + { + hideModal?.(); + }} /> - - - label={t('apiKey')} - name="api_key" - rules={[{ required: false, message: t('apiKeyMessage') }]} - > - - - - label={t('modelName')} - name="llm_name" - initialValue="gpt-3.5-turbo" - rules={[{ required: true, message: t('modelNameMessage') }]} - > - { + handleOk(values); + }} /> - - - label={t('apiVersion')} - name="api_version" - initialValue="2024-02-01" - rules={[{ required: false, message: t('apiVersionMessage') }]} - > - - - - label={t('maxTokens')} - name="max_tokens" - rules={[ - { required: true, message: t('maxTokensMessage') }, - { - type: 'number', - message: t('maxTokensInvalidMessage'), - }, - ({}) => ({ - validator(_, value) { - if (value < 0) { - return Promise.reject(new Error(t('maxTokensMinMessage'))); - } - return Promise.resolve(); - }, - }), - ]} - > - - - - - {({ getFieldValue }) => - getFieldValue('model_type') === 'chat' && ( - - - - ) - } - - + +
); }; From 00f8a80ca4d859999be0e48f3b99dc205a5d6319 Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Mon, 5 Jan 2026 15:28:57 +0800 Subject: [PATCH 038/335] Fix: Some bugs (#12441) ### What problem does this PR solve? Fix: Some bugs - In a production environment, a second-level page refresh results in a white screen. - The knowledge graph cannot be opened. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/.env.development | 2 +- web/.env.production | 2 +- web/package.json | 2 +- .../document-preview/document-header.tsx | 2 +- web/src/components/ui/breadcrumb.tsx | 2 +- .../components/chunk-card/index.tsx | 2 +- .../components/knowledge-chunk/index.tsx | 2 +- .../dataset/knowledge-graph/force-graph.tsx | 18 ++++++++++++++++-- web/src/pages/dataset/knowledge-graph/util.ts | 13 +++++++++++++ web/src/utils/authorization-util.ts | 4 ++-- web/vite.config.ts | 1 + 11 files changed, 39 insertions(+), 11 deletions(-) diff --git a/web/.env.development b/web/.env.development index e43abf9ad82..f33f3bef5c3 100644 --- a/web/.env.development +++ b/web/.env.development @@ -1 +1 @@ -VITE_BASE_URL='' \ No newline at end of file +VITE_BASE_URL='/' \ No newline at end of file diff --git a/web/.env.production b/web/.env.production index e43abf9ad82..f33f3bef5c3 100644 --- a/web/.env.production +++ b/web/.env.production @@ -1 +1 @@ -VITE_BASE_URL='' \ No newline at end of file +VITE_BASE_URL='/' \ No newline at end of file diff --git a/web/package.json b/web/package.json index 92a749743fd..f54f24fffd0 100644 --- a/web/package.json +++ b/web/package.json @@ -7,7 +7,7 @@ "scripts": { "build": "vite build --mode production", "build-storybook": "storybook build", - "dev": "vite", + "dev": "vite --host", "lint": "eslint src --ext .ts,.tsx --report-unused-disable-directives --max-warnings 0", "prepare": "cd .. && husky web/.husky", "preview": "vite preview", diff --git a/web/src/components/document-preview/document-header.tsx b/web/src/components/document-preview/document-header.tsx index 5ff971b3a36..f6656da86de 100644 --- a/web/src/components/document-preview/document-header.tsx +++ b/web/src/components/document-preview/document-header.tsx @@ -12,7 +12,7 @@ export default ({ size, name, create_date }: Props) => { const dateStr = formatDate(create_date); return (
-

{name}

+

{name}

Size:{sizeName} Uploaded Time:{dateStr}
diff --git a/web/src/components/ui/breadcrumb.tsx b/web/src/components/ui/breadcrumb.tsx index 3043a286e9c..3d2de4974a5 100644 --- a/web/src/components/ui/breadcrumb.tsx +++ b/web/src/components/ui/breadcrumb.tsx @@ -69,7 +69,7 @@ const BreadcrumbPage = React.forwardRef< role="link" aria-disabled="true" aria-current="page" - className={cn('font-normal text-foreground', className)} + className={cn('font-normal text-foreground truncate max-w-40', className)} {...props} /> )); diff --git a/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/components/chunk-card/index.tsx b/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/components/chunk-card/index.tsx index 9c2ccdc6471..32f7dd2ed1a 100644 --- a/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/components/chunk-card/index.tsx +++ b/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/components/chunk-card/index.tsx @@ -104,7 +104,7 @@ const ChunkCard = ({ diff --git a/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/index.tsx b/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/index.tsx index 034869e8a07..eff80deca12 100644 --- a/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/index.tsx +++ b/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/index.tsx @@ -232,7 +232,7 @@ const Chunk = () => {

{t('chunk.chunkResult')}

-
+
{t('chunk.chunkResultTip')}
diff --git a/web/src/pages/dataset/knowledge-graph/force-graph.tsx b/web/src/pages/dataset/knowledge-graph/force-graph.tsx index 31533d0dea8..d4776b22e4f 100644 --- a/web/src/pages/dataset/knowledge-graph/force-graph.tsx +++ b/web/src/pages/dataset/knowledge-graph/force-graph.tsx @@ -1,7 +1,7 @@ import { ElementDatum, Graph, IElementEvent } from '@antv/g6'; import isEmpty from 'lodash/isEmpty'; import { useCallback, useEffect, useMemo, useRef } from 'react'; -import { buildNodesAndCombos } from './util'; +import { buildNodesAndCombos, defaultComboLabel } from './util'; import { useIsDarkTheme } from '@/components/theme-provider'; import styles from './index.module.less'; @@ -27,7 +27,7 @@ const ForceGraph = ({ data, show }: IProps) => { const mi = buildNodesAndCombos(graphData.nodes); return { edges: graphData.edges, ...mi }; } - return { nodes: [], edges: [] }; + return { nodes: [], edges: [], combos: [] }; }, [data]); const render = useCallback(() => { @@ -113,6 +113,20 @@ const ForceGraph = ({ data, show }: IProps) => { }; }, }, + combo: { + style: (e) => { + if (e.label === defaultComboLabel) { + return { + stroke: 'rgba(0,0,0,0)', + fill: 'rgba(0,0,0,0)', + }; + } else { + return { + stroke: isDark ? 'rgba(255,255,255,0.5)' : 'rgba(0,0,0,0.5)', + }; + } + }, + }, }); if (graphRef.current) { diff --git a/web/src/pages/dataset/knowledge-graph/util.ts b/web/src/pages/dataset/knowledge-graph/util.ts index e0be797f2ed..72a3efb10c8 100644 --- a/web/src/pages/dataset/knowledge-graph/util.ts +++ b/web/src/pages/dataset/knowledge-graph/util.ts @@ -1,6 +1,7 @@ import { isEmpty } from 'lodash'; import { v4 as uuid } from 'uuid'; +export const defaultComboLabel = 'defaultCombo'; class KeyGenerator { idx = 0; chars: string[] = []; @@ -89,6 +90,18 @@ export const buildNodesAndCombos = (nodes: any[]) => { combo: combos.find((y) => y.data.label === findCombo(x?.communities))?.id, }; }); + if (!combos.length) { + const defaultComboId = uuid(); + const defaultCombo = { + id: defaultComboId, + label: 'defaultCombo', + data: { + label: 'defaultCombo', + }, + }; + + combos.push(defaultCombo); + } return { nodes: nextNodes, combos }; }; diff --git a/web/src/utils/authorization-util.ts b/web/src/utils/authorization-util.ts index d2cd5b0a44e..0c9118cd35c 100644 --- a/web/src/utils/authorization-util.ts +++ b/web/src/utils/authorization-util.ts @@ -59,6 +59,6 @@ export default storage; // Will not jump to the login page export function redirectToLogin() { - const env = import.meta.env; - window.location.href = location.origin + env.VITE_BASE_URL + `/login`; + // const env = import.meta.env; + window.location.href = location.origin + `/login`; } diff --git a/web/vite.config.ts b/web/vite.config.ts index ca63807cf29..92ac2bae23c 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -60,6 +60,7 @@ export default defineConfig(({ mode, command }) => { }, server: { port: 9222, + strictPort: false, proxy: { '/api/v1/admin': { target: 'http://127.0.0.1:9381/', From fada22324997b760cc1b65c7cf525191aa7c4451 Mon Sep 17 00:00:00 2001 From: Lynn Date: Mon, 5 Jan 2026 17:58:32 +0800 Subject: [PATCH 039/335] Feat: process memory (#12445) ### What problem does this PR solve? Add task status for raw message, and move extract message as a nested property under raw message ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- api/apps/memories_app.py | 9 +++ .../joint_services/memory_message_service.py | 61 ++++++++++++++----- api/db/services/task_service.py | 34 +++++++++++ memory/services/messages.py | 40 +++++++++--- 4 files changed, 119 insertions(+), 25 deletions(-) diff --git a/api/apps/memories_app.py b/api/apps/memories_app.py index 66fcabb4c99..72e3e5d72f6 100644 --- a/api/apps/memories_app.py +++ b/api/apps/memories_app.py @@ -21,6 +21,7 @@ from api.db.services.memory_service import MemoryService from api.db.services.user_service import UserTenantService from api.db.services.canvas_service import UserCanvasService +from api.db.services.task_service import TaskService from api.db.joint_services.memory_message_service import get_memory_size_cache, judge_system_prompt_is_default from api.utils.api_utils import validate_request, get_request_json, get_error_argument_result, get_json_result from api.utils.memory_utils import format_ret_data_from_memory, get_memory_type_human @@ -220,9 +221,17 @@ async def get_memory_detail(memory_id): messages = MessageService.list_message( memory.tenant_id, memory_id, agent_ids, keywords, page, page_size) agent_name_mapping = {} + extract_task_mapping = {} if messages["message_list"]: agent_list = UserCanvasService.get_basic_info_by_canvas_ids([message["agent_id"] for message in messages["message_list"]]) agent_name_mapping = {agent["id"]: agent["title"] for agent in agent_list} + task_list = TaskService.get_tasks_progress_by_doc_ids([memory_id]) + if task_list: + task_list.sort(key=lambda t: t["create_time"]) # asc, use newer when exist more than one task + for task in task_list: + # the 'digest' field carries the source_id when a task is created, so use 'digest' as key + extract_task_mapping.update({int(task["digest"]): task}) for message in messages["message_list"]: message["agent_name"] = agent_name_mapping.get(message["agent_id"], "Unknown") + message["task"] = extract_task_mapping.get(message["message_id"], {}) return get_json_result(data={"messages": messages, "storage_type": memory.storage_type}, message=True) diff --git a/api/db/joint_services/memory_message_service.py b/api/db/joint_services/memory_message_service.py index 79848cad5c3..490a16ac2e3 100644 --- a/api/db/joint_services/memory_message_service.py +++ b/api/db/joint_services/memory_message_service.py @@ -16,7 +16,6 @@ import logging from typing import List -from api.db.services.task_service import TaskService from common import settings from common.time_utils import current_timestamp, timestamp_to_date, format_iso_8601_to_ymd_hms from common.constants import MemoryType, LLMType @@ -24,6 +23,7 @@ from common.misc_utils import get_uuid from api.db.db_utils import bulk_insert_into_db from api.db.db_models import Task +from api.db.services.task_service import TaskService from api.db.services.memory_service import MemoryService from api.db.services.tenant_llm_service import TenantLLMService from api.db.services.llm_service import LLMBundle @@ -90,13 +90,19 @@ async def save_to_memory(memory_id: str, message_dict: dict): return await embed_and_save(memory, message_list) -async def save_extracted_to_memory_only(memory_id: str, message_dict, source_message_id: int): +async def save_extracted_to_memory_only(memory_id: str, message_dict, source_message_id: int, task_id: str=None): memory = MemoryService.get_by_memory_id(memory_id) if not memory: - return False, f"Memory '{memory_id}' not found." + msg = f"Memory '{memory_id}' not found." + if task_id: + TaskService.update_progress(task_id, {"progress": -1, "progress_msg": timestamp_to_date(current_timestamp())+ " " + msg}) + return False, msg if memory.memory_type == MemoryType.RAW.value: - return True, f"Memory '{memory_id}' don't need to extract." + msg = f"Memory '{memory_id}' don't need to extract." + if task_id: + TaskService.update_progress(task_id, {"progress": 1.0, "progress_msg": timestamp_to_date(current_timestamp())+ " " + msg}) + return True, msg tenant_id = memory.tenant_id extracted_content = await extract_by_llm( @@ -105,7 +111,8 @@ async def save_extracted_to_memory_only(memory_id: str, message_dict, source_mes {"temperature": memory.temperature}, get_memory_type_human(memory.memory_type), message_dict.get("user_input", ""), - message_dict.get("agent_response", "") + message_dict.get("agent_response", ""), + task_id=task_id ) message_list = [{ "message_id": REDIS_CONN.generate_auto_increment_id(namespace="memory"), @@ -122,13 +129,18 @@ async def save_extracted_to_memory_only(memory_id: str, message_dict, source_mes "status": True } for content in extracted_content] if not message_list: - return True, "No memory extracted from raw message." + msg = "No memory extracted from raw message." + if task_id: + TaskService.update_progress(task_id, {"progress": 1.0, "progress_msg": timestamp_to_date(current_timestamp())+ " " + msg}) + return True, msg - return await embed_and_save(memory, message_list) + if task_id: + TaskService.update_progress(task_id, {"progress": 0.5, "progress_msg": timestamp_to_date(current_timestamp())+ " " + f"Extracted {len(message_list)} messages from raw dialogue."}) + return await embed_and_save(memory, message_list, task_id) async def extract_by_llm(tenant_id: str, llm_id: str, extract_conf: dict, memory_type: List[str], user_input: str, - agent_response: str, system_prompt: str = "", user_prompt: str="") -> List[dict]: + agent_response: str, system_prompt: str = "", user_prompt: str="", task_id: str=None) -> List[dict]: llm_type = TenantLLMService.llm_id2llm_type(llm_id) if not llm_type: raise RuntimeError(f"Unknown type of LLM '{llm_id}'") @@ -143,8 +155,12 @@ async def extract_by_llm(tenant_id: str, llm_id: str, extract_conf: dict, memory else: user_prompts.append({"role": "user", "content": PromptAssembler.assemble_user_prompt(conversation_content, conversation_time, conversation_time)}) llm = LLMBundle(tenant_id, llm_type, llm_id) + if task_id: + TaskService.update_progress(task_id, {"progress": 0.15, "progress_msg": timestamp_to_date(current_timestamp())+ " " + "Prepared prompts and LLM."}) res = await llm.async_chat(system_prompt, user_prompts, extract_conf) res_json = get_json_result_from_llm_response(res) + if task_id: + TaskService.update_progress(task_id, {"progress": 0.35, "progress_msg": timestamp_to_date(current_timestamp())+ " " + "Get extracted result from LLM."}) return [{ "content": extracted_content["content"], "valid_at": format_iso_8601_to_ymd_hms(extracted_content["valid_at"]), @@ -153,16 +169,23 @@ async def extract_by_llm(tenant_id: str, llm_id: str, extract_conf: dict, memory } for message_type, extracted_content_list in res_json.items() for extracted_content in extracted_content_list] -async def embed_and_save(memory, message_list: list[dict]): +async def embed_and_save(memory, message_list: list[dict], task_id: str=None): embedding_model = LLMBundle(memory.tenant_id, llm_type=LLMType.EMBEDDING, llm_name=memory.embd_id) + if task_id: + TaskService.update_progress(task_id, {"progress": 0.65, "progress_msg": timestamp_to_date(current_timestamp())+ " " + "Prepared embedding model."}) vector_list, _ = embedding_model.encode([msg["content"] for msg in message_list]) for idx, msg in enumerate(message_list): msg["content_embed"] = vector_list[idx] + if task_id: + TaskService.update_progress(task_id, {"progress": 0.85, "progress_msg": timestamp_to_date(current_timestamp())+ " " + "Embedded extracted content."}) vector_dimension = len(vector_list[0]) if not MessageService.has_index(memory.tenant_id, memory.id): created = MessageService.create_index(memory.tenant_id, memory.id, vector_size=vector_dimension) if not created: - return False, "Failed to create message index." + error_msg = "Failed to create message index." + if task_id: + TaskService.update_progress(task_id, {"progress": -1, "progress_msg": timestamp_to_date(current_timestamp())+ " " + error_msg}) + return False, error_msg new_msg_size = sum([MessageService.calculate_message_size(m) for m in message_list]) current_memory_size = get_memory_size_cache(memory.tenant_id, memory.id) @@ -174,11 +197,19 @@ async def embed_and_save(memory, message_list: list[dict]): MessageService.delete_message({"message_id": message_ids_to_delete}, memory.tenant_id, memory.id) decrease_memory_size_cache(memory.id, delete_size) else: - return False, "Failed to insert message into memory. Memory size reached limit and cannot decide which to delete." + error_msg = "Failed to insert message into memory. Memory size reached limit and cannot decide which to delete." + if task_id: + TaskService.update_progress(task_id, {"progress": -1, "progress_msg": timestamp_to_date(current_timestamp())+ " " + error_msg}) + return False, error_msg fail_cases = MessageService.insert_message(message_list, memory.tenant_id, memory.id) if fail_cases: - return False, "Failed to insert message into memory. Details: " + "; ".join(fail_cases) + error_msg = "Failed to insert message into memory. Details: " + "; ".join(fail_cases) + if task_id: + TaskService.update_progress(task_id, {"progress": -1, "progress_msg": timestamp_to_date(current_timestamp())+ " " + error_msg}) + return False, error_msg + if task_id: + TaskService.update_progress(task_id, {"progress": 0.95, "progress_msg": timestamp_to_date(current_timestamp())+ " " + "Saved messages to storage."}) increase_memory_size_cache(memory.id, new_msg_size) return True, "Message saved successfully." @@ -379,11 +410,11 @@ async def handle_save_to_memory_task(task_param: dict): memory_id = task_param["memory_id"] source_id = task_param["source_id"] message_dict = task_param["message_dict"] - success, msg = await save_extracted_to_memory_only(memory_id, message_dict, source_id) + success, msg = await save_extracted_to_memory_only(memory_id, message_dict, source_id, task.id) if success: - TaskService.update_progress(task.id, {"progress": 1.0, "progress_msg": msg}) + TaskService.update_progress(task.id, {"progress": 1.0, "progress_msg": timestamp_to_date(current_timestamp())+ " " + msg}) return True, msg logging.error(msg) - TaskService.update_progress(task.id, {"progress": -1, "progress_msg": None}) + TaskService.update_progress(task.id, {"progress": -1, "progress_msg": timestamp_to_date(current_timestamp())+ " " + msg}) return False, msg diff --git a/api/db/services/task_service.py b/api/db/services/task_service.py index 065d2376dd7..028381b44f3 100644 --- a/api/db/services/task_service.py +++ b/api/db/services/task_service.py @@ -179,6 +179,40 @@ def get_tasks(cls, doc_id: str): return None return tasks + @classmethod + @DB.connection_context() + def get_tasks_progress_by_doc_ids(cls, doc_ids: list[str]): + """Retrieve all tasks associated with specific documents. + + This method fetches all processing tasks for given document ids, ordered by + creation time. It includes task progress and chunk information. + + Args: + doc_ids (str): The unique identifier of the document. + + Returns: + list[dict]: List of task dictionaries containing task details. + Returns None if no tasks are found. + """ + fields = [ + cls.model.id, + cls.model.doc_id, + cls.model.from_page, + cls.model.progress, + cls.model.progress_msg, + cls.model.digest, + cls.model.chunk_ids, + cls.model.create_time + ] + tasks = ( + cls.model.select(*fields).order_by(cls.model.create_time.desc()) + .where(cls.model.doc_id.in_(doc_ids)) + ) + tasks = list(tasks.dicts()) + if not tasks: + return None + return tasks + @classmethod @DB.connection_context() def update_chunk_ids(cls, id: str, chunk_ids: str): diff --git a/memory/services/messages.py b/memory/services/messages.py index 0b41754c868..fe855905c48 100644 --- a/memory/services/messages.py +++ b/memory/services/messages.py @@ -17,6 +17,7 @@ from typing import List from common import settings +from common.constants import MemoryType from common.doc_store.doc_store_base import OrderByExpr, MatchExpr @@ -69,15 +70,16 @@ def list_message(cls, uid: str, memory_id: str, agent_ids: List[str]=None, keywo filter_dict["agent_id"] = agent_ids if keywords: filter_dict["session_id"] = keywords + select_fields = [ + "message_id", "message_type", "source_id", "memory_id", "user_id", "agent_id", "session_id", "valid_at", + "invalid_at", "forget_at", "status" + ] order_by = OrderByExpr() order_by.desc("valid_at") res, total_count = settings.msgStoreConn.search( - select_fields=[ - "message_id", "message_type", "source_id", "memory_id", "user_id", "agent_id", "session_id", "valid_at", - "invalid_at", "forget_at", "status" - ], + select_fields=select_fields, highlight_fields=[], - condition=filter_dict, + condition={**filter_dict, "message_type": MemoryType.RAW.name.lower()}, match_expressions=[], order_by=order_by, offset=(page-1)*page_size, limit=page_size, index_names=index, memory_ids=[memory_id], agg_fields=[], hide_forgotten=False @@ -88,12 +90,30 @@ def list_message(cls, uid: str, memory_id: str, agent_ids: List[str]=None, keywo "total_count": 0 } - doc_mapping = settings.msgStoreConn.get_fields(res, [ - "message_id", "message_type", "source_id", "memory_id", "user_id", "agent_id", "session_id", - "valid_at", "invalid_at", "forget_at", "status" - ]) + raw_msg_mapping = settings.msgStoreConn.get_fields(res, select_fields) + raw_messages = list(raw_msg_mapping.values()) + extract_filter = {"source_id": [r["message_id"] for r in raw_messages]} + extract_res, _ = settings.msgStoreConn.search( + select_fields=select_fields, + highlight_fields=[], + condition=extract_filter, + match_expressions=[], order_by=order_by, + offset=0, limit=512, + index_names=index, memory_ids=[memory_id], agg_fields=[], hide_forgotten=False + ) + extract_msg = settings.msgStoreConn.get_fields(extract_res, select_fields) + grouped_extract_msg = {} + for msg in extract_msg.values(): + if grouped_extract_msg.get(msg["source_id"]): + grouped_extract_msg[msg["source_id"]].append(msg) + else: + grouped_extract_msg[msg["source_id"]] = [msg] + + for raw_msg in raw_messages: + raw_msg["extract"] = grouped_extract_msg.get(raw_msg["message_id"], []) + return { - "message_list": list(doc_mapping.values()), + "message_list": raw_messages, "total_count": total_count } From 140dd2c8cc196cfeaad4645912cdabd0cda9db21 Mon Sep 17 00:00:00 2001 From: balibabu Date: Mon, 5 Jan 2026 19:27:56 +0800 Subject: [PATCH 040/335] Refactor: Refactor FishAudioModal and BedrockModal using shadcn. #1036 (#12449) ### What problem does this PR solve? Refactor: Refactor FishAudioModal and BedrockModal using shadcn. #1036 ### Type of change - [x] Refactoring --- .../modal/bedrock-modal/index.tsx | 362 ++++++++++-------- .../modal/fish-audio-modal/index.tsx | 193 +++++----- 2 files changed, 301 insertions(+), 254 deletions(-) diff --git a/web/src/pages/user-setting/setting-model/modal/bedrock-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/bedrock-modal/index.tsx index 6a610d34a87..664eb9a2f59 100644 --- a/web/src/pages/user-setting/setting-model/modal/bedrock-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/bedrock-modal/index.tsx @@ -1,16 +1,17 @@ -import { useTranslate } from '@/hooks/common-hooks'; +import { SelectWithSearch } from '@/components/originui/select-with-search'; +import { RAGFlowFormItem } from '@/components/ragflow-form'; +import { ButtonLoading } from '@/components/ui/button'; +import { Form } from '@/components/ui/form'; +import { Input } from '@/components/ui/input'; +import { Modal } from '@/components/ui/modal/modal'; +import { Segmented } from '@/components/ui/segmented'; +import { useCommonTranslation, useTranslate } from '@/hooks/common-hooks'; import { IModalProps } from '@/interfaces/common'; import { IAddLlmRequestBody } from '@/interfaces/request/llm'; -import { - Form, - Input, - InputNumber, - Modal, - Segmented, - Select, - Typography, -} from 'antd'; -import { useMemo, useState } from 'react'; +import { zodResolver } from '@hookform/resolvers/zod'; +import { useMemo } from 'react'; +import { useForm, useWatch } from 'react-hook-form'; +import { z } from 'zod'; import { LLMHeader } from '../../components/llm-header'; import { BedrockRegionList } from '../../constant'; @@ -22,30 +23,84 @@ type FieldType = IAddLlmRequestBody & { aws_role_arn?: string; }; -const { Option } = Select; -const { Text } = Typography; - const BedrockModal = ({ - visible, + visible = false, hideModal, onOk, loading, llmFactory, }: IModalProps & { llmFactory: string }) => { - const [form] = Form.useForm(); - const [authMode, setAuthMode] = - useState('access_key_secret'); - const { t } = useTranslate('setting'); + const { t: ct } = useCommonTranslation(); + + const FormSchema = z + .object({ + model_type: z.enum(['chat', 'embedding'], { + required_error: t('modelTypeMessage'), + }), + llm_name: z.string().min(1, { message: t('bedrockModelNameMessage') }), + bedrock_region: z.string().min(1, { message: t('bedrockRegionMessage') }), + max_tokens: z + .number({ + required_error: t('maxTokensMessage'), + invalid_type_error: t('maxTokensInvalidMessage'), + }) + .nonnegative({ message: t('maxTokensMinMessage') }), + auth_mode: z + .enum(['access_key_secret', 'iam_role', 'assume_role']) + .default('access_key_secret'), + bedrock_ak: z.string().optional(), + bedrock_sk: z.string().optional(), + aws_role_arn: z.string().optional(), + }) + .superRefine((data, ctx) => { + if (data.auth_mode === 'access_key_secret') { + if (!data.bedrock_ak || data.bedrock_ak.trim() === '') { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: t('bedrockAKMessage'), + path: ['bedrock_ak'], + }); + } + if (!data.bedrock_sk || data.bedrock_sk.trim() === '') { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: t('bedrockSKMessage'), + path: ['bedrock_sk'], + }); + } + } + + if (data.auth_mode === 'iam_role') { + if (!data.aws_role_arn || data.aws_role_arn.trim() === '') { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: t('awsRoleArnMessage'), + path: ['aws_role_arn'], + }); + } + } + }); + + const form = useForm({ + resolver: zodResolver(FormSchema), + defaultValues: { + model_type: 'chat', + auth_mode: 'access_key_secret', + }, + }); + + const authMode = useWatch({ + control: form.control, + name: 'auth_mode', + }); + const options = useMemo( () => BedrockRegionList.map((x) => ({ value: x, label: t(x) })), [t], ); - const handleOk = async () => { - const values = await form.validateFields(); - - // Only submit fields related to the active auth mode. + const handleOk = async (values: FieldType) => { const cleanedValues: Record = { ...values }; const fieldsByMode: Record = { @@ -75,145 +130,140 @@ const BedrockModal = ({ return ( - + title={} + open={visible} + onOpenChange={(open) => !open && hideModal?.()} + maskClosable={false} + footer={ +
+ + + {ct('ok')} +
} - open={visible} - onOk={handleOk} - onCancel={hideModal} - okButtonProps={{ loading }} > -
- - label={t('modelType')} - name="model_type" - initialValue={'chat'} - rules={[{ required: true, message: t('modelTypeMessage') }]} - > - - - - label={t('modelName')} - name="llm_name" - rules={[{ required: true, message: t('bedrockModelNameMessage') }]} + + - - - - {/* AWS Credential Mode Switch (AK/SK section only) */} - - { - const next = v as FieldType['auth_mode']; - setAuthMode(next); - // Clear non-active fields so they won't be validated/submitted by accident. - if (next !== 'access_key_secret') { - form.setFieldsValue({ bedrock_ak: '', bedrock_sk: '' } as any); - } - if (next !== 'iam_role') { - form.setFieldsValue({ aws_role_arn: '' } as any); - } - if (next !== 'assume_role') { - form.setFieldsValue({ role_arn: '' } as any); - } - }} - options={[ - { - label: t('awsAuthModeAccessKeySecret'), - value: 'access_key_secret', - }, - { label: t('awsAuthModeIamRole'), value: 'iam_role' }, - { label: t('awsAuthModeAssumeRole'), value: 'assume_role' }, - ]} - /> - - - {authMode === 'access_key_secret' && ( - <> - - label={t('awsAccessKeyId')} - name="bedrock_ak" - rules={[{ required: true, message: t('bedrockAKMessage') }]} - > - - - - label={t('awsSecretAccessKey')} - name="bedrock_sk" - rules={[{ required: true, message: t('bedrockSKMessage') }]} + + {(field) => ( + + )} + + + + + + +
+ + {(field) => ( + { + // Clear non-active fields so they won't be validated/submitted by accident. + if (value !== 'access_key_secret') { + form.setValue('bedrock_ak', ''); + form.setValue('bedrock_sk', ''); + } + if (value !== 'iam_role') { + form.setValue('aws_role_arn', ''); + } + field.onChange(value); + }} + options={[ + { + label: t('awsAuthModeAccessKeySecret'), + value: 'access_key_secret', + }, + { label: t('awsAuthModeIamRole'), value: 'iam_role' }, + { label: t('awsAuthModeAssumeRole'), value: 'assume_role' }, + ]} + /> + )} + +
+ + {authMode === 'access_key_secret' && ( + <> + + + + + + + + )} + + {authMode === 'iam_role' && ( + - - - - )} - - {authMode === 'iam_role' && ( - - label={t('awsRoleArn')} - name="aws_role_arn" - rules={[{ required: true, message: t('awsRoleArnMessage') }]} - > - - - )} - - {authMode === 'assume_role' && ( - + + )} + + {authMode === 'assume_role' && ( +
+ {t('awsAssumeRoleTip')} +
+ )} + + - {t('awsAssumeRoleTip')} - - )} - - - label={t('bedrockRegion')} - name="bedrock_region" - rules={[{ required: true, message: t('bedrockRegionMessage') }]} - > - - - - label={t('maxTokens')} - name="max_tokens" - rules={[ - { required: true, message: t('maxTokensMessage') }, - { - type: 'number', - message: t('maxTokensInvalidMessage'), - }, - ({}) => ({ - validator(_, value) { - if (value < 0) { - return Promise.reject(new Error(t('maxTokensMinMessage'))); - } - return Promise.resolve(); - }, - }), - ]} - > - - + {(field) => ( + + )} + + + + {(field) => ( + field.onChange(Number(e.target.value))} + /> + )} + +
); diff --git a/web/src/pages/user-setting/setting-model/modal/fish-audio-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/fish-audio-modal/index.tsx index 30511fab110..3ce52cef9aa 100644 --- a/web/src/pages/user-setting/setting-model/modal/fish-audio-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/fish-audio-modal/index.tsx @@ -1,17 +1,15 @@ -import { useTranslate } from '@/hooks/common-hooks'; +import { + DynamicForm, + FormFieldConfig, + FormFieldType, +} from '@/components/dynamic-form'; +import { Modal } from '@/components/ui/modal/modal'; +import { useCommonTranslation, useTranslate } from '@/hooks/common-hooks'; import { IModalProps } from '@/interfaces/common'; import { IAddLlmRequestBody } from '@/interfaces/request/llm'; -import { Flex, Form, Input, InputNumber, Modal, Select, Space } from 'antd'; -import omit from 'lodash/omit'; +import { FieldValues } from 'react-hook-form'; import { LLMHeader } from '../../components/llm-header'; -type FieldType = IAddLlmRequestBody & { - fish_audio_ak: string; - fish_audio_refid: string; -}; - -const { Option } = Select; - const FishAudioModal = ({ visible, hideModal, @@ -19,107 +17,106 @@ const FishAudioModal = ({ loading, llmFactory, }: IModalProps & { llmFactory: string }) => { - const [form] = Form.useForm(); - const { t } = useTranslate('setting'); + const { t: tc } = useCommonTranslation(); - const handleOk = async () => { - const values = await form.validateFields(); - const modelType = values.model_type; + const fields: FormFieldConfig[] = [ + { + name: 'model_type', + label: t('modelType'), + type: FormFieldType.Select, + required: true, + options: [{ label: 'tts', value: 'tts' }], + defaultValue: 'tts', + validation: { message: t('modelTypeMessage') }, + }, + { + name: 'llm_name', + label: t('modelName'), + type: FormFieldType.Text, + required: true, + placeholder: t('FishAudioModelNameMessage'), + validation: { message: t('FishAudioModelNameMessage') }, + }, + { + name: 'fish_audio_ak', + label: t('addFishAudioAK'), + type: FormFieldType.Text, + required: true, + placeholder: t('FishAudioAKMessage'), + validation: { message: t('FishAudioAKMessage') }, + }, + { + name: 'fish_audio_refid', + label: t('addFishAudioRefID'), + type: FormFieldType.Text, + required: true, + placeholder: t('FishAudioRefIDMessage'), + validation: { message: t('FishAudioRefIDMessage') }, + }, + { + name: 'max_tokens', + label: t('maxTokens'), + type: FormFieldType.Number, + required: true, + placeholder: t('maxTokensTip'), + validation: { + min: 0, + message: t('maxTokensInvalidMessage'), + }, + }, + ]; - const data = { - ...omit(values), - model_type: modelType, + const handleOk = async (values?: FieldValues) => { + if (!values) return; + + const data: Record = { llm_factory: llmFactory, - max_tokens: values.max_tokens, + llm_name: values.llm_name as string, + model_type: values.model_type, + fish_audio_ak: values.fish_audio_ak, + fish_audio_refid: values.fish_audio_refid, + max_tokens: values.max_tokens as number, }; - console.info(data); - onOk?.(data); + console.info(data); + await onOk?.(data as IAddLlmRequestBody); }; return ( } - open={visible} - onOk={handleOk} - onCancel={hideModal} - okButtonProps={{ loading }} - footer={(originNode: React.ReactNode) => { - return ( - - - {t('FishAudioLink')} - - {originNode} - - ); - }} - confirmLoading={loading} + open={visible || false} + onOpenChange={(open) => !open && hideModal?.()} + maskClosable={false} + footerClassName="py-1" + footer={
} > -
console.log(data)} + defaultValues={{ model_type: 'tts' }} + labelClassName="font-normal" > - - label={t('modelType')} - name="model_type" - initialValue={'tts'} - rules={[{ required: true, message: t('modelTypeMessage') }]} - > - - - - label={t('modelName')} - name="llm_name" - rules={[{ required: true, message: t('FishAudioModelNameMessage') }]} - > - - - - label={t('addFishAudioAK')} - name="fish_audio_ak" - rules={[{ required: true, message: t('FishAudioAKMessage') }]} - > - - - - label={t('addFishAudioRefID')} - name="fish_audio_refid" - rules={[{ required: true, message: t('FishAudioRefIDMessage') }]} - > - - - - label={t('maxTokens')} - name="max_tokens" - rules={[ - { required: true, message: t('maxTokensMessage') }, - { - type: 'number', - message: t('maxTokensInvalidMessage'), - }, - ({}) => ({ - validator(_, value) { - if (value < 0) { - return Promise.reject(new Error(t('maxTokensMinMessage'))); - } - return Promise.resolve(); - }, - }), - ]} - > - - - +
+ + {t('FishAudioLink')} + +
+ hideModal?.()} /> + handleOk(values)} + /> +
+
+
); }; From 55c9fc00174185a311f6a73e93beb73c05264672 Mon Sep 17 00:00:00 2001 From: He Wang Date: Mon, 5 Jan 2026 19:31:44 +0800 Subject: [PATCH 041/335] fix: add 'mom_id' column to OBConnection chunk table (#12444) ### What problem does this PR solve? Fix #12428 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/utils/ob_conn.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rag/utils/ob_conn.py b/rag/utils/ob_conn.py index d43f8bb752b..d0099a81b8e 100644 --- a/rag/utils/ob_conn.py +++ b/rag/utils/ob_conn.py @@ -48,6 +48,7 @@ column_order_id = Column("_order_id", Integer, nullable=True, comment="chunk order id for maintaining sequence") column_group_id = Column("group_id", String(256), nullable=True, comment="group id for external retrieval") +column_mom_id = Column("mom_id", String(256), nullable=True, comment="parent chunk id") column_definitions: list[Column] = [ Column("id", String(256), primary_key=True, comment="chunk id"), @@ -92,6 +93,7 @@ Column("extra", JSON, nullable=True, comment="extra information of non-general chunk"), column_order_id, column_group_id, + column_mom_id, ] column_names: list[str] = [col.name for col in column_definitions] @@ -538,7 +540,7 @@ def _check_table_exists_cached(self, table_name: str) -> bool: column_name = fts_column.split("^")[0] if not self._index_exists(table_name, fulltext_index_name_template % column_name): return False - for column in [column_order_id, column_group_id]: + for column in [column_order_id, column_group_id, column_mom_id]: if not self._column_exist(table_name, column.name): return False except Exception as e: @@ -592,7 +594,7 @@ def create_idx(self, indexName: str, knowledgebaseId: str, vectorSize: int): ) # new columns migration - for column in [column_order_id, column_group_id]: + for column in [column_order_id, column_group_id, column_mom_id]: _try_with_lock( lock_name=f"ob_add_{column.name}_{indexName}", check_func=lambda: self._column_exist(indexName, column.name), From 7818644129de8d4d72965cdbd2882b982734ebe7 Mon Sep 17 00:00:00 2001 From: AAAkater <125126227+AAAkater@users.noreply.github.com> Date: Mon, 5 Jan 2026 20:22:35 +0800 Subject: [PATCH 042/335] Fix: add uv binary archive to ignored files (#12451) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What problem does this PR solve? After I ran this command, ```bash uv run ./download_deps.py ``` a file was not ignored. ```bash ❯ git status On branch feat/ignore-uv Untracked files: (use "git add ..." to include in what will be committed) uv-x86_64-unknown-linux-gnu.tar.gz nothing added to commit but untracked files present (use "git add" to track) ``` Add this file name to `.gitignore` ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 11aa5449312..22e78ccdd26 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ cl100k_base.tiktoken chrome* huggingface.co/ nltk_data/ +uv-x86_64*.tar.gz # Exclude hash-like temporary files like 9b5ad71b2ce5302211f9c61530b329a4922fc6a4 *[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]* @@ -197,4 +198,4 @@ ragflow_cli.egg-info backup -.hypothesis \ No newline at end of file +.hypothesis From aa08920e514e0f9c60c04cee486266c613d900e9 Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Tue, 6 Jan 2026 11:01:16 +0800 Subject: [PATCH 043/335] Fix: The avatar and greeting message no longer appear in the Agent iFrame. [#12410] (#12459) ### What problem does this PR solve? Fix: The avatar and greeting message no longer appear in the Agent iFrame. [#12410] ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/hooks/use-agent-request.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/hooks/use-agent-request.ts b/web/src/hooks/use-agent-request.ts index b15b032e96b..4ac0abc7c3f 100644 --- a/web/src/hooks/use-agent-request.ts +++ b/web/src/hooks/use-agent-request.ts @@ -622,10 +622,10 @@ export const useFetchExternalAgentInputs = () => { isFetching: loading, refetch, } = useQuery({ - queryKey: [AgentApiAction.FetchExternalAgentInputs], + queryKey: [AgentApiAction.FetchExternalAgentInputs, sharedId], initialData: {} as IInputs, refetchOnReconnect: false, - refetchOnMount: false, + // refetchOnMount: false, refetchOnWindowFocus: false, gcTime: 0, enabled: !!sharedId, From 02e6870755ea1eb6aca749083037c4228f55e866 Mon Sep 17 00:00:00 2001 From: Stephen Hu <812791840@qq.com> Date: Tue, 6 Jan 2026 11:39:07 +0800 Subject: [PATCH 044/335] Refactor: import_test_cases use bulk_create (#12456) ### What problem does this PR solve? import_test_cases use bulk_create ### Type of change - [x] Refactoring --- api/db/services/evaluation_service.py | 41 ++++++++++++++++++--------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/api/db/services/evaluation_service.py b/api/db/services/evaluation_service.py index 3f523b1d8c1..48255512f5a 100644 --- a/api/db/services/evaluation_service.py +++ b/api/db/services/evaluation_service.py @@ -225,21 +225,36 @@ def import_test_cases(cls, dataset_id: str, cases: List[Dict[str, Any]]) -> Tupl """ success_count = 0 failure_count = 0 + case_instances = [] + + if not cases: + return success_count, failure_count + + cur_timestamp = current_timestamp() - for case_data in cases: - success, _ = cls.add_test_case( - dataset_id=dataset_id, - question=case_data.get("question", ""), - reference_answer=case_data.get("reference_answer"), - relevant_doc_ids=case_data.get("relevant_doc_ids"), - relevant_chunk_ids=case_data.get("relevant_chunk_ids"), - metadata=case_data.get("metadata") - ) + try: + for case_data in cases: + case_id = get_uuid() + case_info = { + "id": case_id, + "dataset_id": dataset_id, + "question": case_data.get("question", ""), + "reference_answer": case_data.get("reference_answer"), + "relevant_doc_ids": case_data.get("relevant_doc_ids"), + "relevant_chunk_ids": case_data.get("relevant_chunk_ids"), + "metadata": case_data.get("metadata"), + "create_time": cur_timestamp + } + + case_instances.append(EvaluationCase(**case_info)) + EvaluationCase.bulk_create(case_instances, batch_size=300) + success_count = len(case_instances) + failure_count = 0 - if success: - success_count += 1 - else: - failure_count += 1 + except Exception as e: + logging.error(f"Error bulk importing test cases: {str(e)}") + failure_count = len(cases) + success_count = 0 return success_count, failure_count From 1f60863f6050edfef7ec269216879892ebba9278 Mon Sep 17 00:00:00 2001 From: writinwaters <93570324+writinwaters@users.noreply.github.com> Date: Tue, 6 Jan 2026 17:40:53 +0800 Subject: [PATCH 045/335] Docs: Fixed a display issue. (#12463) ### What problem does this PR solve? ### Type of change - [x] Documentation Update --- docs/develop/migrate_to_single_bucket_mode.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/develop/migrate_to_single_bucket_mode.md b/docs/develop/migrate_to_single_bucket_mode.md index ce258d4e8d9..de7c8fe873b 100644 --- a/docs/develop/migrate_to_single_bucket_mode.md +++ b/docs/develop/migrate_to_single_bucket_mode.md @@ -1,4 +1,3 @@ - --- sidebar_position: 20 slug: /migrate_to_single_bucket_mode From bdd9f3d4d1f2998cc43f109a043fcec07967208a Mon Sep 17 00:00:00 2001 From: Lynn Date: Tue, 6 Jan 2026 19:25:42 +0800 Subject: [PATCH 046/335] Fix: try handle authorization as api-token (#12462) ### What problem does this PR solve? Try handle authorization as api-token when jwt load failed. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/__init__.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/api/apps/__init__.py b/api/apps/__init__.py index c329679f8fb..c99e5f0dce3 100644 --- a/api/apps/__init__.py +++ b/api/apps/__init__.py @@ -125,18 +125,28 @@ def _load_user(): user = UserService.query( access_token=access_token, status=StatusEnum.VALID.value ) - if not user and len(authorization.split()) == 2: - objs = APIToken.query(token=authorization.split()[1]) - if objs: - user = UserService.query(id=objs[0].tenant_id, status=StatusEnum.VALID.value) if user: if not user[0].access_token or not user[0].access_token.strip(): logging.warning(f"User {user[0].email} has empty access_token in database") return None g.user = user[0] return user[0] - except Exception as e: - logging.warning(f"load_user got exception {e}") + except Exception as e_auth: + logging.warning(f"load_user got exception {e_auth}") + try: + authorization = request.headers.get("Authorization") + if len(authorization.split()) == 2: + objs = APIToken.query(token=authorization.split()[1]) + if objs: + user = UserService.query(id=objs[0].tenant_id, status=StatusEnum.VALID.value) + if user: + if not user[0].access_token or not user[0].access_token.strip(): + logging.warning(f"User {user[0].email} has empty access_token in database") + return None + g.user = user[0] + return user[0] + except Exception as e_api_token: + logging.warning(f"load_user got exception {e_api_token}") current_user = LocalProxy(_load_user) From 45fb2719cf0f8300ca355a222a15b9919ad810cf Mon Sep 17 00:00:00 2001 From: buua436 Date: Tue, 6 Jan 2026 19:27:46 +0800 Subject: [PATCH 047/335] Fix: update uv python installation to version 3.12 in Dockerfile (#12464) ### What problem does this PR solve? issue: https://github.com/infiniflow/ragflow/issues/12440 change: update uv python installation to version 3.12 in Dockerfile ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e4defbf31be..aaec6f16e28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -67,7 +67,7 @@ RUN --mount=type=bind,from=infiniflow/ragflow_deps:latest,source=/,target=/deps tar xzf /deps/uv-x86_64-unknown-linux-gnu.tar.gz \ && cp uv-x86_64-unknown-linux-gnu/* /usr/local/bin/ \ && rm -rf uv-x86_64-unknown-linux-gnu \ - && uv python install 3.11 + && uv python install 3.12 ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 ENV PATH=/root/.local/bin:$PATH From 51ece37db2c13207814a29dda39a1af4aa0840e9 Mon Sep 17 00:00:00 2001 From: Jimmy Ben Klieve Date: Wed, 7 Jan 2026 09:39:18 +0800 Subject: [PATCH 048/335] refactor: migrate env prefix to `VITE_*` (#12466) ### What problem does this PR solve? `UMI_APP_*` to `VITE_*` ### Type of change - [x] Refactoring --- web/src/pages/admin/utils.tsx | 2 +- web/vite.config.ts | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/web/src/pages/admin/utils.tsx b/web/src/pages/admin/utils.tsx index 812373afb9e..c2d2e9d68cb 100644 --- a/web/src/pages/admin/utils.tsx +++ b/web/src/pages/admin/utils.tsx @@ -77,4 +77,4 @@ export function getSortIcon(sorting: false | SortDirection) { export const PERMISSION_TYPES = ['enable', 'read', 'write', 'share'] as const; export const EMPTY_DATA = Object.freeze([]) as any[]; export const IS_ENTERPRISE = - process.env.UMI_APP_RAGFLOW_ENTERPRISE === 'RAGFLOW_ENTERPRISE'; + import.meta.env.VITE_RAGFLOW_ENTERPRISE === 'RAGFLOW_ENTERPRISE'; diff --git a/web/vite.config.ts b/web/vite.config.ts index 92ac2bae23c..25f1c5b01d2 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -74,11 +74,6 @@ export default defineConfig(({ mode, command }) => { }, }, }, - define: { - 'process.env.UMI_APP_RAGFLOW_ENTERPRISE': JSON.stringify( - env.UMI_APP_RAGFLOW_ENTERPRISE, - ), - }, assetsInclude: ['**/*.md'], base: env.VITE_BASE_URL, publicDir: 'public', From 8e038431458e0531200be51bb630ab6ccb81f7c8 Mon Sep 17 00:00:00 2001 From: Jimmy Ben Klieve Date: Wed, 7 Jan 2026 09:58:16 +0800 Subject: [PATCH 049/335] fix: task executor with status "timeout" corrupts page when checking its details (#12467) ### What problem does this PR solve? In **Admin UI** > **Service Status**, clicking "Show details" on task executor with status "Timeout" may corrupts page. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/pages/admin/service-status.tsx | 2 ++ web/src/pages/admin/task-executor-detail.tsx | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/web/src/pages/admin/service-status.tsx b/web/src/pages/admin/service-status.tsx index c78cbb0d62f..582b38cac64 100644 --- a/web/src/pages/admin/service-status.tsx +++ b/web/src/pages/admin/service-status.tsx @@ -68,6 +68,8 @@ import { } from './utils'; import JsonView from 'react18-json-view'; +import 'react18-json-view/src/style.css'; + import ServiceDetail from './service-detail'; import TaskExecutorDetail from './task-executor-detail'; diff --git a/web/src/pages/admin/task-executor-detail.tsx b/web/src/pages/admin/task-executor-detail.tsx index 55d2eef114c..0adf6d4c063 100644 --- a/web/src/pages/admin/task-executor-detail.tsx +++ b/web/src/pages/admin/task-executor-detail.tsx @@ -1,5 +1,8 @@ import dayjs from 'dayjs'; +import { isPlainObject } from 'lodash'; import JsonView from 'react18-json-view'; +import 'react18-json-view/src/style.css'; + import { Bar, BarChart, @@ -15,6 +18,7 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { ScrollArea } from '@/components/ui/scroll-area'; import { formatDate, formatTime } from '@/utils/date'; +import ServiceDetail from './service-detail'; interface TaskExecutorDetailProps { content?: AdminService.TaskExecutorInfo; @@ -68,9 +72,15 @@ function CustomAxisTick({ x, y, payload }: any) { } function TaskExecutorDetail({ content }: TaskExecutorDetailProps) { + if (!isPlainObject(content)) { + return ; + } + return (
{Object.entries(content ?? {}).map(([name, data]) => { + console.log(data); + const items = data.map((x) => ({ ...x, done: Math.floor(Math.random() * 100), From ca9645f39bbaa3f2e81c0b3465e2afdd847ffab8 Mon Sep 17 00:00:00 2001 From: Lynn Date: Wed, 7 Jan 2026 09:59:08 +0800 Subject: [PATCH 050/335] Feat: adapt to , arglist (#12468) ### What problem does this PR solve? Adapt to ',' joined arg list in get method url. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- api/apps/memories_app.py | 9 ++++++++- api/apps/messages_app.py | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/api/apps/memories_app.py b/api/apps/memories_app.py index 72e3e5d72f6..efd23388d80 100644 --- a/api/apps/memories_app.py +++ b/api/apps/memories_app.py @@ -180,13 +180,18 @@ async def list_memory(): page = int(args.get("page", 1)) page_size = int(args.get("page_size", 50)) # make filter dict - filter_dict = {"memory_type": memory_types, "storage_type": storage_type} + filter_dict: dict = {"storage_type": storage_type} if not tenant_ids: # restrict to current user's tenants user_tenants = UserTenantService.get_user_tenant_relation_by_user_id(current_user.id) filter_dict["tenant_id"] = [tenant["tenant_id"] for tenant in user_tenants] else: + if len(tenant_ids) == 1 and ',' in tenant_ids[0]: + tenant_ids = tenant_ids[0].split(',') filter_dict["tenant_id"] = tenant_ids + if memory_types and len(memory_types) == 1 and ',' in memory_types[0]: + memory_types = memory_types[0].split(',') + filter_dict["memory_type"] = memory_types memory_list, count = MemoryService.get_by_filter(filter_dict, keywords, page, page_size) [memory.update({"memory_type": get_memory_type_human(memory["memory_type"])}) for memory in memory_list] @@ -211,6 +216,8 @@ async def get_memory_config(memory_id): async def get_memory_detail(memory_id): args = request.args agent_ids = args.getlist("agent_id") + if len(agent_ids) == 1 and ',' in agent_ids[0]: + agent_ids = agent_ids[0].split(',') keywords = args.get("keywords", "") keywords = keywords.strip() page = int(args.get("page", 1)) diff --git a/api/apps/messages_app.py b/api/apps/messages_app.py index 2963baefa4a..d18acb5e03f 100644 --- a/api/apps/messages_app.py +++ b/api/apps/messages_app.py @@ -104,12 +104,13 @@ async def update_message(memory_id: str, message_id: int): @login_required async def search_message(): args = request.args - print(args, flush=True) empty_fields = [f for f in ["memory_id", "query"] if not args.get(f)] if empty_fields: return get_error_argument_result(f"{', '.join(empty_fields)} can't be empty.") memory_ids = args.getlist("memory_id") + if len(memory_ids) == 1 and ',' in memory_ids[0]: + memory_ids = memory_ids[0].split(',') query = args.get("query") similarity_threshold = float(args.get("similarity_threshold", 0.2)) keywords_similarity_weight = float(args.get("keywords_similarity_weight", 0.7)) @@ -137,6 +138,8 @@ async def search_message(): async def get_messages(): args = request.args memory_ids = args.getlist("memory_id") + if len(memory_ids) == 1 and ',' in memory_ids[0]: + memory_ids = memory_ids[0].split(',') agent_id = args.get("agent_id", "") session_id = args.get("session_id", "") limit = int(args.get("limit", 10)) From 6814ace1aa1d449b792f2a87d5ee5686e41b3081 Mon Sep 17 00:00:00 2001 From: Jimmy Ben Klieve Date: Wed, 7 Jan 2026 10:00:09 +0800 Subject: [PATCH 051/335] docs: update docs icons (#12465) ### What problem does this PR solve? Update icons for docs. Trailing spaces are auto truncated by the editor, does not affect real content. ### Type of change - [x] Documentation Update --- docs/basics/rag.md | 14 +- docs/configurations.md | 3 + docs/contribution/_category_.json | 3 + docs/contribution/contributing.md | 5 +- docs/develop/_category_.json | 3 + docs/develop/acquire_ragflow_api_key.md | 3 + docs/develop/build_docker_image.mdx | 3 + docs/develop/launch_ragflow_from_source.md | 13 +- docs/develop/mcp/_category_.json | 3 + docs/develop/mcp/launch_mcp_server.md | 63 +- docs/develop/mcp/mcp_client_example.md | 7 +- docs/develop/mcp/mcp_tools.md | 3 + docs/develop/switch_doc_engine.md | 3 + docs/faq.mdx | 29 +- docs/guides/_category_.json | 3 + docs/guides/admin/_category_.json | 3 + docs/guides/admin/admin_cli.md | 7 +- docs/guides/admin/admin_service.md | 5 +- docs/guides/admin/admin_ui.md | 3 + docs/guides/agent/_category_.json | 3 + .../agent_component_reference/_category_.json | 3 + .../agent/agent_component_reference/agent.mdx | 31 +- .../await_response.mdx | 13 +- .../agent/agent_component_reference/begin.mdx | 11 +- .../agent_component_reference/categorize.mdx | 29 +- .../chunker_title.md | 5 +- .../chunker_token.md | 3 + .../agent/agent_component_reference/code.mdx | 25 +- .../agent_component_reference/execute_sql.md | 5 +- .../agent/agent_component_reference/http.md | 5 +- .../agent_component_reference/indexer.md | 3 + .../agent_component_reference/iteration.mdx | 13 +- .../agent_component_reference/message.mdx | 3 + .../agent/agent_component_reference/parser.md | 7 +- .../agent_component_reference/retrieval.mdx | 11 +- .../agent_component_reference/switch.mdx | 13 +- .../text_processing.mdx | 5 +- .../agent_component_reference/transformer.md | 21 +- docs/guides/agent/agent_introduction.md | 7 +- .../agent/best_practices/_category_.json | 3 + docs/guides/agent/embed_agent_into_webpage.md | 3 + docs/guides/agent/sandbox_quickstart.md | 7 +- docs/guides/ai_search.md | 5 +- docs/guides/chat/_category_.json | 3 + .../chat/best_practices/_category_.json | 3 + docs/guides/chat/implement_deep_research.md | 3 + docs/guides/chat/set_chat_variables.md | 9 +- docs/guides/chat/start_chat.md | 17 +- docs/guides/dataset/_category_.json | 3 + .../dataset/add_data_source/_category_.json | 3 + .../add_data_source/add_google_drive.md | 17 +- docs/guides/dataset/auto_metadata.md | 3 + .../dataset/autokeyword_autoquestion.mdx | 19 +- .../dataset/best_practices/_category_.json | 3 + .../configure_child_chunking_strategy.md | 3 + .../dataset/configure_knowledge_base.md | 27 +- .../dataset/construct_knowledge_graph.md | 11 +- docs/guides/dataset/enable_excel2html.md | 3 + docs/guides/dataset/enable_raptor.md | 9 +- .../dataset/extract_table_of_contents.md | 5 +- docs/guides/dataset/manage_metadata.md | 5 +- docs/guides/dataset/run_retrieval_test.md | 9 +- docs/guides/dataset/select_pdf_parser.md | 7 +- docs/guides/dataset/set_context_window.md | 3 + docs/guides/dataset/set_metadata.md | 3 + docs/guides/dataset/set_page_rank.md | 3 + docs/guides/dataset/use_tag_sets.md | 13 +- docs/guides/manage_files.md | 17 +- docs/guides/migration/_category_.json | 3 + docs/guides/models/_category_.json | 3 + docs/guides/models/deploy_local_llm.mdx | 33 +- docs/guides/models/llm_api_key_setup.md | 5 +- docs/guides/team/_category_.json | 3 + docs/guides/team/join_or_leave_team.md | 3 + docs/guides/team/manage_team_members.md | 3 + docs/guides/team/share_agents.md | 5 +- docs/guides/team/share_chat_assistant.md | 3 + docs/guides/team/share_knowledge_bases.md | 3 + docs/guides/team/share_model.md | 3 + docs/guides/tracing.mdx | 29 +- docs/guides/upgrade_ragflow.mdx | 3 + docs/quickstart.mdx | 43 +- docs/references/_category_.json | 3 + docs/references/glossary.mdx | 3 + docs/references/http_api_reference.md | 579 +++++++++--------- docs/references/python_api_reference.md | 221 +++---- docs/references/supported_models.mdx | 3 + docs/release_notes.md | 21 +- 88 files changed, 922 insertions(+), 661 deletions(-) diff --git a/docs/basics/rag.md b/docs/basics/rag.md index 4cf2e7997a0..fc7025a3806 100644 --- a/docs/basics/rag.md +++ b/docs/basics/rag.md @@ -3,7 +3,7 @@ sidebar_position: 1 slug: /what-is-rag --- -# What is Retreival-Augmented-Generation (RAG)? +# What is Retreival-Augmented-Generation (RAG)? Since large language models (LLMs) became the focus of technology, their ability to handle general knowledge has been astonishing. However, when questions shift to internal corporate documents, proprietary knowledge bases, or real-time data, the limitations of LLMs become glaringly apparent: they cannot access private information outside their training data. Retrieval-Augmented Generation (RAG) was born precisely to address this core need. Before an LLM generates an answer, it first retrieves the most relevant context from an external knowledge base and inputs it as "reference material" to the LLM, thereby guiding it to produce accurate answers. In short, RAG elevates LLMs from "relying on memory" to "having evidence to rely on," significantly improving their accuracy and trustworthiness in specialized fields and real-time information queries. @@ -86,22 +86,22 @@ They are highly consistent at the technical base (e.g., vector retrieval, keywor RAG has demonstrated clear value in several typical scenarios: -1. Enterprise Knowledge Q&A and Internal Search +1. Enterprise Knowledge Q&A and Internal Search By vectorizing corporate private data and combining it with an LLM, RAG can directly return natural language answers based on authoritative sources, rather than document lists. While meeting intelligent Q&A needs, it inherently aligns with corporate requirements for data security, access control, and compliance. -2. Complex Document Understanding and Professional Q&A +2. Complex Document Understanding and Professional Q&A For structurally complex documents like contracts and regulations, the value of RAG lies in its ability to generate accurate, verifiable answers while maintaining context integrity. Its system accuracy largely depends on text chunking and semantic understanding strategies. -3. Dynamic Knowledge Fusion and Decision Support +3. Dynamic Knowledge Fusion and Decision Support In business scenarios requiring the synthesis of information from multiple sources, RAG evolves into a knowledge orchestration and reasoning support system for business decisions. Through a multi-path recall mechanism, it fuses knowledge from different systems and formats, maintaining factual consistency and logical controllability during the generation phase. ## The future of RAG The evolution of RAG is unfolding along several clear paths: -1. RAG as the data foundation for Agents +1. RAG as the data foundation for Agents RAG and agents have an architecture vs. scenario relationship. For agents to achieve autonomous and reliable decision-making and execution, they must rely on accurate and timely knowledge. RAG provides them with a standardized capability to access private domain knowledge and is an inevitable choice for building knowledge-aware agents. -2. Advanced RAG: Using LLMs to optimize retrieval itself +2. Advanced RAG: Using LLMs to optimize retrieval itself The core feature of next-generation RAG is fully utilizing the reasoning capabilities of LLMs to optimize the retrieval process, such as rewriting queries, summarizing or fusing results, or implementing intelligent routing. Empowering every aspect of retrieval with LLMs is key to breaking through current performance bottlenecks. -3. Towards context engineering 2.0 +3. Towards context engineering 2.0 Current RAG can be viewed as Context Engineering 1.0, whose core is assembling static knowledge context for single Q&A tasks. The forthcoming Context Engineering 2.0 will extend with RAG technology at its core, becoming a system that automatically and dynamically assembles comprehensive context for agents. The context fused by this system will come not only from documents but also include interaction memory, available tools/skills, and real-time environmental information. This marks the transition of agent development from a "handicraft workshop" model to the industrial starting point of automated context engineering. The essence of RAG is to build a dedicated, efficient, and trustworthy external data interface for large language models; its core is Retrieval, not Generation. Starting from the practical need to solve private data access, its technical depth is reflected in the optimization of retrieval for complex unstructured data. With its deep integration into agent architectures and its development towards automated context engineering, RAG is evolving from a technology that improves Q&A quality into the core infrastructure for building the next generation of trustworthy, controllable, and scalable intelligent applications. diff --git a/docs/configurations.md b/docs/configurations.md index b55042e8f5b..565354d6cf7 100644 --- a/docs/configurations.md +++ b/docs/configurations.md @@ -1,6 +1,9 @@ --- sidebar_position: 1 slug: /configurations +sidebar_custom_props: { + sidebarIcon: LucideCog +} --- # Configuration diff --git a/docs/contribution/_category_.json b/docs/contribution/_category_.json index 594fe200b4c..a9bd348a8cc 100644 --- a/docs/contribution/_category_.json +++ b/docs/contribution/_category_.json @@ -4,5 +4,8 @@ "link": { "type": "generated-index", "description": "Miscellaneous contribution guides." + }, + "customProps": { + "sidebarIcon": "LucideHandshake" } } diff --git a/docs/contribution/contributing.md b/docs/contribution/contributing.md index 5d1ec19c1cb..53d5d08394a 100644 --- a/docs/contribution/contributing.md +++ b/docs/contribution/contributing.md @@ -1,6 +1,9 @@ --- sidebar_position: 1 slug: /contributing +sidebar_custom_props: { + categoryIcon: LucideBookA +} --- # Contribution guidelines @@ -32,7 +35,7 @@ The list below mentions some contributions you can make, but it is not a complet 1. Fork our GitHub repository. 2. Clone your fork to your local machine: `git clone git@github.com:/ragflow.git` -3. Create a local branch: +3. Create a local branch: `git checkout -b my-branch` 4. Provide sufficient information in your commit message `git commit -m 'Provide sufficient info in your commit message'` diff --git a/docs/develop/_category_.json b/docs/develop/_category_.json index 036bc99a129..c80693175f7 100644 --- a/docs/develop/_category_.json +++ b/docs/develop/_category_.json @@ -4,5 +4,8 @@ "link": { "type": "generated-index", "description": "Guides for hardcore developers" + }, + "customProps": { + "sidebarIcon": "LucideWrench" } } diff --git a/docs/develop/acquire_ragflow_api_key.md b/docs/develop/acquire_ragflow_api_key.md index 4dc4520fe2b..fec9f6da388 100644 --- a/docs/develop/acquire_ragflow_api_key.md +++ b/docs/develop/acquire_ragflow_api_key.md @@ -1,6 +1,9 @@ --- sidebar_position: 4 slug: /acquire_ragflow_api_key +sidebar_custom_props: { + categoryIcon: LucideKey +} --- # Acquire RAGFlow API key diff --git a/docs/develop/build_docker_image.mdx b/docs/develop/build_docker_image.mdx index 3d20430f3b1..3a1ef350617 100644 --- a/docs/develop/build_docker_image.mdx +++ b/docs/develop/build_docker_image.mdx @@ -1,6 +1,9 @@ --- sidebar_position: 1 slug: /build_docker_image +sidebar_custom_props: { + categoryIcon: LucidePackage +} --- # Build RAGFlow Docker image diff --git a/docs/develop/launch_ragflow_from_source.md b/docs/develop/launch_ragflow_from_source.md index 0f154252934..11510f71767 100644 --- a/docs/develop/launch_ragflow_from_source.md +++ b/docs/develop/launch_ragflow_from_source.md @@ -1,6 +1,9 @@ --- sidebar_position: 2 slug: /launch_ragflow_from_source +sidebar_custom_props: { + categoryIcon: LucideMonitorPlay +} --- # Launch service from source @@ -36,7 +39,7 @@ cd ragflow/ ### Install Python dependencies 1. Install uv: - + ```bash pipx install uv ``` @@ -88,13 +91,13 @@ docker compose -f docker/docker-compose-base.yml up -d ``` 3. **Optional:** If you cannot access HuggingFace, set the HF_ENDPOINT environment variable to use a mirror site: - + ```bash export HF_ENDPOINT=https://hf-mirror.com ``` 4. Check the configuration in **conf/service_conf.yaml**, ensuring all hosts and ports are correctly set. - + 5. Run the **entrypoint.sh** script to launch the backend service: ```shell @@ -123,10 +126,10 @@ docker compose -f docker/docker-compose-base.yml up -d 3. Start up the RAGFlow frontend service: ```bash - npm run dev + npm run dev ``` - *The following message appears, showing the IP address and port number of your frontend service:* + *The following message appears, showing the IP address and port number of your frontend service:* ![](https://github.com/user-attachments/assets/0daf462c-a24d-4496-a66f-92533534e187) diff --git a/docs/develop/mcp/_category_.json b/docs/develop/mcp/_category_.json index d2f129c23b8..eb7b1444aa9 100644 --- a/docs/develop/mcp/_category_.json +++ b/docs/develop/mcp/_category_.json @@ -4,5 +4,8 @@ "link": { "type": "generated-index", "description": "Guides and references on accessing RAGFlow's datasets via MCP." + }, + "customProps": { + "categoryIcon": "SiModelcontextprotocol" } } diff --git a/docs/develop/mcp/launch_mcp_server.md b/docs/develop/mcp/launch_mcp_server.md index 2b9f052f06b..e3a27e07146 100644 --- a/docs/develop/mcp/launch_mcp_server.md +++ b/docs/develop/mcp/launch_mcp_server.md @@ -1,6 +1,9 @@ --- sidebar_position: 1 slug: /launch_mcp_server +sidebar_custom_props: { + categoryIcon: LucideTvMinimalPlay +} --- # Launch RAGFlow MCP server @@ -9,13 +12,13 @@ Launch an MCP server from source or via Docker. --- -A RAGFlow Model Context Protocol (MCP) server is designed as an independent component to complement the RAGFlow server. Note that an MCP server must operate alongside a properly functioning RAGFlow server. +A RAGFlow Model Context Protocol (MCP) server is designed as an independent component to complement the RAGFlow server. Note that an MCP server must operate alongside a properly functioning RAGFlow server. -An MCP server can start up in either self-host mode (default) or host mode: +An MCP server can start up in either self-host mode (default) or host mode: -- **Self-host mode**: +- **Self-host mode**: When launching an MCP server in self-host mode, you must provide an API key to authenticate the MCP server with the RAGFlow server. In this mode, the MCP server can access *only* the datasets of a specified tenant on the RAGFlow server. -- **Host mode**: +- **Host mode**: In host mode, each MCP client can access their own datasets on the RAGFlow server. However, each client request must include a valid API key to authenticate the client with the RAGFlow server. Once a connection is established, an MCP server communicates with its client in MCP HTTP+SSE (Server-Sent Events) mode, unidirectionally pushing responses from the RAGFlow server to its client in real time. @@ -29,9 +32,9 @@ Once a connection is established, an MCP server communicates with its client in If you wish to try out our MCP server without upgrading RAGFlow, community contributor [yiminghub2024](https://github.com/yiminghub2024) 👏 shares their recommended steps [here](#launch-an-mcp-server-without-upgrading-ragflow). ::: -## Launch an MCP server +## Launch an MCP server -You can start an MCP server either from source code or via Docker. +You can start an MCP server either from source code or via Docker. ### Launch from source code @@ -48,7 +51,7 @@ uv run mcp/server/server.py --host=127.0.0.1 --port=9382 --base-url=http://127.0 # uv run mcp/server/server.py --host=127.0.0.1 --port=9382 --base-url=http://127.0.0.1:9380 --mode=host ``` -Where: +Where: - `host`: The MCP server's host address. - `port`: The MCP server's listening port. @@ -94,7 +97,7 @@ The MCP server is designed as an optional component that complements the RAGFlow # - --no-json-response # Disables JSON responses for the streamable-HTTP transport ``` -Where: +Where: - `mcp-host`: The MCP server's host address. - `mcp-port`: The MCP server's listening port. @@ -119,13 +122,13 @@ Run `docker compose -f docker-compose.yml up` to launch the RAGFlow server toget docker-ragflow-cpu-1 | Starting MCP Server on 0.0.0.0:9382 with base URL http://127.0.0.1:9380... docker-ragflow-cpu-1 | Starting 1 task executor(s) on host 'dd0b5e07e76f'... docker-ragflow-cpu-1 | 2025-04-18 15:41:18,816 INFO 27 ragflow_server log path: /ragflow/logs/ragflow_server.log, log levels: {'peewee': 'WARNING', 'pdfminer': 'WARNING', 'root': 'INFO'} - docker-ragflow-cpu-1 | + docker-ragflow-cpu-1 | docker-ragflow-cpu-1 | __ __ ____ ____ ____ _____ ______ _______ ____ docker-ragflow-cpu-1 | | \/ |/ ___| _ \ / ___|| ____| _ \ \ / / ____| _ \ docker-ragflow-cpu-1 | | |\/| | | | |_) | \___ \| _| | |_) \ \ / /| _| | |_) | docker-ragflow-cpu-1 | | | | | |___| __/ ___) | |___| _ < \ V / | |___| _ < docker-ragflow-cpu-1 | |_| |_|\____|_| |____/|_____|_| \_\ \_/ |_____|_| \_\ - docker-ragflow-cpu-1 | + docker-ragflow-cpu-1 | docker-ragflow-cpu-1 | MCP launch mode: self-host docker-ragflow-cpu-1 | MCP host: 0.0.0.0 docker-ragflow-cpu-1 | MCP port: 9382 @@ -138,13 +141,13 @@ Run `docker compose -f docker-compose.yml up` to launch the RAGFlow server toget docker-ragflow-cpu-1 | 2025-04-18 15:41:23,263 INFO 27 init database on cluster mode successfully docker-ragflow-cpu-1 | 2025-04-18 15:41:25,318 INFO 27 load_model /ragflow/rag/res/deepdoc/det.onnx uses CPU docker-ragflow-cpu-1 | 2025-04-18 15:41:25,367 INFO 27 load_model /ragflow/rag/res/deepdoc/rec.onnx uses CPU - docker-ragflow-cpu-1 | ____ ___ ______ ______ __ + docker-ragflow-cpu-1 | ____ ___ ______ ______ __ docker-ragflow-cpu-1 | / __ \ / | / ____// ____// /____ _ __ docker-ragflow-cpu-1 | / /_/ // /| | / / __ / /_ / // __ \| | /| / / - docker-ragflow-cpu-1 | / _, _// ___ |/ /_/ // __/ / // /_/ /| |/ |/ / - docker-ragflow-cpu-1 | /_/ |_|/_/ |_|\____//_/ /_/ \____/ |__/|__/ - docker-ragflow-cpu-1 | - docker-ragflow-cpu-1 | + docker-ragflow-cpu-1 | / _, _// ___ |/ /_/ // __/ / // /_/ /| |/ |/ / + docker-ragflow-cpu-1 | /_/ |_|/_/ |_|\____//_/ /_/ \____/ |__/|__/ + docker-ragflow-cpu-1 | + docker-ragflow-cpu-1 | docker-ragflow-cpu-1 | 2025-04-18 15:41:29,088 INFO 27 RAGFlow version: v0.18.0-285-gb2c299fa full docker-ragflow-cpu-1 | 2025-04-18 15:41:29,088 INFO 27 project base: /ragflow docker-ragflow-cpu-1 | 2025-04-18 15:41:29,088 INFO 27 Current configs, from /ragflow/conf/service_conf.yaml: @@ -153,12 +156,12 @@ Run `docker compose -f docker-compose.yml up` to launch the RAGFlow server toget docker-ragflow-cpu-1 | * Running on all addresses (0.0.0.0) docker-ragflow-cpu-1 | * Running on http://127.0.0.1:9380 docker-ragflow-cpu-1 | * Running on http://172.19.0.6:9380 - docker-ragflow-cpu-1 | ______ __ ______ __ + docker-ragflow-cpu-1 | ______ __ ______ __ docker-ragflow-cpu-1 | /_ __/___ ______/ /__ / ____/ _____ _______ __/ /_____ _____ docker-ragflow-cpu-1 | / / / __ `/ ___/ //_/ / __/ | |/_/ _ \/ ___/ / / / __/ __ \/ ___/ - docker-ragflow-cpu-1 | / / / /_/ (__ ) ,< / /____> 9200/tcp, :::9200->9200/tcp ragflow-es-01 @@ -368,7 +371,7 @@ Yes, we do. See the Python files under the **rag/app** folder. $ docker ps ``` - *The status of a healthy Elasticsearch component should look as follows:* + *The status of a healthy Elasticsearch component should look as follows:* ```bash cd29bcb254bc quay.io/minio/minio:RELEASE.2023-12-20T01-00-02Z "/usr/bin/docker-ent…" 2 weeks ago Up 11 hours 0.0.0.0:9001->9001/tcp, :::9001->9001/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp ragflow-minio @@ -451,7 +454,7 @@ See [Upgrade RAGFlow](./guides/upgrade_ragflow.mdx) for more information. To switch your document engine from Elasticsearch to [Infinity](https://github.com/infiniflow/infinity): -1. Stop all running containers: +1. Stop all running containers: ```bash $ docker compose -f docker/docker-compose.yml down -v @@ -461,7 +464,7 @@ To switch your document engine from Elasticsearch to [Infinity](https://github.c ::: 2. In **docker/.env**, set `DOC_ENGINE=${DOC_ENGINE:-infinity}` -3. Restart your Docker image: +3. Restart your Docker image: ```bash $ docker compose -f docker-compose.yml up -d @@ -506,12 +509,12 @@ From v0.22.0 onwards, RAGFlow includes MinerU (≥ 2.6.3) as an optional PDF pa - `"vlm-mlx-engine"` - `"vlm-vllm-async-engine"` - `"vlm-lmdeploy-engine"`. - - `MINERU_SERVER_URL`: (optional) The downstream vLLM HTTP server (e.g., `http://vllm-host:30000`). Applicable when `MINERU_BACKEND` is set to `"vlm-http-client"`. + - `MINERU_SERVER_URL`: (optional) The downstream vLLM HTTP server (e.g., `http://vllm-host:30000`). Applicable when `MINERU_BACKEND` is set to `"vlm-http-client"`. - `MINERU_OUTPUT_DIR`: (optional) The local directory for holding the outputs of the MinerU API service (zip/JSON) before ingestion. - `MINERU_DELETE_OUTPUT`: Whether to delete temporary output when a temporary directory is used: - `1`: Delete. - `0`: Retain. -3. In the web UI, navigate to your dataset's **Configuration** page and find the **Ingestion pipeline** section: +3. In the web UI, navigate to your dataset's **Configuration** page and find the **Ingestion pipeline** section: - If you decide to use a chunking method from the **Built-in** dropdown, ensure it supports PDF parsing, then select **MinerU** from the **PDF parser** dropdown. - If you use a custom ingestion pipeline instead, select **MinerU** in the **PDF parser** section of the **Parser** component. diff --git a/docs/guides/_category_.json b/docs/guides/_category_.json index 895506b000c..18f4890a985 100644 --- a/docs/guides/_category_.json +++ b/docs/guides/_category_.json @@ -4,5 +4,8 @@ "link": { "type": "generated-index", "description": "Guides for RAGFlow users and developers." + }, + "customProps": { + "sidebarIcon": "LucideBookMarked" } } diff --git a/docs/guides/admin/_category_.json b/docs/guides/admin/_category_.json index 590d6208357..fa6d832fc8d 100644 --- a/docs/guides/admin/_category_.json +++ b/docs/guides/admin/_category_.json @@ -4,5 +4,8 @@ "link": { "type": "generated-index", "description": "RAGFlow administration" + }, + "customProps": { + "categoryIcon": "LucideUserCog" } } diff --git a/docs/guides/admin/admin_cli.md b/docs/guides/admin/admin_cli.md index 5a6cc3b0b66..d03afc6f212 100644 --- a/docs/guides/admin/admin_cli.md +++ b/docs/guides/admin/admin_cli.md @@ -1,6 +1,9 @@ --- sidebar_position: 2 slug: /admin_cli +sidebar_custom_props: { + categoryIcon: LucideSquareTerminal +} --- # Admin CLI @@ -27,9 +30,9 @@ The RAGFlow Admin CLI is a command-line-based system administration tool that of The default password is admin. **Parameters:** - + - -h: RAGFlow admin server host address - + - -p: RAGFlow admin server port ## Default administrative account diff --git a/docs/guides/admin/admin_service.md b/docs/guides/admin/admin_service.md index 7e5f1302577..52162a5b11b 100644 --- a/docs/guides/admin/admin_service.md +++ b/docs/guides/admin/admin_service.md @@ -1,6 +1,9 @@ --- sidebar_position: 0 slug: /admin_service +sidebar_custom_props: { + categoryIcon: LucideActivity +} --- @@ -24,7 +27,7 @@ With its unified interface design, the Admin Service combines the convenience of python admin/server/admin_server.py ``` - The service will start and listen for incoming connections from the CLI on the configured port. + The service will start and listen for incoming connections from the CLI on the configured port. ### Using docker image diff --git a/docs/guides/admin/admin_ui.md b/docs/guides/admin/admin_ui.md index 148257ae56c..67786421e1f 100644 --- a/docs/guides/admin/admin_ui.md +++ b/docs/guides/admin/admin_ui.md @@ -1,6 +1,9 @@ --- sidebar_position: 1 slug: /admin_ui +sidebar_custom_props: { + categoryIcon: LucidePalette +} --- # Admin UI diff --git a/docs/guides/agent/_category_.json b/docs/guides/agent/_category_.json index 020ba1d3f72..dc81d28a494 100644 --- a/docs/guides/agent/_category_.json +++ b/docs/guides/agent/_category_.json @@ -4,5 +4,8 @@ "link": { "type": "generated-index", "description": "RAGFlow v0.8.0 introduces an agent mechanism, featuring a no-code workflow editor on the front end and a comprehensive graph-based task orchestration framework on the backend." + }, + "customProps": { + "categoryIcon": "RagAiAgent" } } diff --git a/docs/guides/agent/agent_component_reference/_category_.json b/docs/guides/agent/agent_component_reference/_category_.json index 7548ec8031b..c40dadb1441 100644 --- a/docs/guides/agent/agent_component_reference/_category_.json +++ b/docs/guides/agent/agent_component_reference/_category_.json @@ -4,5 +4,8 @@ "link": { "type": "generated-index", "description": "A complete reference for RAGFlow's agent components." + }, + "customProps": { + "categoryIcon": "RagAiAgent" } } diff --git a/docs/guides/agent/agent_component_reference/agent.mdx b/docs/guides/agent/agent_component_reference/agent.mdx index 882c22be12d..29b0e0d697c 100644 --- a/docs/guides/agent/agent_component_reference/agent.mdx +++ b/docs/guides/agent/agent_component_reference/agent.mdx @@ -1,6 +1,9 @@ --- sidebar_position: 2 slug: /agent_component +sidebar_custom_props: { + categoryIcon: RagAiAgent +} --- # Agent component @@ -16,7 +19,7 @@ An **Agent** component fine-tunes the LLM and sets its prompt. From v0.20.5 onwa ## Scenarios -An **Agent** component is essential when you need the LLM to assist with summarizing, translating, or controlling various tasks. +An **Agent** component is essential when you need the LLM to assist with summarizing, translating, or controlling various tasks. ## Prerequisites @@ -28,13 +31,13 @@ An **Agent** component is essential when you need the LLM to assist with summari ## Quickstart -### 1. Click on an **Agent** component to show its configuration panel +### 1. Click on an **Agent** component to show its configuration panel The corresponding configuration panel appears to the right of the canvas. Use this panel to define and fine-tune the **Agent** component's behavior. ### 2. Select your model -Click **Model**, and select a chat model from the dropdown menu. +Click **Model**, and select a chat model from the dropdown menu. :::tip NOTE If no model appears, check if your have added a chat model on the **Model providers** page. @@ -55,7 +58,7 @@ In this quickstart, we assume your **Agent** component is used standalone (witho ### 5. Skip Tools and Agent -The **+ Add tools** and **+ Add agent** sections are used *only* when you need to configure your **Agent** component as a planner (with tools or sub-Agents beneath). In this quickstart, we assume your **Agent** component is used standalone (without tools or sub-Agents beneath). +The **+ Add tools** and **+ Add agent** sections are used *only* when you need to configure your **Agent** component as a planner (with tools or sub-Agents beneath). In this quickstart, we assume your **Agent** component is used standalone (without tools or sub-Agents beneath). ### 6. Choose the next component @@ -71,7 +74,7 @@ In this section, we assume your **Agent** will be configured as a planner, with ![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/mcp_page.jpg) -### 2. Configure your Tavily MCP server +### 2. Configure your Tavily MCP server Update your MCP server's name, URL (including the API key), server type, and other necessary settings. When configured correctly, the available tools will be displayed. @@ -110,7 +113,7 @@ On the canvas, click the newly-populated Tavily server to view and select its av Click the dropdown menu of **Model** to show the model configuration window. -- **Model**: The chat model to use. +- **Model**: The chat model to use. - Ensure you set the chat model correctly on the **Model providers** page. - You can use different models for different components to increase flexibility or improve overall performance. - **Creativity**: A shortcut to **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty** settings, indicating the freedom level of the model. From **Improvise**, **Precise**, to **Balance**, each preset configuration corresponds to a unique combination of **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty**. @@ -118,21 +121,21 @@ Click the dropdown menu of **Model** to show the model configuration window. - **Improvise**: Produces more creative responses. - **Precise**: (Default) Produces more conservative responses. - **Balance**: A middle ground between **Improvise** and **Precise**. -- **Temperature**: The randomness level of the model's output. +- **Temperature**: The randomness level of the model's output. Defaults to 0.1. - Lower values lead to more deterministic and predictable outputs. - Higher values lead to more creative and varied outputs. - A temperature of zero results in the same output for the same prompt. -- **Top P**: Nucleus sampling. +- **Top P**: Nucleus sampling. - Reduces the likelihood of generating repetitive or unnatural text by setting a threshold *P* and restricting the sampling to tokens with a cumulative probability exceeding *P*. - Defaults to 0.3. -- **Presence penalty**: Encourages the model to include a more diverse range of tokens in the response. +- **Presence penalty**: Encourages the model to include a more diverse range of tokens in the response. - A higher **presence penalty** value results in the model being more likely to generate tokens not yet been included in the generated text. - Defaults to 0.4. -- **Frequency penalty**: Discourages the model from repeating the same words or phrases too frequently in the generated text. +- **Frequency penalty**: Discourages the model from repeating the same words or phrases too frequently in the generated text. - A higher **frequency penalty** value results in the model being more conservative in its use of repeated tokens. - Defaults to 0.7. -- **Max tokens**: +- **Max tokens**: This sets the maximum length of the model's output, measured in the number of tokens (words or pieces of words). It is disabled by default, allowing the model to determine the number of tokens in its responses. :::tip NOTE @@ -142,7 +145,7 @@ Click the dropdown menu of **Model** to show the model configuration window. ### System prompt -Typically, you use the system prompt to describe the task for the LLM, specify how it should respond, and outline other miscellaneous requirements. We do not plan to elaborate on this topic, as it can be as extensive as prompt engineering. However, please be aware that the system prompt is often used in conjunction with keys (variables), which serve as various data inputs for the LLM. +Typically, you use the system prompt to describe the task for the LLM, specify how it should respond, and outline other miscellaneous requirements. We do not plan to elaborate on this topic, as it can be as extensive as prompt engineering. However, please be aware that the system prompt is often used in conjunction with keys (variables), which serve as various data inputs for the LLM. An **Agent** component relies on keys (variables) to specify its data inputs. Its immediate upstream component is *not* necessarily its data input, and the arrows in the workflow indicate *only* the processing sequence. Keys in a **Agent** component are used in conjunction with the system prompt to specify data inputs for the LLM. Use a forward slash `/` or the **(x)** button to show the keys to use. @@ -190,11 +193,11 @@ From v0.20.5 onwards, four framework-level prompt blocks are available in the ** The user-defined prompt. Defaults to `sys.query`, the user query. As a general rule, when using the **Agent** component as a standalone module (not as a planner), you usually need to specify the corresponding **Retrieval** component’s output variable (`formalized_content`) here as part of the input to the LLM. -### Tools +### Tools You can use an **Agent** component as a collaborator that reasons and reflects with the aid of other tools; for instance, **Retrieval** can serve as one such tool for an **Agent**. -### Agent +### Agent You use an **Agent** component as a collaborator that reasons and reflects with the aid of subagents or other tools, forming a multi-agent system. diff --git a/docs/guides/agent/agent_component_reference/await_response.mdx b/docs/guides/agent/agent_component_reference/await_response.mdx index 973e1dfa5e6..4f30c38d09f 100644 --- a/docs/guides/agent/agent_component_reference/await_response.mdx +++ b/docs/guides/agent/agent_component_reference/await_response.mdx @@ -1,6 +1,9 @@ --- sidebar_position: 5 slug: /await_response +sidebar_custom_props: { + categoryIcon: LucideMessageSquareDot +} --- # Await response component @@ -23,7 +26,7 @@ Whether to show the message defined in the **Message** field. ### Message -The static message to send out. +The static message to send out. Click **+ Add message** to add message options. When multiple messages are supplied, the **Message** component randomly selects one to send. @@ -31,9 +34,9 @@ Click **+ Add message** to add message options. When multiple messages are suppl You can define global variables within the **Await response** component, which can be either mandatory or optional. Once set, users will need to provide values for these variables when engaging with the agent. Click **+** to add a global variable, each with the following attributes: -- **Name**: _Required_ - A descriptive name providing additional details about the variable. -- **Type**: _Required_ +- **Name**: _Required_ + A descriptive name providing additional details about the variable. +- **Type**: _Required_ The type of the variable: - **Single-line text**: Accepts a single line of text without line breaks. - **Paragraph text**: Accepts multiple lines of text, including line breaks. @@ -41,7 +44,7 @@ You can define global variables within the **Await response** component, which c - **file upload**: Requires the user to upload one or multiple files. - **Number**: Accepts a number as input. - **Boolean**: Requires the user to toggle between on and off. -- **Key**: _Required_ +- **Key**: _Required_ The unique variable name. - **Optional**: A toggle indicating whether the variable is optional. diff --git a/docs/guides/agent/agent_component_reference/begin.mdx b/docs/guides/agent/agent_component_reference/begin.mdx index c265bd2c6a8..921ed898b9d 100644 --- a/docs/guides/agent/agent_component_reference/begin.mdx +++ b/docs/guides/agent/agent_component_reference/begin.mdx @@ -1,6 +1,9 @@ --- sidebar_position: 1 slug: /begin_component +sidebar_custom_props: { + categoryIcon: LucideHome +} --- # Begin component @@ -36,9 +39,9 @@ An agent in conversational mode begins with an opening greeting. It is the agent You can define global variables within the **Begin** component, which can be either mandatory or optional. Once set, users will need to provide values for these variables when engaging with the agent. Click **+ Add variable** to add a global variable, each with the following attributes: -- **Name**: _Required_ - A descriptive name providing additional details about the variable. -- **Type**: _Required_ +- **Name**: _Required_ + A descriptive name providing additional details about the variable. +- **Type**: _Required_ The type of the variable: - **Single-line text**: Accepts a single line of text without line breaks. - **Paragraph text**: Accepts multiple lines of text, including line breaks. @@ -46,7 +49,7 @@ You can define global variables within the **Begin** component, which can be eit - **file upload**: Requires the user to upload one or multiple files. - **Number**: Accepts a number as input. - **Boolean**: Requires the user to toggle between on and off. -- **Key**: _Required_ +- **Key**: _Required_ The unique variable name. - **Optional**: A toggle indicating whether the variable is optional. diff --git a/docs/guides/agent/agent_component_reference/categorize.mdx b/docs/guides/agent/agent_component_reference/categorize.mdx index a40cc3731de..9c710318e05 100644 --- a/docs/guides/agent/agent_component_reference/categorize.mdx +++ b/docs/guides/agent/agent_component_reference/categorize.mdx @@ -1,11 +1,14 @@ --- sidebar_position: 8 slug: /categorize_component +sidebar_custom_props: { + categoryIcon: LucideSwatchBook +} --- # Categorize component -A component that classifies user inputs and applies strategies accordingly. +A component that classifies user inputs and applies strategies accordingly. --- @@ -23,7 +26,7 @@ A **Categorize** component is essential when you need the LLM to help you identi Select the source for categorization. -The **Categorize** component relies on query variables to specify its data inputs (queries). All global variables defined before the **Categorize** component are available in the dropdown list. +The **Categorize** component relies on query variables to specify its data inputs (queries). All global variables defined before the **Categorize** component are available in the dropdown list. ### Input @@ -31,7 +34,7 @@ The **Categorize** component relies on query variables to specify its data input The **Categorize** component relies on input variables to specify its data inputs (queries). Click **+ Add variable** in the **Input** section to add the desired input variables. There are two types of input variables: **Reference** and **Text**. - **Reference**: Uses a component's output or a user input as the data source. You are required to select from the dropdown menu: - - A component ID under **Component Output**, or + - A component ID under **Component Output**, or - A global variable under **Begin input**, which is defined in the **Begin** component. - **Text**: Uses fixed text as the query. You are required to enter static text. @@ -39,29 +42,29 @@ The **Categorize** component relies on input variables to specify its data input Click the dropdown menu of **Model** to show the model configuration window. -- **Model**: The chat model to use. +- **Model**: The chat model to use. - Ensure you set the chat model correctly on the **Model providers** page. - You can use different models for different components to increase flexibility or improve overall performance. - **Creativity**: A shortcut to **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty** settings, indicating the freedom level of the model. From **Improvise**, **Precise**, to **Balance**, each preset configuration corresponds to a unique combination of **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty**. - This parameter has three options: + This parameter has three options: - **Improvise**: Produces more creative responses. - **Precise**: (Default) Produces more conservative responses. - **Balance**: A middle ground between **Improvise** and **Precise**. -- **Temperature**: The randomness level of the model's output. - Defaults to 0.1. +- **Temperature**: The randomness level of the model's output. + Defaults to 0.1. - Lower values lead to more deterministic and predictable outputs. - Higher values lead to more creative and varied outputs. - A temperature of zero results in the same output for the same prompt. -- **Top P**: Nucleus sampling. +- **Top P**: Nucleus sampling. - Reduces the likelihood of generating repetitive or unnatural text by setting a threshold *P* and restricting the sampling to tokens with a cumulative probability exceeding *P*. - Defaults to 0.3. -- **Presence penalty**: Encourages the model to include a more diverse range of tokens in the response. +- **Presence penalty**: Encourages the model to include a more diverse range of tokens in the response. - A higher **presence penalty** value results in the model being more likely to generate tokens not yet been included in the generated text. - Defaults to 0.4. -- **Frequency penalty**: Discourages the model from repeating the same words or phrases too frequently in the generated text. +- **Frequency penalty**: Discourages the model from repeating the same words or phrases too frequently in the generated text. - A higher **frequency penalty** value results in the model being more conservative in its use of repeated tokens. - Defaults to 0.7. -- **Max tokens**: +- **Max tokens**: This sets the maximum length of the model's output, measured in the number of tokens (words or pieces of words). It is disabled by default, allowing the model to determine the number of tokens in its responses. :::tip NOTE @@ -81,7 +84,7 @@ This feature is used for multi-turn dialogue *only*. If your **Categorize** comp ### Category name -A **Categorize** component must have at least two categories. This field sets the name of the category. Click **+ Add Item** to include the intended categories. +A **Categorize** component must have at least two categories. This field sets the name of the category. Click **+ Add Item** to include the intended categories. :::tip NOTE You will notice that the category name is auto-populated. No worries. Each category is assigned a random name upon creation. Feel free to change it to a name that is understandable to the LLM. @@ -89,7 +92,7 @@ You will notice that the category name is auto-populated. No worries. Each categ #### Description -Description of this category. +Description of this category. You can input criteria, situation, or information that may help the LLM determine which inputs belong in this category. diff --git a/docs/guides/agent/agent_component_reference/chunker_title.md b/docs/guides/agent/agent_component_reference/chunker_title.md index 27b8a97ce59..f75d8796efc 100644 --- a/docs/guides/agent/agent_component_reference/chunker_title.md +++ b/docs/guides/agent/agent_component_reference/chunker_title.md @@ -1,6 +1,9 @@ --- sidebar_position: 31 slug: /chunker_title_component +sidebar_custom_props: { + categoryIcon: LucideBlocks +} --- # Title chunker component @@ -23,7 +26,7 @@ Placing a **Title chunker** after a **Token chunker** is invalid and will cause ### Hierarchy -Specifies the heading level to define chunk boundaries: +Specifies the heading level to define chunk boundaries: - H1 - H2 diff --git a/docs/guides/agent/agent_component_reference/chunker_token.md b/docs/guides/agent/agent_component_reference/chunker_token.md index d93f0ea4288..8f96230151b 100644 --- a/docs/guides/agent/agent_component_reference/chunker_token.md +++ b/docs/guides/agent/agent_component_reference/chunker_token.md @@ -1,6 +1,9 @@ --- sidebar_position: 32 slug: /chunker_token_component +sidebar_custom_props: { + categoryIcon: LucideBlocks +} --- # Token chunker component diff --git a/docs/guides/agent/agent_component_reference/code.mdx b/docs/guides/agent/agent_component_reference/code.mdx index ea483158148..a9b9c82b8be 100644 --- a/docs/guides/agent/agent_component_reference/code.mdx +++ b/docs/guides/agent/agent_component_reference/code.mdx @@ -1,6 +1,9 @@ --- sidebar_position: 13 slug: /code_component +sidebar_custom_props: { + categoryIcon: LucideCodeXml +} --- # Code component @@ -33,7 +36,7 @@ If your RAGFlow Sandbox is not working, please be sure to consult the [Troublesh ### 3. (Optional) Install necessary dependencies -If you need to import your own Python or JavaScript packages into Sandbox, please follow the commands provided in the [How to import my own Python or JavaScript packages into Sandbox?](#how-to-import-my-own-python-or-javascript-packages-into-sandbox) section to install the additional dependencies. +If you need to import your own Python or JavaScript packages into Sandbox, please follow the commands provided in the [How to import my own Python or JavaScript packages into Sandbox?](#how-to-import-my-own-python-or-javascript-packages-into-sandbox) section to install the additional dependencies. ### 4. Enable Sandbox-specific settings in RAGFlow @@ -43,11 +46,11 @@ Ensure all Sandbox-specific settings are enabled in **ragflow/docker/.env**. Any changes to the configuration or environment *require* a full service restart to take effect. -## Configurations +## Configurations ### Input -You can specify multiple input sources for the **Code** component. Click **+ Add variable** in the **Input variables** section to include the desired input variables. +You can specify multiple input sources for the **Code** component. Click **+ Add variable** in the **Input variables** section to include the desired input variables. ### Code @@ -59,7 +62,7 @@ If your code implementation includes defined variables, whether input or output #### A Python code example -```Python +```Python def main(arg1: str, arg2: str) -> dict: return { "result": arg1 + arg2, @@ -102,7 +105,7 @@ The defined output variable(s) will be auto-populated here. ### `HTTPConnectionPool(host='sandbox-executor-manager', port=9385): Read timed out.` -**Root cause** +**Root cause** - You did not properly install gVisor and `runsc` was not recognized as a valid Docker runtime. - You did not pull the required base images for the runners and no runner was started. @@ -144,11 +147,11 @@ docker build -t sandbox-executor-manager:latest ./sandbox/executor_manager ### `HTTPConnectionPool(host='none', port=9385): Max retries exceeded.` -**Root cause** +**Root cause** `sandbox-executor-manager` is not mapped in `/etc/hosts`. -**Solution** +**Solution** Add a new entry to `/etc/hosts`: @@ -156,11 +159,11 @@ Add a new entry to `/etc/hosts`: ### `Container pool is busy` -**Root cause** +**Root cause** -All runners are currently in use, executing tasks. +All runners are currently in use, executing tasks. -**Solution** +**Solution** Please try again shortly or increase the pool size in the configuration to improve availability and reduce waiting times. @@ -205,7 +208,7 @@ To import your JavaScript packages, navigate to `sandbox_base_image/nodejs` and (ragflow) ➜ ragflow/sandbox main ✓ cd sandbox_base_image/nodejs -(ragflow) ➜ ragflow/sandbox/sandbox_base_image/nodejs main ✓ npm install lodash +(ragflow) ➜ ragflow/sandbox/sandbox_base_image/nodejs main ✓ npm install lodash (ragflow) ➜ ragflow/sandbox/sandbox_base_image/nodejs main ✓ cd ../.. # go back to sandbox root directory diff --git a/docs/guides/agent/agent_component_reference/execute_sql.md b/docs/guides/agent/agent_component_reference/execute_sql.md index 47561eccb0f..23786df6d7b 100644 --- a/docs/guides/agent/agent_component_reference/execute_sql.md +++ b/docs/guides/agent/agent_component_reference/execute_sql.md @@ -1,6 +1,9 @@ --- sidebar_position: 25 slug: /execute_sql +sidebar_custom_props: { + categoryIcon: RagSql +} --- # Execute SQL tool @@ -9,7 +12,7 @@ A tool that execute SQL queries on a specified relational database. --- -The **Execute SQL** tool enables you to connect to a relational database and run SQL queries, whether entered directly or generated by the system’s Text2SQL capability via an **Agent** component. +The **Execute SQL** tool enables you to connect to a relational database and run SQL queries, whether entered directly or generated by the system’s Text2SQL capability via an **Agent** component. ## Prerequisites diff --git a/docs/guides/agent/agent_component_reference/http.md b/docs/guides/agent/agent_component_reference/http.md index 51277f0182d..6de2f0e45a3 100644 --- a/docs/guides/agent/agent_component_reference/http.md +++ b/docs/guides/agent/agent_component_reference/http.md @@ -1,11 +1,14 @@ --- sidebar_position: 30 slug: /http_request_component +sidebar_custom_props: { + categoryIcon: RagHTTP +} --- # HTTP request component -A component that calls remote services. +A component that calls remote services. --- diff --git a/docs/guides/agent/agent_component_reference/indexer.md b/docs/guides/agent/agent_component_reference/indexer.md index 5bc2d925e10..236ab6e688b 100644 --- a/docs/guides/agent/agent_component_reference/indexer.md +++ b/docs/guides/agent/agent_component_reference/indexer.md @@ -1,6 +1,9 @@ --- sidebar_position: 40 slug: /indexer_component +sidebar_custom_props: { + categoryIcon: LucideListPlus +} --- # Indexer component diff --git a/docs/guides/agent/agent_component_reference/iteration.mdx b/docs/guides/agent/agent_component_reference/iteration.mdx index 9d4907d8773..3ec4998e792 100644 --- a/docs/guides/agent/agent_component_reference/iteration.mdx +++ b/docs/guides/agent/agent_component_reference/iteration.mdx @@ -1,6 +1,9 @@ --- sidebar_position: 7 slug: /iteration_component +sidebar_custom_props: { + categoryIcon: LucideRepeat2 +} --- # Iteration component @@ -9,12 +12,12 @@ A component that splits text input into text segments and iterates a predefined --- -An **Interaction** component can divide text input into text segments and apply its built-in component workflow to each segment. +An **Interaction** component can divide text input into text segments and apply its built-in component workflow to each segment. ## Scenario -An **Iteration** component is essential when a workflow loop is required and the loop count is *not* fixed but depends on number of segments created from the output of specific agent components. +An **Iteration** component is essential when a workflow loop is required and the loop count is *not* fixed but depends on number of segments created from the output of specific agent components. - If, for instance, you plan to feed several paragraphs into an LLM for content generation, each with its own focus, and feeding them to the LLM all at once could create confusion or contradictions, then you can use an **Iteration** component, which encapsulates a **Generate** component, to repeat the content generation process for each paragraph. - Another example: If you wish to use the LLM to translate a lengthy paper into a target language without exceeding its token limit, consider using an **Iteration** component, which encapsulates a **Generate** component, to break the paper into smaller pieces and repeat the translation process for each one. @@ -29,12 +32,12 @@ Each **Iteration** component includes an internal **IterationItem** component. T The **IterationItem** component is visible *only* to the components encapsulated by the current **Iteration** components. ::: -### Build an internal workflow +### Build an internal workflow You are allowed to pull other components into the **Iteration** component to build an internal workflow, and these "added internal components" are no longer visible to components outside of the current **Iteration** component. :::danger IMPORTANT -To reference the created text segments from an added internal component, simply add a **Reference** variable that equals **IterationItem** within the **Input** section of that internal component. There is no need to reference the corresponding external component, as the **IterationItem** component manages the loop of the workflow for all created text segments. +To reference the created text segments from an added internal component, simply add a **Reference** variable that equals **IterationItem** within the **Input** section of that internal component. There is no need to reference the corresponding external component, as the **IterationItem** component manages the loop of the workflow for all created text segments. ::: :::tip NOTE @@ -48,7 +51,7 @@ An added internal component can reference an external component when necessary. The **Iteration** component uses input variables to specify its data inputs, namely the texts to be segmented. You are allowed to specify multiple input sources for the **Iteration** component. Click **+ Add variable** in the **Input** section to include the desired input variables. There are two types of input variables: **Reference** and **Text**. - **Reference**: Uses a component's output or a user input as the data source. You are required to select from the dropdown menu: - - A component ID under **Component Output**, or + - A component ID under **Component Output**, or - A global variable under **Begin input**, which is defined in the **Begin** component. - **Text**: Uses fixed text as the query. You are required to enter static text. diff --git a/docs/guides/agent/agent_component_reference/message.mdx b/docs/guides/agent/agent_component_reference/message.mdx index 9e12ba547d4..a049e3a895d 100644 --- a/docs/guides/agent/agent_component_reference/message.mdx +++ b/docs/guides/agent/agent_component_reference/message.mdx @@ -1,6 +1,9 @@ --- sidebar_position: 4 slug: /message_component +sidebar_custom_props: { + categoryIcon: LucideMessageSquareReply +} --- # Message component diff --git a/docs/guides/agent/agent_component_reference/parser.md b/docs/guides/agent/agent_component_reference/parser.md index 0eb0f6bff2d..8dcb702cf66 100644 --- a/docs/guides/agent/agent_component_reference/parser.md +++ b/docs/guides/agent/agent_component_reference/parser.md @@ -1,6 +1,9 @@ --- sidebar_position: 30 slug: /parser_component +sidebar_custom_props: { + categoryIcon: LucideFilePlay +} --- # Parser component @@ -54,12 +57,12 @@ Starting from v0.22.0, RAGFlow includes MinerU (≥ 2.6.3) as an optional PDF p - `"vlm-mlx-engine"` - `"vlm-vllm-async-engine"` - `"vlm-lmdeploy-engine"`. - - `MINERU_SERVER_URL`: (optional) The downstream vLLM HTTP server (e.g., `http://vllm-host:30000`). Applicable when `MINERU_BACKEND` is set to `"vlm-http-client"`. + - `MINERU_SERVER_URL`: (optional) The downstream vLLM HTTP server (e.g., `http://vllm-host:30000`). Applicable when `MINERU_BACKEND` is set to `"vlm-http-client"`. - `MINERU_OUTPUT_DIR`: (optional) The local directory for holding the outputs of the MinerU API service (zip/JSON) before ingestion. - `MINERU_DELETE_OUTPUT`: Whether to delete temporary output when a temporary directory is used: - `1`: Delete. - `0`: Retain. -3. In the web UI, navigate to your dataset's **Configuration** page and find the **Ingestion pipeline** section: +3. In the web UI, navigate to your dataset's **Configuration** page and find the **Ingestion pipeline** section: - If you decide to use a chunking method from the **Built-in** dropdown, ensure it supports PDF parsing, then select **MinerU** from the **PDF parser** dropdown. - If you use a custom ingestion pipeline instead, select **MinerU** in the **PDF parser** section of the **Parser** component. diff --git a/docs/guides/agent/agent_component_reference/retrieval.mdx b/docs/guides/agent/agent_component_reference/retrieval.mdx index 1f88669cfa2..3adc2ab932e 100644 --- a/docs/guides/agent/agent_component_reference/retrieval.mdx +++ b/docs/guides/agent/agent_component_reference/retrieval.mdx @@ -1,6 +1,9 @@ --- sidebar_position: 3 slug: /retrieval_component +sidebar_custom_props: { + categoryIcon: LucideFolderSearch +} --- # Retrieval component @@ -21,13 +24,13 @@ Ensure you [have properly configured your target dataset(s)](../../dataset/confi ## Quickstart -### 1. Click on a **Retrieval** component to show its configuration panel +### 1. Click on a **Retrieval** component to show its configuration panel The corresponding configuration panel appears to the right of the canvas. Use this panel to define and fine-tune the **Retrieval** component's search behavior. ### 2. Input query variable(s) -The **Retrieval** component depends on query variables to specify its queries. +The **Retrieval** component depends on query variables to specify its queries. :::caution IMPORTANT - If you use the **Retrieval** component as a standalone workflow module, input query variables in the **Input Variables** text box. @@ -74,7 +77,7 @@ Select the query source for retrieval. Defaults to `sys.query`, which is the def The **Retrieval** component relies on query variables to specify its queries. All global variables defined before the **Retrieval** component can also be used as queries. Use the `(x)` button or type `/` to show all the available query variables. -### Knowledge bases +### Knowledge bases Select the dataset(s) to retrieve data from. @@ -110,7 +113,7 @@ Using a rerank model will *significantly* increase the system's response time. ### Empty response -- Set this as a response if no results are retrieved from the dataset(s) for your query, or +- Set this as a response if no results are retrieved from the dataset(s) for your query, or - Leave this field blank to allow the chat model to improvise when nothing is found. :::caution WARNING diff --git a/docs/guides/agent/agent_component_reference/switch.mdx b/docs/guides/agent/agent_component_reference/switch.mdx index 1840e666a49..fe90923302e 100644 --- a/docs/guides/agent/agent_component_reference/switch.mdx +++ b/docs/guides/agent/agent_component_reference/switch.mdx @@ -1,11 +1,14 @@ --- sidebar_position: 6 slug: /switch_component +sidebar_custom_props: { + categoryIcon: LucideSplit +} --- # Switch component -A component that evaluates whether specified conditions are met and directs the follow of execution accordingly. +A component that evaluates whether specified conditions are met and directs the follow of execution accordingly. --- @@ -13,7 +16,7 @@ A **Switch** component evaluates conditions based on the output of specific comp ## Scenarios -A **Switch** component is essential for condition-based direction of execution flow. While it shares similarities with the [Categorize](./categorize.mdx) component, which is also used in multi-pronged strategies, the key distinction lies in their approach: the evaluation of the **Switch** component is rule-based, whereas the **Categorize** component involves AI and uses an LLM for decision-making. +A **Switch** component is essential for condition-based direction of execution flow. While it shares similarities with the [Categorize](./categorize.mdx) component, which is also used in multi-pronged strategies, the key distinction lies in their approach: the evaluation of the **Switch** component is rule-based, whereas the **Categorize** component involves AI and uses an LLM for decision-making. ## Configurations @@ -39,12 +42,12 @@ When you have added multiple conditions for a specific case, a **Logical operato - Greater equal - Less than - Less equal - - Contains - - Not contains + - Contains + - Not contains - Starts with - Ends with - Is empty - Not empty -- **Value**: A single value, which can be an integer, float, or string. +- **Value**: A single value, which can be an integer, float, or string. - Delimiters, multiple values, or expressions are *not* supported. diff --git a/docs/guides/agent/agent_component_reference/text_processing.mdx b/docs/guides/agent/agent_component_reference/text_processing.mdx index 626ae67bf3e..bfc0d9dd422 100644 --- a/docs/guides/agent/agent_component_reference/text_processing.mdx +++ b/docs/guides/agent/agent_component_reference/text_processing.mdx @@ -1,6 +1,9 @@ --- sidebar_position: 15 slug: /text_processing +sidebar_custom_props: { + categoryIcon: LucideType +} --- # Text processing component @@ -24,7 +27,7 @@ Appears only when you select **Split** as method. The variable to be split. Type `/` to quickly insert variables. -### Script +### Script Template for the merge. Appears only when you select **Merge** as method. Type `/` to quickly insert variables. diff --git a/docs/guides/agent/agent_component_reference/transformer.md b/docs/guides/agent/agent_component_reference/transformer.md index ad8274ac4ee..7afcf4de8aa 100644 --- a/docs/guides/agent/agent_component_reference/transformer.md +++ b/docs/guides/agent/agent_component_reference/transformer.md @@ -1,6 +1,9 @@ --- sidebar_position: 37 slug: /transformer_component +sidebar_custom_props: { + categoryIcon: LucideFileStack +} --- # Transformer component @@ -13,7 +16,7 @@ A **Transformer** component indexes chunks and configures their storage formats ## Scenario -A **Transformer** component is essential when you need the LLM to extract new information, such as keywords, questions, metadata, and summaries, from the original chunks. +A **Transformer** component is essential when you need the LLM to extract new information, such as keywords, questions, metadata, and summaries, from the original chunks. ## Configurations @@ -21,29 +24,29 @@ A **Transformer** component is essential when you need the LLM to extract new in Click the dropdown menu of **Model** to show the model configuration window. -- **Model**: The chat model to use. +- **Model**: The chat model to use. - Ensure you set the chat model correctly on the **Model providers** page. - You can use different models for different components to increase flexibility or improve overall performance. -- **Creativity**: A shortcut to **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty** settings, indicating the freedom level of the model. From **Improvise**, **Precise**, to **Balance**, each preset configuration corresponds to a unique combination of **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty**. +- **Creativity**: A shortcut to **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty** settings, indicating the freedom level of the model. From **Improvise**, **Precise**, to **Balance**, each preset configuration corresponds to a unique combination of **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty**. This parameter has three options: - **Improvise**: Produces more creative responses. - **Precise**: (Default) Produces more conservative responses. - **Balance**: A middle ground between **Improvise** and **Precise**. -- **Temperature**: The randomness level of the model's output. +- **Temperature**: The randomness level of the model's output. Defaults to 0.1. - Lower values lead to more deterministic and predictable outputs. - Higher values lead to more creative and varied outputs. - A temperature of zero results in the same output for the same prompt. -- **Top P**: Nucleus sampling. +- **Top P**: Nucleus sampling. - Reduces the likelihood of generating repetitive or unnatural text by setting a threshold *P* and restricting the sampling to tokens with a cumulative probability exceeding *P*. - Defaults to 0.3. -- **Presence penalty**: Encourages the model to include a more diverse range of tokens in the response. +- **Presence penalty**: Encourages the model to include a more diverse range of tokens in the response. - A higher **presence penalty** value results in the model being more likely to generate tokens not yet been included in the generated text. - Defaults to 0.4. -- **Frequency penalty**: Discourages the model from repeating the same words or phrases too frequently in the generated text. +- **Frequency penalty**: Discourages the model from repeating the same words or phrases too frequently in the generated text. - A higher **frequency penalty** value results in the model being more conservative in its use of repeated tokens. - Defaults to 0.7. -- **Max tokens**: +- **Max tokens**: This sets the maximum length of the model's output, measured in the number of tokens (words or pieces of words). It is disabled by default, allowing the model to determine the number of tokens in its responses. :::tip NOTE @@ -62,7 +65,7 @@ Select the type of output to be generated by the LLM: ### System prompt -Typically, you use the system prompt to describe the task for the LLM, specify how it should respond, and outline other miscellaneous requirements. We do not plan to elaborate on this topic, as it can be as extensive as prompt engineering. +Typically, you use the system prompt to describe the task for the LLM, specify how it should respond, and outline other miscellaneous requirements. We do not plan to elaborate on this topic, as it can be as extensive as prompt engineering. :::tip NOTE The system prompt here automatically updates to match your selected **Result destination**. diff --git a/docs/guides/agent/agent_introduction.md b/docs/guides/agent/agent_introduction.md index fa21a781062..87d35dbc51c 100644 --- a/docs/guides/agent/agent_introduction.md +++ b/docs/guides/agent/agent_introduction.md @@ -1,6 +1,9 @@ --- sidebar_position: 1 slug: /agent_introduction +sidebar_custom_props: { + categoryIcon: LucideBookOpenText +} --- # Introduction to agents @@ -24,7 +27,7 @@ Agents and RAG are complementary techniques, each enhancing the other’s capabi :::tip NOTE -Before proceeding, ensure that: +Before proceeding, ensure that: 1. You have properly set the LLM to use. See the guides on [Configure your API key](../models/llm_api_key_setup.md) or [Deploy a local LLM](../models/deploy_local_llm.mdx) for more information. 2. You have a dataset configured and the corresponding files properly parsed. See the guide on [Configure a dataset](../dataset/configure_knowledge_base.md) for more information. @@ -41,7 +44,7 @@ We also provide templates catered to different business scenarios. You can eithe ![agent_template](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/agent_template_list.jpg) -2. To create an agent from scratch, click **Create Agent**. Alternatively, to create an agent from one of our templates, click the desired card, such as **Deep Research**, name your agent in the pop-up dialogue, and click **OK** to confirm. +2. To create an agent from scratch, click **Create Agent**. Alternatively, to create an agent from one of our templates, click the desired card, such as **Deep Research**, name your agent in the pop-up dialogue, and click **OK** to confirm. *You are now taken to the **no-code workflow editor** page.* diff --git a/docs/guides/agent/best_practices/_category_.json b/docs/guides/agent/best_practices/_category_.json index c788383c044..e06d81d632a 100644 --- a/docs/guides/agent/best_practices/_category_.json +++ b/docs/guides/agent/best_practices/_category_.json @@ -4,5 +4,8 @@ "link": { "type": "generated-index", "description": "Best practices on Agent configuration." + }, + "customProps": { + "categoryIcon": "LucideStar" } } diff --git a/docs/guides/agent/embed_agent_into_webpage.md b/docs/guides/agent/embed_agent_into_webpage.md index 1b532c4d724..5b4644c3444 100644 --- a/docs/guides/agent/embed_agent_into_webpage.md +++ b/docs/guides/agent/embed_agent_into_webpage.md @@ -1,6 +1,9 @@ --- sidebar_position: 3 slug: /embed_agent_into_webpage +sidebar_custom_props: { + categoryIcon: LucideMonitorDot +} --- # Embed agent into webpage diff --git a/docs/guides/agent/sandbox_quickstart.md b/docs/guides/agent/sandbox_quickstart.md index 5baa935a844..2ea3ed0fbdf 100644 --- a/docs/guides/agent/sandbox_quickstart.md +++ b/docs/guides/agent/sandbox_quickstart.md @@ -1,13 +1,16 @@ --- sidebar_position: 20 slug: /sandbox_quickstart +sidebar_custom_props: { + categoryIcon: LucideCodesandbox +} --- # Sandbox quickstart A secure, pluggable code execution backend designed for RAGFlow and other applications requiring isolated code execution environments. -## Features: +## Features: - Seamless RAGFlow Integration — Works out-of-the-box with the code component of RAGFlow. - High Security — Uses gVisor for syscall-level sandboxing to isolate execution. @@ -55,7 +58,7 @@ Next, build the executor manager image: docker build -t sandbox-executor-manager:latest ./executor_manager ``` -## Running with RAGFlow +## Running with RAGFlow 1. Verify that gVisor is properly installed and operational. diff --git a/docs/guides/ai_search.md b/docs/guides/ai_search.md index 6bd5336006d..609192a21dc 100644 --- a/docs/guides/ai_search.md +++ b/docs/guides/ai_search.md @@ -1,6 +1,9 @@ --- sidebar_position: 2 slug: /ai_search +sidebar_custom_props: { + categoryIcon: LucideSearch +} --- # Search @@ -9,7 +12,7 @@ Conduct an AI search. --- -An AI search is a single-turn AI conversation using a predefined retrieval strategy (a hybrid search of weighted keyword similarity and weighted vector similarity) and the system's default chat model. It does not involve advanced RAG strategies like knowledge graph, auto-keyword, or auto-question. The related chunks are listed below the chat model's response in descending order based on their similarity scores. +An AI search is a single-turn AI conversation using a predefined retrieval strategy (a hybrid search of weighted keyword similarity and weighted vector similarity) and the system's default chat model. It does not involve advanced RAG strategies like knowledge graph, auto-keyword, or auto-question. The related chunks are listed below the chat model's response in descending order based on their similarity scores. ![Create search app](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/create_search_app.jpg) diff --git a/docs/guides/chat/_category_.json b/docs/guides/chat/_category_.json index 4b33e0c7b3d..d55b914ec73 100644 --- a/docs/guides/chat/_category_.json +++ b/docs/guides/chat/_category_.json @@ -4,5 +4,8 @@ "link": { "type": "generated-index", "description": "Chat-specific guides." + }, + "customProps": { + "categoryIcon": "LucideMessagesSquare" } } diff --git a/docs/guides/chat/best_practices/_category_.json b/docs/guides/chat/best_practices/_category_.json index e92bb793db6..a0e97731fba 100644 --- a/docs/guides/chat/best_practices/_category_.json +++ b/docs/guides/chat/best_practices/_category_.json @@ -4,5 +4,8 @@ "link": { "type": "generated-index", "description": "Best practices on chat assistant configuration." + }, + "customProps": { + "categoryIcon": "LucideStar" } } diff --git a/docs/guides/chat/implement_deep_research.md b/docs/guides/chat/implement_deep_research.md index b5edd2d92f0..ec6d8ee8d7d 100644 --- a/docs/guides/chat/implement_deep_research.md +++ b/docs/guides/chat/implement_deep_research.md @@ -1,6 +1,9 @@ --- sidebar_position: 3 slug: /implement_deep_research +sidebar_custom_props: { + categoryIcon: LucideScanSearch +} --- # Implement deep research diff --git a/docs/guides/chat/set_chat_variables.md b/docs/guides/chat/set_chat_variables.md index 00f1a58c71c..a6507a8a7e9 100644 --- a/docs/guides/chat/set_chat_variables.md +++ b/docs/guides/chat/set_chat_variables.md @@ -1,6 +1,9 @@ --- sidebar_position: 4 slug: /set_chat_variables +sidebar_custom_props: { + categoryIcon: LucideVariable +} --- # Set variables @@ -91,7 +94,7 @@ from ragflow_sdk import RAGFlow rag_object = RAGFlow(api_key="", base_url="http://:9380") assistant = rag_object.list_chats(name="Miss R") assistant = assistant[0] -session = assistant.create_session() +session = assistant.create_session() print("\n==================== Miss R =====================\n") print("Hello. What can I do for you?") @@ -99,9 +102,9 @@ print("Hello. What can I do for you?") while True: question = input("\n==================== User =====================\n> ") style = input("Please enter your preferred style (e.g., formal, informal, hilarious): ") - + print("\n==================== Miss R =====================\n") - + cont = "" for ans in session.ask(question, stream=True, style=style): print(ans.content[len(cont):], end='', flush=True) diff --git a/docs/guides/chat/start_chat.md b/docs/guides/chat/start_chat.md index 1e0dd0f10f0..279ea62304f 100644 --- a/docs/guides/chat/start_chat.md +++ b/docs/guides/chat/start_chat.md @@ -1,6 +1,9 @@ --- sidebar_position: 1 slug: /start_chat +sidebar_custom_props: { + categoryIcon: LucideBot +} --- # Start AI chat @@ -42,8 +45,8 @@ You start an AI conversation by creating an assistant. - **Rerank model** sets the reranker model to use. It is left empty by default. - If **Rerank model** is left empty, the hybrid score system uses keyword similarity and vector similarity, and the default weight assigned to the vector similarity component is 1-0.7=0.3. - If **Rerank model** is selected, the hybrid score system uses keyword similarity and reranker score, and the default weight assigned to the reranker score is 1-0.7=0.3. - - [Cross-language search](../../references/glossary.mdx#cross-language-search): Optional - Select one or more target languages from the dropdown menu. The system’s default chat model will then translate your query into the selected target language(s). This translation ensures accurate semantic matching across languages, allowing you to retrieve relevant results regardless of language differences. + - [Cross-language search](../../references/glossary.mdx#cross-language-search): Optional + Select one or more target languages from the dropdown menu. The system’s default chat model will then translate your query into the selected target language(s). This translation ensures accurate semantic matching across languages, allowing you to retrieve relevant results regardless of language differences. - When selecting target languages, please ensure that these languages are present in the dataset to guarantee an effective search. - If no target language is selected, the system will search only in the language of your query, which may cause relevant information in other languages to be missed. - **Variable** refers to the variables (keys) to be used in the system prompt. `{knowledge}` is a reserved variable. Click **Add** to add more variables for the system prompt. @@ -55,23 +58,23 @@ You start an AI conversation by creating an assistant. 4. Update Model-specific Settings: - In **Model**: you select the chat model. Though you have selected the default chat model in **System Model Settings**, RAGFlow allows you to choose an alternative chat model for your dialogue. - - **Creativity**: A shortcut to **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty** settings, indicating the freedom level of the model. From **Improvise**, **Precise**, to **Balance**, each preset configuration corresponds to a unique combination of **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty**. + - **Creativity**: A shortcut to **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty** settings, indicating the freedom level of the model. From **Improvise**, **Precise**, to **Balance**, each preset configuration corresponds to a unique combination of **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty**. This parameter has three options: - **Improvise**: Produces more creative responses. - **Precise**: (Default) Produces more conservative responses. - **Balance**: A middle ground between **Improvise** and **Precise**. - - **Temperature**: The randomness level of the model's output. + - **Temperature**: The randomness level of the model's output. Defaults to 0.1. - Lower values lead to more deterministic and predictable outputs. - Higher values lead to more creative and varied outputs. - A temperature of zero results in the same output for the same prompt. - - **Top P**: Nucleus sampling. + - **Top P**: Nucleus sampling. - Reduces the likelihood of generating repetitive or unnatural text by setting a threshold *P* and restricting the sampling to tokens with a cumulative probability exceeding *P*. - Defaults to 0.3. - - **Presence penalty**: Encourages the model to include a more diverse range of tokens in the response. + - **Presence penalty**: Encourages the model to include a more diverse range of tokens in the response. - A higher **presence penalty** value results in the model being more likely to generate tokens not yet been included in the generated text. - Defaults to 0.4. - - **Frequency penalty**: Discourages the model from repeating the same words or phrases too frequently in the generated text. + - **Frequency penalty**: Discourages the model from repeating the same words or phrases too frequently in the generated text. - A higher **frequency penalty** value results in the model being more conservative in its use of repeated tokens. - Defaults to 0.7. diff --git a/docs/guides/dataset/_category_.json b/docs/guides/dataset/_category_.json index 4c454f51f47..9501311fd68 100644 --- a/docs/guides/dataset/_category_.json +++ b/docs/guides/dataset/_category_.json @@ -4,5 +4,8 @@ "link": { "type": "generated-index", "description": "Guides on configuring a dataset." + }, + "customProps": { + "categoryIcon": "LucideDatabaseZap" } } diff --git a/docs/guides/dataset/add_data_source/_category_.json b/docs/guides/dataset/add_data_source/_category_.json index 42f2b164a13..71b3d794d30 100644 --- a/docs/guides/dataset/add_data_source/_category_.json +++ b/docs/guides/dataset/add_data_source/_category_.json @@ -4,5 +4,8 @@ "link": { "type": "generated-index", "description": "Add various data sources" + }, + "customProps": { + "categoryIcon": "LucideServer" } } diff --git a/docs/guides/dataset/add_data_source/add_google_drive.md b/docs/guides/dataset/add_data_source/add_google_drive.md index a1f2d895fe6..d4ee70a875b 100644 --- a/docs/guides/dataset/add_data_source/add_google_drive.md +++ b/docs/guides/dataset/add_data_source/add_google_drive.md @@ -1,6 +1,9 @@ --- sidebar_position: 3 slug: /add_google_drive +sidebar_custom_props: { + categoryIcon: SiGoogledrive +} --- # Add Google Drive @@ -10,9 +13,9 @@ slug: /add_google_drive You can either create a dedicated project for RAGFlow or use an existing Google Cloud external project. -**Steps:** +**Steps:** 1. Open the project creation page\ -`https://console.cloud.google.com/projectcreate` +`https://console.cloud.google.com/projectcreate` ![placeholder-image](https://github.com/infiniflow/ragflow-docs/blob/040e4acd4c1eac6dc73dc44e934a6518de78d097/images/google_drive/image1.jpeg?raw=true) 2. Select **External** as the Audience ![placeholder-image](https://github.com/infiniflow/ragflow-docs/blob/040e4acd4c1eac6dc73dc44e934a6518de78d097/images/google_drive/image2.png?raw=true) @@ -96,11 +99,11 @@ Navigate to the Google API Library:\ Enable the following APIs: -- Google Drive API -- Admin SDK API -- Google Sheets API +- Google Drive API +- Admin SDK API +- Google Sheets API - Google Docs API - + ![placeholder-image](https://github.com/infiniflow/ragflow-docs/blob/040e4acd4c1eac6dc73dc44e934a6518de78d097/images/google_drive/image15.png?raw=true) @@ -126,7 +129,7 @@ Enable the following APIs: ![placeholder-image](https://github.com/infiniflow/ragflow-docs/blob/040e4acd4c1eac6dc73dc44e934a6518de78d097/images/google_drive/image23.png?raw=true) 5. Click **Authorize with Google** -A browser window will appear. +A browser window will appear. ![placeholder-image](https://github.com/infiniflow/ragflow-docs/blob/040e4acd4c1eac6dc73dc44e934a6518de78d097/images/google_drive/image25.jpeg?raw=true) Click: - **Continue** - **Select All → Continue** - Authorization should succeed - Select **OK** to add the data source diff --git a/docs/guides/dataset/auto_metadata.md b/docs/guides/dataset/auto_metadata.md index 35967b935b6..2cbf854291a 100644 --- a/docs/guides/dataset/auto_metadata.md +++ b/docs/guides/dataset/auto_metadata.md @@ -1,6 +1,9 @@ --- sidebar_position: -6 slug: /auto_metadata +sidebar_custom_props: { + categoryIcon: LucideFileCodeCorner +} --- # Auto-extract metadata diff --git a/docs/guides/dataset/autokeyword_autoquestion.mdx b/docs/guides/dataset/autokeyword_autoquestion.mdx index e917645856f..937394e4ee0 100644 --- a/docs/guides/dataset/autokeyword_autoquestion.mdx +++ b/docs/guides/dataset/autokeyword_autoquestion.mdx @@ -1,6 +1,9 @@ --- sidebar_position: 3 slug: /autokeyword_autoquestion +sidebar_custom_props: { + categoryIcon: LucideSlidersHorizontal +} --- # Auto-keyword Auto-question @@ -20,14 +23,14 @@ Enabling this feature increases document indexing time and uses extra tokens, as Auto-keyword refers to the auto-keyword generation feature of RAGFlow. It uses a chat model to generate a set of keywords or synonyms from each chunk to correct errors and enhance retrieval accuracy. This feature is implemented as a slider under **Page rank** on the **Configuration** page of your dataset. -**Values**: +**Values**: -- 0: (Default) Disabled. -- Between 3 and 5 (inclusive): Recommended if you have chunks of approximately 1,000 characters. -- 30 (maximum) +- 0: (Default) Disabled. +- Between 3 and 5 (inclusive): Recommended if you have chunks of approximately 1,000 characters. +- 30 (maximum) :::tip NOTE -- If your chunk size increases, you can increase the value accordingly. Please note, as the value increases, the marginal benefit decreases. +- If your chunk size increases, you can increase the value accordingly. Please note, as the value increases, the marginal benefit decreases. - An Auto-keyword value must be an integer. If you set it to a non-integer, say 1.7, it will be rounded down to the nearest integer, which in this case is 1. ::: @@ -37,12 +40,12 @@ Auto-question is a feature of RAGFlow that automatically generates questions fro **Values**: -- 0: (Default) Disabled. -- 1 or 2: Recommended if you have chunks of approximately 1,000 characters. +- 0: (Default) Disabled. +- 1 or 2: Recommended if you have chunks of approximately 1,000 characters. - 10 (maximum) :::tip NOTE -- If your chunk size increases, you can increase the value accordingly. Please note, as the value increases, the marginal benefit decreases. +- If your chunk size increases, you can increase the value accordingly. Please note, as the value increases, the marginal benefit decreases. - An Auto-question value must be an integer. If you set it to a non-integer, say 1.7, it will be rounded down to the nearest integer, which in this case is 1. ::: diff --git a/docs/guides/dataset/best_practices/_category_.json b/docs/guides/dataset/best_practices/_category_.json index 79a1103d5fa..f1fe9fa4100 100644 --- a/docs/guides/dataset/best_practices/_category_.json +++ b/docs/guides/dataset/best_practices/_category_.json @@ -4,5 +4,8 @@ "link": { "type": "generated-index", "description": "Best practices on configuring a dataset." + }, + "customProps": { + "categoryIcon": "LucideStar" } } diff --git a/docs/guides/dataset/configure_child_chunking_strategy.md b/docs/guides/dataset/configure_child_chunking_strategy.md index 0be4d233034..267b4b070b7 100644 --- a/docs/guides/dataset/configure_child_chunking_strategy.md +++ b/docs/guides/dataset/configure_child_chunking_strategy.md @@ -1,6 +1,9 @@ --- sidebar_position: -4 slug: /configure_child_chunking_strategy +sidebar_custom_props: { + categoryIcon: LucideGroup +} --- # Configure child chunking strategy diff --git a/docs/guides/dataset/configure_knowledge_base.md b/docs/guides/dataset/configure_knowledge_base.md index e7aaa50ff8a..85f00180dcc 100644 --- a/docs/guides/dataset/configure_knowledge_base.md +++ b/docs/guides/dataset/configure_knowledge_base.md @@ -1,6 +1,9 @@ --- sidebar_position: -10 slug: /configure_knowledge_base +sidebar_custom_props: { + categoryIcon: LucideCog +} --- # Configure dataset @@ -22,7 +25,7 @@ _Each time a dataset is created, a folder with the same name is generated in the ## Configure dataset -The following screenshot shows the configuration page of a dataset. A proper configuration of your dataset is crucial for future AI chats. For example, choosing the wrong embedding model or chunking method would cause unexpected semantic loss or mismatched answers in chats. +The following screenshot shows the configuration page of a dataset. A proper configuration of your dataset is crucial for future AI chats. For example, choosing the wrong embedding model or chunking method would cause unexpected semantic loss or mismatched answers in chats. ![dataset configuration](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/configure_knowledge_base.jpg) @@ -60,14 +63,14 @@ You can also change a file's chunking method on the **Files** page.
From v0.21.0 onward, RAGFlow supports ingestion pipeline for customized data ingestion and cleansing workflows. - + To use a customized data pipeline: 1. On the **Agent** page, click **+ Create agent** > **Create from blank**. 2. Select **Ingestion pipeline** and name your data pipeline in the popup, then click **Save** to show the data pipeline canvas. 3. After updating your data pipeline, click **Save** on the top right of the canvas. 4. Navigate to the **Configuration** page of your dataset, select **Choose pipeline** in **Ingestion pipeline**. - + *Your saved data pipeline will appear in the dropdown menu below.*
@@ -83,9 +86,9 @@ Some embedding models are optimized for specific languages, so performance may b ### Upload file - RAGFlow's File system allows you to link a file to multiple datasets, in which case each target dataset holds a reference to the file. -- In **Knowledge Base**, you are also given the option of uploading a single file or a folder of files (bulk upload) from your local machine to a dataset, in which case the dataset holds file copies. +- In **Knowledge Base**, you are also given the option of uploading a single file or a folder of files (bulk upload) from your local machine to a dataset, in which case the dataset holds file copies. -While uploading files directly to a dataset seems more convenient, we *highly* recommend uploading files to RAGFlow's File system and then linking them to the target datasets. This way, you can avoid permanently deleting files uploaded to the dataset. +While uploading files directly to a dataset seems more convenient, we *highly* recommend uploading files to RAGFlow's File system and then linking them to the target datasets. This way, you can avoid permanently deleting files uploaded to the dataset. ### Parse file @@ -93,14 +96,14 @@ File parsing is a crucial topic in dataset configuration. The meaning of file pa ![parse file](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/parse_file.jpg) -- As shown above, RAGFlow allows you to use a different chunking method for a particular file, offering flexibility beyond the default method. -- As shown above, RAGFlow allows you to enable or disable individual files, offering finer control over dataset-based AI chats. +- As shown above, RAGFlow allows you to use a different chunking method for a particular file, offering flexibility beyond the default method. +- As shown above, RAGFlow allows you to enable or disable individual files, offering finer control over dataset-based AI chats. ### Intervene with file parsing results -RAGFlow features visibility and explainability, allowing you to view the chunking results and intervene where necessary. To do so: +RAGFlow features visibility and explainability, allowing you to view the chunking results and intervene where necessary. To do so: -1. Click on the file that completes file parsing to view the chunking results: +1. Click on the file that completes file parsing to view the chunking results: _You are taken to the **Chunk** page:_ @@ -113,7 +116,7 @@ RAGFlow features visibility and explainability, allowing you to view the chunkin ![update chunk](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/add_keyword_question.jpg) :::caution NOTE -You can add keywords to a file chunk to increase its ranking for queries containing those keywords. This action increases its keyword weight and can improve its position in search list. +You can add keywords to a file chunk to increase its ranking for queries containing those keywords. This action increases its keyword weight and can improve its position in search list. ::: 4. In Retrieval testing, ask a quick question in **Test text** to double-check if your configurations work: @@ -141,7 +144,7 @@ As of RAGFlow v0.23.1, the search feature is still in a rudimentary form, suppor You are allowed to delete a dataset. Hover your mouse over the three dot of the intended dataset card and the **Delete** option appears. Once you delete a dataset, the associated folder under **root/.knowledge** directory is AUTOMATICALLY REMOVED. The consequence is: -- The files uploaded directly to the dataset are gone; -- The file references, which you created from within RAGFlow's File system, are gone, but the associated files still exist. +- The files uploaded directly to the dataset are gone; +- The file references, which you created from within RAGFlow's File system, are gone, but the associated files still exist. ![delete dataset](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/delete_datasets.jpg) diff --git a/docs/guides/dataset/construct_knowledge_graph.md b/docs/guides/dataset/construct_knowledge_graph.md index 47108081151..4c4b5674012 100644 --- a/docs/guides/dataset/construct_knowledge_graph.md +++ b/docs/guides/dataset/construct_knowledge_graph.md @@ -1,6 +1,9 @@ --- sidebar_position: 8 slug: /construct_knowledge_graph +sidebar_custom_props: { + categoryIcon: LucideWandSparkles +} --- # Construct knowledge graph @@ -63,7 +66,7 @@ In a knowledge graph, a community is a cluster of entities linked by relationshi ## Quickstart 1. Navigate to the **Configuration** page of your dataset and update: - + - Entity types: *Required* - Specifies the entity types in the knowledge graph to generate. You don't have to stick with the default, but you need to customize them for your documents. - Method: *Optional* - Entity resolution: *Optional* @@ -74,12 +77,12 @@ In a knowledge graph, a community is a cluster of entities linked by relationshi *You can click the pause button in the dropdown to halt the build process when necessary.* -3. Go back to the **Configuration** page: - +3. Go back to the **Configuration** page: + *Once a knowledge graph is generated, the **Knowledge graph** field changes from `Not generated` to `Generated at a specific timestamp`. You can delete it by clicking the recycle bin button to the right of the field.* 4. To use the created knowledge graph, do either of the following: - + - In the **Chat setting** panel of your chat app, switch on the **Use knowledge graph** toggle. - If you are using an agent, click the **Retrieval** agent component to specify the dataset(s) and switch on the **Use knowledge graph** toggle. diff --git a/docs/guides/dataset/enable_excel2html.md b/docs/guides/dataset/enable_excel2html.md index 5a7a8fa41f3..7449ee59bd2 100644 --- a/docs/guides/dataset/enable_excel2html.md +++ b/docs/guides/dataset/enable_excel2html.md @@ -1,6 +1,9 @@ --- sidebar_position: 4 slug: /enable_excel2html +sidebar_custom_props: { + categoryIcon: LucideToggleRight +} --- # Enable Excel2HTML diff --git a/docs/guides/dataset/enable_raptor.md b/docs/guides/dataset/enable_raptor.md index 2d8fa245358..abe6f6a8cad 100644 --- a/docs/guides/dataset/enable_raptor.md +++ b/docs/guides/dataset/enable_raptor.md @@ -1,6 +1,9 @@ --- sidebar_position: 7 slug: /enable_raptor +sidebar_custom_props: { + categoryIcon: LucideNetwork +} --- # Enable RAPTOR @@ -76,7 +79,7 @@ A random seed. Click **+** to change the seed value. ## Quickstart 1. Navigate to the **Configuration** page of your dataset and update: - + - Prompt: *Optional* - We recommend that you keep it as-is until you understand the mechanism behind. - Max token: *Optional* - Threshold: *Optional* @@ -86,8 +89,8 @@ A random seed. Click **+** to change the seed value. *You can click the pause button in the dropdown to halt the build process when necessary.* -3. Go back to the **Configuration** page: - +3. Go back to the **Configuration** page: + *The **RAPTOR** field changes from `Not generated` to `Generated at a specific timestamp` when a RAPTOR hierarchical tree structure is generated. You can delete it by clicking the recycle bin button to the right of the field.* 4. Once a RAPTOR hierarchical tree structure is generated, your chat assistant and **Retrieval** agent component will use it for retrieval as a default. diff --git a/docs/guides/dataset/extract_table_of_contents.md b/docs/guides/dataset/extract_table_of_contents.md index 58e920613ec..4e67ecae41f 100644 --- a/docs/guides/dataset/extract_table_of_contents.md +++ b/docs/guides/dataset/extract_table_of_contents.md @@ -1,6 +1,9 @@ --- sidebar_position: 4 slug: /enable_table_of_contents +sidebar_custom_props: { + categoryIcon: LucideTableOfContents +} --- # Extract table of contents @@ -28,7 +31,7 @@ The system's default chat model is used to summarize clustered content. Before p 2. Enable **TOC Enhance**. 3. To use this technique during retrieval, do either of the following: - + - In the **Chat setting** panel of your chat app, switch on the **TOC Enhance** toggle. - If you are using an agent, click the **Retrieval** agent component to specify the dataset(s) and switch on the **TOC Enhance** toggle. diff --git a/docs/guides/dataset/manage_metadata.md b/docs/guides/dataset/manage_metadata.md index a848007fbf7..1f6439f5199 100644 --- a/docs/guides/dataset/manage_metadata.md +++ b/docs/guides/dataset/manage_metadata.md @@ -1,6 +1,9 @@ --- sidebar_position: -5 slug: /manage_metadata +sidebar_custom_props: { + categoryIcon: LucideCode +} --- # Manage metadata @@ -19,7 +22,7 @@ From v0.23.0 onwards, RAGFlow allows you to manage metadata both at the dataset ![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/click_metadata.png) -2. On the **Manage Metadata** page, you can do either of the following: +2. On the **Manage Metadata** page, you can do either of the following: - Edit Values: You can modify existing values. If you rename two values to be identical, they will be automatically merged. - Delete: You can delete specific values or entire fields. These changes will apply to all associated files. diff --git a/docs/guides/dataset/run_retrieval_test.md b/docs/guides/dataset/run_retrieval_test.md index 87bd29835c5..0291043c2c4 100644 --- a/docs/guides/dataset/run_retrieval_test.md +++ b/docs/guides/dataset/run_retrieval_test.md @@ -1,6 +1,9 @@ --- sidebar_position: 10 slug: /run_retrieval_test +sidebar_custom_props: { + categoryIcon: LucideTextSearch +} --- # Run retrieval test @@ -53,7 +56,7 @@ The switch is disabled by default. When enabled, RAGFlow performs the following 3. Find similar entities and their N-hop relationships from the graph using the embeddings of the extracted query entities. 4. Retrieve similar relationships from the graph using the query embedding. 5. Rank these retrieved entities and relationships by multiplying each one's PageRank value with its similarity score to the query, returning the top n as the final retrieval. -6. Retrieve the report for the community involving the most entities in the final retrieval. +6. Retrieve the report for the community involving the most entities in the final retrieval. *The retrieved entity descriptions, relationship descriptions, and the top 1 community report are sent to the LLM for content generation.* :::danger IMPORTANT @@ -78,10 +81,10 @@ This field is where you put in your testing query. 1. Navigate to the **Retrieval testing** page of your dataset, enter your query in **Test text**, and click **Testing** to run the test. 2. If the results are unsatisfactory, tune the options listed in the Configuration section and rerun the test. - *The following is a screenshot of a retrieval test conducted without using knowledge graph. It demonstrates a hybrid search combining weighted keyword similarity and weighted vector cosine similarity. The overall hybrid similarity score is 28.56, calculated as 25.17 (term similarity score) x 0.7 + 36.49 (vector similarity score) x 0.3:* + *The following is a screenshot of a retrieval test conducted without using knowledge graph. It demonstrates a hybrid search combining weighted keyword similarity and weighted vector cosine similarity. The overall hybrid similarity score is 28.56, calculated as 25.17 (term similarity score) x 0.7 + 36.49 (vector similarity score) x 0.3:* ![Image](https://github.com/user-attachments/assets/541554d4-3f3e-44e1-954b-0ae77d7372c6) - *The following is a screenshot of a retrieval test conducted using a knowledge graph. It shows that only vector similarity is used for knowledge graph-generated chunks:* + *The following is a screenshot of a retrieval test conducted using a knowledge graph. It shows that only vector similarity is used for knowledge graph-generated chunks:* ![Image](https://github.com/user-attachments/assets/30a03091-0f7b-4058-901a-f4dc5ca5aa6b) :::caution WARNING diff --git a/docs/guides/dataset/select_pdf_parser.md b/docs/guides/dataset/select_pdf_parser.md index 14831490803..95e0305f6f7 100644 --- a/docs/guides/dataset/select_pdf_parser.md +++ b/docs/guides/dataset/select_pdf_parser.md @@ -1,6 +1,9 @@ --- sidebar_position: -3 slug: /select_pdf_parser +sidebar_custom_props: { + categoryIcon: LucideFileText +} --- # Select PDF parser @@ -54,12 +57,12 @@ Starting from v0.22.0, RAGFlow includes MinerU (≥ 2.6.3) as an optional PDF p - `"vlm-mlx-engine"` - `"vlm-vllm-async-engine"` - `"vlm-lmdeploy-engine"`. - - `MINERU_SERVER_URL`: (optional) The downstream vLLM HTTP server (e.g., `http://vllm-host:30000`). Applicable when `MINERU_BACKEND` is set to `"vlm-http-client"`. + - `MINERU_SERVER_URL`: (optional) The downstream vLLM HTTP server (e.g., `http://vllm-host:30000`). Applicable when `MINERU_BACKEND` is set to `"vlm-http-client"`. - `MINERU_OUTPUT_DIR`: (optional) The local directory for holding the outputs of the MinerU API service (zip/JSON) before ingestion. - `MINERU_DELETE_OUTPUT`: Whether to delete temporary output when a temporary directory is used: - `1`: Delete. - `0`: Retain. -3. In the web UI, navigate to your dataset's **Configuration** page and find the **Ingestion pipeline** section: +3. In the web UI, navigate to your dataset's **Configuration** page and find the **Ingestion pipeline** section: - If you decide to use a chunking method from the **Built-in** dropdown, ensure it supports PDF parsing, then select **MinerU** from the **PDF parser** dropdown. - If you use a custom ingestion pipeline instead, select **MinerU** in the **PDF parser** section of the **Parser** component. diff --git a/docs/guides/dataset/set_context_window.md b/docs/guides/dataset/set_context_window.md index 7f9abdd804c..e3f84262a28 100644 --- a/docs/guides/dataset/set_context_window.md +++ b/docs/guides/dataset/set_context_window.md @@ -1,6 +1,9 @@ --- sidebar_position: -8 slug: /set_context_window +sidebar_custom_props: { + categoryIcon: LucideListChevronsUpDown +} --- # Set context window size diff --git a/docs/guides/dataset/set_metadata.md b/docs/guides/dataset/set_metadata.md index 34db390cd29..5af503400bd 100644 --- a/docs/guides/dataset/set_metadata.md +++ b/docs/guides/dataset/set_metadata.md @@ -1,6 +1,9 @@ --- sidebar_position: -7 slug: /set_metadata +sidebar_custom_props: { + categoryIcon: LucideCode +} --- # Set metadata diff --git a/docs/guides/dataset/set_page_rank.md b/docs/guides/dataset/set_page_rank.md index 5df848a0e22..d18b6271b78 100644 --- a/docs/guides/dataset/set_page_rank.md +++ b/docs/guides/dataset/set_page_rank.md @@ -1,6 +1,9 @@ --- sidebar_position: -2 slug: /set_page_rank +sidebar_custom_props: { + categoryIcon: LucideStickyNote +} --- # Set page rank diff --git a/docs/guides/dataset/use_tag_sets.md b/docs/guides/dataset/use_tag_sets.md index 389a97b0a93..29b005d872f 100644 --- a/docs/guides/dataset/use_tag_sets.md +++ b/docs/guides/dataset/use_tag_sets.md @@ -1,6 +1,9 @@ --- sidebar_position: 6 slug: /use_tag_sets +sidebar_custom_props: { + categoryIcon: LucideTags +} --- # Use tag set @@ -43,10 +46,10 @@ A tag set is *not* involved in document indexing or retrieval. Do not specify a 1. Click **+ Create dataset** to create a dataset. 2. Navigate to the **Configuration** page of the created dataset, select **Built-in** in **Ingestion pipeline**, then choose **Tag** as the default chunking method from the **Built-in** drop-down menu. -3. Go back to the **Files** page and upload and parse your table file in XLSX, CSV, or TXT formats. - _A tag cloud appears under the **Tag view** section, indicating the tag set is created:_ +3. Go back to the **Files** page and upload and parse your table file in XLSX, CSV, or TXT formats. + _A tag cloud appears under the **Tag view** section, indicating the tag set is created:_ ![Image](https://github.com/user-attachments/assets/abefbcbf-c130-4abe-95e1-267b0d2a0505) -4. Click the **Table** tab to view the tag frequency table: +4. Click the **Table** tab to view the tag frequency table: ![Image](https://github.com/user-attachments/assets/af91d10c-5ea5-491f-ab21-3803d5ebf59f) ## 2. Tag chunks @@ -60,12 +63,12 @@ Once a tag set is created, you can apply it to your dataset: If the tag set is missing from the dropdown, check that it has been created or configured correctly. ::: -3. Re-parse your documents to start the auto-tagging process. +3. Re-parse your documents to start the auto-tagging process. _In an AI chat scenario using auto-tagged datasets, each query will be tagged using the corresponding tag set(s) and chunks with these tags will have a higher chance to be retrieved._ ## 3. Update tag set -Creating a tag set is *not* for once and for all. Oftentimes, you may find it necessary to update or delete existing tags or add new entries. +Creating a tag set is *not* for once and for all. Oftentimes, you may find it necessary to update or delete existing tags or add new entries. - You can update the existing tag set in the tag frequency table. - To add new entries, you can add and parse new table files in XLSX, CSV, or TXT formats. diff --git a/docs/guides/manage_files.md b/docs/guides/manage_files.md index 27c6f1d3657..2d60c485d62 100644 --- a/docs/guides/manage_files.md +++ b/docs/guides/manage_files.md @@ -1,6 +1,9 @@ --- sidebar_position: 6 slug: /manage_files +sidebar_custom_props: { + categoryIcon: LucideFolderDot +} --- # Files @@ -13,7 +16,7 @@ Compared to uploading files directly to various datasets, uploading them to RAGF ## Create folder -RAGFlow's file management allows you to establish your file system with nested folder structures. To create a folder in the root directory of RAGFlow: +RAGFlow's file management allows you to establish your file system with nested folder structures. To create a folder in the root directory of RAGFlow: ![create new folder](https://github.com/infiniflow/ragflow/assets/93570324/3a37a5f4-43a6-426d-a62a-e5cd2ff7a533) @@ -23,7 +26,7 @@ Each dataset in RAGFlow has a corresponding folder under the **root/.knowledgeba ## Upload file -RAGFlow's file management supports file uploads from your local machine, allowing both individual and bulk uploads: +RAGFlow's file management supports file uploads from your local machine, allowing both individual and bulk uploads: ![upload file](https://github.com/infiniflow/ragflow/assets/93570324/5d7ded14-ce2b-4703-8567-9356a978f45c) @@ -45,7 +48,7 @@ RAGFlow's file management allows you to *link* an uploaded file to multiple data ![link knowledgebase](https://github.com/infiniflow/ragflow/assets/93570324/6c6b8db4-3269-4e35-9434-6089887e3e3f) -You can link your file to one dataset or multiple datasets at one time: +You can link your file to one dataset or multiple datasets at one time: ![link multiple kb](https://github.com/infiniflow/ragflow/assets/93570324/6c508803-fb1f-435d-b688-683066fd7fff) @@ -68,9 +71,9 @@ RAGFlow's file management allows you to rename a file or folder: ## Delete files or folders -RAGFlow's file management allows you to delete files or folders individually or in bulk. +RAGFlow's file management allows you to delete files or folders individually or in bulk. -To delete a file or folder: +To delete a file or folder: ![delete file](https://github.com/infiniflow/ragflow/assets/93570324/85872728-125d-45e9-a0ee-21e9d4cedb8b) @@ -78,7 +81,7 @@ To bulk delete files or folders: ![bulk delete](https://github.com/infiniflow/ragflow/assets/93570324/519b99ab-ec7f-4c8a-8cea-e0b6dcb3cb46) -> - You are not allowed to delete the **root/.knowledgebase** folder. +> - You are not allowed to delete the **root/.knowledgebase** folder. > - Deleting files that have been linked to datasets will **AUTOMATICALLY REMOVE** all associated file references across the datasets. ## Download uploaded file @@ -87,4 +90,4 @@ RAGFlow's file management allows you to download an uploaded file: ![download_file](https://github.com/infiniflow/ragflow/assets/93570324/cf3b297f-7d9b-4522-bf5f-4f45743e4ed5) -> As of RAGFlow v0.23.1, bulk download is not supported, nor can you download an entire folder. +> As of RAGFlow v0.23.1, bulk download is not supported, nor can you download an entire folder. diff --git a/docs/guides/migration/_category_.json b/docs/guides/migration/_category_.json index dcb81271612..1099886f2ee 100644 --- a/docs/guides/migration/_category_.json +++ b/docs/guides/migration/_category_.json @@ -4,5 +4,8 @@ "link": { "type": "generated-index", "description": "RAGFlow migration guide" + }, + "customProps": { + "categoryIcon": "LucideArrowRightLeft" } } diff --git a/docs/guides/models/_category_.json b/docs/guides/models/_category_.json index 8536f8e4760..b4a996b4fa5 100644 --- a/docs/guides/models/_category_.json +++ b/docs/guides/models/_category_.json @@ -4,5 +4,8 @@ "link": { "type": "generated-index", "description": "Guides on model settings." + }, + "customProps": { + "categoryIcon": "LucideBox" } } diff --git a/docs/guides/models/deploy_local_llm.mdx b/docs/guides/models/deploy_local_llm.mdx index 7d8e58eee9b..2e141a79ea6 100644 --- a/docs/guides/models/deploy_local_llm.mdx +++ b/docs/guides/models/deploy_local_llm.mdx @@ -1,6 +1,9 @@ --- sidebar_position: 2 slug: /deploy_local_llm +sidebar_custom_props: { + categoryIcon: LucideMonitorCog +} --- # Deploy local models @@ -53,9 +56,9 @@ $ sudo docker exec ollama ollama pull llama3.2 ``` ```bash -$ sudo docker exec ollama ollama pull bge-m3 -> pulling daec91ffb5dd... 100% ▕████████████████▏ 1.2 GB -> success +$ sudo docker exec ollama ollama pull bge-m3 +> pulling daec91ffb5dd... 100% ▕████████████████▏ 1.2 GB +> success ``` ### 2. Find Ollama URL and ensure it is accessible @@ -105,7 +108,7 @@ Max retries exceeded with url: /api/chat (Caused by NewConnectionError('** **Model providers** **>** **System Model Settings** to update your model: - + - *You should now be able to find **llama3.2** from the dropdown list under **Chat model**, and **bge-m3** from the dropdown list under **Embedding model**.* ### 6. Update Chat Configuration @@ -125,7 +128,7 @@ To deploy a local model, e.g., **Mistral**, using Xinference: ### 1. Check firewall settings -Ensure that your host machine's firewall allows inbound connections on port 9997. +Ensure that your host machine's firewall allows inbound connections on port 9997. ### 2. Start an Xinference instance @@ -148,13 +151,13 @@ In RAGFlow, click on your logo on the top right of the page **>** **Model provid ### 5. Complete basic Xinference settings -Enter an accessible base URL, such as `http://:9997/v1`. +Enter an accessible base URL, such as `http://:9997/v1`. > For rerank model, please use the `http://:9997/v1/rerank` as the base URL. ### 6. Update System Model Settings Click on your logo **>** **Model providers** **>** **System Model Settings** to update your model. - + *You should now be able to find **mistral** from the dropdown list under **Chat model**.* ### 7. Update Chat Configuration @@ -170,7 +173,7 @@ To deploy a local model, e.g., **Qwen2**, using IPEX-LLM-accelerated Ollama: ### 1. Check firewall settings Ensure that your host machine's firewall allows inbound connections on port 11434. For example: - + ```bash sudo ufw allow 11434/tcp ``` @@ -179,7 +182,7 @@ sudo ufw allow 11434/tcp #### 2.1 Install IPEX-LLM for Ollama -:::tip NOTE +:::tip NOTE IPEX-LLM's supports Ollama on Linux and Windows systems. ::: @@ -191,7 +194,7 @@ For detailed information about installing IPEX-LLM for Ollama, see [Run llama.cp #### 2.2 Initialize Ollama -1. Activate the `llm-cpp` Conda environment and initialize Ollama: +1. Activate the `llm-cpp` Conda environment and initialize Ollama: - + ```bash conda activate llm-cpp init-ollama @@ -218,7 +221,7 @@ For detailed information about installing IPEX-LLM for Ollama, see [Run llama.cp 2. If the installed `ipex-llm[cpp]` requires an upgrade to the Ollama binary files, remove the old binary files and reinitialize Ollama using `init-ollama` (Linux) or `init-ollama.bat` (Windows). - + *A symbolic link to Ollama appears in your current directory, and you can use this executable file following standard Ollama commands.* #### 2.3 Launch Ollama service @@ -226,7 +229,7 @@ For detailed information about installing IPEX-LLM for Ollama, see [Run llama.cp 1. Set the environment variable `OLLAMA_NUM_GPU` to `999` to ensure that all layers of your model run on the Intel GPU; otherwise, some layers may default to CPU. 2. For optimal performance on Intel Arc™ A-Series Graphics with Linux OS (Kernel 6.2), set the following environment variable before launching the Ollama service: - ```bash + ```bash export SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 ``` 3. Launch the Ollama service: @@ -314,12 +317,12 @@ To enable IPEX-LLM accelerated Ollama in RAGFlow, you must also complete the con 3. [Update System Model Settings](#6-update-system-model-settings) 4. [Update Chat Configuration](#7-update-chat-configuration) -### 5. Deploy VLLM +### 5. Deploy VLLM ubuntu 22.04/24.04 ```bash - pip install vllm + pip install vllm ``` ### 5.1 RUN VLLM WITH BEST PRACTISE diff --git a/docs/guides/models/llm_api_key_setup.md b/docs/guides/models/llm_api_key_setup.md index f61d71c5830..b996105c42d 100644 --- a/docs/guides/models/llm_api_key_setup.md +++ b/docs/guides/models/llm_api_key_setup.md @@ -1,6 +1,9 @@ --- sidebar_position: 1 slug: /llm_api_key_setup +sidebar_custom_props: { + categoryIcon: LucideKey +} --- # Configure model API key @@ -30,7 +33,7 @@ You have two options for configuring your model API key: - Update `api_key` with yours. - Update `base_url` if you use a proxy to connect to the remote service. 3. Reboot your system for your changes to take effect. -4. Log into RAGFlow. +4. Log into RAGFlow. _After logging into RAGFlow, you will find your chosen model appears under **Added models** on the **Model providers** page._ ### Configure model API key after logging into RAGFlow diff --git a/docs/guides/team/_category_.json b/docs/guides/team/_category_.json index 37bbf13073e..f245a5f35b6 100644 --- a/docs/guides/team/_category_.json +++ b/docs/guides/team/_category_.json @@ -4,5 +4,8 @@ "link": { "type": "generated-index", "description": "Team-specific guides." + }, + "customProps": { + "categoryIcon": "LucideUsers" } } diff --git a/docs/guides/team/join_or_leave_team.md b/docs/guides/team/join_or_leave_team.md index 978523d8018..a4acf573792 100644 --- a/docs/guides/team/join_or_leave_team.md +++ b/docs/guides/team/join_or_leave_team.md @@ -1,6 +1,9 @@ --- sidebar_position: 3 slug: /join_or_leave_team +sidebar_custom_props: { + categoryIcon: LucideLogOut +} --- # Join or leave a team diff --git a/docs/guides/team/manage_team_members.md b/docs/guides/team/manage_team_members.md index edd8289cda4..c529c1c0695 100644 --- a/docs/guides/team/manage_team_members.md +++ b/docs/guides/team/manage_team_members.md @@ -1,6 +1,9 @@ --- sidebar_position: 2 slug: /manage_team_members +sidebar_custom_props: { + categoryIcon: LucideUserCog +} --- # Manage team members diff --git a/docs/guides/team/share_agents.md b/docs/guides/team/share_agents.md index f6be1a7288a..84f13e7c0b9 100644 --- a/docs/guides/team/share_agents.md +++ b/docs/guides/team/share_agents.md @@ -1,6 +1,9 @@ --- sidebar_position: 6 slug: /share_agent +sidebar_custom_props: { + categoryIcon: LucideShare2 +} --- # Share Agent @@ -11,7 +14,7 @@ Share an Agent with your team members. When ready, you may share your Agents with your team members so that they can use them. Please note that your Agents are not shared automatically; you must manually enable sharing by selecting the corresponding **Permissions** radio button: -1. Click the intended Agent to open its editing canvas. +1. Click the intended Agent to open its editing canvas. 2. Click **Management** > **Settings** to show the **Agent settings** dialogue. 3. Change **Permissions** from **Only me** to **Team**. 4. Click **Save** to apply your changes. diff --git a/docs/guides/team/share_chat_assistant.md b/docs/guides/team/share_chat_assistant.md index f8f172ee5db..c8d04eb8b26 100644 --- a/docs/guides/team/share_chat_assistant.md +++ b/docs/guides/team/share_chat_assistant.md @@ -1,6 +1,9 @@ --- sidebar_position: 5 slug: /share_chat_assistant +sidebar_custom_props: { + categoryIcon: LucideShare2 +} --- # Share chat assistant diff --git a/docs/guides/team/share_knowledge_bases.md b/docs/guides/team/share_knowledge_bases.md index 4eeccd2643f..57e67912ee8 100644 --- a/docs/guides/team/share_knowledge_bases.md +++ b/docs/guides/team/share_knowledge_bases.md @@ -1,6 +1,9 @@ --- sidebar_position: 4 slug: /share_datasets +sidebar_custom_props: { + categoryIcon: LucideShare2 +} --- # Share dataset diff --git a/docs/guides/team/share_model.md b/docs/guides/team/share_model.md index 459641fcaa8..831415baa37 100644 --- a/docs/guides/team/share_model.md +++ b/docs/guides/team/share_model.md @@ -1,6 +1,9 @@ --- sidebar_position: 7 slug: /share_model +sidebar_custom_props: { + categoryIcon: LucideShare2 +} --- # Share models diff --git a/docs/guides/tracing.mdx b/docs/guides/tracing.mdx index c9f37ba7537..41b5a41a6ac 100644 --- a/docs/guides/tracing.mdx +++ b/docs/guides/tracing.mdx @@ -1,6 +1,9 @@ --- sidebar_position: 9 slug: /tracing +sidebar_custom_props: { + categoryIcon: LucideLocateFixed +} --- # Tracing @@ -15,10 +18,10 @@ This document is contributed by our community contributor [jannikmaierhoefer](ht RAGFlow ships with a built-in [Langfuse](https://langfuse.com) integration so that you can **inspect and debug every retrieval and generation step** of your RAG pipelines in near real-time. -Langfuse stores traces, spans and prompt payloads in a purpose-built observability backend and offers filtering and visualisations on top. +Langfuse stores traces, spans and prompt payloads in a purpose-built observability backend and offers filtering and visualisations on top. :::info NOTE -• RAGFlow **≥ 0.18.0** (contains the Langfuse connector) +• RAGFlow **≥ 0.18.0** (contains the Langfuse connector) • A Langfuse workspace (cloud or self-hosted) with a _Project Public Key_ and _Secret Key_ ::: @@ -26,9 +29,9 @@ Langfuse stores traces, spans and prompt payloads in a purpose-built observabili ## 1. Collect your Langfuse credentials -1. Sign in to your Langfuse dashboard. -2. Open **Settings ▸ Projects** and either create a new project or select an existing one. -3. Copy the **Public Key** and **Secret Key**. +1. Sign in to your Langfuse dashboard. +2. Open **Settings ▸ Projects** and either create a new project or select an existing one. +3. Copy the **Public Key** and **Secret Key**. 4. Note the Langfuse **host** (e.g. `https://cloud.langfuse.com`). Use the base URL of your own installation if you self-host. > The keys are _project-scoped_: one pair of keys is enough for all environments that should write into the same project. @@ -39,10 +42,10 @@ Langfuse stores traces, spans and prompt payloads in a purpose-built observabili RAGFlow stores the credentials _per tenant_. You can configure them either via the web UI or the HTTP API. -1. Log in to RAGFlow and click your avatar in the top-right corner. -2. Select **API ▸ Scroll down to the bottom ▸ Langfuse Configuration**. -3. Fill in you Langfuse **Host**, **Public Key** and **Secret Key**. -4. Click **Save**. +1. Log in to RAGFlow and click your avatar in the top-right corner. +2. Select **API ▸ Scroll down to the bottom ▸ Langfuse Configuration**. +3. Fill in you Langfuse **Host**, **Public Key** and **Secret Key**. +4. Click **Save**. ![Example RAGFlow trace in Langfuse](https://langfuse.com/images/docs/ragflow/ragflow-configuration.gif) @@ -52,14 +55,14 @@ Once saved, RAGFlow starts emitting traces automatically – no code change requ ## 3. Run a pipeline and watch the traces -1. Execute any chat or retrieval pipeline in RAGFlow (e.g. the Quickstart demo). -2. Open your Langfuse project ▸ **Traces**. +1. Execute any chat or retrieval pipeline in RAGFlow (e.g. the Quickstart demo). +2. Open your Langfuse project ▸ **Traces**. 3. Filter by **name ~ `ragflow-*`** (RAGFlow prefixes each trace with `ragflow-`). For every user request you will see: -• a **trace** representing the overall request -• **spans** for retrieval, ranking and generation steps +• a **trace** representing the overall request +• **spans** for retrieval, ranking and generation steps • the complete **prompts**, **retrieved documents** and **LLM responses** as metadata ![Example RAGFlow trace in Langfuse](https://langfuse.com/images/docs/ragflow/ragflow-trace-frame.png) diff --git a/docs/guides/upgrade_ragflow.mdx b/docs/guides/upgrade_ragflow.mdx index 419fe76e4f4..e299dc74b69 100644 --- a/docs/guides/upgrade_ragflow.mdx +++ b/docs/guides/upgrade_ragflow.mdx @@ -1,6 +1,9 @@ --- sidebar_position: 11 slug: /upgrade_ragflow +sidebar_custom_props: { + categoryIcon: LucideArrowBigUpDash +} --- # Upgrading diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx index 387de9d7906..3a0f336eb13 100644 --- a/docs/quickstart.mdx +++ b/docs/quickstart.mdx @@ -1,6 +1,9 @@ --- sidebar_position: 0 slug: / +sidebar_custom_props: { + sidebarIcon: LucideRocket +} --- # Get started @@ -12,9 +15,9 @@ RAGFlow is an open-source RAG (Retrieval-Augmented Generation) engine based on d This quick start guide describes a general process from: -- Starting up a local RAGFlow server, -- Creating a dataset, -- Intervening with file parsing, to +- Starting up a local RAGFlow server, +- Creating a dataset, +- Intervening with file parsing, to - Establishing an AI chat based on your datasets. :::danger IMPORTANT @@ -71,7 +74,7 @@ This section provides instructions on setting up the RAGFlow server on Linux. If :::caution WARNING This change will be reset after a system reboot. If you forget to update the value the next time you start up the server, you may get a `Can't connect to ES cluster` exception. ::: - + 1.3. To ensure your change remains permanent, add or update the `vm.max_map_count` value in **/etc/sysctl.conf** accordingly: ```bash @@ -145,7 +148,7 @@ This section provides instructions on setting up the RAGFlow server on Linux. If ``` #### If you are on Windows with Docker Desktop WSL 2 backend, then use docker-desktop to set `vm.max_map_count`: - 1.1. Run the following in WSL: + 1.1. Run the following in WSL: ```bash $ wsl -d docker-desktop -u root $ sysctl -w vm.max_map_count=262144 @@ -172,7 +175,7 @@ This section provides instructions on setting up the RAGFlow server on Linux. If ``` ```bash - # Append a line, which reads: + # Append a line, which reads: vm.max_map_count = 262144 ``` ::: @@ -227,13 +230,13 @@ This section provides instructions on setting up the RAGFlow server on Linux. If / /_/ // /| | / / __ / /_ / // __ \| | /| / / / _, _// ___ |/ /_/ // __/ / // /_/ /| |/ |/ / /_/ |_|/_/ |_|\____//_/ /_/ \____/ |__/|__/ - + * Running on all addresses (0.0.0.0) ``` :::danger IMPORTANT If you skip this confirmation step and directly log in to RAGFlow, your browser may prompt a `network anomaly` error because, at that moment, your RAGFlow may not be fully initialized. - ::: + ::: 5. In your web browser, enter the IP address of your server and log in to RAGFlow. @@ -245,24 +248,24 @@ This section provides instructions on setting up the RAGFlow server on Linux. If RAGFlow is a RAG engine and needs to work with an LLM to offer grounded, hallucination-free question-answering capabilities. RAGFlow supports most mainstream LLMs. For a complete list of supported models, please refer to [Supported Models](./references/supported_models.mdx). -:::note -RAGFlow also supports deploying LLMs locally using Ollama, Xinference, or LocalAI, but this part is not covered in this quick start guide. +:::note +RAGFlow also supports deploying LLMs locally using Ollama, Xinference, or LocalAI, but this part is not covered in this quick start guide. ::: -To add and configure an LLM: +To add and configure an LLM: 1. Click on your logo on the top right of the page **>** **Model providers**. 2. Click on the desired LLM and update the API key accordingly. -3. Click **System Model Settings** to select the default models: +3. Click **System Model Settings** to select the default models: - - Chat model, - - Embedding model, + - Chat model, + - Embedding model, - Image-to-text model, - and more. -> Some models, such as the image-to-text model **qwen-vl-max**, are subsidiary to a specific LLM. And you may need to update your API key to access these models. +> Some models, such as the image-to-text model **qwen-vl-max**, are subsidiary to a specific LLM. And you may need to update your API key to access these models. ## Create your first dataset @@ -278,21 +281,21 @@ To create your first dataset: ![dataset configuration](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/configure_knowledge_base.jpg) -3. RAGFlow offers multiple chunk templates that cater to different document layouts and file formats. Select the embedding model and chunking method (template) for your dataset. +3. RAGFlow offers multiple chunk templates that cater to different document layouts and file formats. Select the embedding model and chunking method (template) for your dataset. - :::danger IMPORTANT - Once you have selected an embedding model and used it to parse a file, you are no longer allowed to change it. The obvious reason is that we must ensure that all files in a specific dataset are parsed using the *same* embedding model (ensure that they are being compared in the same embedding space). + :::danger IMPORTANT + Once you have selected an embedding model and used it to parse a file, you are no longer allowed to change it. The obvious reason is that we must ensure that all files in a specific dataset are parsed using the *same* embedding model (ensure that they are being compared in the same embedding space). ::: _You are taken to the **Dataset** page of your dataset._ -4. Click **+ Add file** **>** **Local files** to start uploading a particular file to the dataset. +4. Click **+ Add file** **>** **Local files** to start uploading a particular file to the dataset. 5. In the uploaded file entry, click the play button to start file parsing: ![parse file](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/parse_file.jpg) - :::caution NOTE + :::caution NOTE - If your file parsing gets stuck at below 1%, see [this FAQ](./faq.mdx#why-does-my-document-parsing-stall-at-under-one-percent). - If your file parsing gets stuck at near completion, see [this FAQ](./faq.mdx#why-does-my-pdf-parsing-stall-near-completion-while-the-log-does-not-show-any-error) ::: diff --git a/docs/references/_category_.json b/docs/references/_category_.json index fec53356012..f41a83cc712 100644 --- a/docs/references/_category_.json +++ b/docs/references/_category_.json @@ -4,5 +4,8 @@ "link": { "type": "generated-index", "description": "Miscellaneous References" + }, + "customProps": { + "sidebarIcon": "LucideScrollText" } } diff --git a/docs/references/glossary.mdx b/docs/references/glossary.mdx index ceec555dd24..f4cb071e77c 100644 --- a/docs/references/glossary.mdx +++ b/docs/references/glossary.mdx @@ -1,6 +1,9 @@ --- sidebar_position: 0 slug: /glossary +sidebar_custom_props: { + categoryIcon: LucideCaseUpper +} --- # Glossary diff --git a/docs/references/http_api_reference.md b/docs/references/http_api_reference.md index 8cc35ac7e1f..872c3cedb02 100644 --- a/docs/references/http_api_reference.md +++ b/docs/references/http_api_reference.md @@ -1,6 +1,9 @@ --- sidebar_position: 4 slug: /http_api_reference +sidebar_custom_props: { + categoryIcon: LucideGlobe +} --- # HTTP API @@ -79,17 +82,17 @@ curl --request POST \ ##### Request Parameters -- `model` (*Body parameter*) `string`, *Required* +- `model` (*Body parameter*) `string`, *Required* The model used to generate the response. The server will parse this automatically, so you can set it to any value for now. -- `messages` (*Body parameter*) `list[object]`, *Required* +- `messages` (*Body parameter*) `list[object]`, *Required* A list of historical chat messages used to generate the response. This must contain at least one message with the `user` role. -- `stream` (*Body parameter*) `boolean` +- `stream` (*Body parameter*) `boolean` Whether to receive the response as a stream. Set this to `false` explicitly if you prefer to receive the entire response in one go instead of as a stream. -- `extra_body` (*Body parameter*) `object` - Extra request parameters: +- `extra_body` (*Body parameter*) `object` + Extra request parameters: - `reference`: `boolean` - include reference in the final chunk (stream) or in the final message (non-stream). - `metadata_condition`: `object` - metadata filter conditions applied to retrieval results. @@ -209,16 +212,16 @@ curl --request POST \ ##### Request Parameters -- `model` (*Body parameter*) `string`, *Required* +- `model` (*Body parameter*) `string`, *Required* The model used to generate the response. The server will parse this automatically, so you can set it to any value for now. -- `messages` (*Body parameter*) `list[object]`, *Required* +- `messages` (*Body parameter*) `list[object]`, *Required* A list of historical chat messages used to generate the response. This must contain at least one message with the `user` role. -- `stream` (*Body parameter*) `boolean` +- `stream` (*Body parameter*) `boolean` Whether to receive the response as a stream. Set this to `false` explicitly if you prefer to receive the entire response in one go instead of as a stream. -- `session_id` (*Body parameter*) `string` +- `session_id` (*Body parameter*) `string` Agent session id. #### Response @@ -474,33 +477,33 @@ curl --request POST \ ##### Request parameters -- `"name"`: (*Body parameter*), `string`, *Required* - The unique name of the dataset to create. It must adhere to the following requirements: +- `"name"`: (*Body parameter*), `string`, *Required* + The unique name of the dataset to create. It must adhere to the following requirements: - Basic Multilingual Plane (BMP) only - Maximum 128 characters - Case-insensitive -- `"avatar"`: (*Body parameter*), `string` +- `"avatar"`: (*Body parameter*), `string` Base64 encoding of the avatar. - Maximum 65535 characters -- `"description"`: (*Body parameter*), `string` +- `"description"`: (*Body parameter*), `string` A brief description of the dataset to create. - Maximum 65535 characters -- `"embedding_model"`: (*Body parameter*), `string` +- `"embedding_model"`: (*Body parameter*), `string` The name of the embedding model to use. For example: `"BAAI/bge-large-zh-v1.5@BAAI"` - Maximum 255 characters - Must follow `model_name@model_factory` format -- `"permission"`: (*Body parameter*), `string` - Specifies who can access the dataset to create. Available options: +- `"permission"`: (*Body parameter*), `string` + Specifies who can access the dataset to create. Available options: - `"me"`: (Default) Only you can manage the dataset. - `"team"`: All team members can manage the dataset. -- `"chunk_method"`: (*Body parameter*), `enum` - The default chunk method of the dataset to create. Mutually exclusive with `"parse_type"` and `"pipeline_id"`. If you set `"chunk_method"`, do not include `"parse_type"` or `"pipeline_id"`. - Available options: +- `"chunk_method"`: (*Body parameter*), `enum` + The default chunk method of the dataset to create. Mutually exclusive with `"parse_type"` and `"pipeline_id"`. If you set `"chunk_method"`, do not include `"parse_type"` or `"pipeline_id"`. + Available options: - `"naive"`: General (default) - `"book"`: Book - `"email"`: Email @@ -514,8 +517,8 @@ curl --request POST \ - `"table"`: Table - `"tag"`: Tag -- `"parser_config"`: (*Body parameter*), `object` - The configuration settings for the dataset parser. The attributes in this JSON object vary with the selected `"chunk_method"`: +- `"parser_config"`: (*Body parameter*), `object` + The configuration settings for the dataset parser. The attributes in this JSON object vary with the selected `"chunk_method"`: - If `"chunk_method"` is `"naive"`, the `"parser_config"` object contains the following attributes: - `"auto_keywords"`: `int` - Defaults to `0` @@ -547,17 +550,17 @@ curl --request POST \ - Defaults to: `{"use_raptor": false}` - `"graphrag"`: `object` GRAPHRAG-specific settings. - Defaults to: `{"use_graphrag": false}` - - If `"chunk_method"` is `"qa"`, `"manuel"`, `"paper"`, `"book"`, `"laws"`, or `"presentation"`, the `"parser_config"` object contains the following attribute: + - If `"chunk_method"` is `"qa"`, `"manuel"`, `"paper"`, `"book"`, `"laws"`, or `"presentation"`, the `"parser_config"` object contains the following attribute: - `"raptor"`: `object` RAPTOR-specific settings. - Defaults to: `{"use_raptor": false}`. - If `"chunk_method"` is `"table"`, `"picture"`, `"one"`, or `"email"`, `"parser_config"` is an empty JSON object. -- `"parse_type"`: (*Body parameter*), `int` - The ingestion pipeline parse type identifier, i.e., the number of parsers in your **Parser** component. +- `"parse_type"`: (*Body parameter*), `int` + The ingestion pipeline parse type identifier, i.e., the number of parsers in your **Parser** component. - Required (along with `"pipeline_id"`) if specifying an ingestion pipeline. - Must not be included when `"chunk_method"` is specified. -- `"pipeline_id"`: (*Body parameter*), `string` +- `"pipeline_id"`: (*Body parameter*), `string` The ingestion pipeline ID. Can be found in the corresponding URL in the RAGFlow UI. - Required (along with `"parse_type"`) if specifying an ingestion pipeline. - Must be a 32-character lowercase hexadecimal string, e.g., `"d0bebe30ae2211f0970942010a8e0005"`. @@ -594,10 +597,10 @@ Success: "name": "RAGFlow example", "pagerank": 0, "parser_config": { - "chunk_token_num": 128, - "delimiter": "\\n!?;。;!?", - "html4excel": false, - "layout_recognize": "DeepDOC", + "chunk_token_num": 128, + "delimiter": "\\n!?;。;!?", + "html4excel": false, + "layout_recognize": "DeepDOC", "raptor": { "use_raptor": false } @@ -655,7 +658,7 @@ curl --request DELETE \ ##### Request parameters -- `"ids"`: (*Body parameter*), `list[string]` or `null`, *Required* +- `"ids"`: (*Body parameter*), `list[string]` or `null`, *Required* Specifies the datasets to delete: - If `null`, all datasets will be deleted. - If an array of IDs, only the specified datasets will be deleted. @@ -667,7 +670,7 @@ Success: ```json { - "code": 0 + "code": 0 } ``` @@ -720,32 +723,32 @@ curl --request PUT \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The ID of the dataset to update. -- `"name"`: (*Body parameter*), `string` +- `"name"`: (*Body parameter*), `string` The revised name of the dataset. - Basic Multilingual Plane (BMP) only - Maximum 128 characters - Case-insensitive -- `"avatar"`: (*Body parameter*), `string` +- `"avatar"`: (*Body parameter*), `string` The updated base64 encoding of the avatar. - Maximum 65535 characters -- `"embedding_model"`: (*Body parameter*), `string` - The updated embedding model name. +- `"embedding_model"`: (*Body parameter*), `string` + The updated embedding model name. - Ensure that `"chunk_count"` is `0` before updating `"embedding_model"`. - Maximum 255 characters - Must follow `model_name@model_factory` format -- `"permission"`: (*Body parameter*), `string` - The updated dataset permission. Available options: +- `"permission"`: (*Body parameter*), `string` + The updated dataset permission. Available options: - `"me"`: (Default) Only you can manage the dataset. - `"team"`: All team members can manage the dataset. -- `"pagerank"`: (*Body parameter*), `int` +- `"pagerank"`: (*Body parameter*), `int` refer to [Set page rank](https://ragflow.io/docs/dev/set_page_rank) - Default: `0` - Minimum: `0` - Maximum: `100` -- `"chunk_method"`: (*Body parameter*), `enum` - The chunking method for the dataset. Available options: +- `"chunk_method"`: (*Body parameter*), `enum` + The chunking method for the dataset. Available options: - `"naive"`: General (default) - `"book"`: Book - `"email"`: Email @@ -758,8 +761,8 @@ curl --request PUT \ - `"qa"`: Q&A - `"table"`: Table - `"tag"`: Tag -- `"parser_config"`: (*Body parameter*), `object` - The configuration settings for the dataset parser. The attributes in this JSON object vary with the selected `"chunk_method"`: +- `"parser_config"`: (*Body parameter*), `object` + The configuration settings for the dataset parser. The attributes in this JSON object vary with the selected `"chunk_method"`: - If `"chunk_method"` is `"naive"`, the `"parser_config"` object contains the following attributes: - `"auto_keywords"`: `int` - Defaults to `0` @@ -788,7 +791,7 @@ curl --request PUT \ - Defaults to: `{"use_raptor": false}` - `"graphrag"`: `object` GRAPHRAG-specific settings. - Defaults to: `{"use_graphrag": false}` - - If `"chunk_method"` is `"qa"`, `"manuel"`, `"paper"`, `"book"`, `"laws"`, or `"presentation"`, the `"parser_config"` object contains the following attribute: + - If `"chunk_method"` is `"qa"`, `"manuel"`, `"paper"`, `"book"`, `"laws"`, or `"presentation"`, the `"parser_config"` object contains the following attribute: - `"raptor"`: `object` RAPTOR-specific settings. - Defaults to: `{"use_raptor": false}`. - If `"chunk_method"` is `"table"`, `"picture"`, `"one"`, or `"email"`, `"parser_config"` is an empty JSON object. @@ -799,7 +802,7 @@ Success: ```json { - "code": 0 + "code": 0 } ``` @@ -837,19 +840,19 @@ curl --request GET \ ##### Request parameters -- `page`: (*Filter parameter*) +- `page`: (*Filter parameter*) Specifies the page on which the datasets will be displayed. Defaults to `1`. -- `page_size`: (*Filter parameter*) +- `page_size`: (*Filter parameter*) The number of datasets on each page. Defaults to `30`. -- `orderby`: (*Filter parameter*) +- `orderby`: (*Filter parameter*) The field by which datasets should be sorted. Available options: - `create_time` (default) - `update_time` -- `desc`: (*Filter parameter*) +- `desc`: (*Filter parameter*) Indicates whether the retrieved datasets should be sorted in descending order. Defaults to `true`. -- `name`: (*Filter parameter*) +- `name`: (*Filter parameter*) The name of the dataset to retrieve. -- `id`: (*Filter parameter*) +- `id`: (*Filter parameter*) The ID of the dataset to retrieve. #### Response @@ -932,7 +935,7 @@ curl --request GET \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The ID of the target dataset. #### Response @@ -1012,7 +1015,7 @@ curl --request DELETE \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The ID of the target dataset. #### Response @@ -1060,7 +1063,7 @@ curl --request POST \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The ID of the target dataset. #### Response @@ -1110,7 +1113,7 @@ curl --request GET \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The ID of the target dataset. #### Response @@ -1175,7 +1178,7 @@ curl --request POST \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The ID of the target dataset. #### Response @@ -1225,7 +1228,7 @@ curl --request GET \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The ID of the target dataset. #### Response @@ -1301,9 +1304,9 @@ curl --request POST \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The ID of the dataset to which the documents will be uploaded. -- `'file'`: (*Body parameter*) +- `'file'`: (*Body parameter*) A document to upload. #### Response @@ -1378,8 +1381,8 @@ curl --request PUT \ --header 'Content-Type: application/json' \ --data ' { - "name": "manual.txt", - "chunk_method": "manual", + "name": "manual.txt", + "chunk_method": "manual", "parser_config": {"chunk_token_num": 128} }' @@ -1387,14 +1390,14 @@ curl --request PUT \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The ID of the associated dataset. -- `document_id`: (*Path parameter*) +- `document_id`: (*Path parameter*) The ID of the document to update. - `"name"`: (*Body parameter*), `string` - `"meta_fields"`: (*Body parameter*), `dict[str, Any]` The meta fields of the document. -- `"chunk_method"`: (*Body parameter*), `string` - The parsing method to apply to the document: +- `"chunk_method"`: (*Body parameter*), `string` + The parsing method to apply to the document: - `"naive"`: General - `"manual`: Manual - `"qa"`: Q&A @@ -1406,8 +1409,8 @@ curl --request PUT \ - `"picture"`: Picture - `"one"`: One - `"email"`: Email -- `"parser_config"`: (*Body parameter*), `object` - The configuration settings for the dataset parser. The attributes in this JSON object vary with the selected `"chunk_method"`: +- `"parser_config"`: (*Body parameter*), `object` + The configuration settings for the dataset parser. The attributes in this JSON object vary with the selected `"chunk_method"`: - If `"chunk_method"` is `"naive"`, the `"parser_config"` object contains the following attributes: - `"chunk_token_num"`: Defaults to `256`. - `"layout_recognize"`: Defaults to `true`. @@ -1418,10 +1421,10 @@ curl --request PUT \ - If `"chunk_method"` is `"qa"`, `"manuel"`, `"paper"`, `"book"`, `"laws"`, or `"presentation"`, the `"parser_config"` object contains the following attribute: - `"raptor"`: RAPTOR-specific settings. Defaults to: `{"use_raptor": false}`. - If `"chunk_method"` is `"table"`, `"picture"`, `"one"`, or `"email"`, `"parser_config"` is an empty JSON object. -- `"enabled"`: (*Body parameter*), `integer` - Whether the document should be **available** in the knowledge base. - - `1` → (available) - - `0` → (unavailable) +- `"enabled"`: (*Body parameter*), `integer` + Whether the document should be **available** in the knowledge base. + - `1` → (available) + - `0` → (unavailable) #### Response @@ -1545,9 +1548,9 @@ curl --request GET \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The associated dataset ID. -- `documents_id`: (*Path parameter*) +- `documents_id`: (*Path parameter*) The ID of the document to download. #### Response @@ -1595,30 +1598,30 @@ curl --request GET \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The associated dataset ID. -- `keywords`: (*Filter parameter*), `string` +- `keywords`: (*Filter parameter*), `string` The keywords used to match document titles. - `page`: (*Filter parameter*), `integer` Specifies the page on which the documents will be displayed. Defaults to `1`. -- `page_size`: (*Filter parameter*), `integer` +- `page_size`: (*Filter parameter*), `integer` The maximum number of documents on each page. Defaults to `30`. -- `orderby`: (*Filter parameter*), `string` +- `orderby`: (*Filter parameter*), `string` The field by which documents should be sorted. Available options: - `create_time` (default) - `update_time` -- `desc`: (*Filter parameter*), `boolean` +- `desc`: (*Filter parameter*), `boolean` Indicates whether the retrieved documents should be sorted in descending order. Defaults to `true`. -- `id`: (*Filter parameter*), `string` +- `id`: (*Filter parameter*), `string` The ID of the document to retrieve. -- `create_time_from`: (*Filter parameter*), `integer` +- `create_time_from`: (*Filter parameter*), `integer` Unix timestamp for filtering documents created after this time. 0 means no filter. Defaults to `0`. -- `create_time_to`: (*Filter parameter*), `integer` +- `create_time_to`: (*Filter parameter*), `integer` Unix timestamp for filtering documents created before this time. 0 means no filter. Defaults to `0`. -- `suffix`: (*Filter parameter*), `array[string]` +- `suffix`: (*Filter parameter*), `array[string]` Filter by file suffix. Supports multiple values, e.g., `pdf`, `txt`, and `docx`. Defaults to all suffixes. -- `run`: (*Filter parameter*), `array[string]` - Filter by document processing status. Supports numeric, text, and mixed formats: +- `run`: (*Filter parameter*), `array[string]` + Filter by document processing status. Supports numeric, text, and mixed formats: - Numeric format: `["0", "1", "2", "3", "4"]` - Text format: `[UNSTART, RUNNING, CANCEL, DONE, FAIL]` - Mixed format: `[UNSTART, 1, DONE]` (mixing numeric and text formats) @@ -1627,7 +1630,7 @@ curl --request GET \ - `1` / `RUNNING`: Document is currently being processed - `2` / `CANCEL`: Document processing was cancelled - `3` / `DONE`: Document processing completed successfully - - `4` / `FAIL`: Document processing failed + - `4` / `FAIL`: Document processing failed Defaults to all statuses. - `metadata_condition`: (*Filter parameter*), `object` (JSON in query) Optional metadata filter applied to documents when `document_ids` is not provided. Uses the same structure as retrieval: @@ -1741,9 +1744,9 @@ curl --request DELETE \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The associated dataset ID. -- `"ids"`: (*Body parameter*), `list[string]` +- `"ids"`: (*Body parameter*), `list[string]` The IDs of the documents to delete. If it is not specified, all documents in the specified dataset will be deleted. #### Response @@ -1798,9 +1801,9 @@ curl --request POST \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The dataset ID. -- `"document_ids"`: (*Body parameter*), `list[string]`, *Required* +- `"document_ids"`: (*Body parameter*), `list[string]`, *Required* The IDs of the documents to parse. #### Response @@ -1855,9 +1858,9 @@ curl --request DELETE \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The associated dataset ID. -- `"document_ids"`: (*Body parameter*), `list[string]`, *Required* +- `"document_ids"`: (*Body parameter*), `list[string]`, *Required* The IDs of the documents for which the parsing should be stopped. #### Response @@ -1917,13 +1920,13 @@ curl --request POST \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The associated dataset ID. -- `document_ids`: (*Path parameter*) +- `document_ids`: (*Path parameter*) The associated document ID. -- `"content"`: (*Body parameter*), `string`, *Required* +- `"content"`: (*Body parameter*), `string`, *Required* The text content of the chunk. -- `"important_keywords`(*Body parameter*), `list[string]` +- `"important_keywords`(*Body parameter*), `list[string]` The key terms or phrases to tag with the chunk. - `"questions"`(*Body parameter*), `list[string]` If there is a given question, the embedded chunks will be based on them @@ -1979,22 +1982,22 @@ Lists chunks in a specified document. ```bash curl --request GET \ --url http://{address}/api/v1/datasets/{dataset_id}/documents/{document_id}/chunks?keywords={keywords}&page={page}&page_size={page_size}&id={chunk_id} \ - --header 'Authorization: Bearer ' + --header 'Authorization: Bearer ' ``` ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The associated dataset ID. -- `document_id`: (*Path parameter*) +- `document_id`: (*Path parameter*) The associated document ID. -- `keywords`(*Filter parameter*), `string` +- `keywords`(*Filter parameter*), `string` The keywords used to match chunk content. -- `page`(*Filter parameter*), `integer` +- `page`(*Filter parameter*), `integer` Specifies the page on which the chunks will be displayed. Defaults to `1`. -- `page_size`(*Filter parameter*), `integer` +- `page_size`(*Filter parameter*), `integer` The maximum number of chunks on each page. Defaults to `1024`. -- `id`(*Filter parameter*), `string` +- `id`(*Filter parameter*), `string` The ID of the chunk to retrieve. #### Response @@ -2099,11 +2102,11 @@ curl --request DELETE \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The associated dataset ID. -- `document_ids`: (*Path parameter*) +- `document_ids`: (*Path parameter*) The associated document ID. -- `"chunk_ids"`: (*Body parameter*), `list[string]` +- `"chunk_ids"`: (*Body parameter*), `list[string]` The IDs of the chunks to delete. If it is not specified, all chunks of the specified document will be deleted. #### Response @@ -2153,26 +2156,26 @@ curl --request PUT \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ' \ --data ' - { - "content": "ragflow123", - "important_keywords": [] + { + "content": "ragflow123", + "important_keywords": [] }' ``` ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The associated dataset ID. -- `document_ids`: (*Path parameter*) +- `document_ids`: (*Path parameter*) The associated document ID. -- `chunk_id`: (*Path parameter*) +- `chunk_id`: (*Path parameter*) The ID of the chunk to update. -- `"content"`: (*Body parameter*), `string` +- `"content"`: (*Body parameter*), `string` The text content of the chunk. -- `"important_keywords"`: (*Body parameter*), `list[string]` +- `"important_keywords"`: (*Body parameter*), `list[string]` A list of key terms or phrases to tag with the chunk. -- `"available"`: (*Body parameter*) `boolean` - The chunk's availability status in the dataset. Value options: +- `"available"`: (*Body parameter*) `boolean` + The chunk's availability status in the dataset. Value options: - `true`: Available (default) - `false`: Unavailable @@ -2248,18 +2251,18 @@ Batch update or delete document-level metadata within a specified dataset. If bo #### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The associated dataset ID. -- `"selector"`: (*Body parameter*), `object`, *optional* - A document selector: - - `"document_ids"`: `list[string]` *optional* - The associated document ID. - - `"metadata_condition"`: `object`, *optional* +- `"selector"`: (*Body parameter*), `object`, *optional* + A document selector: + - `"document_ids"`: `list[string]` *optional* + The associated document ID. + - `"metadata_condition"`: `object`, *optional* - `"logic"`: Defines the logic relation between conditions if multiple conditions are provided. Options: - `"and"` (default) - `"or"` - - `"conditions"`: `list[object]` *optional* - Each object: `{ "name": string, "comparison_operator": string, "value": string }` + - `"conditions"`: `list[object]` *optional* + Each object: `{ "name": string, "comparison_operator": string, "value": string }` - `"name"`: `string` The key name to search by. - `"comparison_operator"`: `string` Available options: - `"is"` @@ -2276,14 +2279,14 @@ Batch update or delete document-level metadata within a specified dataset. If bo - `"≤"` - `"empty"` - `"not empty"` - - `"value"`: `string` The key value to search by. -- `"updates"`: (*Body parameter*), `list[object]`, *optional* - Replaces metadata of the retrieved documents. Each object: `{ "key": string, "match": string, "value": string }`. + - `"value"`: `string` The key value to search by. +- `"updates"`: (*Body parameter*), `list[object]`, *optional* + Replaces metadata of the retrieved documents. Each object: `{ "key": string, "match": string, "value": string }`. - `"key"`: `string` The name of the key to update. - `"match"`: `string` *optional* The current value of the key to update. When omitted, the corresponding keys are updated to `"value"` regardless of their current values. - `"value"`: `string` The new value to set for the specified keys. -- `"deletes`: (*Body parameter*), `list[ojbect]`, *optional* - Deletes metadata of the retrieved documents. Each object: `{ "key": string, "value": string }`. +- `"deletes`: (*Body parameter*), `list[ojbect]`, *optional* + Deletes metadata of the retrieved documents. Each object: `{ "key": string, "value": string }`. - `"key"`: `string` The name of the key to delete. - `"value"`: `string` *Optional* The value of the key to delete. - When provided, only keys with a matching value are deleted. @@ -2345,16 +2348,16 @@ Retrieves chunks from specified datasets. - `'content-Type: application/json'` - `'Authorization: Bearer '` - Body: - - `"question"`: `string` - - `"dataset_ids"`: `list[string]` + - `"question"`: `string` + - `"dataset_ids"`: `list[string]` - `"document_ids"`: `list[string]` - - `"page"`: `integer` - - `"page_size"`: `integer` - - `"similarity_threshold"`: `float` - - `"vector_similarity_weight"`: `float` - - `"top_k"`: `integer` - - `"rerank_id"`: `string` - - `"keyword"`: `boolean` + - `"page"`: `integer` + - `"page_size"`: `integer` + - `"similarity_threshold"`: `float` + - `"vector_similarity_weight"`: `float` + - `"top_k"`: `integer` + - `"rerank_id"`: `string` + - `"keyword"`: `boolean` - `"highlight"`: `boolean` - `"cross_languages"`: `list[string]` - `"metadata_condition"`: `object` @@ -2393,45 +2396,45 @@ curl --request POST \ ##### Request parameter -- `"question"`: (*Body parameter*), `string`, *Required* +- `"question"`: (*Body parameter*), `string`, *Required* The user query or query keywords. -- `"dataset_ids"`: (*Body parameter*) `list[string]` +- `"dataset_ids"`: (*Body parameter*) `list[string]` The IDs of the datasets to search. If you do not set this argument, ensure that you set `"document_ids"`. -- `"document_ids"`: (*Body parameter*), `list[string]` +- `"document_ids"`: (*Body parameter*), `list[string]` The IDs of the documents to search. Ensure that all selected documents use the same embedding model. Otherwise, an error will occur. If you do not set this argument, ensure that you set `"dataset_ids"`. -- `"page"`: (*Body parameter*), `integer` +- `"page"`: (*Body parameter*), `integer` Specifies the page on which the chunks will be displayed. Defaults to `1`. -- `"page_size"`: (*Body parameter*) +- `"page_size"`: (*Body parameter*) The maximum number of chunks on each page. Defaults to `30`. -- `"similarity_threshold"`: (*Body parameter*) +- `"similarity_threshold"`: (*Body parameter*) The minimum similarity score. Defaults to `0.2`. -- `"vector_similarity_weight"`: (*Body parameter*), `float` +- `"vector_similarity_weight"`: (*Body parameter*), `float` The weight of vector cosine similarity. Defaults to `0.3`. If x represents the weight of vector cosine similarity, then (1 - x) is the term similarity weight. -- `"top_k"`: (*Body parameter*), `integer` +- `"top_k"`: (*Body parameter*), `integer` The number of chunks engaged in vector cosine computation. Defaults to `1024`. -- `"use_kg"`: (*Body parameter*), `boolean` +- `"use_kg"`: (*Body parameter*), `boolean` Whether to search chunks related to the generated knowledge graph for multi-hop queries. Defaults to `False`. Before enabling this, ensure you have successfully constructed a knowledge graph for the specified datasets. See [here](https://ragflow.io/docs/dev/construct_knowledge_graph) for details. -- `"toc_enhance"`: (*Body parameter*), `boolean` +- `"toc_enhance"`: (*Body parameter*), `boolean` Whether to search chunks with extracted table of content. Defaults to `False`. Before enabling this, ensure you have enabled `TOC_Enhance` and successfully extracted table of contents for the specified datasets. See [here](https://ragflow.io/docs/dev/enable_table_of_contents) for details. -- `"rerank_id"`: (*Body parameter*), `integer` +- `"rerank_id"`: (*Body parameter*), `integer` The ID of the rerank model. -- `"keyword"`: (*Body parameter*), `boolean` - Indicates whether to enable keyword-based matching: +- `"keyword"`: (*Body parameter*), `boolean` + Indicates whether to enable keyword-based matching: - `true`: Enable keyword-based matching. - `false`: Disable keyword-based matching (default). -- `"highlight"`: (*Body parameter*), `boolean` - Specifies whether to enable highlighting of matched terms in the results: +- `"highlight"`: (*Body parameter*), `boolean` + Specifies whether to enable highlighting of matched terms in the results: - `true`: Enable highlighting of matched terms. - `false`: Disable highlighting of matched terms (default). -- `"cross_languages"`: (*Body parameter*) `list[string]` +- `"cross_languages"`: (*Body parameter*) `list[string]` The languages that should be translated into, in order to achieve keywords retrievals in different languages. -- `"metadata_condition"`: (*Body parameter*), `object` - The metadata condition used for filtering chunks: +- `"metadata_condition"`: (*Body parameter*), `object` + The metadata condition used for filtering chunks: - `"logic"`: (*Body parameter*), `string` - `"and"`: Return only results that satisfy *every* condition (default). - `"or"`: Return results that satisfy *any* condition. - - `"conditions"`: (*Body parameter*), `array` - A list of metadata filter conditions. + - `"conditions"`: (*Body parameter*), `array` + A list of metadata filter conditions. - `"name"`: `string` - The metadata field name to filter by, e.g., `"author"`, `"company"`, `"url"`. Ensure this parameter before use. See [Set metadata](../guides/dataset/set_metadata.md) for details. - `comparison_operator`: `string` - The comparison operator. Can be one of: - `"contains"` @@ -2538,16 +2541,16 @@ curl --request POST \ ##### Request parameters -- `"name"`: (*Body parameter*), `string`, *Required* +- `"name"`: (*Body parameter*), `string`, *Required* The name of the chat assistant. -- `"avatar"`: (*Body parameter*), `string` +- `"avatar"`: (*Body parameter*), `string` Base64 encoding of the avatar. -- `"dataset_ids"`: (*Body parameter*), `list[string]` +- `"dataset_ids"`: (*Body parameter*), `list[string]` The IDs of the associated datasets. -- `"llm"`: (*Body parameter*), `object` - The LLM settings for the chat assistant to create. If it is not explicitly set, a JSON object with the following values will be generated as the default. An `llm` JSON object contains the following attributes: - - `"model_name"`, `string` - The chat model name. If not set, the user's default chat model will be used. +- `"llm"`: (*Body parameter*), `object` + The LLM settings for the chat assistant to create. If it is not explicitly set, a JSON object with the following values will be generated as the default. An `llm` JSON object contains the following attributes: + - `"model_name"`, `string` + The chat model name. If not set, the user's default chat model will be used. :::caution WARNING `model_type` is an *internal* parameter, serving solely as a temporary workaround for the current model-configuration design limitations. @@ -2558,23 +2561,23 @@ curl --request POST \ - It is subject to change or removal in future releases. ::: - - `"model_type"`: `string` + - `"model_type"`: `string` A model type specifier. Only `"chat"` and `"image2text"` are recognized; any other inputs, or when omitted, are treated as `"chat"`. - `"model_name"`, `string` - - `"temperature"`: `float` - Controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses. Defaults to `0.1`. - - `"top_p"`: `float` - Also known as “nucleus sampling”, this parameter sets a threshold to select a smaller set of words to sample from. It focuses on the most likely words, cutting off the less probable ones. Defaults to `0.3` - - `"presence_penalty"`: `float` + - `"temperature"`: `float` + Controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses. Defaults to `0.1`. + - `"top_p"`: `float` + Also known as “nucleus sampling”, this parameter sets a threshold to select a smaller set of words to sample from. It focuses on the most likely words, cutting off the less probable ones. Defaults to `0.3` + - `"presence_penalty"`: `float` This discourages the model from repeating the same information by penalizing words that have already appeared in the conversation. Defaults to `0.4`. - - `"frequency penalty"`: `float` + - `"frequency penalty"`: `float` Similar to the presence penalty, this reduces the model’s tendency to repeat the same words frequently. Defaults to `0.7`. -- `"prompt"`: (*Body parameter*), `object` - Instructions for the LLM to follow. If it is not explicitly set, a JSON object with the following values will be generated as the default. A `prompt` JSON object contains the following attributes: +- `"prompt"`: (*Body parameter*), `object` + Instructions for the LLM to follow. If it is not explicitly set, a JSON object with the following values will be generated as the default. A `prompt` JSON object contains the following attributes: - `"similarity_threshold"`: `float` RAGFlow employs either a combination of weighted keyword similarity and weighted vector cosine similarity, or a combination of weighted keyword similarity and weighted reranking score during retrieval. This argument sets the threshold for similarities between the user query and chunks. If a similarity score falls below this threshold, the corresponding chunk will be excluded from the results. The default value is `0.2`. - `"keywords_similarity_weight"`: `float` This argument sets the weight of keyword similarity in the hybrid similarity score with vector cosine similarity or reranking model similarity. By adjusting this weight, you can control the influence of keyword similarity in relation to other similarity measures. The default value is `0.7`. - `"top_n"`: `int` This argument specifies the number of top chunks with similarity scores above the `similarity_threshold` that are fed to the LLM. The LLM will *only* access these 'top N' chunks. The default value is `6`. - - `"variables"`: `object[]` This argument lists the variables to use in the 'System' field of **Chat Configurations**. Note that: + - `"variables"`: `object[]` This argument lists the variables to use in the 'System' field of **Chat Configurations**. Note that: - `"knowledge"` is a reserved variable, which represents the retrieved chunks. - All the variables in 'System' should be curly bracketed. - The default value is `[{"key": "knowledge", "optional": true}]`. @@ -2682,32 +2685,32 @@ curl --request PUT \ #### Parameters -- `chat_id`: (*Path parameter*) +- `chat_id`: (*Path parameter*) The ID of the chat assistant to update. -- `"name"`: (*Body parameter*), `string`, *Required* +- `"name"`: (*Body parameter*), `string`, *Required* The revised name of the chat assistant. -- `"avatar"`: (*Body parameter*), `string` +- `"avatar"`: (*Body parameter*), `string` Base64 encoding of the avatar. -- `"dataset_ids"`: (*Body parameter*), `list[string]` +- `"dataset_ids"`: (*Body parameter*), `list[string]` The IDs of the associated datasets. -- `"llm"`: (*Body parameter*), `object` - The LLM settings for the chat assistant to create. If it is not explicitly set, a dictionary with the following values will be generated as the default. An `llm` object contains the following attributes: - - `"model_name"`, `string` - The chat model name. If not set, the user's default chat model will be used. - - `"temperature"`: `float` - Controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses. Defaults to `0.1`. - - `"top_p"`: `float` - Also known as “nucleus sampling”, this parameter sets a threshold to select a smaller set of words to sample from. It focuses on the most likely words, cutting off the less probable ones. Defaults to `0.3` - - `"presence_penalty"`: `float` +- `"llm"`: (*Body parameter*), `object` + The LLM settings for the chat assistant to create. If it is not explicitly set, a dictionary with the following values will be generated as the default. An `llm` object contains the following attributes: + - `"model_name"`, `string` + The chat model name. If not set, the user's default chat model will be used. + - `"temperature"`: `float` + Controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses. Defaults to `0.1`. + - `"top_p"`: `float` + Also known as “nucleus sampling”, this parameter sets a threshold to select a smaller set of words to sample from. It focuses on the most likely words, cutting off the less probable ones. Defaults to `0.3` + - `"presence_penalty"`: `float` This discourages the model from repeating the same information by penalizing words that have already appeared in the conversation. Defaults to `0.2`. - - `"frequency penalty"`: `float` + - `"frequency penalty"`: `float` Similar to the presence penalty, this reduces the model’s tendency to repeat the same words frequently. Defaults to `0.7`. -- `"prompt"`: (*Body parameter*), `object` - Instructions for the LLM to follow. A `prompt` object contains the following attributes: +- `"prompt"`: (*Body parameter*), `object` + Instructions for the LLM to follow. A `prompt` object contains the following attributes: - `"similarity_threshold"`: `float` RAGFlow employs either a combination of weighted keyword similarity and weighted vector cosine similarity, or a combination of weighted keyword similarity and weighted rerank score during retrieval. This argument sets the threshold for similarities between the user query and chunks. If a similarity score falls below this threshold, the corresponding chunk will be excluded from the results. The default value is `0.2`. - `"keywords_similarity_weight"`: `float` This argument sets the weight of keyword similarity in the hybrid similarity score with vector cosine similarity or reranking model similarity. By adjusting this weight, you can control the influence of keyword similarity in relation to other similarity measures. The default value is `0.7`. - `"top_n"`: `int` This argument specifies the number of top chunks with similarity scores above the `similarity_threshold` that are fed to the LLM. The LLM will *only* access these 'top N' chunks. The default value is `8`. - - `"variables"`: `object[]` This argument lists the variables to use in the 'System' field of **Chat Configurations**. Note that: + - `"variables"`: `object[]` This argument lists the variables to use in the 'System' field of **Chat Configurations**. Note that: - `"knowledge"` is a reserved variable, which represents the retrieved chunks. - All the variables in 'System' should be curly bracketed. - The default value is `[{"key": "knowledge", "optional": true}]` @@ -2769,7 +2772,7 @@ curl --request DELETE \ ##### Request parameters -- `"ids"`: (*Body parameter*), `list[string]` +- `"ids"`: (*Body parameter*), `list[string]` The IDs of the chat assistants to delete. If it is not specified, all chat assistants in the system will be deleted. #### Response @@ -2816,19 +2819,19 @@ curl --request GET \ ##### Request parameters -- `page`: (*Filter parameter*), `integer` +- `page`: (*Filter parameter*), `integer` Specifies the page on which the chat assistants will be displayed. Defaults to `1`. -- `page_size`: (*Filter parameter*), `integer` +- `page_size`: (*Filter parameter*), `integer` The number of chat assistants on each page. Defaults to `30`. -- `orderby`: (*Filter parameter*), `string` +- `orderby`: (*Filter parameter*), `string` The attribute by which the results are sorted. Available options: - `create_time` (default) - `update_time` -- `desc`: (*Filter parameter*), `boolean` +- `desc`: (*Filter parameter*), `boolean` Indicates whether the retrieved chat assistants should be sorted in descending order. Defaults to `true`. -- `id`: (*Filter parameter*), `string` +- `id`: (*Filter parameter*), `string` The ID of the chat assistant to retrieve. -- `name`: (*Filter parameter*), `string` +- `name`: (*Filter parameter*), `string` The name of the chat assistant to retrieve. #### Response @@ -2929,11 +2932,11 @@ curl --request POST \ ##### Request parameters -- `chat_id`: (*Path parameter*) +- `chat_id`: (*Path parameter*) The ID of the associated chat assistant. -- `"name"`: (*Body parameter*), `string` +- `"name"`: (*Body parameter*), `string` The name of the chat session to create. -- `"user_id"`: (*Body parameter*), `string` +- `"user_id"`: (*Body parameter*), `string` Optional user-defined ID. #### Response @@ -3004,13 +3007,13 @@ curl --request PUT \ ##### Request Parameter -- `chat_id`: (*Path parameter*) +- `chat_id`: (*Path parameter*) The ID of the associated chat assistant. -- `session_id`: (*Path parameter*) +- `session_id`: (*Path parameter*) The ID of the session to update. -- `"name"`: (*Body Parameter*), `string` +- `"name"`: (*Body Parameter*), `string` The revised name of the session. -- `"user_id"`: (*Body parameter*), `string` +- `"user_id"`: (*Body parameter*), `string` Optional user-defined ID. #### Response @@ -3057,23 +3060,23 @@ curl --request GET \ ##### Request Parameters -- `chat_id`: (*Path parameter*) +- `chat_id`: (*Path parameter*) The ID of the associated chat assistant. -- `page`: (*Filter parameter*), `integer` +- `page`: (*Filter parameter*), `integer` Specifies the page on which the sessions will be displayed. Defaults to `1`. -- `page_size`: (*Filter parameter*), `integer` +- `page_size`: (*Filter parameter*), `integer` The number of sessions on each page. Defaults to `30`. -- `orderby`: (*Filter parameter*), `string` - The field by which sessions should be sorted. Available options: +- `orderby`: (*Filter parameter*), `string` + The field by which sessions should be sorted. Available options: - `create_time` (default) - `update_time` -- `desc`: (*Filter parameter*), `boolean` +- `desc`: (*Filter parameter*), `boolean` Indicates whether the retrieved sessions should be sorted in descending order. Defaults to `true`. -- `name`: (*Filter parameter*) `string` +- `name`: (*Filter parameter*) `string` The name of the chat session to retrieve. -- `id`: (*Filter parameter*), `string` +- `id`: (*Filter parameter*), `string` The ID of the chat session to retrieve. -- `user_id`: (*Filter parameter*), `string` +- `user_id`: (*Filter parameter*), `string` The optional user-defined ID passed in when creating session. #### Response @@ -3145,9 +3148,9 @@ curl --request DELETE \ ##### Request Parameters -- `chat_id`: (*Path parameter*) +- `chat_id`: (*Path parameter*) The ID of the associated chat assistant. -- `"ids"`: (*Body Parameter*), `list[string]` +- `"ids"`: (*Body Parameter*), `list[string]` The IDs of the sessions to delete. If it is not specified, all sessions associated with the specified chat assistant will be deleted. #### Response @@ -3243,20 +3246,20 @@ curl --request POST \ ##### Request Parameters -- `chat_id`: (*Path parameter*) +- `chat_id`: (*Path parameter*) The ID of the associated chat assistant. -- `"question"`: (*Body Parameter*), `string`, *Required* +- `"question"`: (*Body Parameter*), `string`, *Required* The question to start an AI-powered conversation. -- `"stream"`: (*Body Parameter*), `boolean` +- `"stream"`: (*Body Parameter*), `boolean` Indicates whether to output responses in a streaming way: - `true`: Enable streaming (default). - `false`: Disable streaming. -- `"session_id"`: (*Body Parameter*) +- `"session_id"`: (*Body Parameter*) The ID of session. If it is not provided, a new session will be generated. -- `"user_id"`: (*Body parameter*), `string` +- `"user_id"`: (*Body parameter*), `string` The optional user-defined ID. Valid *only* when no `session_id` is provided. -- `"metadata_condition"`: (*Body parameter*), `object` - Optional metadata filter conditions applied to retrieval results. +- `"metadata_condition"`: (*Body parameter*), `object` + Optional metadata filter conditions applied to retrieval results. - `logic`: `string`, one of `and` / `or` - `conditions`: `list[object]` where each condition contains: - `name`: `string` metadata key @@ -3411,9 +3414,9 @@ curl --request POST \ ##### Request parameters -- `agent_id`: (*Path parameter*) +- `agent_id`: (*Path parameter*) The ID of the associated agent. -- `user_id`: (*Filter parameter*) +- `user_id`: (*Filter parameter*) The optional user-defined ID for parsing docs (especially images) when creating a session while uploading files. #### Response @@ -3625,7 +3628,7 @@ Failure: ### Converse with agent -**POST** `/api/v1/agents/{agent_id}/completions` +**POST** `/api/v1/agents/{agent_id}/completions` Asks a specified agent a question to start an AI-powered conversation. @@ -3687,7 +3690,7 @@ curl --request POST \ }' ``` -- If the **Begin** component takes parameters, include their values in the body of `"inputs"` as follows: +- If the **Begin** component takes parameters, include their values in the body of `"inputs"` as follows: ```bash curl --request POST \ @@ -3740,24 +3743,24 @@ curl --request POST \ ##### Request Parameters -- `agent_id`: (*Path parameter*), `string` +- `agent_id`: (*Path parameter*), `string` The ID of the associated agent. -- `"question"`: (*Body Parameter*), `string`, *Required* +- `"question"`: (*Body Parameter*), `string`, *Required* The question to start an AI-powered conversation. -- `"stream"`: (*Body Parameter*), `boolean` - Indicates whether to output responses in a streaming way: +- `"stream"`: (*Body Parameter*), `boolean` + Indicates whether to output responses in a streaming way: - `true`: Enable streaming (default). - `false`: Disable streaming. -- `"session_id"`: (*Body Parameter*) +- `"session_id"`: (*Body Parameter*) The ID of the session. If it is not provided, a new session will be generated. -- `"inputs"`: (*Body Parameter*) - Variables specified in the **Begin** component. -- `"user_id"`: (*Body parameter*), `string` +- `"inputs"`: (*Body Parameter*) + Variables specified in the **Begin** component. +- `"user_id"`: (*Body parameter*), `string` The optional user-defined ID. Valid *only* when no `session_id` is provided. :::tip NOTE -For now, this method does *not* support a file type input/variable. As a workaround, use the following to upload a file to an agent: -`http://{address}/v1/canvas/upload/{agent_id}` +For now, this method does *not* support a file type input/variable. As a workaround, use the following to upload a file to an agent: +`http://{address}/v1/canvas/upload/{agent_id}` *You will get a corresponding file ID from its response body.* ::: @@ -4304,23 +4307,23 @@ curl --request GET \ ##### Request Parameters -- `agent_id`: (*Path parameter*) +- `agent_id`: (*Path parameter*) The ID of the associated agent. -- `page`: (*Filter parameter*), `integer` +- `page`: (*Filter parameter*), `integer` Specifies the page on which the sessions will be displayed. Defaults to `1`. -- `page_size`: (*Filter parameter*), `integer` +- `page_size`: (*Filter parameter*), `integer` The number of sessions on each page. Defaults to `30`. -- `orderby`: (*Filter parameter*), `string` - The field by which sessions should be sorted. Available options: +- `orderby`: (*Filter parameter*), `string` + The field by which sessions should be sorted. Available options: - `create_time` (default) - `update_time` -- `desc`: (*Filter parameter*), `boolean` +- `desc`: (*Filter parameter*), `boolean` Indicates whether the retrieved sessions should be sorted in descending order. Defaults to `true`. -- `id`: (*Filter parameter*), `string` +- `id`: (*Filter parameter*), `string` The ID of the agent session to retrieve. -- `user_id`: (*Filter parameter*), `string` +- `user_id`: (*Filter parameter*), `string` The optional user-defined ID passed in when creating session. -- `dsl`: (*Filter parameter*), `boolean` +- `dsl`: (*Filter parameter*), `boolean` Indicates whether to include the dsl field of the sessions in the response. Defaults to `true`. #### Response @@ -4506,9 +4509,9 @@ curl --request DELETE \ ##### Request Parameters -- `agent_id`: (*Path parameter*) +- `agent_id`: (*Path parameter*) The ID of the associated agent. -- `"ids"`: (*Body Parameter*), `list[string]` +- `"ids"`: (*Body Parameter*), `list[string]` The IDs of the sessions to delete. If it is not specified, all sessions associated with the specified agent will be deleted. #### Response @@ -4639,19 +4642,19 @@ curl --request GET \ ##### Request parameters -- `page`: (*Filter parameter*), `integer` +- `page`: (*Filter parameter*), `integer` Specifies the page on which the agents will be displayed. Defaults to `1`. -- `page_size`: (*Filter parameter*), `integer` +- `page_size`: (*Filter parameter*), `integer` The number of agents on each page. Defaults to `30`. -- `orderby`: (*Filter parameter*), `string` +- `orderby`: (*Filter parameter*), `string` The attribute by which the results are sorted. Available options: - `create_time` (default) - `update_time` -- `desc`: (*Filter parameter*), `boolean` +- `desc`: (*Filter parameter*), `boolean` Indicates whether the retrieved agents should be sorted in descending order. Defaults to `true`. -- `id`: (*Filter parameter*), `string` +- `id`: (*Filter parameter*), `string` The ID of the agent to retrieve. -- `title`: (*Filter parameter*), `string` +- `title`: (*Filter parameter*), `string` The name of the agent to retrieve. #### Response @@ -4763,11 +4766,11 @@ curl --request POST \ ##### Request parameters -- `title`: (*Body parameter*), `string`, *Required* +- `title`: (*Body parameter*), `string`, *Required* The title of the agent. -- `description`: (*Body parameter*), `string` +- `description`: (*Body parameter*), `string` The description of the agent. Defaults to `None`. -- `dsl`: (*Body parameter*), `object`, *Required* +- `dsl`: (*Body parameter*), `object`, *Required* The canvas DSL object of the agent. #### Response @@ -4829,13 +4832,13 @@ curl --request PUT \ ##### Request parameters -- `agent_id`: (*Path parameter*), `string` +- `agent_id`: (*Path parameter*), `string` The id of the agent to be updated. -- `title`: (*Body parameter*), `string` +- `title`: (*Body parameter*), `string` The title of the agent. -- `description`: (*Body parameter*), `string` +- `description`: (*Body parameter*), `string` The description of the agent. -- `dsl`: (*Body parameter*), `object` +- `dsl`: (*Body parameter*), `object` The canvas DSL object of the agent. Only specify the parameter you want to change in the request body. If a parameter does not exist or is `None`, it won't be updated. @@ -4889,7 +4892,7 @@ curl --request DELETE \ ##### Request parameters -- `agent_id`: (*Path parameter*), `string` +- `agent_id`: (*Path parameter*), `string` The id of the agent to be deleted. #### Response @@ -4943,7 +4946,7 @@ curl --request GET ##### Request parameters -- `address`: (*Path parameter*), string +- `address`: (*Path parameter*), string The host and port of the backend service (e.g., `localhost:7897`). --- @@ -4986,11 +4989,11 @@ Content-Type: application/json } ``` -Explanation: +Explanation: -- Each service is reported as "ok" or "nok". -- The top-level `status` reflects overall health. -- If any service is "nok", detailed error info appears in `_meta`. +- Each service is reported as "ok" or "nok". +- The top-level `status` reflects overall health. +- If any service is "nok", detailed error info appears in `_meta`. --- @@ -5029,9 +5032,9 @@ curl --request POST \ ##### Request parameters -- `'file'`: (*Form parameter*), `file`, *Required* +- `'file'`: (*Form parameter*), `file`, *Required* The file(s) to upload. Multiple files can be uploaded in a single request. -- `'parent_id'`: (*Form parameter*), `string` +- `'parent_id'`: (*Form parameter*), `string` The parent folder ID where the file will be uploaded. If not specified, files will be uploaded to the root folder. #### Response @@ -5100,11 +5103,11 @@ curl --request POST \ ##### Request parameters -- `"name"`: (*Body parameter*), `string`, *Required* +- `"name"`: (*Body parameter*), `string`, *Required* The name of the file or folder to create. -- `"parent_id"`: (*Body parameter*), `string` +- `"parent_id"`: (*Body parameter*), `string` The parent folder ID. If not specified, the file/folder will be created in the root folder. -- `"type"`: (*Body parameter*), `string` +- `"type"`: (*Body parameter*), `string` The type of the file to create. Available options: - `"FOLDER"`: Create a folder - `"VIRTUAL"`: Create a virtual file @@ -5161,18 +5164,18 @@ curl --request GET \ ##### Request parameters -- `parent_id`: (*Filter parameter*), `string` +- `parent_id`: (*Filter parameter*), `string` The folder ID to list files from. If not specified, the root folder is used by default. -- `keywords`: (*Filter parameter*), `string` +- `keywords`: (*Filter parameter*), `string` Search keyword to filter files by name. -- `page`: (*Filter parameter*), `integer` +- `page`: (*Filter parameter*), `integer` Specifies the page on which the files will be displayed. Defaults to `1`. -- `page_size`: (*Filter parameter*), `integer` +- `page_size`: (*Filter parameter*), `integer` The number of files on each page. Defaults to `15`. -- `orderby`: (*Filter parameter*), `string` +- `orderby`: (*Filter parameter*), `string` The field by which files should be sorted. Available options: - `create_time` (default) -- `desc`: (*Filter parameter*), `boolean` +- `desc`: (*Filter parameter*), `boolean` Indicates whether the retrieved files should be sorted in descending order. Defaults to `true`. #### Response @@ -5280,7 +5283,7 @@ curl --request GET \ ##### Request parameters -- `file_id`: (*Filter parameter*), `string`, *Required* +- `file_id`: (*Filter parameter*), `string`, *Required* The ID of the file whose immediate parent folder to retrieve. #### Response @@ -5333,7 +5336,7 @@ curl --request GET \ ##### Request parameters -- `file_id`: (*Filter parameter*), `string`, *Required* +- `file_id`: (*Filter parameter*), `string`, *Required* The ID of the file whose parent folders to retrieve. #### Response @@ -5399,7 +5402,7 @@ curl --request POST \ ##### Request parameters -- `"file_ids"`: (*Body parameter*), `list[string]`, *Required* +- `"file_ids"`: (*Body parameter*), `list[string]`, *Required* The IDs of the files or folders to delete. #### Response @@ -5456,9 +5459,9 @@ curl --request POST \ ##### Request parameters -- `"file_id"`: (*Body parameter*), `string`, *Required* +- `"file_id"`: (*Body parameter*), `string`, *Required* The ID of the file or folder to rename. -- `"name"`: (*Body parameter*), `string`, *Required* +- `"name"`: (*Body parameter*), `string`, *Required* The new name for the file or folder. Note: Changing file extensions is *not* supported. #### Response @@ -5516,7 +5519,7 @@ curl --request GET \ ##### Request parameters -- `file_id`: (*Path parameter*), `string`, *Required* +- `file_id`: (*Path parameter*), `string`, *Required* The ID of the file to download. #### Response @@ -5568,9 +5571,9 @@ curl --request POST \ ##### Request parameters -- `"src_file_ids"`: (*Body parameter*), `list[string]`, *Required* +- `"src_file_ids"`: (*Body parameter*), `list[string]`, *Required* The IDs of the files or folders to move. -- `"dest_file_id"`: (*Body parameter*), `string`, *Required* +- `"dest_file_id"`: (*Body parameter*), `string`, *Required* The ID of the destination folder. #### Response @@ -5636,9 +5639,9 @@ curl --request POST \ ##### Request parameters -- `"file_ids"`: (*Body parameter*), `list[string]`, *Required* +- `"file_ids"`: (*Body parameter*), `list[string]`, *Required* The IDs of the files to convert. If a folder ID is provided, all files within that folder will be converted. -- `"kb_ids"`: (*Body parameter*), `list[string]`, *Required* +- `"kb_ids"`: (*Body parameter*), `list[string]`, *Required* The IDs of the target datasets. #### Response diff --git a/docs/references/python_api_reference.md b/docs/references/python_api_reference.md index 3689da3f3eb..089dd981972 100644 --- a/docs/references/python_api_reference.md +++ b/docs/references/python_api_reference.md @@ -1,6 +1,9 @@ --- sidebar_position: 5 slug: /python_api_reference +sidebar_custom_props: { + categoryIcon: SiPython +} --- # Python API @@ -108,7 +111,7 @@ RAGFlow.create_dataset( avatar: Optional[str] = None, description: Optional[str] = None, embedding_model: Optional[str] = "BAAI/bge-large-zh-v1.5@BAAI", - permission: str = "me", + permission: str = "me", chunk_method: str = "naive", parser_config: DataSet.ParserConfig = None ) -> DataSet @@ -136,7 +139,7 @@ A brief description of the dataset to create. Defaults to `None`. ##### permission -Specifies who can access the dataset to create. Available options: +Specifies who can access the dataset to create. Available options: - `"me"`: (Default) Only you can manage the dataset. - `"team"`: All team members can manage the dataset. @@ -161,29 +164,29 @@ The chunking method of the dataset to create. Available options: The parser configuration of the dataset. A `ParserConfig` object's attributes vary based on the selected `chunk_method`: -- `chunk_method`=`"naive"`: +- `chunk_method`=`"naive"`: `{"chunk_token_num":512,"delimiter":"\\n","html4excel":False,"layout_recognize":True,"raptor":{"use_raptor":False}}`. -- `chunk_method`=`"qa"`: +- `chunk_method`=`"qa"`: `{"raptor": {"use_raptor": False}}` -- `chunk_method`=`"manuel"`: +- `chunk_method`=`"manuel"`: `{"raptor": {"use_raptor": False}}` -- `chunk_method`=`"table"`: +- `chunk_method`=`"table"`: `None` -- `chunk_method`=`"paper"`: +- `chunk_method`=`"paper"`: `{"raptor": {"use_raptor": False}}` -- `chunk_method`=`"book"`: +- `chunk_method`=`"book"`: `{"raptor": {"use_raptor": False}}` -- `chunk_method`=`"laws"`: +- `chunk_method`=`"laws"`: `{"raptor": {"use_raptor": False}}` -- `chunk_method`=`"picture"`: +- `chunk_method`=`"picture"`: `None` -- `chunk_method`=`"presentation"`: +- `chunk_method`=`"presentation"`: `{"raptor": {"use_raptor": False}}` -- `chunk_method`=`"one"`: +- `chunk_method`=`"one"`: `None` -- `chunk_method`=`"knowledge-graph"`: +- `chunk_method`=`"knowledge-graph"`: `{"chunk_token_num":128,"delimiter":"\\n","entity_types":["organization","person","location","event","time"]}` -- `chunk_method`=`"email"`: +- `chunk_method`=`"email"`: `None` #### Returns @@ -236,9 +239,9 @@ rag_object.delete_datasets(ids=["d94a8dc02c9711f0930f7fbc369eab6d","e94a8dc02c97 ```python RAGFlow.list_datasets( - page: int = 1, - page_size: int = 30, - orderby: str = "create_time", + page: int = 1, + page_size: int = 30, + orderby: str = "create_time", desc: bool = True, id: str = None, name: str = None @@ -317,25 +320,25 @@ A dictionary representing the attributes to update, with the following keys: - Basic Multilingual Plane (BMP) only - Maximum 128 characters - Case-insensitive -- `"avatar"`: (*Body parameter*), `string` +- `"avatar"`: (*Body parameter*), `string` The updated base64 encoding of the avatar. - Maximum 65535 characters -- `"embedding_model"`: (*Body parameter*), `string` - The updated embedding model name. +- `"embedding_model"`: (*Body parameter*), `string` + The updated embedding model name. - Ensure that `"chunk_count"` is `0` before updating `"embedding_model"`. - Maximum 255 characters - Must follow `model_name@model_factory` format -- `"permission"`: (*Body parameter*), `string` - The updated dataset permission. Available options: +- `"permission"`: (*Body parameter*), `string` + The updated dataset permission. Available options: - `"me"`: (Default) Only you can manage the dataset. - `"team"`: All team members can manage the dataset. -- `"pagerank"`: (*Body parameter*), `int` +- `"pagerank"`: (*Body parameter*), `int` refer to [Set page rank](https://ragflow.io/docs/dev/set_page_rank) - Default: `0` - Minimum: `0` - Maximum: `100` -- `"chunk_method"`: (*Body parameter*), `enum` - The chunking method for the dataset. Available options: +- `"chunk_method"`: (*Body parameter*), `enum` + The chunking method for the dataset. Available options: - `"naive"`: General (default) - `"book"`: Book - `"email"`: Email @@ -385,7 +388,7 @@ Uploads documents to the current dataset. A list of dictionaries representing the documents to upload, each containing the following keys: -- `"display_name"`: (Optional) The file name to display in the dataset. +- `"display_name"`: (Optional) The file name to display in the dataset. - `"blob"`: (Optional) The binary content of the file to upload. #### Returns @@ -431,29 +434,29 @@ A dictionary representing the attributes to update, with the following keys: - `"one"`: One - `"email"`: Email - `"parser_config"`: `dict[str, Any]` The parsing configuration for the document. Its attributes vary based on the selected `"chunk_method"`: - - `"chunk_method"`=`"naive"`: + - `"chunk_method"`=`"naive"`: `{"chunk_token_num":128,"delimiter":"\\n","html4excel":False,"layout_recognize":True,"raptor":{"use_raptor":False}}`. - - `chunk_method`=`"qa"`: + - `chunk_method`=`"qa"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"manuel"`: + - `chunk_method`=`"manuel"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"table"`: + - `chunk_method`=`"table"`: `None` - - `chunk_method`=`"paper"`: + - `chunk_method`=`"paper"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"book"`: + - `chunk_method`=`"book"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"laws"`: + - `chunk_method`=`"laws"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"presentation"`: + - `chunk_method`=`"presentation"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"picture"`: + - `chunk_method`=`"picture"`: `None` - - `chunk_method`=`"one"`: + - `chunk_method`=`"one"`: `None` - - `chunk_method`=`"knowledge-graph"`: + - `chunk_method`=`"knowledge-graph"`: `{"chunk_token_num":128,"delimiter":"\\n","entity_types":["organization","person","location","event","time"]}` - - `chunk_method`=`"email"`: + - `chunk_method`=`"email"`: `None` #### Returns @@ -586,27 +589,27 @@ A `Document` object contains the following attributes: - `"FAIL"` - `status`: `str` Reserved for future use. - `parser_config`: `ParserConfig` Configuration object for the parser. Its attributes vary based on the selected `chunk_method`: - - `chunk_method`=`"naive"`: + - `chunk_method`=`"naive"`: `{"chunk_token_num":128,"delimiter":"\\n","html4excel":False,"layout_recognize":True,"raptor":{"use_raptor":False}}`. - - `chunk_method`=`"qa"`: + - `chunk_method`=`"qa"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"manuel"`: + - `chunk_method`=`"manuel"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"table"`: + - `chunk_method`=`"table"`: `None` - - `chunk_method`=`"paper"`: + - `chunk_method`=`"paper"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"book"`: + - `chunk_method`=`"book"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"laws"`: + - `chunk_method`=`"laws"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"presentation"`: + - `chunk_method`=`"presentation"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"picure"`: + - `chunk_method`=`"picure"`: `None` - - `chunk_method`=`"one"`: + - `chunk_method`=`"one"`: `None` - - `chunk_method`=`"email"`: + - `chunk_method`=`"email"`: `None` #### Examples @@ -724,9 +727,9 @@ A list of tuples with detailed parsing results: ... ] ``` -- `status`: The final parsing state (e.g., `success`, `failed`, `cancelled`). -- `chunk_count`: The number of content chunks created from the document. -- `token_count`: The total number of tokens processed. +- `status`: The final parsing state (e.g., `success`, `failed`, `cancelled`). +- `chunk_count`: The number of content chunks created from the document. +- `token_count`: The total number of tokens processed. --- @@ -986,11 +989,11 @@ The user query or query keywords. Defaults to `""`. ##### dataset_ids: `list[str]`, *Required* -The IDs of the datasets to search. Defaults to `None`. +The IDs of the datasets to search. Defaults to `None`. ##### document_ids: `list[str]` -The IDs of the documents to search. Defaults to `None`. You must ensure all selected documents use the same embedding model. Otherwise, an error will occur. +The IDs of the documents to search. Defaults to `None`. You must ensure all selected documents use the same embedding model. Otherwise, an error will occur. ##### page: `int` @@ -1023,7 +1026,7 @@ Indicates whether to enable keyword-based matching: - `True`: Enable keyword-based matching. - `False`: Disable keyword-based matching (default). -##### cross_languages: `list[string]` +##### cross_languages: `list[string]` The languages that should be translated into, in order to achieve keywords retrievals in different languages. @@ -1064,10 +1067,10 @@ for c in rag_object.retrieve(dataset_ids=[dataset.id],document_ids=[doc.id]): ```python RAGFlow.create_chat( - name: str, - avatar: str = "", - dataset_ids: list[str] = [], - llm: Chat.LLM = None, + name: str, + avatar: str = "", + dataset_ids: list[str] = [], + llm: Chat.LLM = None, prompt: Chat.Prompt = None ) -> Chat ``` @@ -1092,15 +1095,15 @@ The IDs of the associated datasets. Defaults to `[""]`. The LLM settings for the chat assistant to create. Defaults to `None`. When the value is `None`, a dictionary with the following values will be generated as the default. An `LLM` object contains the following attributes: -- `model_name`: `str` - The chat model name. If it is `None`, the user's default chat model will be used. -- `temperature`: `float` - Controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses. Defaults to `0.1`. -- `top_p`: `float` - Also known as “nucleus sampling”, this parameter sets a threshold to select a smaller set of words to sample from. It focuses on the most likely words, cutting off the less probable ones. Defaults to `0.3` -- `presence_penalty`: `float` +- `model_name`: `str` + The chat model name. If it is `None`, the user's default chat model will be used. +- `temperature`: `float` + Controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses. Defaults to `0.1`. +- `top_p`: `float` + Also known as “nucleus sampling”, this parameter sets a threshold to select a smaller set of words to sample from. It focuses on the most likely words, cutting off the less probable ones. Defaults to `0.3` +- `presence_penalty`: `float` This discourages the model from repeating the same information by penalizing words that have already appeared in the conversation. Defaults to `0.2`. -- `frequency penalty`: `float` +- `frequency penalty`: `float` Similar to the presence penalty, this reduces the model’s tendency to repeat the same words frequently. Defaults to `0.7`. ##### prompt: `Chat.Prompt` @@ -1160,8 +1163,8 @@ A dictionary representing the attributes to update, with the following keys: - `"dataset_ids"`: `list[str]` The datasets to update. - `"llm"`: `dict` The LLM settings: - `"model_name"`, `str` The chat model name. - - `"temperature"`, `float` Controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses. - - `"top_p"`, `float` Also known as “nucleus sampling”, this parameter sets a threshold to select a smaller set of words to sample from. + - `"temperature"`, `float` Controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses. + - `"top_p"`, `float` Also known as “nucleus sampling”, this parameter sets a threshold to select a smaller set of words to sample from. - `"presence_penalty"`, `float` This discourages the model from repeating the same information by penalizing words that have appeared in the conversation. - `"frequency penalty"`, `float` Similar to presence penalty, this reduces the model’s tendency to repeat the same words. - `"prompt"` : Instructions for the LLM to follow. @@ -1231,9 +1234,9 @@ rag_object.delete_chats(ids=["id_1","id_2"]) ```python RAGFlow.list_chats( - page: int = 1, - page_size: int = 30, - orderby: str = "create_time", + page: int = 1, + page_size: int = 30, + orderby: str = "create_time", desc: bool = True, id: str = None, name: str = None @@ -1263,11 +1266,11 @@ The attribute by which the results are sorted. Available options: Indicates whether the retrieved chat assistants should be sorted in descending order. Defaults to `True`. -##### id: `str` +##### id: `str` The ID of the chat assistant to retrieve. Defaults to `None`. -##### name: `str` +##### name: `str` The name of the chat assistant to retrieve. Defaults to `None`. @@ -1367,9 +1370,9 @@ session.update({"name": "updated_name"}) ```python Chat.list_sessions( - page: int = 1, - page_size: int = 30, - orderby: str = "create_time", + page: int = 1, + page_size: int = 30, + orderby: str = "create_time", desc: bool = True, id: str = None, name: str = None @@ -1506,25 +1509,25 @@ The content of the message. Defaults to `"Hi! I am your assistant, can I help yo A list of `Chunk` objects representing references to the message, each containing the following attributes: -- `id` `str` +- `id` `str` The chunk ID. -- `content` `str` +- `content` `str` The content of the chunk. -- `img_id` `str` +- `img_id` `str` The ID of the snapshot of the chunk. Applicable only when the source of the chunk is an image, PPT, PPTX, or PDF file. -- `document_id` `str` +- `document_id` `str` The ID of the referenced document. -- `document_name` `str` +- `document_name` `str` The name of the referenced document. -- `position` `list[str]` +- `position` `list[str]` The location information of the chunk within the referenced document. -- `dataset_id` `str` +- `dataset_id` `str` The ID of the dataset to which the referenced document belongs. -- `similarity` `float` +- `similarity` `float` A composite similarity score of the chunk ranging from `0` to `1`, with a higher value indicating greater similarity. It is the weighted sum of `vector_similarity` and `term_similarity`. -- `vector_similarity` `float` +- `vector_similarity` `float` A vector similarity score of the chunk ranging from `0` to `1`, with a higher value indicating greater similarity between vector embeddings. -- `term_similarity` `float` +- `term_similarity` `float` A keyword similarity score of the chunk ranging from `0` to `1`, with a higher value indicating greater similarity between keywords. #### Examples @@ -1535,7 +1538,7 @@ from ragflow_sdk import RAGFlow rag_object = RAGFlow(api_key="", base_url="http://:9380") assistant = rag_object.list_chats(name="Miss R") assistant = assistant[0] -session = assistant.create_session() +session = assistant.create_session() print("\n==================== Miss R =====================\n") print("Hello. What can I do for you?") @@ -1543,7 +1546,7 @@ print("Hello. What can I do for you?") while True: question = input("\n==================== User =====================\n> ") print("\n==================== Miss R =====================\n") - + cont = "" for ans in session.ask(question, stream=True): print(ans.content[len(cont):], end='', flush=True) @@ -1631,25 +1634,25 @@ The content of the message. Defaults to `"Hi! I am your assistant, can I help yo A list of `Chunk` objects representing references to the message, each containing the following attributes: -- `id` `str` +- `id` `str` The chunk ID. -- `content` `str` +- `content` `str` The content of the chunk. -- `image_id` `str` +- `image_id` `str` The ID of the snapshot of the chunk. Applicable only when the source of the chunk is an image, PPT, PPTX, or PDF file. -- `document_id` `str` +- `document_id` `str` The ID of the referenced document. -- `document_name` `str` +- `document_name` `str` The name of the referenced document. -- `position` `list[str]` +- `position` `list[str]` The location information of the chunk within the referenced document. -- `dataset_id` `str` +- `dataset_id` `str` The ID of the dataset to which the referenced document belongs. -- `similarity` `float` +- `similarity` `float` A composite similarity score of the chunk ranging from `0` to `1`, with a higher value indicating greater similarity. It is the weighted sum of `vector_similarity` and `term_similarity`. -- `vector_similarity` `float` +- `vector_similarity` `float` A vector similarity score of the chunk ranging from `0` to `1`, with a higher value indicating greater similarity between vector embeddings. -- `term_similarity` `float` +- `term_similarity` `float` A keyword similarity score of the chunk ranging from `0` to `1`, with a higher value indicating greater similarity between keywords. #### Examples @@ -1660,7 +1663,7 @@ from ragflow_sdk import RAGFlow, Agent rag_object = RAGFlow(api_key="", base_url="http://:9380") AGENT_id = "AGENT_ID" agent = rag_object.list_agents(id = AGENT_id)[0] -session = agent.create_session() +session = agent.create_session() print("\n===== Miss R ====\n") print("Hello. What can I do for you?") @@ -1668,7 +1671,7 @@ print("Hello. What can I do for you?") while True: question = input("\n===== User ====\n> ") print("\n==== Miss R ====\n") - + cont = "" for ans in session.ask(question, stream=True): print(ans.content[len(cont):], end='', flush=True) @@ -1681,9 +1684,9 @@ while True: ```python Agent.list_sessions( - page: int = 1, - page_size: int = 30, - orderby: str = "update_time", + page: int = 1, + page_size: int = 30, + orderby: str = "update_time", desc: bool = True, id: str = None ) -> List[Session] @@ -1774,9 +1777,9 @@ agent.delete_sessions(ids=["id_1","id_2"]) ```python RAGFlow.list_agents( - page: int = 1, - page_size: int = 30, - orderby: str = "create_time", + page: int = 1, + page_size: int = 30, + orderby: str = "create_time", desc: bool = True, id: str = None, title: str = None @@ -1806,11 +1809,11 @@ The attribute by which the results are sorted. Available options: Indicates whether the retrieved agents should be sorted in descending order. Defaults to `True`. -##### id: `str` +##### id: `str` The ID of the agent to retrieve. Defaults to `None`. -##### name: `str` +##### name: `str` The name of the agent to retrieve. Defaults to `None`. diff --git a/docs/references/supported_models.mdx b/docs/references/supported_models.mdx index a572fb84985..1d7a0387c62 100644 --- a/docs/references/supported_models.mdx +++ b/docs/references/supported_models.mdx @@ -1,6 +1,9 @@ --- sidebar_position: 1 slug: /supported_models +sidebar_custom_props: { + categoryIcon: LucideBox +} --- # Supported models diff --git a/docs/release_notes.md b/docs/release_notes.md index 98d5dfbe060..e724f503726 100644 --- a/docs/release_notes.md +++ b/docs/release_notes.md @@ -1,6 +1,9 @@ --- sidebar_position: 2 slug: /release_notes +sidebar_custom_props: { + sidebarIcon: LucideClipboardPenLine +} --- # Releases @@ -20,7 +23,7 @@ Released on December 31, 2025. ### Fixed issues -- Memory: +- Memory: - The RAGFlow server failed to start if an empty memory object existed. - Unable to delete a newly created empty Memory. - RAG: MDX file parsing was not supported. @@ -256,7 +259,7 @@ Ecommerce Customer Service Workflow: A template designed to handle enquiries abo ### Fixed issues -- Dataset: +- Dataset: - Unable to share resources with the team. - Inappropriate restrictions on the number and size of uploaded files. - Chat: @@ -272,13 +275,13 @@ Released on August 20, 2025. ### Improvements -- Revamps the user interface for the **Datasets**, **Chat**, and **Search** pages. +- Revamps the user interface for the **Datasets**, **Chat**, and **Search** pages. - Search and Chat: Introduces document-level metadata filtering, allowing automatic or manual filtering during chats or searches. - Search: Supports creating search apps tailored to various business scenarios - Chat: Supports comparing answer performance of up to three chat model settings on a single **Chat** page. -- Agent: - - Implements a toggle in the **Agent** component to enable or disable citation. - - Introduces a drag-and-drop method for creating components. +- Agent: + - Implements a toggle in the **Agent** component to enable or disable citation. + - Introduces a drag-and-drop method for creating components. - Documentation: Corrects inaccuracies in the API reference. ### New Agent templates @@ -288,8 +291,8 @@ Released on August 20, 2025. ### Fixed issues - The timeout mechanism introduced in v0.20.0 caused tasks like GraphRAG to halt. -- Predefined opening greeting in the **Agent** component was missing during conversations. -- An automatic line break issue in the prompt editor. +- Predefined opening greeting in the **Agent** component was missing during conversations. +- An automatic line break issue in the prompt editor. - A memory leak issue caused by PyPDF. [#9469](https://github.com/infiniflow/ragflow/pull/9469) ### API changes @@ -373,7 +376,7 @@ Released on June 23, 2025. ### Newly supported models -- Qwen 3 Embedding. [#8184](https://github.com/infiniflow/ragflow/pull/8184) +- Qwen 3 Embedding. [#8184](https://github.com/infiniflow/ragflow/pull/8184) - Voyage Multimodal 3. [#7987](https://github.com/infiniflow/ragflow/pull/7987) ## v0.19.0 From 2a4627d9a04ad81c085c5e2713d85f821957230b Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Wed, 7 Jan 2026 10:03:54 +0800 Subject: [PATCH 052/335] Fix: Issues and style fixes related to the 'Memory' page (#12469) ### What problem does this PR solve? Fix: Some bugs - Issues and style fixes related to the 'Memory' page - Data source icon replacement - Build optimization ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/assets/svg/data-source/github.svg | 3 - web/src/assets/svg/data-source/imap.svg | 7 -- web/src/components/dynamic-form.tsx | 1 + web/src/components/more-button.tsx | 5 +- web/src/components/ragflow-form.tsx | 2 +- web/src/components/ui/input.tsx | 14 +++- web/src/locales/en.ts | 1 + web/src/locales/zh.ts | 8 ++- web/src/pages/agents/index.tsx | 2 +- .../configuration/common-item.tsx | 1 - .../dataset/dataset-setting/form-schema.ts | 2 +- web/src/pages/datasets/index.tsx | 2 +- web/src/pages/memories/hooks.ts | 72 +++++++++++++++++-- web/src/pages/memories/index.tsx | 11 ++- web/src/pages/memory/index.tsx | 2 +- web/src/pages/memory/memory-message/hook.ts | 37 ++++++++-- web/src/pages/memory/memory-message/index.tsx | 14 ++-- .../memory/memory-message/message-table.tsx | 4 +- .../memory-setting/advanced-settings-form.tsx | 6 +- .../memory/memory-setting/basic-form.tsx | 1 + web/src/pages/next-chats/index.tsx | 2 +- web/src/pages/next-searches/index.tsx | 2 +- .../data-source/constant/index.tsx | 12 +++- web/src/utils/list-filter-util.ts | 28 +++++++- web/vite.config.ts | 51 +++++++++++++ 25 files changed, 239 insertions(+), 51 deletions(-) delete mode 100644 web/src/assets/svg/data-source/github.svg delete mode 100644 web/src/assets/svg/data-source/imap.svg diff --git a/web/src/assets/svg/data-source/github.svg b/web/src/assets/svg/data-source/github.svg deleted file mode 100644 index a8d1174049a..00000000000 --- a/web/src/assets/svg/data-source/github.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/web/src/assets/svg/data-source/imap.svg b/web/src/assets/svg/data-source/imap.svg deleted file mode 100644 index 82a815425a0..00000000000 --- a/web/src/assets/svg/data-source/imap.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/web/src/components/dynamic-form.tsx b/web/src/components/dynamic-form.tsx index 6ef736a4029..1900d579401 100644 --- a/web/src/components/dynamic-form.tsx +++ b/web/src/components/dynamic-form.tsx @@ -97,6 +97,7 @@ export interface FormFieldConfig { schema?: ZodSchema; shouldRender?: (formValues: any) => boolean; labelClassName?: string; + className?: string; disabled?: boolean; } diff --git a/web/src/components/more-button.tsx b/web/src/components/more-button.tsx index f8d2d75dcd6..45953a4b1d6 100644 --- a/web/src/components/more-button.tsx +++ b/web/src/components/more-button.tsx @@ -10,7 +10,10 @@ export const MoreButton = React.forwardRef( ref={ref} variant="ghost" size={size || 'icon'} - className={cn('invisible group-hover:visible size-3.5', className)} + className={cn( + 'invisible group-hover:visible size-3.5 bg-transparent group-hover:bg-transparent', + className, + )} {...props} > diff --git a/web/src/components/ragflow-form.tsx b/web/src/components/ragflow-form.tsx index 758038bfddc..5d10124ff14 100644 --- a/web/src/components/ragflow-form.tsx +++ b/web/src/components/ragflow-form.tsx @@ -45,7 +45,7 @@ export function RAGFlowFormItem({ , 'prefix'> { +export interface InputProps extends Omit< + React.InputHTMLAttributes, + 'prefix' +> { value?: string | number | readonly string[] | undefined; prefix?: React.ReactNode; suffix?: React.ReactNode; @@ -157,8 +160,13 @@ export interface ExpandedInputProps extends InputProps {} const ExpandedInput = Input; const SearchInput = (props: InputProps) => { + const { t } = useTranslation(); return ( - } /> + } + /> ); }; diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index 385dae580c6..42458e61684 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -129,6 +129,7 @@ Procedural Memory: Learned skills, habits, and automated procedures.`, }, memory: { messages: { + forget: 'Forget', forgetMessageTip: 'Are you sure you want to forget?', messageDescription: 'Memory extract is configured with Prompts and Temperature from Advanced Settings.', diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts index 96d36a31268..18e9273b1ca 100644 --- a/web/src/locales/zh.ts +++ b/web/src/locales/zh.ts @@ -101,7 +101,7 @@ export default { embeddingModelTooltip: '将文本转换为数值向量,用于语义相似度搜索和记忆检索。', embeddingModelError: '记忆类型为必填项,且"原始"类型不可删除。', - memoryTypeTooltip: `原始: 用户与代理之间的原始对话内容(默认必需)。 + memoryTypeTooltip: `原始: 用户与智能体之间的原始对话内容(默认必需)。 语义记忆: 关于用户和世界的通用知识和事实。 情景记忆: 带时间戳的特定事件和经历记录。 程序记忆: 学习的技能、习惯和自动化程序。`, @@ -118,15 +118,16 @@ export default { embeddingModel: '嵌入模型', selectModel: '选择模型', llm: '大语言模型', - delMemoryWarn: `删除后,此记忆中的所有消息都将被删除,代理将无法检索。`, + delMemoryWarn: `删除后,此记忆中的所有消息都将被删除,智能体将无法检索。`, }, memory: { messages: { + forget: '遗忘', forgetMessageTip: '确定遗忘吗?', messageDescription: '记忆提取使用高级设置中的提示词和温度值进行配置。', copied: '已复制!', content: '内容', - delMessageWarn: `遗忘后,代理将无法检索此消息。`, + delMessageWarn: `遗忘后,智能体将无法检索此消息。`, forgetMessage: '遗忘消息', sessionId: '会话ID', agent: '智能体', @@ -2138,6 +2139,7 @@ Tokenizer 会根据所选方式将内容存储为对应的数据结构。`, delFilesContent: '已选择 {{count}} 个文件', delChat: '删除聊天', delMember: '删除成员', + delMemory: '删除记忆', }, empty: { diff --git a/web/src/pages/agents/index.tsx b/web/src/pages/agents/index.tsx index 52815392f0b..82308f3096f 100644 --- a/web/src/pages/agents/index.tsx +++ b/web/src/pages/agents/index.tsx @@ -109,7 +109,7 @@ export default function Agents() { diff --git a/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx b/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx index 3f90d64a46c..8a8d6e1a8d5 100644 --- a/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx +++ b/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx @@ -515,7 +515,6 @@ export function LLMModelItem({ line = 1, isEdit, label, name }: IProps) { })} > diff --git a/web/src/pages/memories/hooks.ts b/web/src/pages/memories/hooks.ts index 9a50d337eed..f2bd4b64d5f 100644 --- a/web/src/pages/memories/hooks.ts +++ b/web/src/pages/memories/hooks.ts @@ -1,14 +1,21 @@ // src/pages/next-memoryes/hooks.ts +import { FilterCollection } from '@/components/list-filter-bar/interface'; +import { useHandleFilterSubmit } from '@/components/list-filter-bar/use-handle-filter-submit'; import message from '@/components/ui/message'; import { useSetModalState } from '@/hooks/common-hooks'; import { useHandleSearchChange } from '@/hooks/logic-hooks'; import { useFetchTenantInfo } from '@/hooks/use-user-setting-request'; import memoryService, { updateMemoryById } from '@/services/memory-service'; +import { + buildOwnersFilter, + groupListByArray, + groupListByType, +} from '@/utils/list-filter-util'; import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; import { useDebounce } from 'ahooks'; import { omit } from 'lodash'; -import { useCallback, useState } from 'react'; +import { useCallback, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useParams, useSearchParams } from 'react-router'; import { @@ -45,7 +52,27 @@ export const useCreateMemory = () => { export const useFetchMemoryList = () => { const { handleInputChange, searchString, pagination, setPagination } = useHandleSearchChange(); + const { filterValue, handleFilterSubmit } = useHandleFilterSubmit(); const debouncedSearchString = useDebounce(searchString, { wait: 500 }); + + const memoryType = Array.isArray(filterValue.memoryType) + ? filterValue.memoryType + : []; + const storageType = Array.isArray(filterValue.storageType) + ? filterValue.storageType + : []; + const owner = filterValue.owner; + const requestParams: Record = { + keywords: debouncedSearchString, + page_size: pagination.pageSize, + page: pagination.current, + memory_type: memoryType.length > 0 ? memoryType.join(',') : undefined, + storage_type: storageType.length === 1 ? storageType[0] : undefined, + }; + + if (Array.isArray(owner) && owner.length > 0) { + requestParams.owner_ids = owner.join(','); + } const { data, isLoading, isError, refetch } = useQuery< MemoryListResponse, Error @@ -56,16 +83,13 @@ export const useFetchMemoryList = () => { debouncedSearchString, ...pagination, }, + filterValue, ], queryFn: async () => { const { data: response } = await memoryService.getMemoryList( { - params: { - keywords: debouncedSearchString, - page_size: pagination.pageSize, - page: pagination.current, - }, - data: {}, + params: requestParams, + data: { memory_type: memoryType }, }, true, ); @@ -93,6 +117,8 @@ export const useFetchMemoryList = () => { handleInputChange, setPagination, refetch, + filterValue, + handleFilterSubmit, }; }; @@ -275,3 +301,35 @@ export const useRenameMemory = () => { showMemoryRenameModal: handleShowChatRenameModal, }; }; + +export function useSelectFilters() { + const { data: res } = useFetchMemoryList(); + const data = res?.data; + + const memoryType = useMemo(() => { + return groupListByArray(data?.memory_list ?? [], 'memory_type'); + }, [data?.memory_list]); + const storageType = useMemo(() => { + return groupListByType( + data?.memory_list ?? [], + 'storage_type', + 'storage_type', + ); + }, [data?.memory_list]); + + const filters: FilterCollection[] = [ + buildOwnersFilter(data?.memory_list ?? [], 'owner_name'), + { + field: 'memoryType', + list: memoryType, + label: 'Memory Type', + }, + { + field: 'storageType', + list: storageType, + label: 'Storage Type', + }, + ]; + + return { filters }; +} diff --git a/web/src/pages/memories/index.tsx b/web/src/pages/memories/index.tsx index a29c4f3bfc0..811102a8e69 100644 --- a/web/src/pages/memories/index.tsx +++ b/web/src/pages/memories/index.tsx @@ -11,7 +11,7 @@ import { useCallback, useEffect, useState } from 'react'; import { useSearchParams } from 'react-router'; import { AddOrEditModal } from './add-or-edit-modal'; import { defaultMemoryFields } from './constants'; -import { useFetchMemoryList, useRenameMemory } from './hooks'; +import { useFetchMemoryList, useRenameMemory, useSelectFilters } from './hooks'; import { ICreateMemoryProps, IMemory } from './interface'; import { MemoryCard } from './memory-card'; @@ -27,6 +27,8 @@ export default function MemoryList() { handleInputChange, setPagination, refetch: refetchList, + filterValue, + handleFilterSubmit, } = useFetchMemoryList(); const { @@ -56,6 +58,7 @@ export default function MemoryList() { ); const [searchUrl, setMemoryUrl] = useSearchParams(); + const { filters } = useSelectFilters(); const isCreate = searchUrl.get('isCreate') === 'true'; useEffect(() => { if (isCreate) { @@ -87,9 +90,11 @@ export default function MemoryList() { diff --git a/web/src/pages/memory/index.tsx b/web/src/pages/memory/index.tsx index 77dde215c6e..89a964bfcd5 100644 --- a/web/src/pages/memory/index.tsx +++ b/web/src/pages/memory/index.tsx @@ -4,7 +4,7 @@ import { SideBar } from './sidebar'; export default function DatasetWrapper() { return ( -
+
diff --git a/web/src/pages/memory/memory-message/hook.ts b/web/src/pages/memory/memory-message/hook.ts index 7cf05a5d25d..0273b581ac2 100644 --- a/web/src/pages/memory/memory-message/hook.ts +++ b/web/src/pages/memory/memory-message/hook.ts @@ -1,9 +1,12 @@ +import { FilterCollection } from '@/components/list-filter-bar/interface'; +import { useHandleFilterSubmit } from '@/components/list-filter-bar/use-handle-filter-submit'; import message from '@/components/ui/message'; import { useHandleSearchChange } from '@/hooks/logic-hooks'; import memoryService, { getMemoryDetailById } from '@/services/memory-service'; +import { groupListByType } from '@/utils/list-filter-util'; import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; import { t } from 'i18next'; -import { useCallback, useState } from 'react'; +import { useCallback, useMemo, useState } from 'react'; import { useParams, useSearchParams } from 'react-router'; import { MemoryApiAction } from '../constant'; import { @@ -18,13 +21,15 @@ export const useFetchMemoryMessageList = () => { const memoryBaseId = searchParams.get('id') || id; const { handleInputChange, searchString, pagination, setPagination } = useHandleSearchChange(); - + const { filterValue, handleFilterSubmit } = useHandleFilterSubmit(); let queryKey: (MemoryApiAction | number)[] = [ MemoryApiAction.FetchMemoryMessage, ]; - + const agentIds = Array.isArray(filterValue.agentId) + ? filterValue.agentId + : []; const { data, isFetching: loading } = useQuery({ - queryKey: [...queryKey, searchString, pagination], + queryKey: [...queryKey, searchString, pagination, filterValue], initialData: {} as IMessageTableProps, gcTime: 0, queryFn: async () => { @@ -33,6 +38,7 @@ export const useFetchMemoryMessageList = () => { keywords: searchString, page: pagination.current, page_size: pagination.pageSize, + agentId: agentIds.length > 0 ? agentIds.join(',') : undefined, }); return data?.data ?? {}; } else { @@ -48,6 +54,8 @@ export const useFetchMemoryMessageList = () => { searchString, pagination, setPagination, + filterValue, + handleFilterSubmit, }; }; @@ -164,3 +172,24 @@ export const useMessageAction = () => { handleClickUpdateMessageState, }; }; + +export function useSelectFilters() { + const { data } = useFetchMemoryMessageList(); + const agentId = useMemo(() => { + return groupListByType( + data?.messages?.message_list ?? [], + 'agent_id', + 'agent_name', + ); + }, [data?.messages?.message_list]); + + const filters: FilterCollection[] = [ + { + field: 'agentId', + list: agentId, + label: 'Agent', + }, + ]; + + return { filters }; +} diff --git a/web/src/pages/memory/memory-message/index.tsx b/web/src/pages/memory/memory-message/index.tsx index 943fad706ed..62e27678d37 100644 --- a/web/src/pages/memory/memory-message/index.tsx +++ b/web/src/pages/memory/memory-message/index.tsx @@ -1,6 +1,6 @@ import ListFilterBar from '@/components/list-filter-bar'; import { t } from 'i18next'; -import { useFetchMemoryMessageList } from './hook'; +import { useFetchMemoryMessageList, useSelectFilters } from './hook'; import { MemoryTable } from './message-table'; export default function MemoryMessage() { @@ -11,25 +11,29 @@ export default function MemoryMessage() { pagination, handleInputChange, setPagination, - // filterValue, - // handleFilterSubmit, + filterValue, + handleFilterSubmit, loading, } = useFetchMemoryMessageList(); + const { filters } = useSelectFilters(); return (
{t('memory.sideBar.messages')}
-
+
{t('memory.messages.messageDescription')}
diff --git a/web/src/pages/memory/memory-message/message-table.tsx b/web/src/pages/memory/memory-message/message-table.tsx index 9557c0190f1..1a8d6c94671 100644 --- a/web/src/pages/memory/memory-message/message-table.tsx +++ b/web/src/pages/memory/memory-message/message-table.tsx @@ -210,7 +210,7 @@ export function MemoryTable({ return (
- +
{table.getHeaderGroups().map((headerGroup) => ( @@ -257,7 +257,7 @@ export function MemoryTable({ title={t('memory.messages.forgetMessage')} open={showDeleteDialog} onOpenChange={setShowDeleteDialog} - okButtonText={t('common.confirm')} + okButtonText={t('memory.messages.forget')} content={{ title: t('memory.messages.forgetMessageTip'), node: ( diff --git a/web/src/pages/memory/memory-setting/advanced-settings-form.tsx b/web/src/pages/memory/memory-setting/advanced-settings-form.tsx index 8ff2918ea50..2776e29f8a5 100644 --- a/web/src/pages/memory/memory-setting/advanced-settings-form.tsx +++ b/web/src/pages/memory/memory-setting/advanced-settings-form.tsx @@ -30,7 +30,9 @@ export const AdvancedSettingsForm = () => { return ( <>
setShowAdvancedSettings(!showAdvancedSettings)} > {showAdvancedSettings ? ( @@ -134,6 +136,7 @@ export const AdvancedSettingsForm = () => { /> { /> { label={t('memory.config.description')} required={false} horizontal={true} + className="!items-start" // tooltip={field.tooltip} // labelClassName={labelClassName || field.labelClassName} > diff --git a/web/src/pages/next-chats/index.tsx b/web/src/pages/next-chats/index.tsx index 2f45ff94285..00077b678be 100644 --- a/web/src/pages/next-chats/index.tsx +++ b/web/src/pages/next-chats/index.tsx @@ -72,7 +72,7 @@ export default function ChatList() { searchString={searchString} > diff --git a/web/src/pages/next-searches/index.tsx b/web/src/pages/next-searches/index.tsx index 39482c0fe8c..7656c50afb7 100644 --- a/web/src/pages/next-searches/index.tsx +++ b/web/src/pages/next-searches/index.tsx @@ -96,7 +96,7 @@ export default function SearchList() { openCreateModalFun(); }} > - + {t('createSearch')} diff --git a/web/src/pages/user-setting/data-source/constant/index.tsx b/web/src/pages/user-setting/data-source/constant/index.tsx index 8b9193c1804..199443178b2 100644 --- a/web/src/pages/user-setting/data-source/constant/index.tsx +++ b/web/src/pages/user-setting/data-source/constant/index.tsx @@ -1,6 +1,8 @@ import { FormFieldType } from '@/components/dynamic-form'; +import { IconFontFill } from '@/components/icon-font'; import SvgIcon from '@/components/svg-icon'; import { t, TFunction } from 'i18next'; +import { Mail } from 'lucide-react'; import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import BoxTokenField from '../component/box-token-field'; @@ -130,12 +132,18 @@ export const generateDataSourceInfo = (t: TFunction) => { [DataSourceKey.GITHUB]: { name: 'GitHub', description: t(`setting.${DataSourceKey.GITHUB}Description`), - icon: , + icon: ( + + ), }, [DataSourceKey.IMAP]: { name: 'IMAP', description: t(`setting.${DataSourceKey.IMAP}Description`), - icon: , + icon: , }, [DataSourceKey.BITBUCKET]: { name: 'Bitbucket', diff --git a/web/src/utils/list-filter-util.ts b/web/src/utils/list-filter-util.ts index 727f55e9b14..06fcbc733b2 100644 --- a/web/src/utils/list-filter-util.ts +++ b/web/src/utils/list-filter-util.ts @@ -22,8 +22,32 @@ export function groupListByType>( return fileTypeList; } -export function buildOwnersFilter>(list: T[]) { - const owners = groupListByType(list, 'tenant_id', 'nickname'); +export function groupListByArray>( + list: T[], + idField: string, +) { + const fileTypeList: FilterType[] = []; + list.forEach((x) => { + if (Array.isArray(x[idField])) { + x[idField].forEach((j) => { + const item = fileTypeList.find((i) => i.id === j); + if (!item) { + fileTypeList.push({ id: j, label: j, count: 1 }); + } else { + item.count += 1; + } + }); + } + }); + + return fileTypeList; +} + +export function buildOwnersFilter>( + list: T[], + nickName?: string, +) { + const owners = groupListByType(list, 'tenant_id', nickName || 'nickname'); return { field: 'owner', list: owners, label: 'Owner' }; } diff --git a/web/vite.config.ts b/web/vite.config.ts index 25f1c5b01d2..7ef0e5c71b6 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -61,6 +61,9 @@ export default defineConfig(({ mode, command }) => { server: { port: 9222, strictPort: false, + hmr: { + overlay: false, + }, proxy: { '/api/v1/admin': { target: 'http://127.0.0.1:9381/', @@ -77,18 +80,63 @@ export default defineConfig(({ mode, command }) => { assetsInclude: ['**/*.md'], base: env.VITE_BASE_URL, publicDir: 'public', + cacheDir: './node_modules/.vite-cache', + optimizeDeps: { + include: [ + 'react', + 'react-dom', + 'react-router', + 'antd', + 'axios', + 'lodash', + 'dayjs', + ], + exclude: [], + force: false, + }, build: { outDir: 'dist', assetsDir: 'assets', assetsInlineLimit: 4096, experimentalMinChunkSize: 30 * 1024, + chunkSizeWarningLimit: 1000, rollupOptions: { output: { + manualChunks(id) { + // if (id.includes('src/components')) { + // return 'components'; + // } + + if (id.includes('node_modules')) { + if (id.includes('node_modules/d3')) { + return 'd3'; + } + if (id.includes('node_modules/ajv')) { + return 'ajv'; + } + if (id.includes('node_modules/@antv')) { + return 'antv'; + } + const name = id + .toString() + .split('node_modules/')[1] + .split('/')[0] + .toString(); + if (['lodash', 'dayjs', 'date-fns', 'axios'].includes(name)) { + return 'utils'; + } + if (['@xmldom', 'xmlbuilder '].includes(name)) { + return 'xml-js'; + } + return name; + } + }, chunkFileNames: 'chunk/js/[name]-[hash].js', entryFileNames: 'entry/js/[name]-[hash].js', assetFileNames: 'assets/[ext]/[name]-[hash].[ext]', }, plugins: [], + treeshake: true, }, minify: 'terser', terserOptions: { @@ -108,6 +156,8 @@ export default defineConfig(({ mode, command }) => { }, }, sourcemap: true, + cssCodeSplit: true, + target: 'es2015', }, esbuild: { tsconfigRaw: { @@ -118,5 +168,6 @@ export default defineConfig(({ mode, command }) => { }, }, }, + entries: ['./src/main.tsx'], }; }); From 8d406bd2e69996f4b8ed3129dee1492dc6ea2d20 Mon Sep 17 00:00:00 2001 From: OliverW <1225191678@qq.com> Date: Wed, 7 Jan 2026 10:07:18 +0800 Subject: [PATCH 053/335] fix: prevent MinIO health check failure in multi-bucket mode (#12446) ### What problem does this PR solve? - Fixes the health check failure in multi-bucket MinIO environments. Previously, health checks would fail because the default "ragflow-bucket" did not exist. This caused false negatives for system health. - Also removes the _health_check write in single-bucket mode to avoid side effects (minor optimization). ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/utils/minio_conn.py | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/rag/utils/minio_conn.py b/rag/utils/minio_conn.py index 2c7b35ff645..595a00d1ca2 100644 --- a/rag/utils/minio_conn.py +++ b/rag/utils/minio_conn.py @@ -18,7 +18,7 @@ import time from minio import Minio from minio.commonconfig import CopySource -from minio.error import S3Error +from minio.error import S3Error, ServerError, InvalidResponseError from io import BytesIO from common.decorator import singleton from common import settings @@ -97,19 +97,28 @@ def __close__(self): self.conn = None def health(self): - bucket = self.bucket if self.bucket else "ragflow-bucket" - fnm = "_health_check" - if self.prefix_path: - fnm = f"{self.prefix_path}/{fnm}" - binary = b"_t@@@1" - # Don't try to create bucket - it should already exist - # if not self.conn.bucket_exists(bucket): - # self.conn.make_bucket(bucket) - r = self.conn.put_object(bucket, fnm, - BytesIO(binary), - len(binary) - ) - return r + """ + Check MinIO service availability. + """ + try: + if self.bucket: + # Single-bucket mode: check bucket exists only (no side effects) + exists = self.conn.bucket_exists(self.bucket) + + # Historical: + # - Previously wrote "_health_check" to verify write permissions + # - Previously auto-created bucket if missing + + return exists + else: + # Multi-bucket mode: verify MinIO service connectivity + self.conn.list_buckets() + return True + except (S3Error, ServerError, InvalidResponseError): + return False + except Exception as e: + logging.warning(f"Unexpected error in MinIO health check: {e}") + return False @use_default_bucket @use_prefix_path From 07845be5bdf9b1867d40cf82f8ccf65ef9e70d58 Mon Sep 17 00:00:00 2001 From: Lynn Date: Wed, 7 Jan 2026 13:19:54 +0800 Subject: [PATCH 054/335] Fix: display agent name for extract messages (#12480) ### What problem does this PR solve? Display agent name for extract messages ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/memories_app.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/apps/memories_app.py b/api/apps/memories_app.py index efd23388d80..0ced960e305 100644 --- a/api/apps/memories_app.py +++ b/api/apps/memories_app.py @@ -241,4 +241,6 @@ async def get_memory_detail(memory_id): for message in messages["message_list"]: message["agent_name"] = agent_name_mapping.get(message["agent_id"], "Unknown") message["task"] = extract_task_mapping.get(message["message_id"], {}) + for extract_msg in message["extract"]: + extract_msg["agent_name"] = agent_name_mapping.get(extract_msg["agent_id"], "Unknown") return get_json_result(data={"messages": messages, "storage_type": memory.storage_type}, message=True) From 671e719d752c77d75c1be4ebcf98fd61ed4a9674 Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Wed, 7 Jan 2026 13:48:40 +0800 Subject: [PATCH 055/335] Feat: Memory-message supports categorized display (#12482) ### What problem does this PR solve? Feat: Memory-message supports categorized display ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- .../pages/memory/memory-message/interface.ts | 2 +- .../memory/memory-message/message-table.tsx | 70 +++++++++++++++++-- 2 files changed, 65 insertions(+), 7 deletions(-) diff --git a/web/src/pages/memory/memory-message/interface.ts b/web/src/pages/memory/memory-message/interface.ts index 09bd51e75df..b82de47f907 100644 --- a/web/src/pages/memory/memory-message/interface.ts +++ b/web/src/pages/memory/memory-message/interface.ts @@ -2,7 +2,6 @@ export interface IMessageInfo { message_id: number; message_type: 'semantic' | 'raw' | 'procedural'; source_id: string | '-'; - id: string; user_id: string; agent_id: string; agent_name: string; @@ -11,6 +10,7 @@ export interface IMessageInfo { invalid_at: string; forget_at: string; status: boolean; + extract?: IMessageInfo[]; } export interface IMessageTableProps { diff --git a/web/src/pages/memory/memory-message/message-table.tsx b/web/src/pages/memory/memory-message/message-table.tsx index 1a8d6c94671..354baba3a69 100644 --- a/web/src/pages/memory/memory-message/message-table.tsx +++ b/web/src/pages/memory/memory-message/message-table.tsx @@ -17,15 +17,19 @@ import { TableRow, } from '@/components/ui/table'; import { Pagination } from '@/interfaces/common'; +import { cn } from '@/lib/utils'; import { replaceText } from '@/pages/dataset/process-log-modal'; import { MemoryOptions } from '@/pages/memories/constants'; import { ColumnDef, ColumnFiltersState, + ExpandedState, + Row, SortingState, VisibilityState, flexRender, getCoreRowModel, + getExpandedRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, @@ -33,7 +37,13 @@ import { } from '@tanstack/react-table'; import { t } from 'i18next'; import { pick } from 'lodash'; -import { Copy, Eraser, TextSelect } from 'lucide-react'; +import { + Copy, + Eraser, + ListChevronsDownUp, + ListChevronsUpDown, + TextSelect, +} from 'lucide-react'; import * as React from 'react'; import { useMemo, useState } from 'react'; import { CopyToClipboard } from 'react-copy-to-clipboard'; @@ -74,15 +84,55 @@ export function MemoryTable({ handleClickMessageContentDialog, } = useMessageAction(); + const disabledRowFunc = (row: Row) => { + return row.original.forget_at !== 'None' && !!row.original.forget_at; + }; // Define columns for the memory table const columns: ColumnDef[] = useMemo( () => [ { accessorKey: 'session_id', - header: () => {t('memory.messages.sessionId')}, + header: ({ table }) => ( +
+ {' '} + {t('memory.messages.sessionId')} +
+ ), cell: ({ row }) => ( -
- {row.getValue('session_id')} +
+ {row.getCanExpand() ? ( + + ) : ( + '' + )} +
+ {row.getValue('session_id')} +
), }, @@ -138,6 +188,7 @@ export function MemoryTable({ return (
{ handleClickUpdateMessageState(row.original, val); @@ -166,6 +217,7 @@ export function MemoryTable({
" - if title: - html += f"" - for r in tb.rows: - html += "" - i = 0 - try: - while i < len(r.cells): - span = 1 - c = r.cells[i] - for j in range(i + 1, len(r.cells)): - if c.text == r.cells[j].text: - span += 1 - i = j - else: - break - i += 1 - html += f"" if span == 1 else f"" - except Exception as e: - logging.warning(f"Error parsing table, ignore: {e}") - html += "" - html += "
Table Location: {title}
{c.text}{c.text}
" - tbls.append(((None, html), "")) - return new_line, tbls + flush_last_image() + tb = DocxTable(block, self.doc) + title = self.__get_nearest_title(table_idx, filename) + html = "" + if title: + html += f"" + for r in tb.rows: + html += "" + col_idx = 0 + try: + while col_idx < len(r.cells): + span = 1 + c = r.cells[col_idx] + for j in range(col_idx + 1, len(r.cells)): + if c.text == r.cells[j].text: + span += 1 + col_idx = j + else: + break + col_idx += 1 + html += f"" if span == 1 else f"" + except Exception as e: + logging.warning(f"Error parsing table, ignore: {e}") + html += "" + html += "
Table Location: {title}
{c.text}{c.text}
" + lines.append({"text": "", "image": None, "table": html}) + table_idx += 1 + + flush_last_image() + new_line = [(line.get("text"), line.get("image"), line.get("table")) for line in lines] + + return new_line + def to_markdown(self, filename=None, binary=None, inline_images: bool = True): """ @@ -727,26 +778,26 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca # fix "There is no item named 'word/NULL' in the archive", referring to https://github.com/python-openxml/python-docx/issues/1105#issuecomment-1298075246 _SerializedRelationships.load_from_xml = load_from_xml_v2 - sections, tables = Docx()(filename, binary) - tables = vision_figure_parser_docx_wrapper(sections=sections, tbls=tables, callback=callback, **kwargs) - - res = tokenize_table(tables, doc, is_english) - callback(0.8, "Finish parsing.") - - st = timer() + # sections = (text, image, tables) + sections = Docx()(filename, binary) + # chunks list[dict] + # images list - index of image chunk in chunks chunks, images = naive_merge_docx( sections, int(parser_config.get( "chunk_token_num", 128)), parser_config.get( - "delimiter", "\n!?。;!?")) + "delimiter", "\n!?。;!?"), table_context_size, image_context_size) + + vision_figure_parser_docx_wrapper_naive(chunks=chunks, idx_lst=images, callback=callback, **kwargs) - res.extend(tokenize_chunks_with_images(chunks, doc, is_english, images, child_delimiters_pattern=child_deli)) + callback(0.8, "Finish parsing.") + st = timer() + + res.extend(doc_tokenize_chunks_with_images(chunks, doc, is_english, child_delimiters_pattern=child_deli)) logging.info("naive_merge({}): {}".format(filename, timer() - st)) res.extend(embed_res) res.extend(url_res) - if table_context_size or image_context_size: - attach_media_context(res, table_context_size, image_context_size) return res elif re.search(r"\.pdf$", filename, re.IGNORECASE): @@ -1012,7 +1063,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca res.extend(embed_res) if url_res: res.extend(url_res) - #if table_context_size or image_context_size: + # if table_context_size or image_context_size: # attach_media_context(res, table_context_size, image_context_size) return res diff --git a/rag/app/one.py b/rag/app/one.py index bb9f09f1a59..a53d00ea9c5 100644 --- a/rag/app/one.py +++ b/rag/app/one.py @@ -22,7 +22,7 @@ from rag.app import naive from rag.nlp import rag_tokenizer, tokenize from deepdoc.parser import PdfParser, ExcelParser, HtmlParser -from deepdoc.parser.figure_parser import vision_figure_parser_docx_wrapper +from deepdoc.parser.figure_parser import vision_figure_parser_docx_wrapper_naive from rag.app.naive import by_plaintext, PARSERS from common.parser_config_utils import normalize_layout_recognizer @@ -76,11 +76,26 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, if re.search(r"\.docx$", filename, re.IGNORECASE): callback(0.1, "Start to parse.") - sections, tbls = naive.Docx()(filename, binary) - tbls = vision_figure_parser_docx_wrapper(sections=sections, tbls=tbls, callback=callback, **kwargs) - sections = [s for s, _ in sections if s] - for (_, html), _ in tbls: - sections.append(html) + sections = naive.Docx()(filename, binary) + cks = [] + image_idxs = [] + + for text, image, table in sections: + if table is not None: + text = (text or "") + str(table) + ck_type = "table" + else: + ck_type = "image" if image is not None else "text" + + if ck_type == "image": + image_idxs.append(len(cks)) + + cks.append({"text": text, "image": image, "ck_type": ck_type}) + + vision_figure_parser_docx_wrapper_naive(cks, image_idxs, callback, **kwargs) + for ck in cks: + print(ck) + sections = [ck["text"] for ck in cks if ck.get("text")] callback(0.8, "Finish parsing.") elif re.search(r"\.pdf$", filename, re.IGNORECASE): diff --git a/rag/nlp/__init__.py b/rag/nlp/__init__.py index b41bf7ead30..1b0029d2c60 100644 --- a/rag/nlp/__init__.py +++ b/rag/nlp/__init__.py @@ -316,6 +316,32 @@ def tokenize_chunks(chunks, doc, eng, pdf_parser=None, child_delimiters_pattern= return res +def doc_tokenize_chunks_with_images(chunks, doc, eng, child_delimiters_pattern=None, batch_size=10): + res = [] + for ii, ck in enumerate(chunks): + text = ck.get('context_above', "") + ck.get('text') + ck.get('context_below', "") + if len(text.strip()) == 0: + continue + logging.debug("-- {}".format(ck)) + d = copy.deepcopy(doc) + if ck.get("image"): + d["image"] = ck.get("image") + add_positions(d, [[ii] * 5]) + + if ck.get("ck_type") == "text": + if child_delimiters_pattern: + d["mom_with_weight"] = ck + res.extend(split_with_pattern(d, child_delimiters_pattern, text, eng)) + continue + elif ck.get("ck_type") == "image": + d["doc_type_kwd"] = "image" + elif ck.get("ck_type") == "table": + d["doc_type_kwd"] = "table" + tokenize(d, text, eng) + res.append(d) + return res + + def tokenize_chunks_with_images(chunks, doc, eng, images, child_delimiters_pattern=None): res = [] # wrap up as es documents @@ -789,6 +815,11 @@ def lower_context(page, i): if len(contexts) < len(res) + 1: contexts.append(("", "")) res.append(((img, tb), poss)) + + print("\n\n") + for c in contexts: + print(c) + print("\n\n") return contexts if return_context else res @@ -1200,57 +1231,181 @@ def concat_img(img1, img2): new_image.paste(img2, (0, height1)) return new_image - -def naive_merge_docx(sections, chunk_token_num=128, delimiter="\n。;!?"): - if not sections: - return [], [] - +def _build_cks(sections, delimiter): cks = [] + tables = [] images = [] - tk_nums = [] - - def add_chunk(t, image, pos=""): - nonlocal cks, images, tk_nums - tnum = num_tokens_from_string(t) - if tnum < 8: - pos = "" - - if not cks or tk_nums[-1] > chunk_token_num: - # new chunk - if pos and t.find(pos) < 0: - t += pos - cks.append(t) - images.append(image) - tk_nums.append(tnum) - else: - # add to last chunk - if pos and cks[-1].find(pos) < 0: - t += pos - cks[-1] += t - images[-1] = concat_img(images[-1], image) - tk_nums[-1] += tnum custom_delimiters = [m.group(1) for m in re.finditer(r"`([^`]+)`", delimiter)] has_custom = bool(custom_delimiters) + if has_custom: - custom_pattern = "|".join(re.escape(t) for t in sorted(set(custom_delimiters), key=len, reverse=True)) - cks, images, tk_nums = [], [], [] + custom_pattern = "|".join( + re.escape(t) for t in sorted(set(custom_delimiters), key=len, reverse=True) + ) pattern = r"(%s)" % custom_pattern - for sec, image in sections: - split_sec = re.split(pattern, sec) + + for text, image, table in sections: + # normalize text + if not text: + text = "\n" + else: + text = "\n" + str(text) + + if table: + # table ck + ck_text = text + str(table) + idx = len(cks) + cks.append({"text": ck_text, "image": image, "ck_type": "table", "tk_nums": num_tokens_from_string(ck_text)}) + tables.append(idx) + continue + + if image: + # image ck (text can be kept as-is; depends on your downstream) + idx = len(cks) + cks.append({"text": text, "image": image, "ck_type": "image", "tk_nums": num_tokens_from_string(text)}) + images.append(idx) + continue + + # pure text ck(s) + if has_custom: + split_sec = re.split(pattern, text) for sub_sec in split_sec: if not sub_sec or re.fullmatch(custom_pattern, sub_sec): continue - text_seg = "\n" + sub_sec - cks.append(text_seg) - images.append(image) - tk_nums.append(num_tokens_from_string(text_seg)) - return cks, images + seg = "\n" + sub_sec if not sub_sec.startswith("\n") else sub_sec + cks.append({"text": seg, "image": None, "ck_type": "text", "tk_nums": num_tokens_from_string(seg)}) + else: + cks.append({"text": text, "image": None, "ck_type": "text", "tk_nums": num_tokens_from_string(text)}) + + return cks, tables, images - for sec, image in sections: - add_chunk("\n" + sec, image, "") - return cks, images +def _add_context(cks, idx, context_size): + if cks[idx]["ck_type"] not in ("image", "table"): + return + + prev = idx - 1 + after = idx + 1 + remain_above = context_size + remain_below = context_size + + cks[idx]["context_above"] = "" + cks[idx]["context_below"] = "" + + split_pat = r"([。!??;!\n]|\. )" + + picked_above = [] + picked_below = [] + + def take_sentences_from_end(cnt, need_tokens): + txts = re.split(split_pat, cnt, flags=re.DOTALL) + sents = [] + for j in range(0, len(txts), 2): + sents.append(txts[j] + (txts[j + 1] if j + 1 < len(txts) else "")) + acc = "" + for s in reversed(sents): + acc = s + acc + if num_tokens_from_string(acc) >= need_tokens: + break + return acc + + def take_sentences_from_start(cnt, need_tokens): + txts = re.split(split_pat, cnt, flags=re.DOTALL) + acc = "" + for j in range(0, len(txts), 2): + acc += txts[j] + (txts[j + 1] if j + 1 < len(txts) else "") + if num_tokens_from_string(acc) >= need_tokens: + break + return acc + + # above + parts_above = [] + while prev >= 0 and remain_above > 0: + if cks[prev]["ck_type"] == "text": + tk = cks[prev]["tk_nums"] + if tk >= remain_above: + piece = take_sentences_from_end(cks[prev]["text"], remain_above) + parts_above.insert(0, piece) + picked_above.append((prev, "tail", remain_above, tk, piece[:80])) + remain_above = 0 + break + else: + parts_above.insert(0, cks[prev]["text"]) + picked_above.append((prev, "full", remain_above, tk, (cks[prev]["text"] or "")[:80])) + remain_above -= tk + prev -= 1 + + # below + parts_below = [] + while after < len(cks) and remain_below > 0: + if cks[after]["ck_type"] == "text": + tk = cks[after]["tk_nums"] + if tk >= remain_below: + piece = take_sentences_from_start(cks[after]["text"], remain_below) + parts_below.append(piece) + picked_below.append((after, "head", remain_below, tk, piece[:80])) + remain_below = 0 + break + else: + parts_below.append(cks[after]["text"]) + picked_below.append((after, "full", remain_below, tk, (cks[after]["text"] or "")[:80])) + remain_below -= tk + after += 1 + + cks[idx]["context_above"] = "".join(parts_above) if parts_above else "" + cks[idx]["context_below"] = "".join(parts_below) if parts_below else "" + + +def _merge_cks(cks, chunk_token_num): + merged = [] + image_idxs = [] + prev_text_ck = -1 + + for i in range(len(cks)): + ck_type = cks[i]["ck_type"] + + if ck_type != "text": + merged.append(cks[i]) + if ck_type == "image": + image_idxs.append(len(merged) - 1) + continue + + + if prev_text_ck<0 or merged[prev_text_ck]["tk_nums"] >= chunk_token_num: + merged.append(cks[i]) + prev_text_ck = len(merged) - 1 + continue + + merged[prev_text_ck]["text"] = (merged[prev_text_ck].get("text") or "") + (cks[i].get("text") or "") + merged[prev_text_ck]["tk_nums"] = merged[prev_text_ck].get("tk_nums", 0) + cks[i].get("tk_nums", 0) + + return merged, image_idxs + + +def naive_merge_docx( + sections, + chunk_token_num = 128, + delimiter="\n。;!?", + table_context_size=0, + image_context_size=0,): + + if not sections: + return [], [] + + cks, tables, images = _build_cks(sections, delimiter) + + if table_context_size > 0: + for i in tables: + _add_context(cks, i, table_context_size) + + if image_context_size > 0: + for i in images: + _add_context(cks, i, image_context_size) + + merged_cks, merged_image_idx = _merge_cks(cks, chunk_token_num) + + return merged_cks, merged_image_idx def extract_between(text: str, start_tag: str, end_tag: str) -> list[str]: diff --git a/rag/svr/task_executor.py b/rag/svr/task_executor.py index 360d1c9596d..d397898410e 100644 --- a/rag/svr/task_executor.py +++ b/rag/svr/task_executor.py @@ -1127,7 +1127,7 @@ async def _maybe_insert_es(_chunks): if has_canceled(task_id): try: exists = await asyncio.to_thread( - settings.docStoreConn.indexExist, + settings.docStoreConn.index_exist, search.index_name(task_tenant_id), task_dataset_id, ) From 23a9544b73e832600154f3f786941f366ca5ed12 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Wed, 7 Jan 2026 15:35:30 +0800 Subject: [PATCH 058/335] Fix: toc async issue. (#12485) ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- agent/tools/retrieval.py | 2 +- api/apps/sdk/doc.py | 2 +- api/db/services/dialog_service.py | 2 +- rag/nlp/search.py | 5 ++--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/agent/tools/retrieval.py b/agent/tools/retrieval.py index f024c42fa24..77a39b73100 100644 --- a/agent/tools/retrieval.py +++ b/agent/tools/retrieval.py @@ -193,7 +193,7 @@ def _resolve_manual_filter(flt: dict) -> dict: if self._param.toc_enhance: chat_mdl = LLMBundle(self._canvas._tenant_id, LLMType.CHAT) - cks = settings.retriever.retrieval_by_toc(query, kbinfos["chunks"], [kb.tenant_id for kb in kbs], + cks = await settings.retriever.retrieval_by_toc(query, kbinfos["chunks"], [kb.tenant_id for kb in kbs], chat_mdl, self._param.top_n) if self.check_if_canceled("Retrieval processing"): return diff --git a/api/apps/sdk/doc.py b/api/apps/sdk/doc.py index db8a97b6822..d341cea5585 100644 --- a/api/apps/sdk/doc.py +++ b/api/apps/sdk/doc.py @@ -1575,7 +1575,7 @@ async def retrieval_test(tenant_id): ) if toc_enhance: chat_mdl = LLMBundle(kb.tenant_id, LLMType.CHAT) - cks = settings.retriever.retrieval_by_toc(question, ranks["chunks"], tenant_ids, chat_mdl, size) + cks = await settings.retriever.retrieval_by_toc(question, ranks["chunks"], tenant_ids, chat_mdl, size) if cks: ranks["chunks"] = cks if use_kg: diff --git a/api/db/services/dialog_service.py b/api/db/services/dialog_service.py index 33b50730ff4..83f1bb4fa7a 100644 --- a/api/db/services/dialog_service.py +++ b/api/db/services/dialog_service.py @@ -411,7 +411,7 @@ async def async_chat(dialog, messages, stream=True, **kwargs): rank_feature=label_question(" ".join(questions), kbs), ) if prompt_config.get("toc_enhance"): - cks = retriever.retrieval_by_toc(" ".join(questions), kbinfos["chunks"], tenant_ids, chat_mdl, dialog.top_n) + cks = await retriever.retrieval_by_toc(" ".join(questions), kbinfos["chunks"], tenant_ids, chat_mdl, dialog.top_n) if cks: kbinfos["chunks"] = cks kbinfos["chunks"] = retriever.retrieval_by_children(kbinfos["chunks"], tenant_ids) diff --git a/rag/nlp/search.py b/rag/nlp/search.py index 01f55c9ef31..b10dc85726b 100644 --- a/rag/nlp/search.py +++ b/rag/nlp/search.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import asyncio import json import logging import re @@ -589,7 +588,7 @@ def tag_query(self, question: str, tenant_ids: str | list[str], kb_ids: list[str key=lambda x: x[1] * -1)[:topn_tags] return {a.replace(".", "_"): max(1, c) for a, c in tag_fea} - def retrieval_by_toc(self, query: str, chunks: list[dict], tenant_ids: list[str], chat_mdl, topn: int = 6): + async def retrieval_by_toc(self, query: str, chunks: list[dict], tenant_ids: list[str], chat_mdl, topn: int = 6): if not chunks: return [] idx_nms = [index_name(tid) for tid in tenant_ids] @@ -614,7 +613,7 @@ def retrieval_by_toc(self, query: str, chunks: list[dict], tenant_ids: list[str] if not toc: return chunks - ids = asyncio.run(relevant_chunks_with_toc(query, toc, chat_mdl, topn * 2)) + ids = await relevant_chunks_with_toc(query, toc, chat_mdl, topn * 2) if not ids: return chunks From de27c006d887f715c3fc1031a92020a71dc8ddba Mon Sep 17 00:00:00 2001 From: balibabu Date: Thu, 8 Jan 2026 09:43:57 +0800 Subject: [PATCH 059/335] Feat: The chat feature supports streaming output, displaying results one by one. #12490 (#12493) ### What problem does this PR solve? Feat: The chat feature supports streaming output, displaying results one by one. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- web/src/hooks/logic-hooks.ts | 21 +++++++++++++++---- .../chat/app-settings/chat-settings.tsx | 9 +++++--- .../chat/app-settings/dynamic-variable.tsx | 1 + .../app-settings/use-chat-setting-schema.tsx | 14 +++++++------ web/vite.config.ts | 2 +- 5 files changed, 33 insertions(+), 14 deletions(-) diff --git a/web/src/hooks/logic-hooks.ts b/web/src/hooks/logic-hooks.ts index 4fa4ef218bb..e6323af554e 100644 --- a/web/src/hooks/logic-hooks.ts +++ b/web/src/hooks/logic-hooks.ts @@ -274,10 +274,23 @@ export const useSendMessageWithSse = ( const val = JSON.parse(value?.data || ''); const d = val?.data; if (typeof d !== 'boolean') { - setAnswer({ - ...d, - conversationId: body?.conversation_id, - chatBoxId: body.chatBoxId, + setAnswer((prev) => { + let newAnswer = (prev.answer || '') + (d.answer || ''); + + if (d.start_to_think === true) { + newAnswer = newAnswer + ''; + } + + if (d.end_to_think === true) { + newAnswer = newAnswer + ''; + } + + return { + ...d, + answer: newAnswer, + conversationId: body?.conversation_id, + chatBoxId: body.chatBoxId, + }; }); } } catch (e) { diff --git a/web/src/pages/next-chats/chat/app-settings/chat-settings.tsx b/web/src/pages/next-chats/chat/app-settings/chat-settings.tsx index a2a28ddf394..9f715500dbd 100644 --- a/web/src/pages/next-chats/chat/app-settings/chat-settings.tsx +++ b/web/src/pages/next-chats/chat/app-settings/chat-settings.tsx @@ -8,7 +8,7 @@ import { setLLMSettingEnabledValues, } from '@/utils/form'; import { zodResolver } from '@hookform/resolvers/zod'; -import { omit } from 'lodash'; +import { isEmpty, omit } from 'lodash'; import { X } from 'lucide-react'; import { useEffect } from 'react'; import { useForm } from 'react-hook-form'; @@ -33,7 +33,7 @@ export function ChatSettings({ switchSettingVisible }: ChatSettingsProps) { const form = useForm({ resolver: zodResolver(formSchema), - shouldUnregister: true, + shouldUnregister: false, defaultValues: { name: '', icon: '', @@ -88,7 +88,10 @@ export function ChatSettings({ switchSettingVisible }: ChatSettingsProps) { ...data, ...llmSettingEnabledValues, }; - form.reset(nextData as FormSchemaType); + + if (!isEmpty(data)) { + form.reset(nextData as FormSchemaType); + } }, [data, form]); return ( diff --git a/web/src/pages/next-chats/chat/app-settings/dynamic-variable.tsx b/web/src/pages/next-chats/chat/app-settings/dynamic-variable.tsx index 983488b1e0c..b5af161594e 100644 --- a/web/src/pages/next-chats/chat/app-settings/dynamic-variable.tsx +++ b/web/src/pages/next-chats/chat/app-settings/dynamic-variable.tsx @@ -22,6 +22,7 @@ export function DynamicVariableForm() { const { fields, remove, append } = useFieldArray({ name, control: form.control, + shouldUnregister: false, }); const add = useCallback(() => { diff --git a/web/src/pages/next-chats/chat/app-settings/use-chat-setting-schema.tsx b/web/src/pages/next-chats/chat/app-settings/use-chat-setting-schema.tsx index 226400775a0..f4d96b9993d 100644 --- a/web/src/pages/next-chats/chat/app-settings/use-chat-setting-schema.tsx +++ b/web/src/pages/next-chats/chat/app-settings/use-chat-setting-schema.tsx @@ -24,12 +24,14 @@ export function useChatSettingSchema() { system: z.string().min(1, { message: t('systemMessage') }), refine_multiturn: z.boolean(), use_kg: z.boolean(), - parameters: z.array( - z.object({ - key: z.string(), - optional: z.boolean(), - }), - ), + parameters: z + .array( + z.object({ + key: z.string(), + optional: z.boolean(), + }), + ) + .optional(), tavily_api_key: z.string().optional(), reasoning: z.boolean().optional(), cross_languages: z.array(z.string()).optional(), diff --git a/web/vite.config.ts b/web/vite.config.ts index 7ef0e5c71b6..1d54c6d04b2 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -59,7 +59,7 @@ export default defineConfig(({ mode, command }) => { }, }, server: { - port: 9222, + port: Number(env.PORT) || 9222, strictPort: false, hmr: { overlay: false, From f1dc2df23cfabd6435b5fad11bd3404ecc0256ef Mon Sep 17 00:00:00 2001 From: Stephen Hu <812791840@qq.com> Date: Thu, 8 Jan 2026 12:53:41 +0800 Subject: [PATCH 060/335] Fix:Bedrock assume_role auth mode fails with LiteLLM "Extra inputs are not permitted" error (#12495) ### What problem does this PR solve? https://github.com/infiniflow/ragflow/issues/12489 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/llm/chat_model.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py index a9e3c1ab7cf..dc59e1fb8be 100644 --- a/rag/llm/chat_model.py +++ b/rag/llm/chat_model.py @@ -1632,25 +1632,22 @@ def _construct_completion_args(self, history, stream: bool, tools: bool, **kwarg raise ValueError("Bedrock auth_mode must be provided in the key") bedrock_region = bedrock_key.get("bedrock_region") - bedrock_credentials = {"bedrock_region": bedrock_region} if mode == "access_key_secret": - bedrock_credentials["aws_access_key_id"] = bedrock_key.get("bedrock_ak") - bedrock_credentials["aws_secret_access_key"] = bedrock_key.get("bedrock_sk") + completion_args.update({"aws_region_name": bedrock_region}) + completion_args.update({"aws_access_key_id": bedrock_key.get("bedrock_ak")}) + completion_args.update({"aws_secret_access_key": bedrock_key.get("bedrock_sk")}) elif mode == "iam_role": aws_role_arn = bedrock_key.get("aws_role_arn") sts_client = boto3.client("sts", region_name=bedrock_region) resp = sts_client.assume_role(RoleArn=aws_role_arn, RoleSessionName="BedrockSession") creds = resp["Credentials"] - bedrock_credentials["aws_access_key_id"] = creds["AccessKeyId"] - bedrock_credentials["aws_secret_access_key"] = creds["SecretAccessKey"] - bedrock_credentials["aws_session_token"] = creds["SessionToken"] - - completion_args.update( - { - "bedrock_credentials": bedrock_credentials, - } - ) + completion_args.update({"aws_region_name": bedrock_region}) + completion_args.update({"aws_access_key_id": creds["AccessKeyId"]}) + completion_args.update({"aws_secret_access_key": creds["SecretAccessKey"]}) + completion_args.update({"aws_session_token": creds["SessionToken"]}) + else: # assume_role - use default credential chain (IRSA, instance profile, etc.) + completion_args.update({"aws_region_name": bedrock_region}) elif self.provider == SupportedLiteLLMProvider.OpenRouter: if self.provider_order: From 2fd4a3134d4a145c3ba46f4dac7d752ccb7c4580 Mon Sep 17 00:00:00 2001 From: Lynn Date: Thu, 8 Jan 2026 12:54:10 +0800 Subject: [PATCH 061/335] Doc: memory http api (#12499) ### What problem does this PR solve? Use task save function for add_message api, and added http API document. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [x] Documentation Update --- api/apps/messages_app.py | 43 +- docs/references/http_api_reference.md | 1023 +++++++++++++++++++++++++ 2 files changed, 1038 insertions(+), 28 deletions(-) diff --git a/api/apps/messages_app.py b/api/apps/messages_app.py index d18acb5e03f..e9e5ca14e3e 100644 --- a/api/apps/messages_app.py +++ b/api/apps/messages_app.py @@ -31,34 +31,21 @@ async def add_message(): req = await get_request_json() memory_ids = req["memory_id"] - agent_id = req["agent_id"] - session_id = req["session_id"] - user_id = req["user_id"] if req.get("user_id") else "" - user_input = req["user_input"] - agent_response = req["agent_response"] - - res = [] - for memory_id in memory_ids: - success, msg = await memory_message_service.save_to_memory( - memory_id, - { - "user_id": user_id, - "agent_id": agent_id, - "session_id": session_id, - "user_input": user_input, - "agent_response": agent_response - } - ) - res.append({ - "memory_id": memory_id, - "success": success, - "message": msg - }) - - if all([r["success"] for r in res]): - return get_json_result(message="Successfully added to memories.") - - return get_json_result(code=RetCode.SERVER_ERROR, message="Some messages failed to add.", data=res) + + message_dict = { + "user_id": req.get("user_id"), + "agent_id": req["agent_id"], + "session_id": req["session_id"], + "user_input": req["user_input"], + "agent_response": req["agent_response"], + } + + res, msg = await memory_message_service.queue_save_to_memory_task(memory_ids, message_dict) + + if res: + return get_json_result(message=msg) + + return get_json_result(code=RetCode.SERVER_ERROR, message="Some messages failed to add. Detail:" + msg) @manager.route("/:", methods=["DELETE"]) # noqa: F821 diff --git a/docs/references/http_api_reference.md b/docs/references/http_api_reference.md index 872c3cedb02..8c2170ce4de 100644 --- a/docs/references/http_api_reference.md +++ b/docs/references/http_api_reference.md @@ -4916,6 +4916,1029 @@ Failure: } ``` +--- + + + +## MEMORY MANAGEMENT + +### Create Memory + +**POST** `/v1/memories` + +Create a new memory. + +#### Request + +- Method: POST +- URL: `/v1/memories` +- Headers: + - `'Content-Type: application/json'` + - `'Authorization: Bearer '` +- Body: + - `"name"`: `string` + - `"memory_type"`: `list[string]` + - `"embd_id"`: `string`. + - `"llm_id"`: `string` + +##### Request example + +```bash +curl --location 'http://{address}/v1/memories' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Bearer ' \ +--data-raw '{ + "name": "new_memory_1", + "memory_type": ["raw", "semantic"], + "embd_id": "BAAI/bge-large-zh-v1.5@BAAI", + "llm_id": "glm-4-flash@ZHIPU-AI" +}' +``` + +##### Request parameters + +- `name` : (*Body parameter*), `string`, *Required* + + The unique name of the memory to create. It must adhere to the following requirements: + + - Basic Multilingual Plane (BMP) only + - Maximum 128 characters + +- `memory_type`: (*Body parameter*), `list[enum]`, *Required* + + Specifies the types of memory to extract. Available options: + + - `raw`: The raw dialogue content between the user and the agent . *Required by default*. + - `semantic`: General knowledge and facts about the user and world. + - `episodic`: Time-stamped records of specific events and experiences. + - `procedural`: Learned skills, habits, and automated procedures. + +- `embd_id`: (*Body parameter*), `string`, *Required* + + The name of the embedding model to use. For example: `"BAAI/bge-large-zh-v1.5@BAAI"` + + - Maximum 255 characters + - Must follow `model_name@model_factory` format + +- `llm_id`: (*Body parameter*), `string`, *Required* + + The name of the chat model to use. For example: `"glm-4-flash@ZHIPU-AI"` + + - Maximum 255 characters + - Must follow `model_name@model_factory` format + +#### Response + +Success: + +```json +{ + "code": 0, + "data": { + ...your new memory here + }, + "message": true +} +``` + +Failure: + +```json +{ + "code": 101, + "message": "Memory name cannot be empty or whitespace." +} +``` + + + +### Update Memory + +**PUT** `/v1/memories/{memory_id}` + +Updates configurations for a specified memory. + +#### Request + +- Method: PUT +- URL: `/v1/memories/{memory_id}` +- Headers: + - `'Content-Type: application/json'` + - `'Authorization: Bearer '` +- Body: + - `"name"`: `string` + - `"avatar"`: `string` + - `"permission"`: `string` + - `"llm_id"`: `string` + - `"description"`: `string` + - `"memory_size"`: `int` + - `"forgetting_policy"`: `string` + - `"temperature"`: `float` + - `"system_promot"`: `string` + - `"user_prompt"`: `string` + +##### Request example + +```bash +curl --location --request PUT 'http://{address}/v1/memories/d6775d4eeada11f08ca284ba59bc53c7' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Bearer ' \ +--data '{ + "name": "name_update", +}' +``` + +##### Request parameters + +- `memory_id`: (*Path parameter*) + + The ID of the memory to update. + +- `name`: (*Body parameter*), `string`, *Optional* + + The revised name of the memory. + + - Basic Multilingual Plane (BMP) only + - Maximum 128 characters, *Optional* + +- `avatar`: (*Body parameter*), `string`, *Optional* + The updated base64 encoding of the avatar. + + - Maximum 65535 characters + +- `permission`: (*Body parameter*), `enum`, *Optional* + + The updated memory permission. Available options: + + - `"me"`: (Default) Only you can manage the memory. + - `"team"`: All team members can manage the memory. + +- `llm_id`: (*Body parameter*), `string`, *Optional* + + The name of the chat model to use. For example: `"glm-4-flash@ZHIPU-AI"` + + - Maximum 255 characters + - Must follow `model_name@model_factory` format + +- `description`: (*Body parameter*), `string`, *Optional* + + The description of the memory. Defaults to `None`. + +- `memory_size`: (*Body parameter*), `int`, *Optional* + + Defaults to `5*1024*1024` Bytes. Accounts for each message's content + its embedding vector (≈ Content + Dimensions × 8 Bytes). Example: A 1 KB message with 1024-dim embedding uses ~9 KB. The 5 MB default limit holds ~500 such messages. + + - Maximum 10 * 1024 * 1024 Bytes + +- `forgetting_policy`: (*Body parameter*), `enum`, *Optional* + + Evicts existing data based on the chosen policy when the size limit is reached, freeing up space for new messages. Available options: + + - `"FIFO"`: (Default) Prioritize messages with the earliest `forget_at` time for removal. When the pool of messages that have `forget_at` set is insufficient, it falls back to selecting messages in ascending order of their `valid_at` (oldest first). + +- `temperature`: (*Body parameter*), `float`, *Optional* + + Adjusts output randomness. Lower = more deterministic; higher = more creative. + + - Range [0, 1] + +- `system_prompt`: (*Body parameter*), `string`, *Optional* + + Defines the system-level instructions and role for the AI assistant. It is automatically assembled based on the selected `memory_type` by `PromptAssembler` in `memory/utils/prompt_util.py`. This prompt sets the foundational behavior and context for the entire conversation. + + - Keep the `OUTPUT REQUIREMENTS` and `OUTPUT FORMAT` parts unchanged. + +- `user_prompt`: (*Body parameter*), `string`, *Optional* + + Represents the user's custom setting, which is the specific question or instruction the AI needs to respond to directly. Defaults to `None`. + +#### Response + +Success: + +```json +{ + "code": 0, + "data": { + ...your updated memory here + }, + "message": true +} +``` + +Failure: + +```json +{ + "code": 101, + "message": "Memory name cannot be empty or whitespace." +} +``` + + + +### List Memory + +**GET** `/v1/memories?tenant_id={tenant_ids}&memory_type={memory_types}&storage_type={storage_type}&keywords={keywords}&page={page}&page_size={page_size}` + +List memories. + +#### Request + +- Method: GET +- URL: `/v1/memories?tenant_id={tenant_ids}&memory_type={memory_types}&storage_type={storage_type}&keywords={keywords}&page={page}&page_size={page_size}` +- Headers: + - `'Content-Type: application/json'` + - `'Authorization: Bearer '` + +##### Request example + +```bash +curl --location 'http://{address}/v1/memories?keywords=&page_size=50&page=1&memory_type=semantic%2Cepisodic' \ +--header 'Authorization: Bearer ' +``` + +##### Request parameters + +- `tenant_id`: (*Filter parameter*), `string` or `list[string]`, *Optional* + + The owner's ID, supports search multiple IDs. + +- `memory_type`: (*Filter parameter*), `enum` or `list[enum]`, *Optional* + + The type of memory (as set during creation). A memory matches if its type is **included in** the provided value(s). Available options: + + - `raw` + - `semantic` + - `episodic` + - `procedural` + +- `storage_type`: (*Filter parameter*), `enum`, *Optional* + + The storage format of messages. Available options: + + - `table`: (Default) + +- `keywords`: (*Filter parameter*), `string`, *Optional* + + The name of memory to retrieve, supports fuzzy search. + +- `page`: (*Filter parameter*), `int`, *Optional* + Specifies the page on which the datasets will be displayed. Defaults to `1`. + +- `page_size`: (*Filter parameter*), `int`, *Optional* + The number of datasets on each page. Defaults to `50`. + +#### Response + +Success: + +```json +{ + "code": 0, + "data": { + "memory_list": [ + { + "avatar": null, + "create_date": "Tue, 06 Jan 2026 16:36:47 GMT", + "create_time": 1767688607040, + "description": null, + "id": "d6775d4eeada11f08ca284ba59bc53c7", + "memory_type": [ + "raw", + "semantic" + ], + "name": "new_memory_1", + "owner_name": "Lynn", + "permissions": "me", + "storage_type": "table", + "tenant_id": "55777efac9df11f09cd07f49bd527ade" + }, + ...other 3 memories here + ], + "total_count": 4 + }, + "message": true +} +``` + +Failure: + +```json +{ + "code": 500, + "message": "Internal Server Error." +} +``` + + + +### Get Memory Config + +**GET** `/v1/memories/{memory_id}/config` + +Get the configuration of a specified memory. + +#### Request + +- Method: GET +- URL: `/v1/memories/{memory_id}/config` +- Headers: + - `'Content-Type: application/json'` + - `'Authorization: Bearer '` + +##### Request example + +```bash +curl --location 'http://{address}/v1/memories/6c8983badede11f083f184ba59bc53c7/config' \ +--header 'Authorization: Bearer ' +``` + +##### Request parameters + +- `memory_id`: (*Path parameter*), `string`, *Required* + + The ID of the memory. + +#### Response + +Success + +```json +{ + "code": 0, + "data": { + "avatar": null, + "create_date": "Mon, 22 Dec 2025 10:32:13 GMT", + "create_time": 1766370733354, + "description": null, + "embd_id": "BAAI/bge-large-zh-v1.5@SILICONFLOW", + "forgetting_policy": "FIFO", + "id": "6c8983badede11f083f184ba59bc53c7", + "llm_id": "glm-4.5-flash@ZHIPU-AI", + "memory_size": 5242880, + "memory_type": [ + "raw", + "semantic", + "episodic", + "procedural" + ], + "name": "mem1222", + "owner_name": null, + "permissions": "me", + "storage_type": "table", + "system_prompt": ...your prompt here, + "temperature": 0.5, + "tenant_id": "55777efac9df11f09cd07f49bd527ade", + "update_date": null, + "update_time": null, + "user_prompt": null + }, + "message": true +} +``` + +Failure + +```json +{ + "code": 404, + "data": null, + "message": "Memory '{memory_id}' not found." +} +``` + + + +### Delete Memory + +**DELETE** `/v1/memories/{memory_id}` + +#### Request + +- Method: DELETE +- URL: `/v1/memories/{memory_id}` +- Headers: +- Headers: + - `'Content-Type: application/json'` + - `'Authorization: Bearer '` + +##### Request example + +```bash +curl --location --request DELETE 'http://{address}/v1/memories/d6775d4eeada11f08ca284ba59bc53c7' \ +--header 'Authorization: Bearer ' +``` + +##### Request parameters + +- `memory_id`: (*Path parameter*), `string`, *Required* + + The ID of the memory to delete. + +#### Response + +Success + +```json +{ + "code": 0, + "data": null, + "message": true +} +``` + +Failure + +```json +{ + "code": 404, + "data": null, + "message": true +} +``` + + + +### List messages of a memory + +**GET** `/v1/memories/{memory_id}?agent_id={agent_id}&keywords={session_id}&page={page}&page_size={page_size}` + +List the messages of a specified memory. + +#### Request + +- Method: GET +- URL: `/v1/memories/{memory_id}?agent_id={agent_id}&keywords={session_id}&page={page}&page_size={page_size}` +- Headers: + - `'Content-Type: application/json'` + - `'Authorization: Bearer '` + +##### Request example + +```bash +curl --location 'http://{address}/v1/memories/6c8983badede11f083f184ba59bc53c?page=1' \ +--header 'Authorization: Bearer ' +``` + +##### Request parameters + +- `memory_id`: (*Path parameter*), `string`, *Required* + + The ID of the memory to show messages. + +- `agent_id`: (*Filter parameter*), `string` or `list[string]`, *Optional* + + Filters messages by the ID of their source agent. Supports multiple values. + +- `session_id`: (*Filter parameter*), `string`, *Optional* + + Filters messages by their session ID. This field supports fuzzy search. + +- `page`: (*Filter parameter*), `int`, *Optional* + Specifies the page on which the datasets will be displayed. Defaults to `1`. + +- `page_size`: (*Filter parameter*), `int`, *Optional* + The number of datasets on each page. Defaults to `50`. + +#### Response + +Success + +```json +{ + "code": 0, + "data": { + "messages": { + "message_list": [ + { + "agent_id": "8db9c8eddfcc11f0b5da84ba59bc53c7", + "agent_name": "memory_agent_1223", + "extract": [ + { + "agent_id": "8db9c8eddfcc11f0b5da84ba59bc53c7", + "agent_name": "memory_agent_1223", + "forget_at": "None", + "invalid_at": "None", + "memory_id": "6c8983badede11f083f184ba59bc53c7", + "message_id": 236, + "message_type": "semantic", + "session_id": "65b89ab8e96411f08d4e84ba59bc53c7", + "source_id": 233, + "status": true, + "user_id": "", + "valid_at": "2026-01-04 19:56:46" + }, + ...other extracted messages + ], + "forget_at": "None", + "invalid_at": "None", + "memory_id": "6c8983badede11f083f184ba59bc53c7", + "message_id": 233, + "message_type": "raw", + "session_id": "65b89ab8e96411f08d4e84ba59bc53c7", + "source_id": "None", + "status": true, + "task": { + "progress": 1.0, + "progress_msg": "\n2026-01-04 19:56:46 Prepared prompts and LLM.\n2026-01-04 19:57:48 Get extracted result from LLM.\n2026-01-04 19:57:48 Extracted 6 messages from raw dialogue.\n2026-01-04 19:57:48 Prepared embedding model.\n2026-01-04 19:57:48 Embedded extracted content.\n2026-01-04 19:57:48 Saved messages to storage.\n2026-01-04 19:57:48 Message saved successfully." + }, + "user_id": "", + "valid_at": "2026-01-04 19:56:42" + }, + { + "agent_id": "8db9c8eddfcc11f0b5da84ba59bc53c7", + "agent_name": "memory_agent_1223", + "extract": [], + "forget_at": "None", + "invalid_at": "None", + "memory_id": "6c8983badede11f083f184ba59bc53c7", + "message_id": 226, + "message_type": "raw", + "session_id": "d982a8cbe96111f08a1384ba59bc53c7", + "source_id": "None", + "status": true, + "task": { + "progress": -1.0, + "progress_msg": "Failed to insert message into memory. Details: 6c8983badede11f083f184ba59bc53c7_228:{'type': 'document_parsing_exception', 'reason': \"[1:230] failed to parse field [valid_at] of type [date] in document with id '6c8983badede11f083f184ba59bc53c7_228'. Preview of field's value: ''\", 'caused_by': {'type': 'illegal_argument_exception', 'reason': 'cannot parse empty date'}}; 6c8983badede11f083f184ba59bc53c7_229:{'type': 'document_parsing_exception', 'reason': \"[1:230] failed to parse field [valid_at] of type [date] in document with id '6c8983badede11f083f184ba59bc53c7_229'. Preview of field's value: ''\", 'caused_by': {'type': 'illegal_argument_exception', 'reason': 'cannot parse empty date'}}; 6c8983badede11f083f184ba59bc53c7_230:{'type': 'document_parsing_exception', 'reason': \"[1:230] failed to parse field [valid_at] of type [date] in document with id '6c8983badede11f083f184ba59bc53c7_230'. Preview of field's value: ''\", 'caused_by': {'type': 'illegal_argument_exception', 'reason': 'cannot parse empty date'}}; 6c8983badede11f083f184ba59bc53c7_231:{'type': 'document_parsing_exception', 'reason': \"[1:230] failed to parse field [valid_at] of type [date] in document with id '6c8983badede11f083f184ba59bc53c7_231'. Preview of field's value: ''\", 'caused_by': {'type': 'illegal_argument_exception', 'reason': 'cannot parse empty date'}}; 6c8983badede11f083f184ba59bc53c7_232:{'type': 'document_parsing_exception', 'reason': \"[1:230] failed to parse field [valid_at] of type [date] in document with id '6c8983badede11f083f184ba59bc53c7_232'. Preview of field's value: ''\", 'caused_by': {'type': 'illegal_argument_exception', 'reason': 'cannot parse empty date'}}" + }, + "user_id": "", + "valid_at": "2026-01-04 19:38:26" + }, + ...other 11 messages + ], + "total_count": 13 + }, + "storage_type": "table" + }, + "message": true +} +``` + +Failure + +``` +{ + "code": 404, + "data": null, + "message": "Memory '{memory_id}' not found." +} +``` + + + +### Add Message + +**POST** `/v1/messages` + +Add a message to specified memories. + +#### Request + +- Method: POST +- URL: `/v1/messages` +- Headers: + - `'Content-Type: application/json'` + - `'Authorization: Bearer '` +- Body: + - `"memory_id"`: `list[string]` + - `"agent_id"`: `string` + - `"session_id"`: `string` + - `"user_id"`: `string` + - `"user_input"`: `string` + - `"agent_response"`: `string` + +##### Request example + +```bash +curl --location 'http://{address}/v1/messages' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Bearer ' \ +--data '{ + "memory_id": ["6c8983badede11f083f184ba59bc53c7", "87ebb892df1711f08d6b84ba59bc53c7"], + "agent_id": "8db9c8eddfcc11f0b5da84ba59bc53c7", + "session_id": "bf0a50abeb8111f0917884ba59bc53c7", + "user_id": "55777efac9df11f09cd07f49bd527ade", + "user_input": "your user input here", + "agent_response": "your agent response here" + +}' +``` + +##### Request parameter + +- `memory_id`: (*Body parameter*), `list[string]`, *Required* + + The IDs of the memories to save messages. + +- `agent_id`: (*Body parameter*), `string`, *Required* + + The ID of the message's source agent. + +- `session_id`: (*Body parameter*), `string`, *Required* + + The ID of the message's session. + +- `user_id`: (*Body parameter*), `string`, *Optional* + + The user participating in the conversation with the agent. Defaults to `None`. + +- `user_input`: (*Body parameter*), `string`, *Required* + + The text input provided by the user. + +- `agent_response`: (*Body parameter*), `string`, *Required* + + The text response generated by the AI agent. + +#### Response + +Success + +```json +{ + "code": 0, + "data": null, + "message": "All add to task." +} +``` + +Failure + +```json +{ + "code": 500, + "data": null, + "message": "Some messages failed to add. Detail: {fail information}" +} +``` + + + +### Forget Message + +**DELETE** `/v1/messages/{memory_id}:{message_id}` + +Forget a specified message. After forgetting, this message will not be retrieved by agents, and it will also be prioritized for cleanup by the forgetting policy. + +#### Request + +- Method: DELETE +- URL: `/v1/messages/{memory_id}:{message_id}` +- Headers: + - `'Content-Type: application/json'` + - `'Authorization: Bearer '` + +##### Request example + +```bash +curl --location --request DELETE 'http://{address}/v1/messages/6c8983badede11f083f184ba59bc53c7:272' \ +--header 'Authorization: Bearer ' +``` + +##### Request parameters + +- `memory_id`: (*Path parameter*), `string`, *Required* + + The ID of the memory to which the specified message belongs. + +- `message_id`: (*Path parameter*), `string`, *Required* + + The ID of the message to forget. + +#### Response + +Success + +```json +{ + "code": 0, + "data": null, + "message": true +} +``` + +Failure + +```json +{ + "code": 404, + "data": null, + "message": "Memory '{memory_id}' not found." +} +``` + + + +### Update message status + +**PUT** `/v1/messages/{memory_id}:{message_id}` + +Update message status, enable or disable a message. Once a message is disabled, it will not be retrieved by agents. + +#### Request + +- Method: PUT +- URL: `/v1/messages/{memory_id}:{message_id}` +- Headers: + - `'Content-Type: application/json'` + - `'Authorization: Bearer '` +- Body: + - `"status"`: `bool` + +##### Request example + +```bash +curl --location --request PUT 'http://{address}/v1/messages/6c8983badede11f083f184ba59bc53c7:270' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Bearer ' \ +--data '{ + "status": false +}' +``` + +##### Request parameters + +- `memory_id`: (*Path parameter*), `string`, *Required* + + The ID of the memory to which the specified message belongs. + +- `message_id`: (*Path parameter*), `string`, *Required* + + The ID of the message to enable or disable. + +- `status`: (*Body parameter*), `bool`, *Required* + + The status of message. `True` = `enabled`, `False` = `disabled`. + +#### Response + +Success + +```json +{ + "code": 0, + "data": null, + "message": true +} +``` + +Failure + +```json +{ + "code": 404, + "data": null, + "message": "Memory '{memory_id}' not found." +} +``` + +### Search Message + +**GET** `/v1/messages/search?query={question}&memory_id={memory_id}&similarity_threshold={similarity_threshold}&keywords_similarity_weight={keywords_similarity_weight}&top_n={top_n}` + +Searches and retrieves messages from memory based on the provided `query` and other configuration parameters. + +#### Request + +- Method: GET +- URL: `/v1/messages/search?query={question}&memory_id={memory_id}&similarity_threshold={similarity_threshold}&keywords_similarity_weight={keywords_similarity_weight}&top_n={top_n}` +- Headers: + - `'Content-Type: application/json'` + - `'Authorization: Bearer '` + +##### Request example + +```bash +curl --location 'http://{address}/v1/messages/search?query=%22who%20are%20you%3F%22&memory_id=6c8983badede11f083f184ba59bc53c7&similarity_threshold=0.2&keywords_similarity_weight=0.7&top_n=10' \ +--header 'Authorization: Bearer ' +``` + +##### Request parameters + +- `question`: (*Filter parameter*), `string`, *Required* + + The search term or natural language question used to find relevant messages. + +- `memory_id`: (*Filter parameter*), `string` or `list[string]`, *Required* + + The IDs of the memories to search. Supports multiple values. + +- `agent_id`: (*Filter parameter*), `string`, *Optional* + + The ID of the message's source agent. Defaults to `None`. + +- `session_id`: (*Filter parameter*), `string`, *Optional* + + The ID of the message's session. Defaults to `None`. + +- `similarity_threshold`: (*Filter parameter*), `float`, *Optional* + + The minimum cosine similarity score required for a message to be considered a match. A higher value yields more precise but fewer results. Defaults to `0.2`. + + - Range [0.0, 1.0] + +- `keywords_similarity_weight` : (*Filter parameter*), `float`, *Optional* + + Controls the influence of keyword matching versus semantic (embedding-based) matching in the final relevance score. A value of 0.5 gives them equal weight. Defaults to `0.7`. + + - Range [0.0, 1.0] + +- `top_n`: (*Filter parameter*), `int`, *Optional* + + The maximum number of most relevant messages to return. This limits the result set size for efficiency. Defaults to `10`. + +#### Response + +Success + +```json +{ + "code": 0, + "data": [ + { + "agent_id": "8db9c8eddfcc11f0b5da84ba59bc53c7", + "content": "User Input: who am I?\nAgent Response: To address the question \"who am I?\", let's follow the logical steps outlined in the instructions:\n\n1. **Understand the User’s Request**: The user is asking for a clarification or identification of their own self. This is a fundamental question about personal identity.\n\n2. **Decompose the Request**: The request is quite simple and doesn't require complex decomposition. The core task is to provide an answer that identifies the user in some capacity.\n\n3. **Execute the Subtask**:\n - **Identify the nature of the question**: The user is seeking to understand their own existence or their sense of self.\n - **Assess the context**: The context is not explicitly given, so the response will be general.\n - **Provide a response**: The answer should acknowledge the user's inquiry into their identity.\n\n4. **Validate Accuracy and Consistency**: The response should be consistent with the general understanding of the question. Since the user has not provided specific details about their identity, the response should be broad and open-ended.\n\n5. **Summarize the Final Result**: The user is asking \"who am I?\" which is an inquiry into their own identity. The answer is that the user is the individual who is asking the question. Without more specific information, a detailed description of their identity cannot be provided.\n\nSo, the final summary would be:\n\nThe user is asking the question \"who am I?\" to seek an understanding of their own identity. The response to this question is that the user is the individual who is posing the question. Without additional context or details, a more comprehensive description of the user's identity cannot be given.", + "forget_at": "None", + "invalid_at": "None", + "memory_id": "6c8983badede11f083f184ba59bc53c7", + "message_id": 61, + "message_type": "raw", + "session_id": "ebf8025de52211f0b56684ba59bc53c7", + "source_id": "None", + "status": true, + "user_id": "", + "valid_at": "2025-12-30 09:57:49" + }, + ...other 2 matched messages here + ], + "message": true +} +``` + +Failure + +```json +{ + "code": 500, + "message": "Internal Server Error." +} +``` + + + +### Get Recent Messages + +**GET** `/v1/messages?memory_id={memory_id}&agent_id={agent_id}&session_id={session_id}&limit={limit}` + +Retrieves the most recent messages from specified memories. Typically accepts a `limit` parameter to control the number of messages returned. + +#### Request + +- Method: GET +- URL: `/v1/messages?memory_id={memory_id}&agent_id={agent_id}&session_id={session_id}&limit={limit}` +- Headers: + - `'Content-Type: application/json'` + - `'Authorization: Bearer '` + +##### Request example + +```bash +curl --location 'http://{address}/v1/messages?memory_id=6c8983badede11f083f184ba59bc53c7&limit=10' \ +--header 'Authorization: Bearer ' +``` + +##### Request parameters + +- `memory_id`: (*Filter parameter*), `string` or `list[string]`, *Required* + + The IDs of the memories to search. Supports multiple values. + +- `agent_id`: (*Filter parameter*), `string`, *Optional* + + The ID of the message's source agent. Defaults to `None`. + +- `session_id`: (*Filter parameter*), `string`, *Optional* + + The ID of the message's session. Defaults to `None`. + +- `limit`: (*Filter parameter*), `int`, *Optional* + + Control the number of messages returned. Defaults to `10`. + +#### Response + +Success + +```json +{ + "code": 0, + "data": [ + { + "agent_id": "8db9c8eddfcc11f0b5da84ba59bc53c7", + "content": "User Input: what is pineapple?\nAgent Response: A pineapple is a tropical fruit known for its sweet, tangy flavor and distinctive, spiky appearance. Here are the key facts:\nScientific Name: Ananas comosus\nPhysical Description: It has a tough, spiky, diamond-patterned outer skin (rind) that is usually green, yellow, or brownish. Inside, the juicy yellow flesh surrounds a fibrous core.\nGrowth: Unlike most fruits, pineapples do not grow on trees. They grow from a central stem as a composite fruit, meaning they are formed from many individual berries that fuse together around the core. They grow on a short, leafy plant close to the ground.\nUses: Pineapples are eaten fresh, cooked, grilled, juiced, or canned. They are a popular ingredient in desserts, fruit salads, savory dishes (like pizzas or ham glazes), smoothies, and cocktails.\nNutrition: They are a good source of Vitamin C, manganese, and contain an enzyme called bromelain, which aids in digestion and can tenderize meat.\nSymbolism: The pineapple is a traditional symbol of hospitality and welcome in many cultures.\nAre you asking about the fruit itself, or its use in a specific context?", + "forget_at": "None", + "invalid_at": "None", + "memory_id": "6c8983badede11f083f184ba59bc53c7", + "message_id": 269, + "message_type": "raw", + "session_id": "bf0a50abeb8111f0917884ba59bc53c7", + "source_id": "None", + "status": true, + "user_id": "", + "valid_at": "2026-01-07 16:49:12" + }, + ...other 9 messages here + ], + "message": true +} +``` + +Failure + +```json +{ + "code": 500, + "message": "Internal Server Error." +} +``` + + + +### Get Message Content + +**GET** `/v1/messages/{memory_id}:{message_id}/content` + +Retrieves the full content and embed vector of a specific message using its unique message ID. + +#### Request + +- Method: GET +- URL: `/v1/messages/{memory_id}:{message_id}/content` +- Headers: + - `'Content-Type: application/json'` + - `'Authorization: Bearer '` + +##### Request example + +```bash +curl --location 'http://{address}/v1/messages/6c8983badede11f083f184ba59bc53c7:270/content' \ +--header 'Authorization: Bearer ' +``` + +##### Request parameters + +- `memory_id`: (*Path parameter*), `string`, *Required* + + The ID of the memory to which the specified message belongs. + +- `message_id`: (*Path parameter*), `string`, *Required* + + The ID of the message. + +#### Response + +Success + +```json +{ + "code": 0, + "data": { + "agent_id": "8db9c8eddfcc11f0b5da84ba59bc53c7", + "content": "Pineapples are tropical fruits known for their sweet, tangy flavor and distinctive, spiky appearance", + "content_embed": [ + 0.03641991, + ...embed vector here + ], + "forget_at": null, + "id": "6c8983badede11f083f184ba59bc53c7_270", + "invalid_at": null, + "memory_id": "6c8983badede11f083f184ba59bc53c7", + "message_id": 270, + "message_type": "semantic", + "session_id": "bf0a50abeb8111f0917884ba59bc53c7", + "source_id": 269, + "status": false, + "user_id": "", + "valid_at": "2026-01-07 16:48:37", + "zone_id": 0 + }, + "message": true +} +``` + +Failure + +```json +{ + "code": 404, + "data": null, + "message": "Memory '{memory_id}' not found." +} +``` + + + --- ### System From f4e2783eb478ae42d34ceaaa046087441628e689 Mon Sep 17 00:00:00 2001 From: Paul Lu Date: Thu, 8 Jan 2026 13:22:58 +0800 Subject: [PATCH 062/335] optimize doc id check: do not query db when doc id to validate is empty (#12500) ### What problem does this PR solve? when a kb contains many documents, say 50000, and the retrieval is only made against some kb without specifying any doc ids, the query for all docs from the db is not necessary, and can be omitted to improve performance. ### Type of change - [x] Performance Improvement --- api/apps/sdk/doc.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/api/apps/sdk/doc.py b/api/apps/sdk/doc.py index d341cea5585..d8afe5f27ca 100644 --- a/api/apps/sdk/doc.py +++ b/api/apps/sdk/doc.py @@ -647,10 +647,10 @@ async def metadata_batch_update(dataset_id, tenant_id): for d in deletes: if not isinstance(d, dict) or not d.get("key"): return get_error_data_result(message="Each delete requires key.") - - kb_doc_ids = KnowledgebaseService.list_documents_by_ids([dataset_id]) - target_doc_ids = set(kb_doc_ids) + if document_ids: + kb_doc_ids = KnowledgebaseService.list_documents_by_ids([dataset_id]) + target_doc_ids = set(kb_doc_ids) invalid_ids = set(document_ids) - set(kb_doc_ids) if invalid_ids: return get_error_data_result(message=f"These documents do not belong to dataset {dataset_id}: {', '.join(invalid_ids)}") @@ -1519,11 +1519,12 @@ async def retrieval_test(tenant_id): toc_enhance = req.get("toc_enhance", False) langs = req.get("cross_languages", []) if not isinstance(doc_ids, list): - return get_error_data_result("`documents` should be a list") - doc_ids_list = KnowledgebaseService.list_documents_by_ids(kb_ids) - for doc_id in doc_ids: - if doc_id not in doc_ids_list: - return get_error_data_result(f"The datasets don't own the document {doc_id}") + return get_error_data_result("`documents` should be a list") + if doc_ids: + doc_ids_list = KnowledgebaseService.list_documents_by_ids(kb_ids) + for doc_id in doc_ids: + if doc_id not in doc_ids_list: + return get_error_data_result(f"The datasets don't own the document {doc_id}") if not doc_ids: metadata_condition = req.get("metadata_condition", {}) or {} metas = DocumentService.get_meta_by_kbs(kb_ids) From 1996aa0dac72f18014da43efc911181c01a1681f Mon Sep 17 00:00:00 2001 From: buua436 Date: Thu, 8 Jan 2026 13:34:16 +0800 Subject: [PATCH 063/335] Refactor: Enhance delta streaming in chat functions for improved reasoning and content handling (#12453) ### What problem does this PR solve? change: Enhance delta streaming in chat functions for improved reasoning and content handling ### Type of change - [x] Refactoring --- agentic_reasoning/deep_research.py | 161 +++++++++++++++++------- api/apps/sdk/session.py | 71 +++++------ api/db/services/conversation_service.py | 24 +++- api/db/services/dialog_service.py | 147 +++++++++++++++++----- api/db/services/llm_service.py | 43 +++++++ 5 files changed, 324 insertions(+), 122 deletions(-) diff --git a/agentic_reasoning/deep_research.py b/agentic_reasoning/deep_research.py index 20f7017f474..17afdab1871 100644 --- a/agentic_reasoning/deep_research.py +++ b/agentic_reasoning/deep_research.py @@ -37,9 +37,11 @@ def __init__(self, self._kg_retrieve = kg_retrieve def _remove_tags(text: str, start_tag: str, end_tag: str) -> str: - """General Tag Removal Method""" - pattern = re.escape(start_tag) + r"(.*?)" + re.escape(end_tag) - return re.sub(pattern, "", text) + """Remove tags but keep the content between them.""" + if not text: + return text + text = re.sub(re.escape(start_tag), "", text) + return re.sub(re.escape(end_tag), "", text) @staticmethod def _remove_query_tags(text: str) -> str: @@ -52,21 +54,29 @@ def _remove_result_tags(text: str) -> str: return DeepResearcher._remove_tags(text, BEGIN_SEARCH_RESULT, END_SEARCH_RESULT) async def _generate_reasoning(self, msg_history): - """Generate reasoning steps""" - query_think = "" + """Generate reasoning steps (delta output)""" + raw_answer = "" + cleaned_answer = "" if msg_history[-1]["role"] != "user": msg_history.append({"role": "user", "content": "Continues reasoning with the new information.\n"}) else: msg_history[-1]["content"] += "\n\nContinues reasoning with the new information.\n" - - async for ans in self.chat_mdl.async_chat_streamly(REASON_PROMPT, msg_history, {"temperature": 0.7}): - ans = re.sub(r"^.*", "", ans, flags=re.DOTALL) - if not ans: + + async for delta in self.chat_mdl.async_chat_streamly_delta(REASON_PROMPT, msg_history, {"temperature": 0.7}): + if not delta: continue - query_think = ans - yield query_think - query_think = "" - yield query_think + raw_answer += delta + cleaned_full = re.sub(r"^.*", "", raw_answer, flags=re.DOTALL) + if not cleaned_full: + continue + if cleaned_full.startswith(cleaned_answer): + delta_clean = cleaned_full[len(cleaned_answer):] + else: + delta_clean = cleaned_full + if not delta_clean: + continue + cleaned_answer = cleaned_full + yield delta_clean def _extract_search_queries(self, query_think, question, step_index): """Extract search queries from thinking""" @@ -93,7 +103,7 @@ def _truncate_previous_reasoning(self, all_reasoning_steps): else: if truncated_prev_reasoning[-len('\n\n...\n\n'):] != '\n\n...\n\n': truncated_prev_reasoning += '...\n\n' - + return truncated_prev_reasoning.strip('\n') def _retrieve_information(self, search_query): @@ -138,16 +148,17 @@ def _update_chunk_info(self, chunk_info, kbinfos): for c in kbinfos["chunks"]: if c["chunk_id"] not in cids: chunk_info["chunks"].append(c) - + dids = [d["doc_id"] for d in chunk_info["doc_aggs"]] for d in kbinfos["doc_aggs"]: if d["doc_id"] not in dids: chunk_info["doc_aggs"].append(d) async def _extract_relevant_info(self, truncated_prev_reasoning, search_query, kbinfos): - """Extract and summarize relevant information""" - summary_think = "" - async for ans in self.chat_mdl.async_chat_streamly( + """Extract and summarize relevant information (delta output)""" + raw_answer = "" + cleaned_answer = "" + async for delta in self.chat_mdl.async_chat_streamly_delta( RELEVANT_EXTRACTION_PROMPT.format( prev_reasoning=truncated_prev_reasoning, search_query=search_query, @@ -156,39 +167,92 @@ async def _extract_relevant_info(self, truncated_prev_reasoning, search_query, k [{"role": "user", "content": f'Now you should analyze each web page and find helpful information based on the current search query "{search_query}" and previous reasoning steps.'}], {"temperature": 0.7}): - ans = re.sub(r"^.*", "", ans, flags=re.DOTALL) - if not ans: + if not delta: + continue + raw_answer += delta + cleaned_full = re.sub(r"^.*", "", raw_answer, flags=re.DOTALL) + if not cleaned_full: + continue + if cleaned_full.startswith(cleaned_answer): + delta_clean = cleaned_full[len(cleaned_answer):] + else: + delta_clean = cleaned_full + if not delta_clean: continue - summary_think = ans - yield summary_think - summary_think = "" - - yield summary_think + cleaned_answer = cleaned_full + yield delta_clean async def thinking(self, chunk_info: dict, question: str): executed_search_queries = [] msg_history = [{"role": "user", "content": f'Question:\"{question}\"\n'}] all_reasoning_steps = [] think = "" - + last_idx = 0 + endswith_think = False + last_full = "" + + def emit_delta(full_text: str): + nonlocal last_idx, endswith_think, last_full + if full_text == last_full: + return None + last_full = full_text + delta_ans = full_text[last_idx:] + + if delta_ans.find("") == 0: + last_idx += len("") + delta = "" + elif delta_ans.find("") > 0: + delta = full_text[last_idx:last_idx + delta_ans.find("")] + last_idx += delta_ans.find("") + elif delta_ans.endswith(""): + endswith_think = True + delta = re.sub(r"(|)", "", delta_ans) + elif endswith_think: + endswith_think = False + delta = "" + else: + last_idx = len(full_text) + if full_text.endswith(""): + last_idx -= len("") + delta = re.sub(r"(|)", "", delta_ans) + + if not delta: + return None + if delta == "": + return {"answer": "", "reference": {}, "audio_binary": None, "final": False, "start_to_think": True} + if delta == "": + return {"answer": "", "reference": {}, "audio_binary": None, "final": False, "end_to_think": True} + return {"answer": delta, "reference": {}, "audio_binary": None, "final": False} + + def flush_think_close(): + nonlocal endswith_think + if endswith_think: + endswith_think = False + return {"answer": "", "reference": {}, "audio_binary": None, "final": False, "end_to_think": True} + return None + for step_index in range(MAX_SEARCH_LIMIT + 1): # Check if the maximum search limit has been reached if step_index == MAX_SEARCH_LIMIT - 1: summary_think = f"\n{BEGIN_SEARCH_RESULT}\nThe maximum search limit is exceeded. You are not allowed to search.\n{END_SEARCH_RESULT}\n" - yield {"answer": think + summary_think + "", "reference": {}, "audio_binary": None} + payload = emit_delta(think + summary_think) + if payload: + yield payload all_reasoning_steps.append(summary_think) msg_history.append({"role": "assistant", "content": summary_think}) break # Step 1: Generate reasoning query_think = "" - async for ans in self._generate_reasoning(msg_history): - query_think = ans - yield {"answer": think + self._remove_query_tags(query_think) + "", "reference": {}, "audio_binary": None} + async for delta in self._generate_reasoning(msg_history): + query_think += delta + payload = emit_delta(think + self._remove_query_tags(query_think)) + if payload: + yield payload think += self._remove_query_tags(query_think) all_reasoning_steps.append(query_think) - + # Step 2: Extract search queries queries = self._extract_search_queries(query_think, question, step_index) if not queries and step_index > 0: @@ -197,42 +261,51 @@ async def thinking(self, chunk_info: dict, question: str): # Process each search query for search_query in queries: - logging.info(f"[THINK]Query: {step_index}. {search_query}") msg_history.append({"role": "assistant", "content": search_query}) think += f"\n\n> {step_index + 1}. {search_query}\n\n" - yield {"answer": think + "", "reference": {}, "audio_binary": None} + payload = emit_delta(think) + if payload: + yield payload # Check if the query has already been executed if search_query in executed_search_queries: summary_think = f"\n{BEGIN_SEARCH_RESULT}\nYou have searched this query. Please refer to previous results.\n{END_SEARCH_RESULT}\n" - yield {"answer": think + summary_think + "", "reference": {}, "audio_binary": None} + payload = emit_delta(think + summary_think) + if payload: + yield payload all_reasoning_steps.append(summary_think) msg_history.append({"role": "user", "content": summary_think}) think += summary_think continue - + executed_search_queries.append(search_query) - + # Step 3: Truncate previous reasoning steps truncated_prev_reasoning = self._truncate_previous_reasoning(all_reasoning_steps) - + # Step 4: Retrieve information kbinfos = self._retrieve_information(search_query) - + # Step 5: Update chunk information self._update_chunk_info(chunk_info, kbinfos) - + # Step 6: Extract relevant information think += "\n\n" summary_think = "" - async for ans in self._extract_relevant_info(truncated_prev_reasoning, search_query, kbinfos): - summary_think = ans - yield {"answer": think + self._remove_result_tags(summary_think) + "", "reference": {}, "audio_binary": None} + async for delta in self._extract_relevant_info(truncated_prev_reasoning, search_query, kbinfos): + summary_think += delta + payload = emit_delta(think + self._remove_result_tags(summary_think)) + if payload: + yield payload all_reasoning_steps.append(summary_think) msg_history.append( {"role": "user", "content": f"\n\n{BEGIN_SEARCH_RESULT}{summary_think}{END_SEARCH_RESULT}\n\n"}) think += self._remove_result_tags(summary_think) - logging.info(f"[THINK]Summary: {step_index}. {summary_think}") - yield think + "" + final_payload = emit_delta(think + "") + if final_payload: + yield final_payload + close_payload = flush_think_close() + if close_payload: + yield close_payload diff --git a/api/apps/sdk/session.py b/api/apps/sdk/session.py index e76560ccfcc..ceba4b40e2e 100644 --- a/api/apps/sdk/session.py +++ b/api/apps/sdk/session.py @@ -304,9 +304,12 @@ async def chat_completion_openai_like(tenant_id, chat_id): # The choices field on the last chunk will always be an empty array []. async def streamed_response_generator(chat_id, dia, msg): token_used = 0 - answer_cache = "" - reasoning_cache = "" last_ans = {} + full_content = "" + full_reasoning = "" + final_answer = None + final_reference = None + in_think = False response = { "id": f"chatcmpl-{chat_id}", "choices": [ @@ -336,47 +339,30 @@ async def streamed_response_generator(chat_id, dia, msg): chat_kwargs["doc_ids"] = doc_ids_str async for ans in async_chat(dia, msg, True, **chat_kwargs): last_ans = ans - answer = ans["answer"] - - reasoning_match = re.search(r"(.*?)", answer, flags=re.DOTALL) - if reasoning_match: - reasoning_part = reasoning_match.group(1) - content_part = answer[reasoning_match.end() :] - else: - reasoning_part = "" - content_part = answer - - reasoning_incremental = "" - if reasoning_part: - if reasoning_part.startswith(reasoning_cache): - reasoning_incremental = reasoning_part.replace(reasoning_cache, "", 1) - else: - reasoning_incremental = reasoning_part - reasoning_cache = reasoning_part - - content_incremental = "" - if content_part: - if content_part.startswith(answer_cache): - content_incremental = content_part.replace(answer_cache, "", 1) - else: - content_incremental = content_part - answer_cache = content_part - - token_used += len(reasoning_incremental) + len(content_incremental) - - if not any([reasoning_incremental, content_incremental]): + if ans.get("final"): + if ans.get("answer"): + full_content = ans["answer"] + final_answer = ans.get("answer") or full_content + final_reference = ans.get("reference", {}) continue - - if reasoning_incremental: - response["choices"][0]["delta"]["reasoning_content"] = reasoning_incremental + if ans.get("start_to_think"): + in_think = True + continue + if ans.get("end_to_think"): + in_think = False + continue + delta = ans.get("answer") or "" + if not delta: + continue + token_used += len(delta) + if in_think: + full_reasoning += delta + response["choices"][0]["delta"]["reasoning_content"] = delta + response["choices"][0]["delta"]["content"] = None else: + full_content += delta + response["choices"][0]["delta"]["content"] = delta response["choices"][0]["delta"]["reasoning_content"] = None - - if content_incremental: - response["choices"][0]["delta"]["content"] = content_incremental - else: - response["choices"][0]["delta"]["content"] = None - yield f"data:{json.dumps(response, ensure_ascii=False)}\n\n" except Exception as e: response["choices"][0]["delta"]["content"] = "**ERROR**: " + str(e) @@ -388,8 +374,9 @@ async def streamed_response_generator(chat_id, dia, msg): response["choices"][0]["finish_reason"] = "stop" response["usage"] = {"prompt_tokens": len(prompt), "completion_tokens": token_used, "total_tokens": len(prompt) + token_used} if need_reference: - response["choices"][0]["delta"]["reference"] = chunks_format(last_ans.get("reference", [])) - response["choices"][0]["delta"]["final_content"] = last_ans.get("answer", "") + reference_payload = final_reference if final_reference is not None else last_ans.get("reference", []) + response["choices"][0]["delta"]["reference"] = chunks_format(reference_payload) + response["choices"][0]["delta"]["final_content"] = final_answer if final_answer is not None else full_content yield f"data:{json.dumps(response, ensure_ascii=False)}\n\n" yield "data:[DONE]\n\n" diff --git a/api/db/services/conversation_service.py b/api/db/services/conversation_service.py index 2a5b06601dc..693489bf8ac 100644 --- a/api/db/services/conversation_service.py +++ b/api/db/services/conversation_service.py @@ -69,6 +69,7 @@ def structure_answer(conv, ans, message_id, session_id): if not isinstance(reference, dict): reference = {} ans["reference"] = {} + is_final = ans.get("final", True) chunk_list = chunks_format(reference) @@ -81,12 +82,29 @@ def structure_answer(conv, ans, message_id, session_id): if not conv.message: conv.message = [] + content = ans["answer"] + if ans.get("start_to_think"): + content = "" + elif ans.get("end_to_think"): + content = "" + if not conv.message or conv.message[-1].get("role", "") != "assistant": - conv.message.append({"role": "assistant", "content": ans["answer"], "created_at": time.time(), "id": message_id}) + conv.message.append({"role": "assistant", "content": content, "created_at": time.time(), "id": message_id}) else: - conv.message[-1] = {"role": "assistant", "content": ans["answer"], "created_at": time.time(), "id": message_id} + if is_final: + if ans.get("answer"): + conv.message[-1] = {"role": "assistant", "content": ans["answer"], "created_at": time.time(), "id": message_id} + else: + conv.message[-1]["created_at"] = time.time() + conv.message[-1]["id"] = message_id + else: + conv.message[-1]["content"] = (conv.message[-1].get("content") or "") + content + conv.message[-1]["created_at"] = time.time() + conv.message[-1]["id"] = message_id if conv.reference: - conv.reference[-1] = reference + should_update_reference = is_final or bool(reference.get("chunks")) or bool(reference.get("doc_aggs")) + if should_update_reference: + conv.reference[-1] = reference return ans async def async_completion(tenant_id, chat_id, question, name="New session", session_id=None, stream=True, **kwargs): diff --git a/api/db/services/dialog_service.py b/api/db/services/dialog_service.py index 83f1bb4fa7a..54f70658be4 100644 --- a/api/db/services/dialog_service.py +++ b/api/db/services/dialog_service.py @@ -196,19 +196,13 @@ async def async_chat_solo(dialog, messages, stream=True): if attachments and msg: msg[-1]["content"] += attachments if stream: - last_ans = "" - delta_ans = "" - answer = "" - async for ans in chat_mdl.async_chat_streamly(prompt_config.get("system", ""), msg, dialog.llm_setting): - answer = ans - delta_ans = ans[len(last_ans):] - if num_tokens_from_string(delta_ans) < 16: + stream_iter = chat_mdl.async_chat_streamly_delta(prompt_config.get("system", ""), msg, dialog.llm_setting) + async for kind, value, state in _stream_with_think_delta(stream_iter): + if kind == "marker": + flags = {"start_to_think": True} if value == "" else {"end_to_think": True} + yield {"answer": "", "reference": {}, "audio_binary": None, "prompt": "", "created_at": time.time(), "final": False, **flags} continue - last_ans = answer - yield {"answer": answer, "reference": {}, "audio_binary": tts(tts_mdl, delta_ans), "prompt": "", "created_at": time.time()} - delta_ans = "" - if delta_ans: - yield {"answer": answer, "reference": {}, "audio_binary": tts(tts_mdl, delta_ans), "prompt": "", "created_at": time.time()} + yield {"answer": value, "reference": {}, "audio_binary": tts(tts_mdl, value), "prompt": "", "created_at": time.time(), "final": False} else: answer = await chat_mdl.async_chat(prompt_config.get("system", ""), msg, dialog.llm_setting) user_content = msg[-1].get("content", "[content not available]") @@ -434,8 +428,7 @@ async def async_chat(dialog, messages, stream=True, **kwargs): if not knowledges and prompt_config.get("empty_response"): empty_res = prompt_config["empty_response"] yield {"answer": empty_res, "reference": kbinfos, "prompt": "\n\n### Query:\n%s" % " ".join(questions), - "audio_binary": tts(tts_mdl, empty_res)} - yield {"answer": prompt_config["empty_response"], "reference": kbinfos} + "audio_binary": tts(tts_mdl, empty_res), "final": True} return kwargs["knowledge"] = "\n------\n" + "\n\n------\n\n".join(knowledges) @@ -538,21 +531,22 @@ def decorate_answer(answer): ) if stream: - last_ans = "" - answer = "" - async for ans in chat_mdl.async_chat_streamly(prompt + prompt4citation, msg[1:], gen_conf): - if thought: - ans = re.sub(r"^.*", "", ans, flags=re.DOTALL) - answer = ans - delta_ans = ans[len(last_ans):] - if num_tokens_from_string(delta_ans) < 16: + stream_iter = chat_mdl.async_chat_streamly_delta(prompt + prompt4citation, msg[1:], gen_conf) + last_state = None + async for kind, value, state in _stream_with_think_delta(stream_iter): + last_state = state + if kind == "marker": + flags = {"start_to_think": True} if value == "" else {"end_to_think": True} + yield {"answer": "", "reference": {}, "audio_binary": None, "final": False, **flags} continue - last_ans = answer - yield {"answer": thought + answer, "reference": {}, "audio_binary": tts(tts_mdl, delta_ans)} - delta_ans = answer[len(last_ans):] - if delta_ans: - yield {"answer": thought + answer, "reference": {}, "audio_binary": tts(tts_mdl, delta_ans)} - yield decorate_answer(thought + answer) + yield {"answer": value, "reference": {}, "audio_binary": tts(tts_mdl, value), "final": False} + full_answer = last_state.full_text if last_state else "" + if full_answer: + final = decorate_answer(thought + full_answer) + final["final"] = True + final["audio_binary"] = None + final["answer"] = "" + yield final else: answer = await chat_mdl.async_chat(prompt + prompt4citation, msg[1:], gen_conf) user_content = msg[-1].get("content", "[content not available]") @@ -733,6 +727,84 @@ def tts(tts_mdl, text): return None return binascii.hexlify(bin).decode("utf-8") + +class _ThinkStreamState: + def __init__(self) -> None: + self.full_text = "" + self.last_idx = 0 + self.endswith_think = False + self.last_full = "" + self.last_model_full = "" + self.in_think = False + self.buffer = "" + + +def _next_think_delta(state: _ThinkStreamState) -> str: + full_text = state.full_text + if full_text == state.last_full: + return "" + state.last_full = full_text + delta_ans = full_text[state.last_idx:] + + if delta_ans.find("") == 0: + state.last_idx += len("") + return "" + if delta_ans.find("") > 0: + delta_text = full_text[state.last_idx:state.last_idx + delta_ans.find("")] + state.last_idx += delta_ans.find("") + return delta_text + if delta_ans.endswith(""): + state.endswith_think = True + elif state.endswith_think: + state.endswith_think = False + return "" + + state.last_idx = len(full_text) + if full_text.endswith(""): + state.last_idx -= len("") + return re.sub(r"(|)", "", delta_ans) + + +async def _stream_with_think_delta(stream_iter, min_tokens: int = 16): + state = _ThinkStreamState() + async for chunk in stream_iter: + if not chunk: + continue + if chunk.startswith(state.last_model_full): + new_part = chunk[len(state.last_model_full):] + state.last_model_full = chunk + else: + new_part = chunk + state.last_model_full += chunk + if not new_part: + continue + state.full_text += new_part + delta = _next_think_delta(state) + if not delta: + continue + if delta in ("", ""): + if delta == "" and state.in_think: + continue + if delta == "" and not state.in_think: + continue + if state.buffer: + yield ("text", state.buffer, state) + state.buffer = "" + state.in_think = delta == "" + yield ("marker", delta, state) + continue + state.buffer += delta + if num_tokens_from_string(state.buffer) < min_tokens: + continue + yield ("text", state.buffer, state) + state.buffer = "" + + if state.buffer: + yield ("text", state.buffer, state) + state.buffer = "" + if state.endswith_think: + yield ("marker", "", state) + async def async_ask(question, kb_ids, tenant_id, chat_llm_name=None, search_config={}): doc_ids = search_config.get("doc_ids", []) rerank_mdl = None @@ -798,11 +870,20 @@ def decorate_answer(answer): refs["chunks"] = chunks_format(refs) return {"answer": answer, "reference": refs} - answer = "" - async for ans in chat_mdl.async_chat_streamly(sys_prompt, msg, {"temperature": 0.1}): - answer = ans - yield {"answer": answer, "reference": {}} - yield decorate_answer(answer) + stream_iter = chat_mdl.async_chat_streamly_delta(sys_prompt, msg, {"temperature": 0.1}) + last_state = None + async for kind, value, state in _stream_with_think_delta(stream_iter): + last_state = state + if kind == "marker": + flags = {"start_to_think": True} if value == "" else {"end_to_think": True} + yield {"answer": "", "reference": {}, "final": False, **flags} + continue + yield {"answer": value, "reference": {}, "final": False} + full_answer = last_state.full_text if last_state else "" + final = decorate_answer(full_answer) + final["final"] = True + final["answer"] = "" + yield final async def gen_mindmap(question, kb_ids, tenant_id, search_config={}): diff --git a/api/db/services/llm_service.py b/api/db/services/llm_service.py index e5505af8849..db65ec8ecbb 100644 --- a/api/db/services/llm_service.py +++ b/api/db/services/llm_service.py @@ -441,3 +441,46 @@ async def async_chat_streamly(self, system: str, history: list, gen_conf: dict = generation.update(output={"output": ans}, usage_details={"total_tokens": total_tokens}) generation.end() return + + async def async_chat_streamly_delta(self, system: str, history: list, gen_conf: dict = {}, **kwargs): + total_tokens = 0 + ans = "" + if self.is_tools and getattr(self.mdl, "is_tools", False) and hasattr(self.mdl, "async_chat_streamly_with_tools"): + stream_fn = getattr(self.mdl, "async_chat_streamly_with_tools", None) + elif hasattr(self.mdl, "async_chat_streamly"): + stream_fn = getattr(self.mdl, "async_chat_streamly", None) + else: + raise RuntimeError(f"Model {self.mdl} does not implement async_chat or async_chat_with_tools") + + generation = None + if self.langfuse: + generation = self.langfuse.start_generation(trace_context=self.trace_context, name="chat_streamly", model=self.llm_name, input={"system": system, "history": history}) + + if stream_fn: + chat_partial = partial(stream_fn, system, history, gen_conf) + use_kwargs = self._clean_param(chat_partial, **kwargs) + try: + async for txt in chat_partial(**use_kwargs): + if isinstance(txt, int): + total_tokens = txt + break + + if txt.endswith(""): + ans = ans[: -len("")] + + if not self.verbose_tool_use: + txt = re.sub(r".*?", "", txt, flags=re.DOTALL) + + ans += txt + yield txt + except Exception as e: + if generation: + generation.update(output={"error": str(e)}) + generation.end() + raise + if total_tokens and not TenantLLMService.increase_usage(self.tenant_id, self.llm_type, total_tokens, self.llm_name): + logging.error("LLMBundle.async_chat_streamly can't update token usage for {}/CHAT llm_name: {}, used_tokens: {}".format(self.tenant_id, self.llm_name, total_tokens)) + if generation: + generation.update(output={"output": ans}, usage_details={"total_tokens": total_tokens}) + generation.end() + return From 6f1a555d5f338fb10473f984bcfa2bc92a585ddc Mon Sep 17 00:00:00 2001 From: Liu An Date: Thu, 8 Jan 2026 16:11:35 +0800 Subject: [PATCH 064/335] Refa(sdk/python/test): remove unused testcases and utilities (#12505) ### What problem does this PR solve? Removed the following dir: - sdk/python/test/libs/ - sdk/python/test/test_http_api/ - sdk/python/test/test_sdk_api/ ### Type of change - [x] Refactoring --- sdk/python/test/libs/__init__.py | 15 - sdk/python/test/libs/auth.py | 25 - sdk/python/test/libs/utils/__init__.py | 63 -- sdk/python/test/libs/utils/file_utils.py | 107 --- .../test/libs/utils/hypothesis_utils.py | 28 - sdk/python/test/test_http_api/common.py | 257 ------ sdk/python/test/test_http_api/conftest.py | 202 ----- .../conftest.py | 46 - .../test_create_chat_assistant.py | 241 ------ .../test_delete_chat_assistants.py | 124 --- .../test_list_chat_assistants.py | 311 ------- .../test_update_chat_assistant.py | 228 ----- .../conftest.py | 52 -- .../test_add_chunk.py | 250 ------ .../test_delete_chunks.py | 194 ----- .../test_list_chunks.py | 209 ----- .../test_retrieval_chunks.py | 313 ------- .../test_update_chunk.py | 246 ------ .../test_dataset_mangement/conftest.py | 39 - .../test_create_dataset.py | 735 ---------------- .../test_delete_datasets.py | 219 ----- .../test_list_datasets.py | 339 -------- .../test_update_dataset.py | 819 ------------------ .../conftest.py | 51 -- .../test_delete_documents.py | 181 ---- .../test_download_document.py | 178 ---- .../test_list_documents.py | 357 -------- .../test_parse_documents.py | 217 ----- .../test_stop_parse_documents.py | 202 ----- .../test_update_document.py | 547 ------------ .../test_upload_documents.py | 218 ----- .../test_session_management/conftest.py | 53 -- ...test_create_session_with_chat_assistant.py | 117 --- ...est_delete_sessions_with_chat_assistant.py | 170 ---- .../test_list_sessions_with_chat_assistant.py | 247 ------ ...test_update_session_with_chat_assistant.py | 148 ---- sdk/python/test/test_sdk_api/common.py | 19 - sdk/python/test/test_sdk_api/get_email.py | 19 - sdk/python/test/test_sdk_api/t_agent.py | 36 - sdk/python/test/test_sdk_api/t_chat.py | 131 --- sdk/python/test/test_sdk_api/t_chunk.py | 216 ----- sdk/python/test/test_sdk_api/t_dataset.py | 77 -- sdk/python/test/test_sdk_api/t_document.py | 198 ----- sdk/python/test/test_sdk_api/t_session.py | 145 ---- .../test/test_sdk_api/test_data/ragflow.txt | 1 - .../test_sdk_api/test_data/ragflow_test.txt | 29 - .../test/test_sdk_api/test_data/test.docx | Bin 19146 -> 0 bytes .../test/test_sdk_api/test_data/test.html | 148 ---- .../test/test_sdk_api/test_data/test.jpg | Bin 88731 -> 0 bytes .../test/test_sdk_api/test_data/test.json | 107 --- .../test/test_sdk_api/test_data/test.md | 21 - .../test/test_sdk_api/test_data/test.pdf | Bin 65715 -> 0 bytes .../test/test_sdk_api/test_data/test.ppt | Bin 33573 -> 0 bytes .../test/test_sdk_api/test_data/test.txt | 21 - .../test/test_sdk_api/test_data/test.xlsx | Bin 10471 -> 0 bytes 55 files changed, 8916 deletions(-) delete mode 100644 sdk/python/test/libs/__init__.py delete mode 100644 sdk/python/test/libs/auth.py delete mode 100644 sdk/python/test/libs/utils/__init__.py delete mode 100644 sdk/python/test/libs/utils/file_utils.py delete mode 100644 sdk/python/test/libs/utils/hypothesis_utils.py delete mode 100644 sdk/python/test/test_http_api/common.py delete mode 100644 sdk/python/test/test_http_api/conftest.py delete mode 100644 sdk/python/test/test_http_api/test_chat_assistant_management/conftest.py delete mode 100644 sdk/python/test/test_http_api/test_chat_assistant_management/test_create_chat_assistant.py delete mode 100644 sdk/python/test/test_http_api/test_chat_assistant_management/test_delete_chat_assistants.py delete mode 100644 sdk/python/test/test_http_api/test_chat_assistant_management/test_list_chat_assistants.py delete mode 100644 sdk/python/test/test_http_api/test_chat_assistant_management/test_update_chat_assistant.py delete mode 100644 sdk/python/test/test_http_api/test_chunk_management_within_dataset/conftest.py delete mode 100644 sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_add_chunk.py delete mode 100644 sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_delete_chunks.py delete mode 100644 sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_list_chunks.py delete mode 100644 sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_retrieval_chunks.py delete mode 100644 sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_update_chunk.py delete mode 100644 sdk/python/test/test_http_api/test_dataset_mangement/conftest.py delete mode 100644 sdk/python/test/test_http_api/test_dataset_mangement/test_create_dataset.py delete mode 100644 sdk/python/test/test_http_api/test_dataset_mangement/test_delete_datasets.py delete mode 100644 sdk/python/test/test_http_api/test_dataset_mangement/test_list_datasets.py delete mode 100644 sdk/python/test/test_http_api/test_dataset_mangement/test_update_dataset.py delete mode 100644 sdk/python/test/test_http_api/test_file_management_within_dataset/conftest.py delete mode 100644 sdk/python/test/test_http_api/test_file_management_within_dataset/test_delete_documents.py delete mode 100644 sdk/python/test/test_http_api/test_file_management_within_dataset/test_download_document.py delete mode 100644 sdk/python/test/test_http_api/test_file_management_within_dataset/test_list_documents.py delete mode 100644 sdk/python/test/test_http_api/test_file_management_within_dataset/test_parse_documents.py delete mode 100644 sdk/python/test/test_http_api/test_file_management_within_dataset/test_stop_parse_documents.py delete mode 100644 sdk/python/test/test_http_api/test_file_management_within_dataset/test_update_document.py delete mode 100644 sdk/python/test/test_http_api/test_file_management_within_dataset/test_upload_documents.py delete mode 100644 sdk/python/test/test_http_api/test_session_management/conftest.py delete mode 100644 sdk/python/test/test_http_api/test_session_management/test_create_session_with_chat_assistant.py delete mode 100644 sdk/python/test/test_http_api/test_session_management/test_delete_sessions_with_chat_assistant.py delete mode 100644 sdk/python/test/test_http_api/test_session_management/test_list_sessions_with_chat_assistant.py delete mode 100644 sdk/python/test/test_http_api/test_session_management/test_update_session_with_chat_assistant.py delete mode 100644 sdk/python/test/test_sdk_api/common.py delete mode 100644 sdk/python/test/test_sdk_api/get_email.py delete mode 100644 sdk/python/test/test_sdk_api/t_agent.py delete mode 100644 sdk/python/test/test_sdk_api/t_chat.py delete mode 100644 sdk/python/test/test_sdk_api/t_chunk.py delete mode 100644 sdk/python/test/test_sdk_api/t_dataset.py delete mode 100644 sdk/python/test/test_sdk_api/t_document.py delete mode 100644 sdk/python/test/test_sdk_api/t_session.py delete mode 100644 sdk/python/test/test_sdk_api/test_data/ragflow.txt delete mode 100644 sdk/python/test/test_sdk_api/test_data/ragflow_test.txt delete mode 100644 sdk/python/test/test_sdk_api/test_data/test.docx delete mode 100644 sdk/python/test/test_sdk_api/test_data/test.html delete mode 100644 sdk/python/test/test_sdk_api/test_data/test.jpg delete mode 100644 sdk/python/test/test_sdk_api/test_data/test.json delete mode 100644 sdk/python/test/test_sdk_api/test_data/test.md delete mode 100644 sdk/python/test/test_sdk_api/test_data/test.pdf delete mode 100644 sdk/python/test/test_sdk_api/test_data/test.ppt delete mode 100644 sdk/python/test/test_sdk_api/test_data/test.txt delete mode 100644 sdk/python/test/test_sdk_api/test_data/test.xlsx diff --git a/sdk/python/test/libs/__init__.py b/sdk/python/test/libs/__init__.py deleted file mode 100644 index 177b91dd051..00000000000 --- a/sdk/python/test/libs/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/sdk/python/test/libs/auth.py b/sdk/python/test/libs/auth.py deleted file mode 100644 index a27bc737eea..00000000000 --- a/sdk/python/test/libs/auth.py +++ /dev/null @@ -1,25 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from requests.auth import AuthBase - - -class RAGFlowHttpApiAuth(AuthBase): - def __init__(self, token): - self._token = token - - def __call__(self, r): - r.headers["Authorization"] = f'Bearer {self._token}' - return r diff --git a/sdk/python/test/libs/utils/__init__.py b/sdk/python/test/libs/utils/__init__.py deleted file mode 100644 index 7620fdac266..00000000000 --- a/sdk/python/test/libs/utils/__init__.py +++ /dev/null @@ -1,63 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import base64 -import functools -import hashlib -import time -from pathlib import Path - - -def encode_avatar(image_path): - with Path.open(image_path, "rb") as file: - binary_data = file.read() - base64_encoded = base64.b64encode(binary_data).decode("utf-8") - return base64_encoded - - -def compare_by_hash(file1, file2, algorithm="sha256"): - def _calc_hash(file_path): - hash_func = hashlib.new(algorithm) - with open(file_path, "rb") as f: - while chunk := f.read(8192): - hash_func.update(chunk) - return hash_func.hexdigest() - - return _calc_hash(file1) == _calc_hash(file2) - - -def wait_for(timeout=10, interval=1, error_msg="Timeout"): - def decorator(func): - @functools.wraps(func) - def wrapper(*args, **kwargs): - start_time = time.time() - while True: - result = func(*args, **kwargs) - if result is True: - return result - elapsed = time.time() - start_time - if elapsed > timeout: - assert False, error_msg - time.sleep(interval) - - return wrapper - - return decorator - - -def is_sorted(data, field, descending=True): - timestamps = [ds[field] for ds in data] - return all(a >= b for a, b in zip(timestamps, timestamps[1:])) if descending else all(a <= b for a, b in zip(timestamps, timestamps[1:])) diff --git a/sdk/python/test/libs/utils/file_utils.py b/sdk/python/test/libs/utils/file_utils.py deleted file mode 100644 index e7a068023db..00000000000 --- a/sdk/python/test/libs/utils/file_utils.py +++ /dev/null @@ -1,107 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import json - -from docx import Document # pip install python-docx -from openpyxl import Workbook # pip install openpyxl -from PIL import Image, ImageDraw # pip install Pillow -from pptx import Presentation # pip install python-pptx -from reportlab.pdfgen import canvas # pip install reportlab - - -def create_docx_file(path): - doc = Document() - doc.add_paragraph("这是一个测试 DOCX 文件。") - doc.save(path) - return path - - -def create_excel_file(path): - wb = Workbook() - ws = wb.active - ws["A1"] = "测试 Excel 文件" - wb.save(path) - return path - - -def create_ppt_file(path): - prs = Presentation() - slide = prs.slides.add_slide(prs.slide_layouts[0]) - slide.shapes.title.text = "测试 PPT 文件" - prs.save(path) - return path - - -def create_image_file(path): - img = Image.new("RGB", (100, 100), color="blue") - draw = ImageDraw.Draw(img) - draw.text((10, 40), "Test", fill="white") - img.save(path) - return path - - -def create_pdf_file(path): - if not isinstance(path, str): - path = str(path) - c = canvas.Canvas(path) - c.drawString(100, 750, "测试 PDF 文件") - c.save() - return path - - -def create_txt_file(path): - with open(path, "w", encoding="utf-8") as f: - f.write("这是测试 TXT 文件的内容。") - return path - - -def create_md_file(path): - md_content = "# 测试 MD 文件\n\n这是一份 Markdown 格式的测试文件。" - with open(path, "w", encoding="utf-8") as f: - f.write(md_content) - return path - - -def create_json_file(path): - data = {"message": "这是测试 JSON 文件", "value": 123} - with open(path, "w", encoding="utf-8") as f: - json.dump(data, f, indent=2) - return path - - -def create_eml_file(path): - eml_content = ( - "From: sender@example.com\n" - "To: receiver@example.com\n" - "Subject: 测试 EML 文件\n\n" - "这是一封测试邮件的内容。\n" - ) - with open(path, "w", encoding="utf-8") as f: - f.write(eml_content) - return path - - -def create_html_file(path): - html_content = ( - "\n" - "测试 HTML 文件\n" - "

这是一个测试 HTML 文件

\n" - "" - ) - with open(path, "w", encoding="utf-8") as f: - f.write(html_content) - return path diff --git a/sdk/python/test/libs/utils/hypothesis_utils.py b/sdk/python/test/libs/utils/hypothesis_utils.py deleted file mode 100644 index 736e6cbdf55..00000000000 --- a/sdk/python/test/libs/utils/hypothesis_utils.py +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - - -import hypothesis.strategies as st - - -@st.composite -def valid_names(draw): - base_chars = "abcdefghijklmnopqrstuvwxyz_" - first_char = draw(st.sampled_from([c for c in base_chars if c.isalpha() or c == "_"])) - remaining = draw(st.text(alphabet=st.sampled_from(base_chars), min_size=0, max_size=128 - 2)) - - name = (first_char + remaining)[:128] - return name.encode("utf-8").decode("utf-8") diff --git a/sdk/python/test/test_http_api/common.py b/sdk/python/test/test_http_api/common.py deleted file mode 100644 index f3010b58998..00000000000 --- a/sdk/python/test/test_http_api/common.py +++ /dev/null @@ -1,257 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import os -from pathlib import Path - -import requests -from libs.utils.file_utils import create_txt_file -from requests_toolbelt import MultipartEncoder - -HEADERS = {"Content-Type": "application/json"} -HOST_ADDRESS = os.getenv("HOST_ADDRESS", "http://127.0.0.1:9380") -DATASETS_API_URL = "/api/v1/datasets" -FILE_API_URL = "/api/v1/datasets/{dataset_id}/documents" -FILE_CHUNK_API_URL = "/api/v1/datasets/{dataset_id}/chunks" -CHUNK_API_URL = "/api/v1/datasets/{dataset_id}/documents/{document_id}/chunks" -CHAT_ASSISTANT_API_URL = "/api/v1/chats" -SESSION_WITH_CHAT_ASSISTANT_API_URL = "/api/v1/chats/{chat_id}/sessions" -SESSION_WITH_AGENT_API_URL = "/api/v1/agents/{agent_id}/sessions" - -INVALID_API_TOKEN = "invalid_key_123" -DATASET_NAME_LIMIT = 128 -DOCUMENT_NAME_LIMIT = 128 -CHAT_ASSISTANT_NAME_LIMIT = 255 -SESSION_WITH_CHAT_NAME_LIMIT = 255 - - -# DATASET MANAGEMENT -def create_dataset(auth, payload=None, *, headers=HEADERS, data=None): - res = requests.post(url=f"{HOST_ADDRESS}{DATASETS_API_URL}", headers=headers, auth=auth, json=payload, data=data) - return res.json() - - -def list_datasets(auth, params=None, *, headers=HEADERS): - res = requests.get(url=f"{HOST_ADDRESS}{DATASETS_API_URL}", headers=headers, auth=auth, params=params) - return res.json() - - -def update_dataset(auth, dataset_id, payload=None, *, headers=HEADERS, data=None): - res = requests.put(url=f"{HOST_ADDRESS}{DATASETS_API_URL}/{dataset_id}", headers=headers, auth=auth, json=payload, data=data) - return res.json() - - -def delete_datasets(auth, payload=None, *, headers=HEADERS, data=None): - res = requests.delete(url=f"{HOST_ADDRESS}{DATASETS_API_URL}", headers=headers, auth=auth, json=payload, data=data) - return res.json() - - -def batch_create_datasets(auth, num): - ids = [] - for i in range(num): - res = create_dataset(auth, {"name": f"dataset_{i}"}) - ids.append(res["data"]["id"]) - return ids - - -# FILE MANAGEMENT WITHIN DATASET -def upload_documnets(auth, dataset_id, files_path=None): - url = f"{HOST_ADDRESS}{FILE_API_URL}".format(dataset_id=dataset_id) - - if files_path is None: - files_path = [] - - fields = [] - file_objects = [] - try: - for fp in files_path: - p = Path(fp) - f = p.open("rb") - fields.append(("file", (p.name, f))) - file_objects.append(f) - m = MultipartEncoder(fields=fields) - - res = requests.post( - url=url, - headers={"Content-Type": m.content_type}, - auth=auth, - data=m, - ) - return res.json() - finally: - for f in file_objects: - f.close() - - -def download_document(auth, dataset_id, document_id, save_path): - url = f"{HOST_ADDRESS}{FILE_API_URL}/{document_id}".format(dataset_id=dataset_id) - res = requests.get(url=url, auth=auth, stream=True) - try: - if res.status_code == 200: - with open(save_path, "wb") as f: - for chunk in res.iter_content(chunk_size=8192): - f.write(chunk) - finally: - res.close() - - return res - - -def list_documnets(auth, dataset_id, params=None): - url = f"{HOST_ADDRESS}{FILE_API_URL}".format(dataset_id=dataset_id) - res = requests.get(url=url, headers=HEADERS, auth=auth, params=params) - return res.json() - - -def update_documnet(auth, dataset_id, document_id, payload=None): - url = f"{HOST_ADDRESS}{FILE_API_URL}/{document_id}".format(dataset_id=dataset_id) - res = requests.put(url=url, headers=HEADERS, auth=auth, json=payload) - return res.json() - - -def delete_documnets(auth, dataset_id, payload=None): - url = f"{HOST_ADDRESS}{FILE_API_URL}".format(dataset_id=dataset_id) - res = requests.delete(url=url, headers=HEADERS, auth=auth, json=payload) - return res.json() - - -def parse_documnets(auth, dataset_id, payload=None): - url = f"{HOST_ADDRESS}{FILE_CHUNK_API_URL}".format(dataset_id=dataset_id) - res = requests.post(url=url, headers=HEADERS, auth=auth, json=payload) - return res.json() - - -def stop_parse_documnets(auth, dataset_id, payload=None): - url = f"{HOST_ADDRESS}{FILE_CHUNK_API_URL}".format(dataset_id=dataset_id) - res = requests.delete(url=url, headers=HEADERS, auth=auth, json=payload) - return res.json() - - -def bulk_upload_documents(auth, dataset_id, num, tmp_path): - fps = [] - for i in range(num): - fp = create_txt_file(tmp_path / f"ragflow_test_upload_{i}.txt") - fps.append(fp) - res = upload_documnets(auth, dataset_id, fps) - document_ids = [] - for document in res["data"]: - document_ids.append(document["id"]) - return document_ids - - -# CHUNK MANAGEMENT WITHIN DATASET -def add_chunk(auth, dataset_id, document_id, payload=None): - url = f"{HOST_ADDRESS}{CHUNK_API_URL}".format(dataset_id=dataset_id, document_id=document_id) - res = requests.post(url=url, headers=HEADERS, auth=auth, json=payload) - return res.json() - - -def list_chunks(auth, dataset_id, document_id, params=None): - url = f"{HOST_ADDRESS}{CHUNK_API_URL}".format(dataset_id=dataset_id, document_id=document_id) - res = requests.get(url=url, headers=HEADERS, auth=auth, params=params) - return res.json() - - -def update_chunk(auth, dataset_id, document_id, chunk_id, payload=None): - url = f"{HOST_ADDRESS}{CHUNK_API_URL}/{chunk_id}".format(dataset_id=dataset_id, document_id=document_id) - res = requests.put(url=url, headers=HEADERS, auth=auth, json=payload) - return res.json() - - -def delete_chunks(auth, dataset_id, document_id, payload=None): - url = f"{HOST_ADDRESS}{CHUNK_API_URL}".format(dataset_id=dataset_id, document_id=document_id) - res = requests.delete(url=url, headers=HEADERS, auth=auth, json=payload) - return res.json() - - -def retrieval_chunks(auth, payload=None): - url = f"{HOST_ADDRESS}/api/v1/retrieval" - res = requests.post(url=url, headers=HEADERS, auth=auth, json=payload) - return res.json() - - -def batch_add_chunks(auth, dataset_id, document_id, num): - chunk_ids = [] - for i in range(num): - res = add_chunk(auth, dataset_id, document_id, {"content": f"chunk test {i}"}) - chunk_ids.append(res["data"]["chunk"]["id"]) - return chunk_ids - - -# CHAT ASSISTANT MANAGEMENT -def create_chat_assistant(auth, payload=None): - url = f"{HOST_ADDRESS}{CHAT_ASSISTANT_API_URL}" - res = requests.post(url=url, headers=HEADERS, auth=auth, json=payload) - return res.json() - - -def list_chat_assistants(auth, params=None): - url = f"{HOST_ADDRESS}{CHAT_ASSISTANT_API_URL}" - res = requests.get(url=url, headers=HEADERS, auth=auth, params=params) - return res.json() - - -def update_chat_assistant(auth, chat_assistant_id, payload=None): - url = f"{HOST_ADDRESS}{CHAT_ASSISTANT_API_URL}/{chat_assistant_id}" - res = requests.put(url=url, headers=HEADERS, auth=auth, json=payload) - return res.json() - - -def delete_chat_assistants(auth, payload=None): - url = f"{HOST_ADDRESS}{CHAT_ASSISTANT_API_URL}" - res = requests.delete(url=url, headers=HEADERS, auth=auth, json=payload) - return res.json() - - -def batch_create_chat_assistants(auth, num): - chat_assistant_ids = [] - for i in range(num): - res = create_chat_assistant(auth, {"name": f"test_chat_assistant_{i}", "dataset_ids": []}) - chat_assistant_ids.append(res["data"]["id"]) - return chat_assistant_ids - - -# SESSION MANAGEMENT -def create_session_with_chat_assistant(auth, chat_assistant_id, payload=None): - url = f"{HOST_ADDRESS}{SESSION_WITH_CHAT_ASSISTANT_API_URL}".format(chat_id=chat_assistant_id) - res = requests.post(url=url, headers=HEADERS, auth=auth, json=payload) - return res.json() - - -def list_session_with_chat_assistants(auth, chat_assistant_id, params=None): - url = f"{HOST_ADDRESS}{SESSION_WITH_CHAT_ASSISTANT_API_URL}".format(chat_id=chat_assistant_id) - res = requests.get(url=url, headers=HEADERS, auth=auth, params=params) - return res.json() - - -def update_session_with_chat_assistant(auth, chat_assistant_id, session_id, payload=None): - url = f"{HOST_ADDRESS}{SESSION_WITH_CHAT_ASSISTANT_API_URL}/{session_id}".format(chat_id=chat_assistant_id) - res = requests.put(url=url, headers=HEADERS, auth=auth, json=payload) - return res.json() - - -def delete_session_with_chat_assistants(auth, chat_assistant_id, payload=None): - url = f"{HOST_ADDRESS}{SESSION_WITH_CHAT_ASSISTANT_API_URL}".format(chat_id=chat_assistant_id) - res = requests.delete(url=url, headers=HEADERS, auth=auth, json=payload) - return res.json() - - -def batch_add_sessions_with_chat_assistant(auth, chat_assistant_id, num): - session_ids = [] - for i in range(num): - res = create_session_with_chat_assistant(auth, chat_assistant_id, {"name": f"session_with_chat_assistant_{i}"}) - session_ids.append(res["data"]["id"]) - return session_ids diff --git a/sdk/python/test/test_http_api/conftest.py b/sdk/python/test/test_http_api/conftest.py deleted file mode 100644 index 0825113b7fc..00000000000 --- a/sdk/python/test/test_http_api/conftest.py +++ /dev/null @@ -1,202 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os - -import pytest -from common import ( - add_chunk, - batch_create_datasets, - bulk_upload_documents, - create_chat_assistant, - delete_chat_assistants, - delete_datasets, - delete_session_with_chat_assistants, - list_documnets, - parse_documnets, -) -from libs.auth import RAGFlowHttpApiAuth -from libs.utils import wait_for -from libs.utils.file_utils import ( - create_docx_file, - create_eml_file, - create_excel_file, - create_html_file, - create_image_file, - create_json_file, - create_md_file, - create_pdf_file, - create_ppt_file, - create_txt_file, -) - -MARKER_EXPRESSIONS = { - "p1": "p1", - "p2": "p1 or p2", - "p3": "p1 or p2 or p3", -} -HOST_ADDRESS = os.getenv("HOST_ADDRESS", "http://127.0.0.1:9380") - - -def pytest_addoption(parser: pytest.Parser) -> None: - parser.addoption( - "--level", - action="store", - default="p2", - choices=list(MARKER_EXPRESSIONS.keys()), - help=f"Test level ({'/'.join(MARKER_EXPRESSIONS)}): p1=smoke, p2=core, p3=full", - ) - - -def pytest_configure(config: pytest.Config) -> None: - level = config.getoption("--level") - config.option.markexpr = MARKER_EXPRESSIONS[level] - if config.option.verbose > 0: - print(f"\n[CONFIG] Active test level: {level}") - - -@wait_for(30, 1, "Document parsing timeout") -def condition(_auth, _dataset_id): - res = list_documnets(_auth, _dataset_id) - for doc in res["data"]["docs"]: - if doc["run"] != "DONE": - return False - return True - - -@pytest.fixture(scope="session") -def get_http_api_auth(get_api_key_fixture): - return RAGFlowHttpApiAuth(get_api_key_fixture) - - -@pytest.fixture(scope="function") -def clear_datasets(request, get_http_api_auth): - def cleanup(): - delete_datasets(get_http_api_auth, {"ids": None}) - - request.addfinalizer(cleanup) - - -@pytest.fixture(scope="function") -def clear_chat_assistants(request, get_http_api_auth): - def cleanup(): - delete_chat_assistants(get_http_api_auth) - - request.addfinalizer(cleanup) - - -@pytest.fixture(scope="function") -def clear_session_with_chat_assistants(request, get_http_api_auth, add_chat_assistants): - _, _, chat_assistant_ids = add_chat_assistants - - def cleanup(): - for chat_assistant_id in chat_assistant_ids: - delete_session_with_chat_assistants(get_http_api_auth, chat_assistant_id) - - request.addfinalizer(cleanup) - - -@pytest.fixture -def generate_test_files(request, tmp_path): - file_creators = { - "docx": (tmp_path / "ragflow_test.docx", create_docx_file), - "excel": (tmp_path / "ragflow_test.xlsx", create_excel_file), - "ppt": (tmp_path / "ragflow_test.pptx", create_ppt_file), - "image": (tmp_path / "ragflow_test.png", create_image_file), - "pdf": (tmp_path / "ragflow_test.pdf", create_pdf_file), - "txt": (tmp_path / "ragflow_test.txt", create_txt_file), - "md": (tmp_path / "ragflow_test.md", create_md_file), - "json": (tmp_path / "ragflow_test.json", create_json_file), - "eml": (tmp_path / "ragflow_test.eml", create_eml_file), - "html": (tmp_path / "ragflow_test.html", create_html_file), - } - - files = {} - for file_type, (file_path, creator_func) in file_creators.items(): - if request.param in ["", file_type]: - creator_func(file_path) - files[file_type] = file_path - return files - - -@pytest.fixture(scope="class") -def ragflow_tmp_dir(request, tmp_path_factory): - class_name = request.cls.__name__ - return tmp_path_factory.mktemp(class_name) - - -@pytest.fixture(scope="class") -def add_dataset(request, get_http_api_auth): - def cleanup(): - delete_datasets(get_http_api_auth, {"ids": None}) - - request.addfinalizer(cleanup) - - dataset_ids = batch_create_datasets(get_http_api_auth, 1) - return dataset_ids[0] - - -@pytest.fixture(scope="function") -def add_dataset_func(request, get_http_api_auth): - def cleanup(): - delete_datasets(get_http_api_auth, {"ids": None}) - - request.addfinalizer(cleanup) - - return batch_create_datasets(get_http_api_auth, 1)[0] - - -@pytest.fixture(scope="class") -def add_document(get_http_api_auth, add_dataset, ragflow_tmp_dir): - dataset_id = add_dataset - document_ids = bulk_upload_documents(get_http_api_auth, dataset_id, 1, ragflow_tmp_dir) - return dataset_id, document_ids[0] - - -@pytest.fixture(scope="class") -def add_chunks(get_http_api_auth, add_document): - dataset_id, document_id = add_document - parse_documnets(get_http_api_auth, dataset_id, {"document_ids": [document_id]}) - condition(get_http_api_auth, dataset_id) - - chunk_ids = [] - for i in range(4): - res = add_chunk(get_http_api_auth, dataset_id, document_id, {"content": f"chunk test {i}"}) - chunk_ids.append(res["data"]["chunk"]["id"]) - - # issues/6487 - from time import sleep - - sleep(1) - return dataset_id, document_id, chunk_ids - - -@pytest.fixture(scope="class") -def add_chat_assistants(request, get_http_api_auth, add_document): - def cleanup(): - delete_chat_assistants(get_http_api_auth) - - request.addfinalizer(cleanup) - - dataset_id, document_id = add_document - parse_documnets(get_http_api_auth, dataset_id, {"document_ids": [document_id]}) - condition(get_http_api_auth, dataset_id) - - chat_assistant_ids = [] - for i in range(5): - res = create_chat_assistant(get_http_api_auth, {"name": f"test_chat_assistant_{i}", "dataset_ids": [dataset_id]}) - chat_assistant_ids.append(res["data"]["id"]) - - return dataset_id, document_id, chat_assistant_ids diff --git a/sdk/python/test/test_http_api/test_chat_assistant_management/conftest.py b/sdk/python/test/test_http_api/test_chat_assistant_management/conftest.py deleted file mode 100644 index 9265b3aef72..00000000000 --- a/sdk/python/test/test_http_api/test_chat_assistant_management/conftest.py +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import pytest -from common import create_chat_assistant, delete_chat_assistants, list_documnets, parse_documnets -from libs.utils import wait_for - - -@wait_for(30, 1, "Document parsing timeout") -def condition(_auth, _dataset_id): - res = list_documnets(_auth, _dataset_id) - for doc in res["data"]["docs"]: - if doc["run"] != "DONE": - return False - return True - - -@pytest.fixture(scope="function") -def add_chat_assistants_func(request, get_http_api_auth, add_document): - def cleanup(): - delete_chat_assistants(get_http_api_auth) - - request.addfinalizer(cleanup) - - dataset_id, document_id = add_document - parse_documnets(get_http_api_auth, dataset_id, {"document_ids": [document_id]}) - condition(get_http_api_auth, dataset_id) - - chat_assistant_ids = [] - for i in range(5): - res = create_chat_assistant(get_http_api_auth, {"name": f"test_chat_assistant_{i}", "dataset_ids": [dataset_id]}) - chat_assistant_ids.append(res["data"]["id"]) - - return dataset_id, document_id, chat_assistant_ids diff --git a/sdk/python/test/test_http_api/test_chat_assistant_management/test_create_chat_assistant.py b/sdk/python/test/test_http_api/test_chat_assistant_management/test_create_chat_assistant.py deleted file mode 100644 index 74133974469..00000000000 --- a/sdk/python/test/test_http_api/test_chat_assistant_management/test_create_chat_assistant.py +++ /dev/null @@ -1,241 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import pytest -from common import CHAT_ASSISTANT_NAME_LIMIT, INVALID_API_TOKEN, create_chat_assistant -from libs.auth import RAGFlowHttpApiAuth -from libs.utils import encode_avatar -from libs.utils.file_utils import create_image_file - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = create_chat_assistant(auth) - assert res["code"] == expected_code - assert res["message"] == expected_message - - -@pytest.mark.usefixtures("clear_chat_assistants") -class TestChatAssistantCreate: - @pytest.mark.p1 - @pytest.mark.parametrize( - "payload, expected_code, expected_message", - [ - ({"name": "valid_name"}, 0, ""), - pytest.param({"name": "a" * (CHAT_ASSISTANT_NAME_LIMIT + 1)}, 102, "", marks=pytest.mark.skip(reason="issues/")), - pytest.param({"name": 1}, 100, "", marks=pytest.mark.skip(reason="issues/")), - ({"name": ""}, 102, "`name` is required."), - ({"name": "duplicated_name"}, 102, "Duplicated chat name in creating chat."), - ({"name": "case insensitive"}, 102, "Duplicated chat name in creating chat."), - ], - ) - def test_name(self, get_http_api_auth, add_chunks, payload, expected_code, expected_message): - payload["dataset_ids"] = [] # issues/ - if payload["name"] == "duplicated_name": - create_chat_assistant(get_http_api_auth, payload) - elif payload["name"] == "case insensitive": - create_chat_assistant(get_http_api_auth, {"name": payload["name"].upper()}) - - res = create_chat_assistant(get_http_api_auth, payload) - assert res["code"] == expected_code, res - if expected_code == 0: - assert res["data"]["name"] == payload["name"] - else: - assert res["message"] == expected_message - - @pytest.mark.p1 - @pytest.mark.parametrize( - "dataset_ids, expected_code, expected_message", - [ - ([], 0, ""), - (lambda r: [r], 0, ""), - (["invalid_dataset_id"], 102, "You don't own the dataset invalid_dataset_id"), - ("invalid_dataset_id", 102, "You don't own the dataset i"), - ], - ) - def test_dataset_ids(self, get_http_api_auth, add_chunks, dataset_ids, expected_code, expected_message): - dataset_id, _, _ = add_chunks - payload = {"name": "ragflow test"} - if callable(dataset_ids): - payload["dataset_ids"] = dataset_ids(dataset_id) - else: - payload["dataset_ids"] = dataset_ids - - res = create_chat_assistant(get_http_api_auth, payload) - assert res["code"] == expected_code, res - if expected_code == 0: - assert res["data"]["name"] == payload["name"] - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - def test_avatar(self, get_http_api_auth, tmp_path): - fn = create_image_file(tmp_path / "ragflow_test.png") - payload = {"name": "avatar_test", "avatar": encode_avatar(fn), "dataset_ids": []} - res = create_chat_assistant(get_http_api_auth, payload) - assert res["code"] == 0 - - @pytest.mark.p2 - @pytest.mark.parametrize( - "llm, expected_code, expected_message", - [ - ({}, 0, ""), - ({"model_name": "glm-4"}, 0, ""), - ({"model_name": "unknown"}, 102, "`model_name` unknown doesn't exist"), - ({"temperature": 0}, 0, ""), - ({"temperature": 1}, 0, ""), - pytest.param({"temperature": -1}, 0, "", marks=pytest.mark.skip), - pytest.param({"temperature": 10}, 0, "", marks=pytest.mark.skip), - pytest.param({"temperature": "a"}, 0, "", marks=pytest.mark.skip), - ({"top_p": 0}, 0, ""), - ({"top_p": 1}, 0, ""), - pytest.param({"top_p": -1}, 0, "", marks=pytest.mark.skip), - pytest.param({"top_p": 10}, 0, "", marks=pytest.mark.skip), - pytest.param({"top_p": "a"}, 0, "", marks=pytest.mark.skip), - ({"presence_penalty": 0}, 0, ""), - ({"presence_penalty": 1}, 0, ""), - pytest.param({"presence_penalty": -1}, 0, "", marks=pytest.mark.skip), - pytest.param({"presence_penalty": 10}, 0, "", marks=pytest.mark.skip), - pytest.param({"presence_penalty": "a"}, 0, "", marks=pytest.mark.skip), - ({"frequency_penalty": 0}, 0, ""), - ({"frequency_penalty": 1}, 0, ""), - pytest.param({"frequency_penalty": -1}, 0, "", marks=pytest.mark.skip), - pytest.param({"frequency_penalty": 10}, 0, "", marks=pytest.mark.skip), - pytest.param({"frequency_penalty": "a"}, 0, "", marks=pytest.mark.skip), - ({"max_token": 0}, 0, ""), - ({"max_token": 1024}, 0, ""), - pytest.param({"max_token": -1}, 0, "", marks=pytest.mark.skip), - pytest.param({"max_token": 10}, 0, "", marks=pytest.mark.skip), - pytest.param({"max_token": "a"}, 0, "", marks=pytest.mark.skip), - pytest.param({"unknown": "unknown"}, 0, "", marks=pytest.mark.skip), - ], - ) - def test_llm(self, get_http_api_auth, add_chunks, llm, expected_code, expected_message): - dataset_id, _, _ = add_chunks - payload = {"name": "llm_test", "dataset_ids": [dataset_id], "llm": llm} - res = create_chat_assistant(get_http_api_auth, payload) - assert res["code"] == expected_code - if expected_code == 0: - if llm: - for k, v in llm.items(): - assert res["data"]["llm"][k] == v - else: - assert res["data"]["llm"]["model_name"] == "glm-4-flash@ZHIPU-AI" - assert res["data"]["llm"]["temperature"] == 0.1 - assert res["data"]["llm"]["top_p"] == 0.3 - assert res["data"]["llm"]["presence_penalty"] == 0.4 - assert res["data"]["llm"]["frequency_penalty"] == 0.7 - assert res["data"]["llm"]["max_tokens"] == 512 - else: - assert res["message"] == expected_message - - @pytest.mark.p2 - @pytest.mark.parametrize( - "prompt, expected_code, expected_message", - [ - ({}, 0, ""), - ({"similarity_threshold": 0}, 0, ""), - ({"similarity_threshold": 1}, 0, ""), - pytest.param({"similarity_threshold": -1}, 0, "", marks=pytest.mark.skip), - pytest.param({"similarity_threshold": 10}, 0, "", marks=pytest.mark.skip), - pytest.param({"similarity_threshold": "a"}, 0, "", marks=pytest.mark.skip), - ({"keywords_similarity_weight": 0}, 0, ""), - ({"keywords_similarity_weight": 1}, 0, ""), - pytest.param({"keywords_similarity_weight": -1}, 0, "", marks=pytest.mark.skip), - pytest.param({"keywords_similarity_weight": 10}, 0, "", marks=pytest.mark.skip), - pytest.param({"keywords_similarity_weight": "a"}, 0, "", marks=pytest.mark.skip), - ({"variables": []}, 0, ""), - ({"top_n": 0}, 0, ""), - ({"top_n": 1}, 0, ""), - pytest.param({"top_n": -1}, 0, "", marks=pytest.mark.skip), - pytest.param({"top_n": 10}, 0, "", marks=pytest.mark.skip), - pytest.param({"top_n": "a"}, 0, "", marks=pytest.mark.skip), - ({"empty_response": "Hello World"}, 0, ""), - ({"empty_response": ""}, 0, ""), - ({"empty_response": "!@#$%^&*()"}, 0, ""), - ({"empty_response": "中文测试"}, 0, ""), - pytest.param({"empty_response": 123}, 0, "", marks=pytest.mark.skip), - pytest.param({"empty_response": True}, 0, "", marks=pytest.mark.skip), - pytest.param({"empty_response": " "}, 0, "", marks=pytest.mark.skip), - ({"opener": "Hello World"}, 0, ""), - ({"opener": ""}, 0, ""), - ({"opener": "!@#$%^&*()"}, 0, ""), - ({"opener": "中文测试"}, 0, ""), - pytest.param({"opener": 123}, 0, "", marks=pytest.mark.skip), - pytest.param({"opener": True}, 0, "", marks=pytest.mark.skip), - pytest.param({"opener": " "}, 0, "", marks=pytest.mark.skip), - ({"show_quote": True}, 0, ""), - ({"show_quote": False}, 0, ""), - ({"prompt": "Hello World {knowledge}"}, 0, ""), - ({"prompt": "{knowledge}"}, 0, ""), - ({"prompt": "!@#$%^&*() {knowledge}"}, 0, ""), - ({"prompt": "中文测试 {knowledge}"}, 0, ""), - ({"prompt": "Hello World"}, 102, "Parameter 'knowledge' is not used"), - ({"prompt": "Hello World", "variables": []}, 0, ""), - pytest.param({"prompt": 123}, 100, """AttributeError("\'int\' object has no attribute \'find\'")""", marks=pytest.mark.skip), - pytest.param({"prompt": True}, 100, """AttributeError("\'int\' object has no attribute \'find\'")""", marks=pytest.mark.skip), - pytest.param({"unknown": "unknown"}, 0, "", marks=pytest.mark.skip), - ], - ) - def test_prompt(self, get_http_api_auth, add_chunks, prompt, expected_code, expected_message): - dataset_id, _, _ = add_chunks - payload = {"name": "prompt_test", "dataset_ids": [dataset_id], "prompt": prompt} - res = create_chat_assistant(get_http_api_auth, payload) - assert res["code"] == expected_code - if expected_code == 0: - if prompt: - for k, v in prompt.items(): - if k == "keywords_similarity_weight": - assert res["data"]["prompt"][k] == 1 - v - else: - assert res["data"]["prompt"][k] == v - else: - assert res["data"]["prompt"]["similarity_threshold"] == 0.2 - assert res["data"]["prompt"]["keywords_similarity_weight"] == 0.7 - assert res["data"]["prompt"]["top_n"] == 6 - assert res["data"]["prompt"]["variables"] == [{"key": "knowledge", "optional": False}] - assert res["data"]["prompt"]["rerank_model"] == "" - assert res["data"]["prompt"]["empty_response"] == "Sorry! No relevant content was found in the knowledge base!" - assert res["data"]["prompt"]["opener"] == "Hi! I'm your assistant. What can I do for you?" - assert res["data"]["prompt"]["show_quote"] is True - assert ( - res["data"]["prompt"]["prompt"] - == 'You are an intelligent assistant. Please summarize the content of the dataset to answer the question. Please list the data in the dataset and answer in detail. When all dataset content is irrelevant to the question, your answer must include the sentence "The answer you are looking for is not found in the dataset!" Answers need to consider chat history.\n Here is the knowledge base:\n {knowledge}\n The above is the knowledge base.' - ) - else: - assert res["message"] == expected_message - - -class TestChatAssistantCreate2: - @pytest.mark.p2 - def test_unparsed_document(self, get_http_api_auth, add_document): - dataset_id, _ = add_document - payload = {"name": "prompt_test", "dataset_ids": [dataset_id]} - res = create_chat_assistant(get_http_api_auth, payload) - assert res["code"] == 102 - assert "doesn't own parsed file" in res["message"] diff --git a/sdk/python/test/test_http_api/test_chat_assistant_management/test_delete_chat_assistants.py b/sdk/python/test/test_http_api/test_chat_assistant_management/test_delete_chat_assistants.py deleted file mode 100644 index c76ef58009e..00000000000 --- a/sdk/python/test/test_http_api/test_chat_assistant_management/test_delete_chat_assistants.py +++ /dev/null @@ -1,124 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from concurrent.futures import ThreadPoolExecutor - -import pytest -from common import INVALID_API_TOKEN, batch_create_chat_assistants, delete_chat_assistants, list_chat_assistants -from libs.auth import RAGFlowHttpApiAuth - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = delete_chat_assistants(auth) - assert res["code"] == expected_code - assert res["message"] == expected_message - - -class TestChatAssistantsDelete: - @pytest.mark.parametrize( - "payload, expected_code, expected_message, remaining", - [ - pytest.param(None, 0, "", 0, marks=pytest.mark.p3), - pytest.param({"ids": []}, 0, "", 0, marks=pytest.mark.p3), - pytest.param({"ids": ["invalid_id"]}, 102, "Assistant(invalid_id) not found.", 5, marks=pytest.mark.p3), - pytest.param({"ids": ["\n!?。;!?\"'"]}, 102, """Assistant(\n!?。;!?"\') not found.""", 5, marks=pytest.mark.p3), - pytest.param("not json", 100, "AttributeError(\"'str' object has no attribute 'get'\")", 5, marks=pytest.mark.p3), - pytest.param(lambda r: {"ids": r[:1]}, 0, "", 4, marks=pytest.mark.p3), - pytest.param(lambda r: {"ids": r}, 0, "", 0, marks=pytest.mark.p1), - ], - ) - def test_basic_scenarios(self, get_http_api_auth, add_chat_assistants_func, payload, expected_code, expected_message, remaining): - _, _, chat_assistant_ids = add_chat_assistants_func - if callable(payload): - payload = payload(chat_assistant_ids) - res = delete_chat_assistants(get_http_api_auth, payload) - assert res["code"] == expected_code - if res["code"] != 0: - assert res["message"] == expected_message - - res = list_chat_assistants(get_http_api_auth) - assert len(res["data"]) == remaining - - @pytest.mark.parametrize( - "payload", - [ - pytest.param(lambda r: {"ids": ["invalid_id"] + r}, marks=pytest.mark.p3), - pytest.param(lambda r: {"ids": r[:1] + ["invalid_id"] + r[1:5]}, marks=pytest.mark.p1), - pytest.param(lambda r: {"ids": r + ["invalid_id"]}, marks=pytest.mark.p3), - ], - ) - def test_delete_partial_invalid_id(self, get_http_api_auth, add_chat_assistants_func, payload): - _, _, chat_assistant_ids = add_chat_assistants_func - if callable(payload): - payload = payload(chat_assistant_ids) - res = delete_chat_assistants(get_http_api_auth, payload) - assert res["code"] == 0 - assert res["data"]["errors"][0] == "Assistant(invalid_id) not found." - assert res["data"]["success_count"] == 5 - - res = list_chat_assistants(get_http_api_auth) - assert len(res["data"]) == 0 - - @pytest.mark.p3 - def test_repeated_deletion(self, get_http_api_auth, add_chat_assistants_func): - _, _, chat_assistant_ids = add_chat_assistants_func - res = delete_chat_assistants(get_http_api_auth, {"ids": chat_assistant_ids}) - assert res["code"] == 0 - - res = delete_chat_assistants(get_http_api_auth, {"ids": chat_assistant_ids}) - assert res["code"] == 102 - assert "not found" in res["message"] - - @pytest.mark.p3 - def test_duplicate_deletion(self, get_http_api_auth, add_chat_assistants_func): - _, _, chat_assistant_ids = add_chat_assistants_func - res = delete_chat_assistants(get_http_api_auth, {"ids": chat_assistant_ids + chat_assistant_ids}) - assert res["code"] == 0 - assert "Duplicate assistant ids" in res["data"]["errors"][0] - assert res["data"]["success_count"] == 5 - - res = list_chat_assistants(get_http_api_auth) - assert res["code"] == 0 - - @pytest.mark.p3 - def test_concurrent_deletion(self, get_http_api_auth): - ids = batch_create_chat_assistants(get_http_api_auth, 100) - - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [executor.submit(delete_chat_assistants, get_http_api_auth, {"ids": ids[i : i + 1]}) for i in range(100)] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses) - - @pytest.mark.p3 - def test_delete_10k(self, get_http_api_auth): - ids = batch_create_chat_assistants(get_http_api_auth, 10_000) - res = delete_chat_assistants(get_http_api_auth, {"ids": ids}) - assert res["code"] == 0 - - res = list_chat_assistants(get_http_api_auth) - assert len(res["data"]) == 0 diff --git a/sdk/python/test/test_http_api/test_chat_assistant_management/test_list_chat_assistants.py b/sdk/python/test/test_http_api/test_chat_assistant_management/test_list_chat_assistants.py deleted file mode 100644 index e222fea7817..00000000000 --- a/sdk/python/test/test_http_api/test_chat_assistant_management/test_list_chat_assistants.py +++ /dev/null @@ -1,311 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from concurrent.futures import ThreadPoolExecutor - -import pytest -from common import INVALID_API_TOKEN, delete_datasets, list_chat_assistants -from libs.auth import RAGFlowHttpApiAuth -from libs.utils import is_sorted - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = list_chat_assistants(auth) - assert res["code"] == expected_code - assert res["message"] == expected_message - - -@pytest.mark.usefixtures("add_chat_assistants") -class TestChatAssistantsList: - @pytest.mark.p1 - def test_default(self, get_http_api_auth): - res = list_chat_assistants(get_http_api_auth) - assert res["code"] == 0 - assert len(res["data"]) == 5 - - @pytest.mark.p1 - @pytest.mark.parametrize( - "params, expected_code, expected_page_size, expected_message", - [ - ({"page": None, "page_size": 2}, 0, 2, ""), - ({"page": 0, "page_size": 2}, 0, 2, ""), - ({"page": 2, "page_size": 2}, 0, 2, ""), - ({"page": 3, "page_size": 2}, 0, 1, ""), - ({"page": "3", "page_size": 2}, 0, 1, ""), - pytest.param( - {"page": -1, "page_size": 2}, - 100, - 0, - "1064", - marks=pytest.mark.skip(reason="issues/5851"), - ), - pytest.param( - {"page": "a", "page_size": 2}, - 100, - 0, - """ValueError("invalid literal for int() with base 10: \'a\'")""", - marks=pytest.mark.skip(reason="issues/5851"), - ), - ], - ) - def test_page(self, get_http_api_auth, params, expected_code, expected_page_size, expected_message): - res = list_chat_assistants(get_http_api_auth, params=params) - assert res["code"] == expected_code - if expected_code == 0: - assert len(res["data"]) == expected_page_size - else: - assert res["message"] == expected_message - - @pytest.mark.p1 - @pytest.mark.parametrize( - "params, expected_code, expected_page_size, expected_message", - [ - ({"page_size": None}, 0, 5, ""), - ({"page_size": 0}, 0, 0, ""), - ({"page_size": 1}, 0, 1, ""), - ({"page_size": 6}, 0, 5, ""), - ({"page_size": "1"}, 0, 1, ""), - pytest.param( - {"page_size": -1}, - 100, - 0, - "1064", - marks=pytest.mark.skip(reason="issues/5851"), - ), - pytest.param( - {"page_size": "a"}, - 100, - 0, - """ValueError("invalid literal for int() with base 10: \'a\'")""", - marks=pytest.mark.skip(reason="issues/5851"), - ), - ], - ) - def test_page_size( - self, - get_http_api_auth, - params, - expected_code, - expected_page_size, - expected_message, - ): - res = list_chat_assistants(get_http_api_auth, params=params) - assert res["code"] == expected_code - if expected_code == 0: - assert len(res["data"]) == expected_page_size - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "params, expected_code, assertions, expected_message", - [ - ({"orderby": None}, 0, lambda r: (is_sorted(r["data"], "create_time", True)), ""), - ({"orderby": "create_time"}, 0, lambda r: (is_sorted(r["data"], "create_time", True)), ""), - ({"orderby": "update_time"}, 0, lambda r: (is_sorted(r["data"], "update_time", True)), ""), - pytest.param( - {"orderby": "name", "desc": "False"}, - 0, - lambda r: (is_sorted(r["data"], "name", False)), - "", - marks=pytest.mark.skip(reason="issues/5851"), - ), - pytest.param( - {"orderby": "unknown"}, - 102, - 0, - "orderby should be create_time or update_time", - marks=pytest.mark.skip(reason="issues/5851"), - ), - ], - ) - def test_orderby( - self, - get_http_api_auth, - params, - expected_code, - assertions, - expected_message, - ): - res = list_chat_assistants(get_http_api_auth, params=params) - assert res["code"] == expected_code - if expected_code == 0: - if callable(assertions): - assert assertions(res) - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "params, expected_code, assertions, expected_message", - [ - ({"desc": None}, 0, lambda r: (is_sorted(r["data"], "create_time", True)), ""), - ({"desc": "true"}, 0, lambda r: (is_sorted(r["data"], "create_time", True)), ""), - ({"desc": "True"}, 0, lambda r: (is_sorted(r["data"], "create_time", True)), ""), - ({"desc": True}, 0, lambda r: (is_sorted(r["data"], "create_time", True)), ""), - ({"desc": "false"}, 0, lambda r: (is_sorted(r["data"], "create_time", False)), ""), - ({"desc": "False"}, 0, lambda r: (is_sorted(r["data"], "create_time", False)), ""), - ({"desc": False}, 0, lambda r: (is_sorted(r["data"], "create_time", False)), ""), - ({"desc": "False", "orderby": "update_time"}, 0, lambda r: (is_sorted(r["data"], "update_time", False)), ""), - pytest.param( - {"desc": "unknown"}, - 102, - 0, - "desc should be true or false", - marks=pytest.mark.skip(reason="issues/5851"), - ), - ], - ) - def test_desc( - self, - get_http_api_auth, - params, - expected_code, - assertions, - expected_message, - ): - res = list_chat_assistants(get_http_api_auth, params=params) - assert res["code"] == expected_code - if expected_code == 0: - if callable(assertions): - assert assertions(res) - else: - assert res["message"] == expected_message - - @pytest.mark.p1 - @pytest.mark.parametrize( - "params, expected_code, expected_num, expected_message", - [ - ({"name": None}, 0, 5, ""), - ({"name": ""}, 0, 5, ""), - ({"name": "test_chat_assistant_1"}, 0, 1, ""), - ({"name": "unknown"}, 102, 0, "The chat doesn't exist"), - ], - ) - def test_name(self, get_http_api_auth, params, expected_code, expected_num, expected_message): - res = list_chat_assistants(get_http_api_auth, params=params) - assert res["code"] == expected_code - if expected_code == 0: - if params["name"] in [None, ""]: - assert len(res["data"]) == expected_num - else: - assert res["data"][0]["name"] == params["name"] - else: - assert res["message"] == expected_message - - @pytest.mark.p1 - @pytest.mark.parametrize( - "chat_assistant_id, expected_code, expected_num, expected_message", - [ - (None, 0, 5, ""), - ("", 0, 5, ""), - (lambda r: r[0], 0, 1, ""), - ("unknown", 102, 0, "The chat doesn't exist"), - ], - ) - def test_id( - self, - get_http_api_auth, - add_chat_assistants, - chat_assistant_id, - expected_code, - expected_num, - expected_message, - ): - _, _, chat_assistant_ids = add_chat_assistants - if callable(chat_assistant_id): - params = {"id": chat_assistant_id(chat_assistant_ids)} - else: - params = {"id": chat_assistant_id} - - res = list_chat_assistants(get_http_api_auth, params=params) - assert res["code"] == expected_code - if expected_code == 0: - if params["id"] in [None, ""]: - assert len(res["data"]) == expected_num - else: - assert res["data"][0]["id"] == params["id"] - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "chat_assistant_id, name, expected_code, expected_num, expected_message", - [ - (lambda r: r[0], "test_chat_assistant_0", 0, 1, ""), - (lambda r: r[0], "test_chat_assistant_1", 102, 0, "The chat doesn't exist"), - (lambda r: r[0], "unknown", 102, 0, "The chat doesn't exist"), - ("id", "chat_assistant_0", 102, 0, "The chat doesn't exist"), - ], - ) - def test_name_and_id( - self, - get_http_api_auth, - add_chat_assistants, - chat_assistant_id, - name, - expected_code, - expected_num, - expected_message, - ): - _, _, chat_assistant_ids = add_chat_assistants - if callable(chat_assistant_id): - params = {"id": chat_assistant_id(chat_assistant_ids), "name": name} - else: - params = {"id": chat_assistant_id, "name": name} - - res = list_chat_assistants(get_http_api_auth, params=params) - assert res["code"] == expected_code - if expected_code == 0: - assert len(res["data"]) == expected_num - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - def test_concurrent_list(self, get_http_api_auth): - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [executor.submit(list_chat_assistants, get_http_api_auth) for i in range(100)] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses) - - @pytest.mark.p3 - def test_invalid_params(self, get_http_api_auth): - params = {"a": "b"} - res = list_chat_assistants(get_http_api_auth, params=params) - assert res["code"] == 0 - assert len(res["data"]) == 5 - - @pytest.mark.p2 - def test_list_chats_after_deleting_associated_dataset(self, get_http_api_auth, add_chat_assistants): - dataset_id, _, _ = add_chat_assistants - res = delete_datasets(get_http_api_auth, {"ids": [dataset_id]}) - assert res["code"] == 0 - - res = list_chat_assistants(get_http_api_auth) - assert res["code"] == 0 - assert len(res["data"]) == 5 diff --git a/sdk/python/test/test_http_api/test_chat_assistant_management/test_update_chat_assistant.py b/sdk/python/test/test_http_api/test_chat_assistant_management/test_update_chat_assistant.py deleted file mode 100644 index 8da98650354..00000000000 --- a/sdk/python/test/test_http_api/test_chat_assistant_management/test_update_chat_assistant.py +++ /dev/null @@ -1,228 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import pytest -from common import CHAT_ASSISTANT_NAME_LIMIT, INVALID_API_TOKEN, list_chat_assistants, update_chat_assistant -from libs.auth import RAGFlowHttpApiAuth -from libs.utils import encode_avatar -from libs.utils.file_utils import create_image_file - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = update_chat_assistant(auth, "chat_assistant_id") - assert res["code"] == expected_code - assert res["message"] == expected_message - - -class TestChatAssistantUpdate: - @pytest.mark.parametrize( - "payload, expected_code, expected_message", - [ - pytest.param({"name": "valid_name"}, 0, "", marks=pytest.mark.p1), - pytest.param({"name": "a" * (CHAT_ASSISTANT_NAME_LIMIT + 1)}, 102, "", marks=pytest.mark.skip(reason="issues/")), - pytest.param({"name": 1}, 100, "", marks=pytest.mark.skip(reason="issues/")), - pytest.param({"name": ""}, 102, "`name` cannot be empty.", marks=pytest.mark.p3), - pytest.param({"name": "test_chat_assistant_1"}, 102, "Duplicated chat name in updating chat.", marks=pytest.mark.p3), - pytest.param({"name": "TEST_CHAT_ASSISTANT_1"}, 102, "Duplicated chat name in updating chat.", marks=pytest.mark.p3), - ], - ) - def test_name(self, get_http_api_auth, add_chat_assistants_func, payload, expected_code, expected_message): - _, _, chat_assistant_ids = add_chat_assistants_func - - res = update_chat_assistant(get_http_api_auth, chat_assistant_ids[0], payload) - assert res["code"] == expected_code, res - if expected_code == 0: - res = list_chat_assistants(get_http_api_auth, {"id": chat_assistant_ids[0]}) - assert res["data"][0]["name"] == payload.get("name") - else: - assert res["message"] == expected_message - - @pytest.mark.parametrize( - "dataset_ids, expected_code, expected_message", - [ - pytest.param([], 0, "", marks=pytest.mark.skip(reason="issues/")), - pytest.param(lambda r: [r], 0, "", marks=pytest.mark.p1), - pytest.param(["invalid_dataset_id"], 102, "You don't own the dataset invalid_dataset_id", marks=pytest.mark.p3), - pytest.param("invalid_dataset_id", 102, "You don't own the dataset i", marks=pytest.mark.p3), - ], - ) - def test_dataset_ids(self, get_http_api_auth, add_chat_assistants_func, dataset_ids, expected_code, expected_message): - dataset_id, _, chat_assistant_ids = add_chat_assistants_func - payload = {"name": "ragflow test"} - if callable(dataset_ids): - payload["dataset_ids"] = dataset_ids(dataset_id) - else: - payload["dataset_ids"] = dataset_ids - - res = update_chat_assistant(get_http_api_auth, chat_assistant_ids[0], payload) - assert res["code"] == expected_code, res - if expected_code == 0: - res = list_chat_assistants(get_http_api_auth, {"id": chat_assistant_ids[0]}) - assert res["data"][0]["name"] == payload.get("name") - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - def test_avatar(self, get_http_api_auth, add_chat_assistants_func, tmp_path): - dataset_id, _, chat_assistant_ids = add_chat_assistants_func - fn = create_image_file(tmp_path / "ragflow_test.png") - payload = {"name": "avatar_test", "avatar": encode_avatar(fn), "dataset_ids": [dataset_id]} - res = update_chat_assistant(get_http_api_auth, chat_assistant_ids[0], payload) - assert res["code"] == 0 - - @pytest.mark.p3 - @pytest.mark.parametrize( - "llm, expected_code, expected_message", - [ - ({}, 100, "ValueError"), - ({"model_name": "glm-4"}, 0, ""), - ({"model_name": "unknown"}, 102, "`model_name` unknown doesn't exist"), - ({"temperature": 0}, 0, ""), - ({"temperature": 1}, 0, ""), - pytest.param({"temperature": -1}, 0, "", marks=pytest.mark.skip), - pytest.param({"temperature": 10}, 0, "", marks=pytest.mark.skip), - pytest.param({"temperature": "a"}, 0, "", marks=pytest.mark.skip), - ({"top_p": 0}, 0, ""), - ({"top_p": 1}, 0, ""), - pytest.param({"top_p": -1}, 0, "", marks=pytest.mark.skip), - pytest.param({"top_p": 10}, 0, "", marks=pytest.mark.skip), - pytest.param({"top_p": "a"}, 0, "", marks=pytest.mark.skip), - ({"presence_penalty": 0}, 0, ""), - ({"presence_penalty": 1}, 0, ""), - pytest.param({"presence_penalty": -1}, 0, "", marks=pytest.mark.skip), - pytest.param({"presence_penalty": 10}, 0, "", marks=pytest.mark.skip), - pytest.param({"presence_penalty": "a"}, 0, "", marks=pytest.mark.skip), - ({"frequency_penalty": 0}, 0, ""), - ({"frequency_penalty": 1}, 0, ""), - pytest.param({"frequency_penalty": -1}, 0, "", marks=pytest.mark.skip), - pytest.param({"frequency_penalty": 10}, 0, "", marks=pytest.mark.skip), - pytest.param({"frequency_penalty": "a"}, 0, "", marks=pytest.mark.skip), - ({"max_token": 0}, 0, ""), - ({"max_token": 1024}, 0, ""), - pytest.param({"max_token": -1}, 0, "", marks=pytest.mark.skip), - pytest.param({"max_token": 10}, 0, "", marks=pytest.mark.skip), - pytest.param({"max_token": "a"}, 0, "", marks=pytest.mark.skip), - pytest.param({"unknown": "unknown"}, 0, "", marks=pytest.mark.skip), - ], - ) - def test_llm(self, get_http_api_auth, add_chat_assistants_func, llm, expected_code, expected_message): - dataset_id, _, chat_assistant_ids = add_chat_assistants_func - payload = {"name": "llm_test", "dataset_ids": [dataset_id], "llm": llm} - res = update_chat_assistant(get_http_api_auth, chat_assistant_ids[0], payload) - assert res["code"] == expected_code - if expected_code == 0: - res = list_chat_assistants(get_http_api_auth, {"id": chat_assistant_ids[0]}) - if llm: - for k, v in llm.items(): - assert res["data"][0]["llm"][k] == v - else: - assert res["data"][0]["llm"]["model_name"] == "glm-4-flash@ZHIPU-AI" - assert res["data"][0]["llm"]["temperature"] == 0.1 - assert res["data"][0]["llm"]["top_p"] == 0.3 - assert res["data"][0]["llm"]["presence_penalty"] == 0.4 - assert res["data"][0]["llm"]["frequency_penalty"] == 0.7 - assert res["data"][0]["llm"]["max_tokens"] == 512 - else: - assert expected_message in res["message"] - - @pytest.mark.p3 - @pytest.mark.parametrize( - "prompt, expected_code, expected_message", - [ - ({}, 100, "ValueError"), - ({"similarity_threshold": 0}, 0, ""), - ({"similarity_threshold": 1}, 0, ""), - pytest.param({"similarity_threshold": -1}, 0, "", marks=pytest.mark.skip), - pytest.param({"similarity_threshold": 10}, 0, "", marks=pytest.mark.skip), - pytest.param({"similarity_threshold": "a"}, 0, "", marks=pytest.mark.skip), - ({"keywords_similarity_weight": 0}, 0, ""), - ({"keywords_similarity_weight": 1}, 0, ""), - pytest.param({"keywords_similarity_weight": -1}, 0, "", marks=pytest.mark.skip), - pytest.param({"keywords_similarity_weight": 10}, 0, "", marks=pytest.mark.skip), - pytest.param({"keywords_similarity_weight": "a"}, 0, "", marks=pytest.mark.skip), - ({"variables": []}, 0, ""), - ({"top_n": 0}, 0, ""), - ({"top_n": 1}, 0, ""), - pytest.param({"top_n": -1}, 0, "", marks=pytest.mark.skip), - pytest.param({"top_n": 10}, 0, "", marks=pytest.mark.skip), - pytest.param({"top_n": "a"}, 0, "", marks=pytest.mark.skip), - ({"empty_response": "Hello World"}, 0, ""), - ({"empty_response": ""}, 0, ""), - ({"empty_response": "!@#$%^&*()"}, 0, ""), - ({"empty_response": "中文测试"}, 0, ""), - pytest.param({"empty_response": 123}, 0, "", marks=pytest.mark.skip), - pytest.param({"empty_response": True}, 0, "", marks=pytest.mark.skip), - pytest.param({"empty_response": " "}, 0, "", marks=pytest.mark.skip), - ({"opener": "Hello World"}, 0, ""), - ({"opener": ""}, 0, ""), - ({"opener": "!@#$%^&*()"}, 0, ""), - ({"opener": "中文测试"}, 0, ""), - pytest.param({"opener": 123}, 0, "", marks=pytest.mark.skip), - pytest.param({"opener": True}, 0, "", marks=pytest.mark.skip), - pytest.param({"opener": " "}, 0, "", marks=pytest.mark.skip), - ({"show_quote": True}, 0, ""), - ({"show_quote": False}, 0, ""), - ({"prompt": "Hello World {knowledge}"}, 0, ""), - ({"prompt": "{knowledge}"}, 0, ""), - ({"prompt": "!@#$%^&*() {knowledge}"}, 0, ""), - ({"prompt": "中文测试 {knowledge}"}, 0, ""), - ({"prompt": "Hello World"}, 102, "Parameter 'knowledge' is not used"), - ({"prompt": "Hello World", "variables": []}, 0, ""), - pytest.param({"prompt": 123}, 100, """AttributeError("\'int\' object has no attribute \'find\'")""", marks=pytest.mark.skip), - pytest.param({"prompt": True}, 100, """AttributeError("\'int\' object has no attribute \'find\'")""", marks=pytest.mark.skip), - pytest.param({"unknown": "unknown"}, 0, "", marks=pytest.mark.skip), - ], - ) - def test_prompt(self, get_http_api_auth, add_chat_assistants_func, prompt, expected_code, expected_message): - dataset_id, _, chat_assistant_ids = add_chat_assistants_func - payload = {"name": "prompt_test", "dataset_ids": [dataset_id], "prompt": prompt} - res = update_chat_assistant(get_http_api_auth, chat_assistant_ids[0], payload) - assert res["code"] == expected_code - if expected_code == 0: - res = list_chat_assistants(get_http_api_auth, {"id": chat_assistant_ids[0]}) - if prompt: - for k, v in prompt.items(): - if k == "keywords_similarity_weight": - assert res["data"][0]["prompt"][k] == 1 - v - else: - assert res["data"][0]["prompt"][k] == v - else: - assert res["data"]["prompt"][0]["similarity_threshold"] == 0.2 - assert res["data"]["prompt"][0]["keywords_similarity_weight"] == 0.7 - assert res["data"]["prompt"][0]["top_n"] == 6 - assert res["data"]["prompt"][0]["variables"] == [{"key": "knowledge", "optional": False}] - assert res["data"]["prompt"][0]["rerank_model"] == "" - assert res["data"]["prompt"][0]["empty_response"] == "Sorry! No relevant content was found in the knowledge base!" - assert res["data"]["prompt"][0]["opener"] == "Hi! I'm your assistant. What can I do for you?" - assert res["data"]["prompt"][0]["show_quote"] is True - assert ( - res["data"]["prompt"][0]["prompt"] - == 'You are an intelligent assistant. Please summarize the content of the dataset to answer the question. Please list the data in the dataset and answer in detail. When all dataset content is irrelevant to the question, your answer must include the sentence "The answer you are looking for is not found in the dataset!" Answers need to consider chat history.\n Here is the knowledge base:\n {knowledge}\n The above is the knowledge base.' - ) - else: - assert expected_message in res["message"] diff --git a/sdk/python/test/test_http_api/test_chunk_management_within_dataset/conftest.py b/sdk/python/test/test_http_api/test_chunk_management_within_dataset/conftest.py deleted file mode 100644 index ab1ed262241..00000000000 --- a/sdk/python/test/test_http_api/test_chunk_management_within_dataset/conftest.py +++ /dev/null @@ -1,52 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - - -import pytest -from common import add_chunk, delete_chunks, list_documnets, parse_documnets -from libs.utils import wait_for - - -@wait_for(30, 1, "Document parsing timeout") -def condition(_auth, _dataset_id): - res = list_documnets(_auth, _dataset_id) - for doc in res["data"]["docs"]: - if doc["run"] != "DONE": - return False - return True - - -@pytest.fixture(scope="function") -def add_chunks_func(request, get_http_api_auth, add_document): - dataset_id, document_id = add_document - parse_documnets(get_http_api_auth, dataset_id, {"document_ids": [document_id]}) - condition(get_http_api_auth, dataset_id) - - chunk_ids = [] - for i in range(4): - res = add_chunk(get_http_api_auth, dataset_id, document_id, {"content": f"chunk test {i}"}) - chunk_ids.append(res["data"]["chunk"]["id"]) - - # issues/6487 - from time import sleep - - sleep(1) - - def cleanup(): - delete_chunks(get_http_api_auth, dataset_id, document_id, {"chunk_ids": chunk_ids}) - - request.addfinalizer(cleanup) - return dataset_id, document_id, chunk_ids diff --git a/sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_add_chunk.py b/sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_add_chunk.py deleted file mode 100644 index 7c073f0e88e..00000000000 --- a/sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_add_chunk.py +++ /dev/null @@ -1,250 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from concurrent.futures import ThreadPoolExecutor - -import pytest -from common import INVALID_API_TOKEN, add_chunk, delete_documnets, list_chunks -from libs.auth import RAGFlowHttpApiAuth - - -def validate_chunk_details(dataset_id, document_id, payload, res): - chunk = res["data"]["chunk"] - assert chunk["dataset_id"] == dataset_id - assert chunk["document_id"] == document_id - assert chunk["content"] == payload["content"] - if "important_keywords" in payload: - assert chunk["important_keywords"] == payload["important_keywords"] - if "questions" in payload: - assert chunk["questions"] == [str(q).strip() for q in payload.get("questions", []) if str(q).strip()] - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = add_chunk(auth, "dataset_id", "document_id") - assert res["code"] == expected_code - assert res["message"] == expected_message - - -class TestAddChunk: - @pytest.mark.p1 - @pytest.mark.parametrize( - "payload, expected_code, expected_message", - [ - ({"content": None}, 100, """TypeError("unsupported operand type(s) for +: \'NoneType\' and \'str\'")"""), - ({"content": ""}, 102, "`content` is required"), - pytest.param( - {"content": 1}, - 100, - """TypeError("unsupported operand type(s) for +: \'int\' and \'str\'")""", - marks=pytest.mark.skip, - ), - ({"content": "a"}, 0, ""), - ({"content": " "}, 102, "`content` is required"), - ({"content": "\n!?。;!?\"'"}, 0, ""), - ], - ) - def test_content(self, get_http_api_auth, add_document, payload, expected_code, expected_message): - dataset_id, document_id = add_document - res = list_chunks(get_http_api_auth, dataset_id, document_id) - if res["code"] != 0: - assert False, res - chunks_count = res["data"]["doc"]["chunk_count"] - res = add_chunk(get_http_api_auth, dataset_id, document_id, payload) - assert res["code"] == expected_code - if expected_code == 0: - validate_chunk_details(dataset_id, document_id, payload, res) - res = list_chunks(get_http_api_auth, dataset_id, document_id) - if res["code"] != 0: - assert False, res - assert res["data"]["doc"]["chunk_count"] == chunks_count + 1 - else: - assert res["message"] == expected_message - - @pytest.mark.p2 - @pytest.mark.parametrize( - "payload, expected_code, expected_message", - [ - ({"content": "chunk test", "important_keywords": ["a", "b", "c"]}, 0, ""), - ({"content": "chunk test", "important_keywords": [""]}, 0, ""), - ( - {"content": "chunk test", "important_keywords": [1]}, - 100, - "TypeError('sequence item 0: expected str instance, int found')", - ), - ({"content": "chunk test", "important_keywords": ["a", "a"]}, 0, ""), - ({"content": "chunk test", "important_keywords": "abc"}, 102, "`important_keywords` is required to be a list"), - ({"content": "chunk test", "important_keywords": 123}, 102, "`important_keywords` is required to be a list"), - ], - ) - def test_important_keywords(self, get_http_api_auth, add_document, payload, expected_code, expected_message): - dataset_id, document_id = add_document - res = list_chunks(get_http_api_auth, dataset_id, document_id) - if res["code"] != 0: - assert False, res - chunks_count = res["data"]["doc"]["chunk_count"] - res = add_chunk(get_http_api_auth, dataset_id, document_id, payload) - assert res["code"] == expected_code - if expected_code == 0: - validate_chunk_details(dataset_id, document_id, payload, res) - res = list_chunks(get_http_api_auth, dataset_id, document_id) - if res["code"] != 0: - assert False, res - assert res["data"]["doc"]["chunk_count"] == chunks_count + 1 - else: - assert res["message"] == expected_message - - @pytest.mark.p2 - @pytest.mark.parametrize( - "payload, expected_code, expected_message", - [ - ({"content": "chunk test", "questions": ["a", "b", "c"]}, 0, ""), - ({"content": "chunk test", "questions": [""]}, 0, ""), - ({"content": "chunk test", "questions": [1]}, 100, "TypeError('sequence item 0: expected str instance, int found')"), - ({"content": "chunk test", "questions": ["a", "a"]}, 0, ""), - ({"content": "chunk test", "questions": "abc"}, 102, "`questions` is required to be a list"), - ({"content": "chunk test", "questions": 123}, 102, "`questions` is required to be a list"), - ], - ) - def test_questions(self, get_http_api_auth, add_document, payload, expected_code, expected_message): - dataset_id, document_id = add_document - res = list_chunks(get_http_api_auth, dataset_id, document_id) - if res["code"] != 0: - assert False, res - chunks_count = res["data"]["doc"]["chunk_count"] - res = add_chunk(get_http_api_auth, dataset_id, document_id, payload) - assert res["code"] == expected_code - if expected_code == 0: - validate_chunk_details(dataset_id, document_id, payload, res) - if res["code"] != 0: - assert False, res - res = list_chunks(get_http_api_auth, dataset_id, document_id) - assert res["data"]["doc"]["chunk_count"] == chunks_count + 1 - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "dataset_id, expected_code, expected_message", - [ - ("", 100, ""), - ( - "invalid_dataset_id", - 102, - "You don't own the dataset invalid_dataset_id.", - ), - ], - ) - def test_invalid_dataset_id( - self, - get_http_api_auth, - add_document, - dataset_id, - expected_code, - expected_message, - ): - _, document_id = add_document - res = add_chunk(get_http_api_auth, dataset_id, document_id, {"content": "a"}) - assert res["code"] == expected_code - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "document_id, expected_code, expected_message", - [ - ("", 100, ""), - ( - "invalid_document_id", - 102, - "You don't own the document invalid_document_id.", - ), - ], - ) - def test_invalid_document_id(self, get_http_api_auth, add_document, document_id, expected_code, expected_message): - dataset_id, _ = add_document - res = add_chunk(get_http_api_auth, dataset_id, document_id, {"content": "chunk test"}) - assert res["code"] == expected_code - assert res["message"] == expected_message - - @pytest.mark.p3 - def test_repeated_add_chunk(self, get_http_api_auth, add_document): - payload = {"content": "chunk test"} - dataset_id, document_id = add_document - res = list_chunks(get_http_api_auth, dataset_id, document_id) - if res["code"] != 0: - assert False, res - chunks_count = res["data"]["doc"]["chunk_count"] - res = add_chunk(get_http_api_auth, dataset_id, document_id, payload) - assert res["code"] == 0 - validate_chunk_details(dataset_id, document_id, payload, res) - res = list_chunks(get_http_api_auth, dataset_id, document_id) - if res["code"] != 0: - assert False, res - assert res["data"]["doc"]["chunk_count"] == chunks_count + 1 - - res = add_chunk(get_http_api_auth, dataset_id, document_id, payload) - assert res["code"] == 0 - validate_chunk_details(dataset_id, document_id, payload, res) - res = list_chunks(get_http_api_auth, dataset_id, document_id) - if res["code"] != 0: - assert False, res - assert res["data"]["doc"]["chunk_count"] == chunks_count + 2 - - @pytest.mark.p2 - def test_add_chunk_to_deleted_document(self, get_http_api_auth, add_document): - dataset_id, document_id = add_document - delete_documnets(get_http_api_auth, dataset_id, {"ids": [document_id]}) - res = add_chunk(get_http_api_auth, dataset_id, document_id, {"content": "chunk test"}) - assert res["code"] == 102 - assert res["message"] == f"You don't own the document {document_id}." - - @pytest.mark.skip(reason="issues/6411") - def test_concurrent_add_chunk(self, get_http_api_auth, add_document): - chunk_num = 50 - dataset_id, document_id = add_document - res = list_chunks(get_http_api_auth, dataset_id, document_id) - if res["code"] != 0: - assert False, res - chunks_count = res["data"]["doc"]["chunk_count"] - - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [ - executor.submit( - add_chunk, - get_http_api_auth, - dataset_id, - document_id, - {"content": f"chunk test {i}"}, - ) - for i in range(chunk_num) - ] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses) - res = list_chunks(get_http_api_auth, dataset_id, document_id) - if res["code"] != 0: - assert False, res - assert res["data"]["doc"]["chunk_count"] == chunks_count + chunk_num diff --git a/sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_delete_chunks.py b/sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_delete_chunks.py deleted file mode 100644 index 2288160aaab..00000000000 --- a/sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_delete_chunks.py +++ /dev/null @@ -1,194 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from concurrent.futures import ThreadPoolExecutor - -import pytest -from common import INVALID_API_TOKEN, batch_add_chunks, delete_chunks, list_chunks -from libs.auth import RAGFlowHttpApiAuth - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = delete_chunks(auth, "dataset_id", "document_id") - assert res["code"] == expected_code - assert res["message"] == expected_message - - -class TestChunksDeletion: - @pytest.mark.p3 - @pytest.mark.parametrize( - "dataset_id, expected_code, expected_message", - [ - ("", 100, ""), - ( - "invalid_dataset_id", - 102, - "You don't own the dataset invalid_dataset_id.", - ), - ], - ) - def test_invalid_dataset_id(self, get_http_api_auth, add_chunks_func, dataset_id, expected_code, expected_message): - _, document_id, chunk_ids = add_chunks_func - res = delete_chunks(get_http_api_auth, dataset_id, document_id, {"chunk_ids": chunk_ids}) - assert res["code"] == expected_code - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "document_id, expected_code, expected_message", - [ - ("", 100, ""), - ("invalid_document_id", 100, """LookupError("Can't find the document with ID invalid_document_id!")"""), - ], - ) - def test_invalid_document_id(self, get_http_api_auth, add_chunks_func, document_id, expected_code, expected_message): - dataset_id, _, chunk_ids = add_chunks_func - res = delete_chunks(get_http_api_auth, dataset_id, document_id, {"chunk_ids": chunk_ids}) - assert res["code"] == expected_code - assert res["message"] == expected_message - - @pytest.mark.parametrize( - "payload", - [ - pytest.param(lambda r: {"chunk_ids": ["invalid_id"] + r}, marks=pytest.mark.p3), - pytest.param(lambda r: {"chunk_ids": r[:1] + ["invalid_id"] + r[1:4]}, marks=pytest.mark.p1), - pytest.param(lambda r: {"chunk_ids": r + ["invalid_id"]}, marks=pytest.mark.p3), - ], - ) - def test_delete_partial_invalid_id(self, get_http_api_auth, add_chunks_func, payload): - dataset_id, document_id, chunk_ids = add_chunks_func - if callable(payload): - payload = payload(chunk_ids) - res = delete_chunks(get_http_api_auth, dataset_id, document_id, payload) - assert res["code"] == 102 - assert res["message"] == "rm_chunk deleted chunks 4, expect 5" - - res = list_chunks(get_http_api_auth, dataset_id, document_id) - if res["code"] != 0: - assert False, res - assert len(res["data"]["chunks"]) == 1 - assert res["data"]["total"] == 1 - - @pytest.mark.p3 - def test_repeated_deletion(self, get_http_api_auth, add_chunks_func): - dataset_id, document_id, chunk_ids = add_chunks_func - payload = {"chunk_ids": chunk_ids} - res = delete_chunks(get_http_api_auth, dataset_id, document_id, payload) - assert res["code"] == 0 - - res = delete_chunks(get_http_api_auth, dataset_id, document_id, payload) - assert res["code"] == 102 - assert res["message"] == "rm_chunk deleted chunks 0, expect 4" - - @pytest.mark.p3 - def test_duplicate_deletion(self, get_http_api_auth, add_chunks_func): - dataset_id, document_id, chunk_ids = add_chunks_func - res = delete_chunks(get_http_api_auth, dataset_id, document_id, {"chunk_ids": chunk_ids * 2}) - assert res["code"] == 0 - assert "Duplicate chunk ids" in res["data"]["errors"][0] - assert res["data"]["success_count"] == 4 - - res = list_chunks(get_http_api_auth, dataset_id, document_id) - if res["code"] != 0: - assert False, res - assert len(res["data"]["chunks"]) == 1 - assert res["data"]["total"] == 1 - - @pytest.mark.p3 - def test_concurrent_deletion(self, get_http_api_auth, add_document): - chunks_num = 100 - dataset_id, document_id = add_document - chunk_ids = batch_add_chunks(get_http_api_auth, dataset_id, document_id, chunks_num) - - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [ - executor.submit( - delete_chunks, - get_http_api_auth, - dataset_id, - document_id, - {"chunk_ids": chunk_ids[i : i + 1]}, - ) - for i in range(chunks_num) - ] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses) - - @pytest.mark.p3 - def test_delete_1k(self, get_http_api_auth, add_document): - chunks_num = 1_000 - dataset_id, document_id = add_document - chunk_ids = batch_add_chunks(get_http_api_auth, dataset_id, document_id, chunks_num) - - # issues/6487 - from time import sleep - - sleep(1) - - res = delete_chunks(get_http_api_auth, dataset_id, document_id, {"chunk_ids": chunk_ids}) - assert res["code"] == 0 - - res = list_chunks(get_http_api_auth, dataset_id, document_id) - if res["code"] != 0: - assert False, res - assert len(res["data"]["chunks"]) == 1 - assert res["data"]["total"] == 1 - - @pytest.mark.parametrize( - "payload, expected_code, expected_message, remaining", - [ - pytest.param(None, 100, """TypeError("argument of type \'NoneType\' is not iterable")""", 5, marks=pytest.mark.skip), - pytest.param({"chunk_ids": ["invalid_id"]}, 102, "rm_chunk deleted chunks 0, expect 1", 5, marks=pytest.mark.p3), - pytest.param("not json", 100, """UnboundLocalError("local variable \'duplicate_messages\' referenced before assignment")""", 5, marks=pytest.mark.skip(reason="pull/6376")), - pytest.param(lambda r: {"chunk_ids": r[:1]}, 0, "", 4, marks=pytest.mark.p3), - pytest.param(lambda r: {"chunk_ids": r}, 0, "", 1, marks=pytest.mark.p1), - pytest.param({"chunk_ids": []}, 0, "", 0, marks=pytest.mark.p3), - ], - ) - def test_basic_scenarios( - self, - get_http_api_auth, - add_chunks_func, - payload, - expected_code, - expected_message, - remaining, - ): - dataset_id, document_id, chunk_ids = add_chunks_func - if callable(payload): - payload = payload(chunk_ids) - res = delete_chunks(get_http_api_auth, dataset_id, document_id, payload) - assert res["code"] == expected_code - if res["code"] != 0: - assert res["message"] == expected_message - - res = list_chunks(get_http_api_auth, dataset_id, document_id) - if res["code"] != 0: - assert False, res - assert len(res["data"]["chunks"]) == remaining - assert res["data"]["total"] == remaining diff --git a/sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_list_chunks.py b/sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_list_chunks.py deleted file mode 100644 index 5508ff30629..00000000000 --- a/sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_list_chunks.py +++ /dev/null @@ -1,209 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os -from concurrent.futures import ThreadPoolExecutor - -import pytest -from common import INVALID_API_TOKEN, batch_add_chunks, list_chunks -from libs.auth import RAGFlowHttpApiAuth - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = list_chunks(auth, "dataset_id", "document_id") - assert res["code"] == expected_code - assert res["message"] == expected_message - - -class TestChunksList: - @pytest.mark.p1 - @pytest.mark.parametrize( - "params, expected_code, expected_page_size, expected_message", - [ - ({"page": None, "page_size": 2}, 0, 2, ""), - pytest.param({"page": 0, "page_size": 2}, 100, 0, "ValueError('Search does not support negative slicing.')", marks=pytest.mark.skip), - ({"page": 2, "page_size": 2}, 0, 2, ""), - ({"page": 3, "page_size": 2}, 0, 1, ""), - ({"page": "3", "page_size": 2}, 0, 1, ""), - pytest.param({"page": -1, "page_size": 2}, 100, 0, "ValueError('Search does not support negative slicing.')", marks=pytest.mark.skip), - pytest.param({"page": "a", "page_size": 2}, 100, 0, """ValueError("invalid literal for int() with base 10: \'a\'")""", marks=pytest.mark.skip), - ], - ) - def test_page(self, get_http_api_auth, add_chunks, params, expected_code, expected_page_size, expected_message): - dataset_id, document_id, _ = add_chunks - res = list_chunks(get_http_api_auth, dataset_id, document_id, params=params) - assert res["code"] == expected_code - if expected_code == 0: - assert len(res["data"]["chunks"]) == expected_page_size - else: - assert res["message"] == expected_message - - @pytest.mark.p1 - @pytest.mark.parametrize( - "params, expected_code, expected_page_size, expected_message", - [ - ({"page_size": None}, 0, 5, ""), - pytest.param({"page_size": 0}, 0, 5, ""), - pytest.param({"page_size": 0}, 100, 0, ""), - ({"page_size": 1}, 0, 1, ""), - ({"page_size": 6}, 0, 5, ""), - ({"page_size": "1"}, 0, 1, ""), - pytest.param({"page_size": -1}, 0, 5, "", marks=pytest.mark.skip), - pytest.param({"page_size": "a"}, 100, 0, """ValueError("invalid literal for int() with base 10: \'a\'")""", marks=pytest.mark.skip), - ], - ) - def test_page_size(self, get_http_api_auth, add_chunks, params, expected_code, expected_page_size, expected_message): - dataset_id, document_id, _ = add_chunks - res = list_chunks(get_http_api_auth, dataset_id, document_id, params=params) - assert res["code"] == expected_code - if expected_code == 0: - assert len(res["data"]["chunks"]) == expected_page_size - else: - assert res["message"] == expected_message - - @pytest.mark.p2 - @pytest.mark.parametrize( - "params, expected_page_size", - [ - ({"keywords": None}, 5), - ({"keywords": ""}, 5), - ({"keywords": "1"}, 1), - pytest.param({"keywords": "chunk"}, 4, marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") == "infinity", reason="issues/6509")), - ({"keywords": "ragflow"}, 1), - ({"keywords": "unknown"}, 0), - ], - ) - def test_keywords(self, get_http_api_auth, add_chunks, params, expected_page_size): - dataset_id, document_id, _ = add_chunks - res = list_chunks(get_http_api_auth, dataset_id, document_id, params=params) - assert res["code"] == 0 - assert len(res["data"]["chunks"]) == expected_page_size - - @pytest.mark.p1 - @pytest.mark.parametrize( - "chunk_id, expected_code, expected_page_size, expected_message", - [ - (None, 0, 5, ""), - ("", 0, 5, ""), - pytest.param(lambda r: r[0], 0, 1, "", marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") == "infinity", reason="issues/6499")), - pytest.param("unknown", 100, 0, """AttributeError("\'NoneType\' object has no attribute \'keys\'")""", marks=pytest.mark.skip), - ], - ) - def test_id( - self, - get_http_api_auth, - add_chunks, - chunk_id, - expected_code, - expected_page_size, - expected_message, - ): - dataset_id, document_id, chunk_ids = add_chunks - if callable(chunk_id): - params = {"id": chunk_id(chunk_ids)} - else: - params = {"id": chunk_id} - res = list_chunks(get_http_api_auth, dataset_id, document_id, params=params) - assert res["code"] == expected_code - if expected_code == 0: - if params["id"] in [None, ""]: - assert len(res["data"]["chunks"]) == expected_page_size - else: - assert res["data"]["chunks"][0]["id"] == params["id"] - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - def test_invalid_params(self, get_http_api_auth, add_chunks): - dataset_id, document_id, _ = add_chunks - params = {"a": "b"} - res = list_chunks(get_http_api_auth, dataset_id, document_id, params=params) - assert res["code"] == 0 - assert len(res["data"]["chunks"]) == 5 - - @pytest.mark.p3 - def test_concurrent_list(self, get_http_api_auth, add_chunks): - dataset_id, document_id, _ = add_chunks - - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [executor.submit(list_chunks, get_http_api_auth, dataset_id, document_id) for i in range(100)] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses) - assert all(len(r["data"]["chunks"]) == 5 for r in responses) - - @pytest.mark.p1 - def test_default(self, get_http_api_auth, add_document): - dataset_id, document_id = add_document - - res = list_chunks(get_http_api_auth, dataset_id, document_id) - chunks_count = res["data"]["doc"]["chunk_count"] - batch_add_chunks(get_http_api_auth, dataset_id, document_id, 31) - # issues/6487 - from time import sleep - - sleep(3) - res = list_chunks(get_http_api_auth, dataset_id, document_id) - assert res["code"] == 0 - assert len(res["data"]["chunks"]) == 30 - assert res["data"]["doc"]["chunk_count"] == chunks_count + 31 - - @pytest.mark.p3 - @pytest.mark.parametrize( - "dataset_id, expected_code, expected_message", - [ - ("", 100, ""), - ( - "invalid_dataset_id", - 102, - "You don't own the dataset invalid_dataset_id.", - ), - ], - ) - def test_invalid_dataset_id(self, get_http_api_auth, add_chunks, dataset_id, expected_code, expected_message): - _, document_id, _ = add_chunks - res = list_chunks(get_http_api_auth, dataset_id, document_id) - assert res["code"] == expected_code - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "document_id, expected_code, expected_message", - [ - ("", 102, "The dataset not own the document chunks."), - ( - "invalid_document_id", - 102, - "You don't own the document invalid_document_id.", - ), - ], - ) - def test_invalid_document_id(self, get_http_api_auth, add_chunks, document_id, expected_code, expected_message): - dataset_id, _, _ = add_chunks - res = list_chunks(get_http_api_auth, dataset_id, document_id) - assert res["code"] == expected_code - assert res["message"] == expected_message diff --git a/sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_retrieval_chunks.py b/sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_retrieval_chunks.py deleted file mode 100644 index c4fd4b62688..00000000000 --- a/sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_retrieval_chunks.py +++ /dev/null @@ -1,313 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os - -import pytest -from common import ( - INVALID_API_TOKEN, - retrieval_chunks, -) -from libs.auth import RAGFlowHttpApiAuth - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = retrieval_chunks(auth) - assert res["code"] == expected_code - assert res["message"] == expected_message - - -class TestChunksRetrieval: - @pytest.mark.p1 - @pytest.mark.parametrize( - "payload, expected_code, expected_page_size, expected_message", - [ - ({"question": "chunk", "dataset_ids": None}, 0, 4, ""), - ({"question": "chunk", "document_ids": None}, 102, 0, "`dataset_ids` is required."), - ({"question": "chunk", "dataset_ids": None, "document_ids": None}, 0, 4, ""), - ({"question": "chunk"}, 102, 0, "`dataset_ids` is required."), - ], - ) - def test_basic_scenarios(self, get_http_api_auth, add_chunks, payload, expected_code, expected_page_size, expected_message): - dataset_id, document_id, _ = add_chunks - if "dataset_ids" in payload: - payload["dataset_ids"] = [dataset_id] - if "document_ids" in payload: - payload["document_ids"] = [document_id] - res = retrieval_chunks(get_http_api_auth, payload) - assert res["code"] == expected_code - if expected_code == 0: - assert len(res["data"]["chunks"]) == expected_page_size - else: - assert res["message"] == expected_message - - @pytest.mark.p2 - @pytest.mark.parametrize( - "payload, expected_code, expected_page_size, expected_message", - [ - pytest.param( - {"page": None, "page_size": 2}, - 100, - 2, - """TypeError("int() argument must be a string, a bytes-like object or a real number, not \'NoneType\'")""", - marks=pytest.mark.skip, - ), - pytest.param( - {"page": 0, "page_size": 2}, - 100, - 0, - "ValueError('Search does not support negative slicing.')", - marks=pytest.mark.skip, - ), - pytest.param({"page": 2, "page_size": 2}, 0, 2, "", marks=pytest.mark.skip(reason="issues/6646")), - ({"page": 3, "page_size": 2}, 0, 0, ""), - ({"page": "3", "page_size": 2}, 0, 0, ""), - pytest.param( - {"page": -1, "page_size": 2}, - 100, - 0, - "ValueError('Search does not support negative slicing.')", - marks=pytest.mark.skip, - ), - pytest.param( - {"page": "a", "page_size": 2}, - 100, - 0, - """ValueError("invalid literal for int() with base 10: \'a\'")""", - marks=pytest.mark.skip, - ), - ], - ) - def test_page(self, get_http_api_auth, add_chunks, payload, expected_code, expected_page_size, expected_message): - dataset_id, _, _ = add_chunks - payload.update({"question": "chunk", "dataset_ids": [dataset_id]}) - res = retrieval_chunks(get_http_api_auth, payload) - assert res["code"] == expected_code - if expected_code == 0: - assert len(res["data"]["chunks"]) == expected_page_size - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "payload, expected_code, expected_page_size, expected_message", - [ - pytest.param( - {"page_size": None}, - 100, - 0, - """TypeError("int() argument must be a string, a bytes-like object or a real number, not \'NoneType\'")""", - marks=pytest.mark.skip, - ), - # ({"page_size": 0}, 0, 0, ""), - ({"page_size": 1}, 0, 1, ""), - ({"page_size": 5}, 0, 4, ""), - ({"page_size": "1"}, 0, 1, ""), - # ({"page_size": -1}, 0, 0, ""), - pytest.param( - {"page_size": "a"}, - 100, - 0, - """ValueError("invalid literal for int() with base 10: \'a\'")""", - marks=pytest.mark.skip, - ), - ], - ) - def test_page_size(self, get_http_api_auth, add_chunks, payload, expected_code, expected_page_size, expected_message): - dataset_id, _, _ = add_chunks - payload.update({"question": "chunk", "dataset_ids": [dataset_id]}) - - res = retrieval_chunks(get_http_api_auth, payload) - assert res["code"] == expected_code - if expected_code == 0: - assert len(res["data"]["chunks"]) == expected_page_size - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "payload, expected_code, expected_page_size, expected_message", - [ - ({"vector_similarity_weight": 0}, 0, 4, ""), - ({"vector_similarity_weight": 0.5}, 0, 4, ""), - ({"vector_similarity_weight": 10}, 0, 4, ""), - pytest.param( - {"vector_similarity_weight": "a"}, - 100, - 0, - """ValueError("could not convert string to float: \'a\'")""", - marks=pytest.mark.skip, - ), - ], - ) - def test_vector_similarity_weight(self, get_http_api_auth, add_chunks, payload, expected_code, expected_page_size, expected_message): - dataset_id, _, _ = add_chunks - payload.update({"question": "chunk", "dataset_ids": [dataset_id]}) - res = retrieval_chunks(get_http_api_auth, payload) - assert res["code"] == expected_code - if expected_code == 0: - assert len(res["data"]["chunks"]) == expected_page_size - else: - assert res["message"] == expected_message - - @pytest.mark.p2 - @pytest.mark.parametrize( - "payload, expected_code, expected_page_size, expected_message", - [ - ({"top_k": 10}, 0, 4, ""), - pytest.param( - {"top_k": 1}, - 0, - 4, - "", - marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") in ["infinity", "opensearch"], reason="Infinity"), - ), - pytest.param( - {"top_k": 1}, - 0, - 1, - "", - marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") in [None, "opensearch", "elasticsearch"], reason="elasticsearch"), - ), - pytest.param( - {"top_k": -1}, - 100, - 4, - "must be greater than 0", - marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") in ["infinity", "opensearch"], reason="Infinity"), - ), - pytest.param( - {"top_k": -1}, - 100, - 4, - "3014", - marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") in [None, "opensearch", "elasticsearch"], reason="elasticsearch"), - ), - pytest.param( - {"top_k": "a"}, - 100, - 0, - """ValueError("invalid literal for int() with base 10: \'a\'")""", - marks=pytest.mark.skip, - ), - ], - ) - def test_top_k(self, get_http_api_auth, add_chunks, payload, expected_code, expected_page_size, expected_message): - dataset_id, _, _ = add_chunks - payload.update({"question": "chunk", "dataset_ids": [dataset_id]}) - res = retrieval_chunks(get_http_api_auth, payload) - assert res["code"] == expected_code - if expected_code == 0: - assert len(res["data"]["chunks"]) == expected_page_size - else: - assert expected_message in res["message"] - - @pytest.mark.skip - @pytest.mark.parametrize( - "payload, expected_code, expected_message", - [ - ({"rerank_id": "BAAI/bge-reranker-v2-m3"}, 0, ""), - pytest.param({"rerank_id": "unknown"}, 100, "LookupError('Model(unknown) not authorized')", marks=pytest.mark.skip), - ], - ) - def test_rerank_id(self, get_http_api_auth, add_chunks, payload, expected_code, expected_message): - dataset_id, _, _ = add_chunks - payload.update({"question": "chunk", "dataset_ids": [dataset_id]}) - res = retrieval_chunks(get_http_api_auth, payload) - assert res["code"] == expected_code - if expected_code == 0: - assert len(res["data"]["chunks"]) > 0 - else: - assert expected_message in res["message"] - - @pytest.mark.skip - @pytest.mark.parametrize( - "payload, expected_code, expected_page_size, expected_message", - [ - ({"keyword": True}, 0, 5, ""), - ({"keyword": "True"}, 0, 5, ""), - ({"keyword": False}, 0, 5, ""), - ({"keyword": "False"}, 0, 5, ""), - ({"keyword": None}, 0, 5, ""), - ], - ) - def test_keyword(self, get_http_api_auth, add_chunks, payload, expected_code, expected_page_size, expected_message): - dataset_id, _, _ = add_chunks - payload.update({"question": "chunk test", "dataset_ids": [dataset_id]}) - res = retrieval_chunks(get_http_api_auth, payload) - assert res["code"] == expected_code - if expected_code == 0: - assert len(res["data"]["chunks"]) == expected_page_size - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "payload, expected_code, expected_highlight, expected_message", - [ - ({"highlight": True}, 0, True, ""), - ({"highlight": "True"}, 0, True, ""), - pytest.param({"highlight": False}, 0, False, "", marks=pytest.mark.skip(reason="issues/6648")), - ({"highlight": "False"}, 0, False, ""), - pytest.param({"highlight": None}, 0, False, "", marks=pytest.mark.skip(reason="issues/6648")), - ], - ) - def test_highlight(self, get_http_api_auth, add_chunks, payload, expected_code, expected_highlight, expected_message): - dataset_id, _, _ = add_chunks - payload.update({"question": "chunk", "dataset_ids": [dataset_id]}) - res = retrieval_chunks(get_http_api_auth, payload) - assert res["code"] == expected_code - if expected_highlight: - for chunk in res["data"]["chunks"]: - assert "highlight" in chunk - else: - for chunk in res["data"]["chunks"]: - assert "highlight" not in chunk - - if expected_code != 0: - assert res["message"] == expected_message - - @pytest.mark.p3 - def test_invalid_params(self, get_http_api_auth, add_chunks): - dataset_id, _, _ = add_chunks - payload = {"question": "chunk", "dataset_ids": [dataset_id], "a": "b"} - res = retrieval_chunks(get_http_api_auth, payload) - assert res["code"] == 0 - assert len(res["data"]["chunks"]) == 4 - - @pytest.mark.p3 - def test_concurrent_retrieval(self, get_http_api_auth, add_chunks): - from concurrent.futures import ThreadPoolExecutor - - dataset_id, _, _ = add_chunks - payload = {"question": "chunk", "dataset_ids": [dataset_id]} - - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [executor.submit(retrieval_chunks, get_http_api_auth, payload) for i in range(100)] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses) diff --git a/sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_update_chunk.py b/sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_update_chunk.py deleted file mode 100644 index b364f81bd91..00000000000 --- a/sdk/python/test/test_http_api/test_chunk_management_within_dataset/test_update_chunk.py +++ /dev/null @@ -1,246 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os -from concurrent.futures import ThreadPoolExecutor -from random import randint - -import pytest -from common import INVALID_API_TOKEN, delete_documnets, update_chunk -from libs.auth import RAGFlowHttpApiAuth - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = update_chunk(auth, "dataset_id", "document_id", "chunk_id") - assert res["code"] == expected_code - assert res["message"] == expected_message - - -class TestUpdatedChunk: - @pytest.mark.p1 - @pytest.mark.parametrize( - "payload, expected_code, expected_message", - [ - ({"content": None}, 100, "TypeError('expected string or bytes-like object')"), - pytest.param( - {"content": ""}, - 100, - """APIRequestFailedError(\'Error code: 400, with error text {"error":{"code":"1213","message":"未正常接收到prompt参数。"}}\')""", - marks=pytest.mark.skip(reason="issues/6541"), - ), - pytest.param( - {"content": 1}, - 100, - "TypeError('expected string or bytes-like object')", - marks=pytest.mark.skip, - ), - ({"content": "update chunk"}, 0, ""), - pytest.param( - {"content": " "}, - 100, - """APIRequestFailedError(\'Error code: 400, with error text {"error":{"code":"1213","message":"未正常接收到prompt参数。"}}\')""", - marks=pytest.mark.skip(reason="issues/6541"), - ), - ({"content": "\n!?。;!?\"'"}, 0, ""), - ], - ) - def test_content(self, get_http_api_auth, add_chunks, payload, expected_code, expected_message): - dataset_id, document_id, chunk_ids = add_chunks - res = update_chunk(get_http_api_auth, dataset_id, document_id, chunk_ids[0], payload) - assert res["code"] == expected_code - if expected_code != 0: - assert res["message"] == expected_message - - @pytest.mark.p2 - @pytest.mark.parametrize( - "payload, expected_code, expected_message", - [ - ({"important_keywords": ["a", "b", "c"]}, 0, ""), - ({"important_keywords": [""]}, 0, ""), - ({"important_keywords": [1]}, 100, "TypeError('sequence item 0: expected str instance, int found')"), - ({"important_keywords": ["a", "a"]}, 0, ""), - ({"important_keywords": "abc"}, 102, "`important_keywords` should be a list"), - ({"important_keywords": 123}, 102, "`important_keywords` should be a list"), - ], - ) - def test_important_keywords(self, get_http_api_auth, add_chunks, payload, expected_code, expected_message): - dataset_id, document_id, chunk_ids = add_chunks - res = update_chunk(get_http_api_auth, dataset_id, document_id, chunk_ids[0], payload) - assert res["code"] == expected_code - if expected_code != 0: - assert res["message"] == expected_message - - @pytest.mark.p2 - @pytest.mark.parametrize( - "payload, expected_code, expected_message", - [ - ({"questions": ["a", "b", "c"]}, 0, ""), - ({"questions": [""]}, 0, ""), - ({"questions": [1]}, 100, "TypeError('sequence item 0: expected str instance, int found')"), - ({"questions": ["a", "a"]}, 0, ""), - ({"questions": "abc"}, 102, "`questions` should be a list"), - ({"questions": 123}, 102, "`questions` should be a list"), - ], - ) - def test_questions(self, get_http_api_auth, add_chunks, payload, expected_code, expected_message): - dataset_id, document_id, chunk_ids = add_chunks - res = update_chunk(get_http_api_auth, dataset_id, document_id, chunk_ids[0], payload) - assert res["code"] == expected_code - if expected_code != 0: - assert res["message"] == expected_message - - @pytest.mark.p2 - @pytest.mark.parametrize( - "payload, expected_code, expected_message", - [ - ({"available": True}, 0, ""), - pytest.param({"available": "True"}, 100, """ValueError("invalid literal for int() with base 10: \'True\'")""", marks=pytest.mark.skip), - ({"available": 1}, 0, ""), - ({"available": False}, 0, ""), - pytest.param({"available": "False"}, 100, """ValueError("invalid literal for int() with base 10: \'False\'")""", marks=pytest.mark.skip), - ({"available": 0}, 0, ""), - ], - ) - def test_available( - self, - get_http_api_auth, - add_chunks, - payload, - expected_code, - expected_message, - ): - dataset_id, document_id, chunk_ids = add_chunks - res = update_chunk(get_http_api_auth, dataset_id, document_id, chunk_ids[0], payload) - assert res["code"] == expected_code - if expected_code != 0: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "dataset_id, expected_code, expected_message", - [ - ("", 100, ""), - pytest.param("invalid_dataset_id", 102, "You don't own the dataset invalid_dataset_id.", marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") == "infinity", reason="infinity")), - pytest.param("invalid_dataset_id", 102, "Can't find this chunk", marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") in [None, "opensearch","elasticsearch"], reason="elasticsearch")), - ], - ) - def test_invalid_dataset_id(self, get_http_api_auth, add_chunks, dataset_id, expected_code, expected_message): - _, document_id, chunk_ids = add_chunks - res = update_chunk(get_http_api_auth, dataset_id, document_id, chunk_ids[0]) - assert res["code"] == expected_code - assert expected_message in res["message"] - - @pytest.mark.p3 - @pytest.mark.parametrize( - "document_id, expected_code, expected_message", - [ - ("", 100, ""), - ( - "invalid_document_id", - 102, - "You don't own the document invalid_document_id.", - ), - ], - ) - def test_invalid_document_id(self, get_http_api_auth, add_chunks, document_id, expected_code, expected_message): - dataset_id, _, chunk_ids = add_chunks - res = update_chunk(get_http_api_auth, dataset_id, document_id, chunk_ids[0]) - assert res["code"] == expected_code - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "chunk_id, expected_code, expected_message", - [ - ("", 100, ""), - ( - "invalid_document_id", - 102, - "Can't find this chunk invalid_document_id", - ), - ], - ) - def test_invalid_chunk_id(self, get_http_api_auth, add_chunks, chunk_id, expected_code, expected_message): - dataset_id, document_id, _ = add_chunks - res = update_chunk(get_http_api_auth, dataset_id, document_id, chunk_id) - assert res["code"] == expected_code - assert res["message"] == expected_message - - @pytest.mark.p3 - def test_repeated_update_chunk(self, get_http_api_auth, add_chunks): - dataset_id, document_id, chunk_ids = add_chunks - res = update_chunk(get_http_api_auth, dataset_id, document_id, chunk_ids[0], {"content": "chunk test 1"}) - assert res["code"] == 0 - - res = update_chunk(get_http_api_auth, dataset_id, document_id, chunk_ids[0], {"content": "chunk test 2"}) - assert res["code"] == 0 - - @pytest.mark.p3 - @pytest.mark.parametrize( - "payload, expected_code, expected_message", - [ - ({"unknown_key": "unknown_value"}, 0, ""), - ({}, 0, ""), - pytest.param(None, 100, """TypeError("argument of type \'NoneType\' is not iterable")""", marks=pytest.mark.skip), - ], - ) - def test_invalid_params(self, get_http_api_auth, add_chunks, payload, expected_code, expected_message): - dataset_id, document_id, chunk_ids = add_chunks - res = update_chunk(get_http_api_auth, dataset_id, document_id, chunk_ids[0], payload) - assert res["code"] == expected_code - if expected_code != 0: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.skipif(os.getenv("DOC_ENGINE") == "infinity", reason="issues/6554") - def test_concurrent_update_chunk(self, get_http_api_auth, add_chunks): - chunk_num = 50 - dataset_id, document_id, chunk_ids = add_chunks - - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [ - executor.submit( - update_chunk, - get_http_api_auth, - dataset_id, - document_id, - chunk_ids[randint(0, 3)], - {"content": f"update chunk test {i}"}, - ) - for i in range(chunk_num) - ] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses) - - @pytest.mark.p3 - def test_update_chunk_to_deleted_document(self, get_http_api_auth, add_chunks): - dataset_id, document_id, chunk_ids = add_chunks - delete_documnets(get_http_api_auth, dataset_id, {"ids": [document_id]}) - res = update_chunk(get_http_api_auth, dataset_id, document_id, chunk_ids[0]) - assert res["code"] == 102 - assert res["message"] == f"Can't find this chunk {chunk_ids[0]}" diff --git a/sdk/python/test/test_http_api/test_dataset_mangement/conftest.py b/sdk/python/test/test_http_api/test_dataset_mangement/conftest.py deleted file mode 100644 index a6490df67b9..00000000000 --- a/sdk/python/test/test_http_api/test_dataset_mangement/conftest.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - - -import pytest -from common import batch_create_datasets, delete_datasets - - -@pytest.fixture(scope="class") -def add_datasets(get_http_api_auth, request): - def cleanup(): - delete_datasets(get_http_api_auth, {"ids": None}) - - request.addfinalizer(cleanup) - - return batch_create_datasets(get_http_api_auth, 5) - - -@pytest.fixture(scope="function") -def add_datasets_func(get_http_api_auth, request): - def cleanup(): - delete_datasets(get_http_api_auth, {"ids": None}) - - request.addfinalizer(cleanup) - - return batch_create_datasets(get_http_api_auth, 3) diff --git a/sdk/python/test/test_http_api/test_dataset_mangement/test_create_dataset.py b/sdk/python/test/test_http_api/test_dataset_mangement/test_create_dataset.py deleted file mode 100644 index 5001a983c71..00000000000 --- a/sdk/python/test/test_http_api/test_dataset_mangement/test_create_dataset.py +++ /dev/null @@ -1,735 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from concurrent.futures import ThreadPoolExecutor - -import pytest -from common import DATASET_NAME_LIMIT, INVALID_API_TOKEN, create_dataset -from hypothesis import example, given, settings -from libs.auth import RAGFlowHttpApiAuth -from libs.utils import encode_avatar -from libs.utils.file_utils import create_image_file -from libs.utils.hypothesis_utils import valid_names - - -@pytest.mark.usefixtures("clear_datasets") -class TestAuthorization: - @pytest.mark.p1 - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ids=["empty_auth", "invalid_api_token"], - ) - def test_auth_invalid(self, auth, expected_code, expected_message): - res = create_dataset(auth, {"name": "auth_test"}) - assert res["code"] == expected_code, res - assert res["message"] == expected_message, res - - -class TestRquest: - @pytest.mark.p3 - def test_content_type_bad(self, get_http_api_auth): - BAD_CONTENT_TYPE = "text/xml" - res = create_dataset(get_http_api_auth, {"name": "bad_content_type"}, headers={"Content-Type": BAD_CONTENT_TYPE}) - assert res["code"] == 101, res - assert res["message"] == f"Unsupported content type: Expected application/json, got {BAD_CONTENT_TYPE}", res - - @pytest.mark.p3 - @pytest.mark.parametrize( - "payload, expected_message", - [ - ("a", "Malformed JSON syntax: Missing commas/brackets or invalid encoding"), - ('"a"', "Invalid request payload: expected object, got str"), - ], - ids=["malformed_json_syntax", "invalid_request_payload_type"], - ) - def test_payload_bad(self, get_http_api_auth, payload, expected_message): - res = create_dataset(get_http_api_auth, data=payload) - assert res["code"] == 101, res - assert res["message"] == expected_message, res - - -@pytest.mark.usefixtures("clear_datasets") -class TestCapability: - @pytest.mark.p3 - def test_create_dataset_1k(self, get_http_api_auth): - for i in range(1_000): - payload = {"name": f"dataset_{i}"} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, f"Failed to create dataset {i}" - - @pytest.mark.p3 - def test_create_dataset_concurrent(self, get_http_api_auth): - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [executor.submit(create_dataset, get_http_api_auth, {"name": f"dataset_{i}"}) for i in range(100)] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses), responses - - -@pytest.mark.usefixtures("clear_datasets") -class TestDatasetCreate: - @pytest.mark.p1 - @given(name=valid_names()) - @example("a" * 128) - @settings(max_examples=20) - def test_name(self, get_http_api_auth, name): - res = create_dataset(get_http_api_auth, {"name": name}) - assert res["code"] == 0, res - assert res["data"]["name"] == name, res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "name, expected_message", - [ - ("", "String should have at least 1 character"), - (" ", "String should have at least 1 character"), - ("a" * (DATASET_NAME_LIMIT + 1), "String should have at most 128 characters"), - (0, "Input should be a valid string"), - (None, "Input should be a valid string"), - ], - ids=["empty_name", "space_name", "too_long_name", "invalid_name", "None_name"], - ) - def test_name_invalid(self, get_http_api_auth, name, expected_message): - payload = {"name": name} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 101, res - assert expected_message in res["message"], res - - @pytest.mark.p3 - def test_name_duplicated(self, get_http_api_auth): - name = "duplicated_name" - payload = {"name": name} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 103, res - assert res["message"] == f"Dataset name '{name}' already exists", res - - @pytest.mark.p3 - def test_name_case_insensitive(self, get_http_api_auth): - name = "CaseInsensitive" - payload = {"name": name.upper()} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - - payload = {"name": name.lower()} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 103, res - assert res["message"] == f"Dataset name '{name.lower()}' already exists", res - - @pytest.mark.p2 - def test_avatar(self, get_http_api_auth, tmp_path): - fn = create_image_file(tmp_path / "ragflow_test.png") - payload = { - "name": "avatar", - "avatar": f"data:image/png;base64,{encode_avatar(fn)}", - } - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - - @pytest.mark.p2 - def test_avatar_exceeds_limit_length(self, get_http_api_auth): - payload = {"name": "avatar_exceeds_limit_length", "avatar": "a" * 65536} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 101, res - assert "String should have at most 65535 characters" in res["message"], res - - @pytest.mark.p3 - @pytest.mark.parametrize( - "name, prefix, expected_message", - [ - ("empty_prefix", "", "Missing MIME prefix. Expected format: data:;base64,"), - ("missing_comma", "data:image/png;base64", "Missing MIME prefix. Expected format: data:;base64,"), - ("unsupported_mine_type", "invalid_mine_prefix:image/png;base64,", "Invalid MIME prefix format. Must start with 'data:'"), - ("invalid_mine_type", "data:unsupported_mine_type;base64,", "Unsupported MIME type. Allowed: ['image/jpeg', 'image/png']"), - ], - ids=["empty_prefix", "missing_comma", "unsupported_mine_type", "invalid_mine_type"], - ) - def test_avatar_invalid_prefix(self, get_http_api_auth, tmp_path, name, prefix, expected_message): - fn = create_image_file(tmp_path / "ragflow_test.png") - payload = { - "name": name, - "avatar": f"{prefix}{encode_avatar(fn)}", - } - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 101, res - assert expected_message in res["message"], res - - @pytest.mark.p3 - def test_avatar_unset(self, get_http_api_auth): - payload = {"name": "avatar_unset"} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - assert res["data"]["avatar"] is None, res - - @pytest.mark.p3 - def test_avatar_none(self, get_http_api_auth): - payload = {"name": "avatar_none", "avatar": None} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - assert res["data"]["avatar"] is None, res - - @pytest.mark.p2 - def test_description(self, get_http_api_auth): - payload = {"name": "description", "description": "description"} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - assert res["data"]["description"] == "description", res - - @pytest.mark.p2 - def test_description_exceeds_limit_length(self, get_http_api_auth): - payload = {"name": "description_exceeds_limit_length", "description": "a" * 65536} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 101, res - assert "String should have at most 65535 characters" in res["message"], res - - @pytest.mark.p3 - def test_description_unset(self, get_http_api_auth): - payload = {"name": "description_unset"} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - assert res["data"]["description"] is None, res - - @pytest.mark.p3 - def test_description_none(self, get_http_api_auth): - payload = {"name": "description_none", "description": None} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - assert res["data"]["description"] is None, res - - @pytest.mark.p1 - @pytest.mark.parametrize( - "name, embedding_model", - [ - ("BAAI/bge-small-en-v1.5@Builtin", "BAAI/bge-small-en-v1.5@Builtin"), - ("embedding-3@ZHIPU-AI", "embedding-3@ZHIPU-AI"), - ], - ids=["builtin_baai", "tenant_zhipu"], - ) - def test_embedding_model(self, get_http_api_auth, name, embedding_model): - payload = {"name": name, "embedding_model": embedding_model} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - assert res["data"]["embedding_model"] == embedding_model, res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "name, embedding_model", - [ - ("unknown_llm_name", "unknown@ZHIPU-AI"), - ("unknown_llm_factory", "embedding-3@unknown"), - ("tenant_no_auth_default_tenant_llm", "text-embedding-v3@Tongyi-Qianwen"), - ("tenant_no_auth", "text-embedding-3-small@OpenAI"), - ], - ids=["unknown_llm_name", "unknown_llm_factory", "tenant_no_auth_default_tenant_llm", "tenant_no_auth"], - ) - def test_embedding_model_invalid(self, get_http_api_auth, name, embedding_model): - payload = {"name": name, "embedding_model": embedding_model} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 101, res - if "tenant_no_auth" in name: - assert res["message"] == f"Unauthorized model: <{embedding_model}>", res - else: - assert res["message"] == f"Unsupported model: <{embedding_model}>", res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "name, embedding_model", - [ - ("missing_at", "BAAI/bge-small-en-v1.5Builtin"), - ("missing_model_name", "@Builtin"), - ("missing_provider", "BAAI/bge-small-en-v1.5@"), - ("whitespace_only_model_name", " @Builtin"), - ("whitespace_only_provider", "BAAI/bge-small-en-v1.5@ "), - ], - ids=["missing_at", "empty_model_name", "empty_provider", "whitespace_only_model_name", "whitespace_only_provider"], - ) - def test_embedding_model_format(self, get_http_api_auth, name, embedding_model): - payload = {"name": name, "embedding_model": embedding_model} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 101, res - if name == "missing_at": - assert "Embedding model identifier must follow @ format" in res["message"], res - else: - assert "Both model_name and provider must be non-empty strings" in res["message"], res - - @pytest.mark.p2 - def test_embedding_model_unset(self, get_http_api_auth): - payload = {"name": "embedding_model_unset"} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - assert res["data"]["embedding_model"] == "BAAI/bge-small-en-v1.5@Builtin", res - - @pytest.mark.p2 - def test_embedding_model_none(self, get_http_api_auth): - payload = {"name": "embedding_model_none", "embedding_model": None} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 101, res - assert "Input should be a valid string" in res["message"], res - - @pytest.mark.p1 - @pytest.mark.parametrize( - "name, permission", - [ - ("me", "me"), - ("team", "team"), - ("me_upercase", "ME"), - ("team_upercase", "TEAM"), - ("whitespace", " ME "), - ], - ids=["me", "team", "me_upercase", "team_upercase", "whitespace"], - ) - def test_permission(self, get_http_api_auth, name, permission): - payload = {"name": name, "permission": permission} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - assert res["data"]["permission"] == permission.lower().strip(), res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "name, permission", - [ - ("empty", ""), - ("unknown", "unknown"), - ("type_error", list()), - ], - ids=["empty", "unknown", "type_error"], - ) - def test_permission_invalid(self, get_http_api_auth, name, permission): - payload = {"name": name, "permission": permission} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 101 - assert "Input should be 'me' or 'team'" in res["message"] - - @pytest.mark.p2 - def test_permission_unset(self, get_http_api_auth): - payload = {"name": "permission_unset"} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - assert res["data"]["permission"] == "me", res - - @pytest.mark.p3 - def test_permission_none(self, get_http_api_auth): - payload = {"name": "permission_none", "permission": None} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 101, res - assert "Input should be 'me' or 'team'" in res["message"], res - - @pytest.mark.p1 - @pytest.mark.parametrize( - "name, chunk_method", - [ - ("naive", "naive"), - ("book", "book"), - ("email", "email"), - ("laws", "laws"), - ("manual", "manual"), - ("one", "one"), - ("paper", "paper"), - ("picture", "picture"), - ("presentation", "presentation"), - ("qa", "qa"), - ("table", "table"), - ("tag", "tag"), - ], - ids=["naive", "book", "email", "laws", "manual", "one", "paper", "picture", "presentation", "qa", "table", "tag"], - ) - def test_chunk_method(self, get_http_api_auth, name, chunk_method): - payload = {"name": name, "chunk_method": chunk_method} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - assert res["data"]["chunk_method"] == chunk_method, res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "name, chunk_method", - [ - ("empty", ""), - ("unknown", "unknown"), - ("type_error", list()), - ], - ids=["empty", "unknown", "type_error"], - ) - def test_chunk_method_invalid(self, get_http_api_auth, name, chunk_method): - payload = {"name": name, "chunk_method": chunk_method} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 101, res - assert "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table' or 'tag'" in res["message"], res - - @pytest.mark.p2 - def test_chunk_method_unset(self, get_http_api_auth): - payload = {"name": "chunk_method_unset"} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - assert res["data"]["chunk_method"] == "naive", res - - @pytest.mark.p3 - def test_chunk_method_none(self, get_http_api_auth): - payload = {"name": "chunk_method_none", "chunk_method": None} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 101, res - assert "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table' or 'tag'" in res["message"], res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "name, pagerank", - [ - ("pagerank_min", 0), - ("pagerank_mid", 50), - ("pagerank_max", 100), - ], - ids=["min", "mid", "max"], - ) - def test_pagerank(self, get_http_api_auth, name, pagerank): - payload = {"name": name, "pagerank": pagerank} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - assert res["data"]["pagerank"] == pagerank, res - - @pytest.mark.p3 - @pytest.mark.parametrize( - "name, pagerank, expected_message", - [ - ("pagerank_min_limit", -1, "Input should be greater than or equal to 0"), - ("pagerank_max_limit", 101, "Input should be less than or equal to 100"), - ], - ids=["min_limit", "max_limit"], - ) - def test_pagerank_invalid(self, get_http_api_auth, name, pagerank, expected_message): - payload = {"name": name, "pagerank": pagerank} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 101, res - assert expected_message in res["message"], res - - @pytest.mark.p3 - def test_pagerank_unset(self, get_http_api_auth): - payload = {"name": "pagerank_unset"} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - assert res["data"]["pagerank"] == 0, res - - @pytest.mark.p3 - def test_pagerank_none(self, get_http_api_auth): - payload = {"name": "pagerank_unset", "pagerank": None} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 101, res - assert "Input should be a valid integer" in res["message"], res - - @pytest.mark.p1 - @pytest.mark.parametrize( - "name, parser_config", - [ - ("auto_keywords_min", {"auto_keywords": 0}), - ("auto_keywords_mid", {"auto_keywords": 16}), - ("auto_keywords_max", {"auto_keywords": 32}), - ("auto_questions_min", {"auto_questions": 0}), - ("auto_questions_mid", {"auto_questions": 5}), - ("auto_questions_max", {"auto_questions": 10}), - ("chunk_token_num_min", {"chunk_token_num": 1}), - ("chunk_token_num_mid", {"chunk_token_num": 1024}), - ("chunk_token_num_max", {"chunk_token_num": 2048}), - ("delimiter", {"delimiter": "\n"}), - ("delimiter_space", {"delimiter": " "}), - ("html4excel_true", {"html4excel": True}), - ("html4excel_false", {"html4excel": False}), - ("layout_recognize_DeepDOC", {"layout_recognize": "DeepDOC"}), - ("layout_recognize_navie", {"layout_recognize": "Plain Text"}), - ("tag_kb_ids", {"tag_kb_ids": ["1", "2"]}), - ("topn_tags_min", {"topn_tags": 1}), - ("topn_tags_mid", {"topn_tags": 5}), - ("topn_tags_max", {"topn_tags": 10}), - ("filename_embd_weight_min", {"filename_embd_weight": 0.1}), - ("filename_embd_weight_mid", {"filename_embd_weight": 0.5}), - ("filename_embd_weight_max", {"filename_embd_weight": 1.0}), - ("task_page_size_min", {"task_page_size": 1}), - ("task_page_size_None", {"task_page_size": None}), - ("pages", {"pages": [[1, 100]]}), - ("pages_none", {"pages": None}), - ("graphrag_true", {"graphrag": {"use_graphrag": True}}), - ("graphrag_false", {"graphrag": {"use_graphrag": False}}), - ("graphrag_entity_types", {"graphrag": {"entity_types": ["age", "sex", "height", "weight"]}}), - ("graphrag_method_general", {"graphrag": {"method": "general"}}), - ("graphrag_method_light", {"graphrag": {"method": "light"}}), - ("graphrag_community_true", {"graphrag": {"community": True}}), - ("graphrag_community_false", {"graphrag": {"community": False}}), - ("graphrag_resolution_true", {"graphrag": {"resolution": True}}), - ("graphrag_resolution_false", {"graphrag": {"resolution": False}}), - ("raptor_true", {"raptor": {"use_raptor": True}}), - ("raptor_false", {"raptor": {"use_raptor": False}}), - ("raptor_prompt", {"raptor": {"prompt": "Who are you?"}}), - ("raptor_max_token_min", {"raptor": {"max_token": 1}}), - ("raptor_max_token_mid", {"raptor": {"max_token": 1024}}), - ("raptor_max_token_max", {"raptor": {"max_token": 2048}}), - ("raptor_threshold_min", {"raptor": {"threshold": 0.0}}), - ("raptor_threshold_mid", {"raptor": {"threshold": 0.5}}), - ("raptor_threshold_max", {"raptor": {"threshold": 1.0}}), - ("raptor_max_cluster_min", {"raptor": {"max_cluster": 1}}), - ("raptor_max_cluster_mid", {"raptor": {"max_cluster": 512}}), - ("raptor_max_cluster_max", {"raptor": {"max_cluster": 1024}}), - ("raptor_random_seed_min", {"raptor": {"random_seed": 0}}), - ], - ids=[ - "auto_keywords_min", - "auto_keywords_mid", - "auto_keywords_max", - "auto_questions_min", - "auto_questions_mid", - "auto_questions_max", - "chunk_token_num_min", - "chunk_token_num_mid", - "chunk_token_num_max", - "delimiter", - "delimiter_space", - "html4excel_true", - "html4excel_false", - "layout_recognize_DeepDOC", - "layout_recognize_navie", - "tag_kb_ids", - "topn_tags_min", - "topn_tags_mid", - "topn_tags_max", - "filename_embd_weight_min", - "filename_embd_weight_mid", - "filename_embd_weight_max", - "task_page_size_min", - "task_page_size_None", - "pages", - "pages_none", - "graphrag_true", - "graphrag_false", - "graphrag_entity_types", - "graphrag_method_general", - "graphrag_method_light", - "graphrag_community_true", - "graphrag_community_false", - "graphrag_resolution_true", - "graphrag_resolution_false", - "raptor_true", - "raptor_false", - "raptor_prompt", - "raptor_max_token_min", - "raptor_max_token_mid", - "raptor_max_token_max", - "raptor_threshold_min", - "raptor_threshold_mid", - "raptor_threshold_max", - "raptor_max_cluster_min", - "raptor_max_cluster_mid", - "raptor_max_cluster_max", - "raptor_random_seed_min", - ], - ) - def test_parser_config(self, get_http_api_auth, name, parser_config): - payload = {"name": name, "parser_config": parser_config} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - for k, v in parser_config.items(): - if isinstance(v, dict): - for kk, vv in v.items(): - assert res["data"]["parser_config"][k][kk] == vv, res - else: - assert res["data"]["parser_config"][k] == v, res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "name, parser_config, expected_message", - [ - ("auto_keywords_min_limit", {"auto_keywords": -1}, "Input should be greater than or equal to 0"), - ("auto_keywords_max_limit", {"auto_keywords": 33}, "Input should be less than or equal to 32"), - ("auto_keywords_float_not_allowed", {"auto_keywords": 3.14}, "Input should be a valid integer, got a number with a fractional part"), - ("auto_keywords_type_invalid", {"auto_keywords": "string"}, "Input should be a valid integer, unable to parse string as an integer"), - ("auto_questions_min_limit", {"auto_questions": -1}, "Input should be greater than or equal to 0"), - ("auto_questions_max_limit", {"auto_questions": 11}, "Input should be less than or equal to 10"), - ("auto_questions_float_not_allowed", {"auto_questions": 3.14}, "Input should be a valid integer, got a number with a fractional part"), - ("auto_questions_type_invalid", {"auto_questions": "string"}, "Input should be a valid integer, unable to parse string as an integer"), - ("chunk_token_num_min_limit", {"chunk_token_num": 0}, "Input should be greater than or equal to 1"), - ("chunk_token_num_max_limit", {"chunk_token_num": 2049}, "Input should be less than or equal to 2048"), - ("chunk_token_num_float_not_allowed", {"chunk_token_num": 3.14}, "Input should be a valid integer, got a number with a fractional part"), - ("chunk_token_num_type_invalid", {"chunk_token_num": "string"}, "Input should be a valid integer, unable to parse string as an integer"), - ("delimiter_empty", {"delimiter": ""}, "String should have at least 1 character"), - ("html4excel_type_invalid", {"html4excel": "string"}, "Input should be a valid boolean, unable to interpret input"), - ("tag_kb_ids_not_list", {"tag_kb_ids": "1,2"}, "Input should be a valid list"), - ("tag_kb_ids_int_in_list", {"tag_kb_ids": [1, 2]}, "Input should be a valid string"), - ("topn_tags_min_limit", {"topn_tags": 0}, "Input should be greater than or equal to 1"), - ("topn_tags_max_limit", {"topn_tags": 11}, "Input should be less than or equal to 10"), - ("topn_tags_float_not_allowed", {"topn_tags": 3.14}, "Input should be a valid integer, got a number with a fractional part"), - ("topn_tags_type_invalid", {"topn_tags": "string"}, "Input should be a valid integer, unable to parse string as an integer"), - ("filename_embd_weight_min_limit", {"filename_embd_weight": -1}, "Input should be greater than or equal to 0"), - ("filename_embd_weight_max_limit", {"filename_embd_weight": 1.1}, "Input should be less than or equal to 1"), - ("filename_embd_weight_type_invalid", {"filename_embd_weight": "string"}, "Input should be a valid number, unable to parse string as a number"), - ("task_page_size_min_limit", {"task_page_size": 0}, "Input should be greater than or equal to 1"), - ("task_page_size_float_not_allowed", {"task_page_size": 3.14}, "Input should be a valid integer, got a number with a fractional part"), - ("task_page_size_type_invalid", {"task_page_size": "string"}, "Input should be a valid integer, unable to parse string as an integer"), - ("pages_not_list", {"pages": "1,2"}, "Input should be a valid list"), - ("pages_not_list_in_list", {"pages": ["1,2"]}, "Input should be a valid list"), - ("pages_not_int_list", {"pages": [["string1", "string2"]]}, "Input should be a valid integer, unable to parse string as an integer"), - ("graphrag_type_invalid", {"graphrag": {"use_graphrag": "string"}}, "Input should be a valid boolean, unable to interpret input"), - ("graphrag_entity_types_not_list", {"graphrag": {"entity_types": "1,2"}}, "Input should be a valid list"), - ("graphrag_entity_types_not_str_in_list", {"graphrag": {"entity_types": [1, 2]}}, "nput should be a valid string"), - ("graphrag_method_unknown", {"graphrag": {"method": "unknown"}}, "Input should be 'light' or 'general'"), - ("graphrag_method_none", {"graphrag": {"method": None}}, "Input should be 'light' or 'general'"), - ("graphrag_community_type_invalid", {"graphrag": {"community": "string"}}, "Input should be a valid boolean, unable to interpret input"), - ("graphrag_resolution_type_invalid", {"graphrag": {"resolution": "string"}}, "Input should be a valid boolean, unable to interpret input"), - ("raptor_type_invalid", {"raptor": {"use_raptor": "string"}}, "Input should be a valid boolean, unable to interpret input"), - ("raptor_prompt_empty", {"raptor": {"prompt": ""}}, "String should have at least 1 character"), - ("raptor_prompt_space", {"raptor": {"prompt": " "}}, "String should have at least 1 character"), - ("raptor_max_token_min_limit", {"raptor": {"max_token": 0}}, "Input should be greater than or equal to 1"), - ("raptor_max_token_max_limit", {"raptor": {"max_token": 2049}}, "Input should be less than or equal to 2048"), - ("raptor_max_token_float_not_allowed", {"raptor": {"max_token": 3.14}}, "Input should be a valid integer, got a number with a fractional part"), - ("raptor_max_token_type_invalid", {"raptor": {"max_token": "string"}}, "Input should be a valid integer, unable to parse string as an integer"), - ("raptor_threshold_min_limit", {"raptor": {"threshold": -0.1}}, "Input should be greater than or equal to 0"), - ("raptor_threshold_max_limit", {"raptor": {"threshold": 1.1}}, "Input should be less than or equal to 1"), - ("raptor_threshold_type_invalid", {"raptor": {"threshold": "string"}}, "Input should be a valid number, unable to parse string as a number"), - ("raptor_max_cluster_min_limit", {"raptor": {"max_cluster": 0}}, "Input should be greater than or equal to 1"), - ("raptor_max_cluster_max_limit", {"raptor": {"max_cluster": 1025}}, "Input should be less than or equal to 1024"), - ("raptor_max_cluster_float_not_allowed", {"raptor": {"max_cluster": 3.14}}, "Input should be a valid integer, got a number with a fractional par"), - ("raptor_max_cluster_type_invalid", {"raptor": {"max_cluster": "string"}}, "Input should be a valid integer, unable to parse string as an integer"), - ("raptor_random_seed_min_limit", {"raptor": {"random_seed": -1}}, "Input should be greater than or equal to 0"), - ("raptor_random_seed_float_not_allowed", {"raptor": {"random_seed": 3.14}}, "Input should be a valid integer, got a number with a fractional part"), - ("raptor_random_seed_type_invalid", {"raptor": {"random_seed": "string"}}, "Input should be a valid integer, unable to parse string as an integer"), - ("parser_config_type_invalid", {"delimiter": "a" * 65536}, "Parser config exceeds size limit (max 65,535 characters)"), - ], - ids=[ - "auto_keywords_min_limit", - "auto_keywords_max_limit", - "auto_keywords_float_not_allowed", - "auto_keywords_type_invalid", - "auto_questions_min_limit", - "auto_questions_max_limit", - "auto_questions_float_not_allowed", - "auto_questions_type_invalid", - "chunk_token_num_min_limit", - "chunk_token_num_max_limit", - "chunk_token_num_float_not_allowed", - "chunk_token_num_type_invalid", - "delimiter_empty", - "html4excel_type_invalid", - "tag_kb_ids_not_list", - "tag_kb_ids_int_in_list", - "topn_tags_min_limit", - "topn_tags_max_limit", - "topn_tags_float_not_allowed", - "topn_tags_type_invalid", - "filename_embd_weight_min_limit", - "filename_embd_weight_max_limit", - "filename_embd_weight_type_invalid", - "task_page_size_min_limit", - "task_page_size_float_not_allowed", - "task_page_size_type_invalid", - "pages_not_list", - "pages_not_list_in_list", - "pages_not_int_list", - "graphrag_type_invalid", - "graphrag_entity_types_not_list", - "graphrag_entity_types_not_str_in_list", - "graphrag_method_unknown", - "graphrag_method_none", - "graphrag_community_type_invalid", - "graphrag_resolution_type_invalid", - "raptor_type_invalid", - "raptor_prompt_empty", - "raptor_prompt_space", - "raptor_max_token_min_limit", - "raptor_max_token_max_limit", - "raptor_max_token_float_not_allowed", - "raptor_max_token_type_invalid", - "raptor_threshold_min_limit", - "raptor_threshold_max_limit", - "raptor_threshold_type_invalid", - "raptor_max_cluster_min_limit", - "raptor_max_cluster_max_limit", - "raptor_max_cluster_float_not_allowed", - "raptor_max_cluster_type_invalid", - "raptor_random_seed_min_limit", - "raptor_random_seed_float_not_allowed", - "raptor_random_seed_type_invalid", - "parser_config_type_invalid", - ], - ) - def test_parser_config_invalid(self, get_http_api_auth, name, parser_config, expected_message): - payload = {"name": name, "parser_config": parser_config} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 101, res - assert expected_message in res["message"], res - - @pytest.mark.p2 - def test_parser_config_empty(self, get_http_api_auth): - payload = {"name": "parser_config_empty", "parser_config": {}} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - assert res["data"]["parser_config"] == { - "chunk_token_num": 128, - "delimiter": r"\n", - "html4excel": False, - "layout_recognize": "DeepDOC", - "raptor": {"use_raptor": False}, - }, res - - @pytest.mark.p2 - def test_parser_config_unset(self, get_http_api_auth): - payload = {"name": "parser_config_unset"} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - assert res["data"]["parser_config"] == { - "chunk_token_num": 128, - "delimiter": r"\n", - "html4excel": False, - "layout_recognize": "DeepDOC", - "raptor": {"use_raptor": False}, - }, res - - @pytest.mark.p3 - def test_parser_config_none(self, get_http_api_auth): - payload = {"name": "parser_config_none", "parser_config": None} - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 0, res - assert res["data"]["parser_config"] == { - "chunk_token_num": 128, - "delimiter": "\\n", - "html4excel": False, - "layout_recognize": "DeepDOC", - "raptor": {"use_raptor": False}, - }, res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "payload", - [ - {"name": "id", "id": "id"}, - {"name": "tenant_id", "tenant_id": "e57c1966f99211efb41e9e45646e0111"}, - {"name": "created_by", "created_by": "created_by"}, - {"name": "create_date", "create_date": "Tue, 11 Mar 2025 13:37:23 GMT"}, - {"name": "create_time", "create_time": 1741671443322}, - {"name": "update_date", "update_date": "Tue, 11 Mar 2025 13:37:23 GMT"}, - {"name": "update_time", "update_time": 1741671443339}, - {"name": "document_count", "document_count": 1}, - {"name": "chunk_count", "chunk_count": 1}, - {"name": "token_num", "token_num": 1}, - {"name": "status", "status": "1"}, - {"name": "unknown_field", "unknown_field": "unknown_field"}, - ], - ) - def test_unsupported_field(self, get_http_api_auth, payload): - res = create_dataset(get_http_api_auth, payload) - assert res["code"] == 101, res - assert "Extra inputs are not permitted" in res["message"], res diff --git a/sdk/python/test/test_http_api/test_dataset_mangement/test_delete_datasets.py b/sdk/python/test/test_http_api/test_dataset_mangement/test_delete_datasets.py deleted file mode 100644 index a73a1568b30..00000000000 --- a/sdk/python/test/test_http_api/test_dataset_mangement/test_delete_datasets.py +++ /dev/null @@ -1,219 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import uuid -from concurrent.futures import ThreadPoolExecutor - -import pytest -from common import ( - INVALID_API_TOKEN, - batch_create_datasets, - delete_datasets, - list_datasets, -) -from libs.auth import RAGFlowHttpApiAuth - - -class TestAuthorization: - @pytest.mark.p1 - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_auth_invalid(self, auth, expected_code, expected_message): - res = delete_datasets(auth) - assert res["code"] == expected_code, res - assert res["message"] == expected_message, res - - -class TestRquest: - @pytest.mark.p3 - def test_content_type_bad(self, get_http_api_auth): - BAD_CONTENT_TYPE = "text/xml" - res = delete_datasets(get_http_api_auth, headers={"Content-Type": BAD_CONTENT_TYPE}) - assert res["code"] == 101, res - assert res["message"] == f"Unsupported content type: Expected application/json, got {BAD_CONTENT_TYPE}", res - - @pytest.mark.p3 - @pytest.mark.parametrize( - "payload, expected_message", - [ - ("a", "Malformed JSON syntax: Missing commas/brackets or invalid encoding"), - ('"a"', "Invalid request payload: expected object, got str"), - ], - ids=["malformed_json_syntax", "invalid_request_payload_type"], - ) - def test_payload_bad(self, get_http_api_auth, payload, expected_message): - res = delete_datasets(get_http_api_auth, data=payload) - assert res["code"] == 101, res - assert res["message"] == expected_message, res - - @pytest.mark.p3 - def test_payload_unset(self, get_http_api_auth): - res = delete_datasets(get_http_api_auth, None) - assert res["code"] == 101, res - assert res["message"] == "Malformed JSON syntax: Missing commas/brackets or invalid encoding", res - - -class TestCapability: - @pytest.mark.p3 - def test_delete_dataset_1k(self, get_http_api_auth): - ids = batch_create_datasets(get_http_api_auth, 1_000) - res = delete_datasets(get_http_api_auth, {"ids": ids}) - assert res["code"] == 0, res - - res = list_datasets(get_http_api_auth) - assert len(res["data"]) == 0, res - - @pytest.mark.p3 - def test_concurrent_deletion(self, get_http_api_auth): - dataset_num = 1_000 - ids = batch_create_datasets(get_http_api_auth, dataset_num) - - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [executor.submit(delete_datasets, get_http_api_auth, {"ids": ids[i : i + 1]}) for i in range(dataset_num)] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses), responses - - -class TestDatasetsDelete: - @pytest.mark.p1 - @pytest.mark.parametrize( - "func, expected_code, expected_message, remaining", - [ - (lambda r: {"ids": r[:1]}, 0, "", 2), - (lambda r: {"ids": r}, 0, "", 0), - ], - ids=["single_dataset", "multiple_datasets"], - ) - def test_ids(self, get_http_api_auth, add_datasets_func, func, expected_code, expected_message, remaining): - dataset_ids = add_datasets_func - if callable(func): - payload = func(dataset_ids) - res = delete_datasets(get_http_api_auth, payload) - assert res["code"] == expected_code, res - - res = list_datasets(get_http_api_auth) - assert len(res["data"]) == remaining, res - - @pytest.mark.p1 - @pytest.mark.usefixtures("add_dataset_func") - def test_ids_empty(self, get_http_api_auth): - payload = {"ids": []} - res = delete_datasets(get_http_api_auth, payload) - assert res["code"] == 0, res - - res = list_datasets(get_http_api_auth) - assert len(res["data"]) == 1, res - - @pytest.mark.p1 - @pytest.mark.usefixtures("add_datasets_func") - def test_ids_none(self, get_http_api_auth): - payload = {"ids": None} - res = delete_datasets(get_http_api_auth, payload) - assert res["code"] == 0, res - - res = list_datasets(get_http_api_auth) - assert len(res["data"]) == 0, res - - @pytest.mark.p2 - @pytest.mark.usefixtures("add_dataset_func") - def test_id_not_uuid(self, get_http_api_auth): - payload = {"ids": ["not_uuid"]} - res = delete_datasets(get_http_api_auth, payload) - assert res["code"] == 101, res - assert "Invalid UUID1 format" in res["message"], res - - res = list_datasets(get_http_api_auth) - assert len(res["data"]) == 1, res - - @pytest.mark.p3 - @pytest.mark.usefixtures("add_dataset_func") - def test_id_not_uuid1(self, get_http_api_auth): - payload = {"ids": [uuid.uuid4().hex]} - res = delete_datasets(get_http_api_auth, payload) - assert res["code"] == 101, res - assert "Invalid UUID1 format" in res["message"], res - - @pytest.mark.p2 - @pytest.mark.usefixtures("add_dataset_func") - def test_id_wrong_uuid(self, get_http_api_auth): - payload = {"ids": ["d94a8dc02c9711f0930f7fbc369eab6d"]} - res = delete_datasets(get_http_api_auth, payload) - assert res["code"] == 108, res - assert "lacks permission for dataset" in res["message"], res - - res = list_datasets(get_http_api_auth) - assert len(res["data"]) == 1, res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "func", - [ - lambda r: {"ids": ["d94a8dc02c9711f0930f7fbc369eab6d"] + r}, - lambda r: {"ids": r[:1] + ["d94a8dc02c9711f0930f7fbc369eab6d"] + r[1:3]}, - lambda r: {"ids": r + ["d94a8dc02c9711f0930f7fbc369eab6d"]}, - ], - ) - def test_ids_partial_invalid(self, get_http_api_auth, add_datasets_func, func): - dataset_ids = add_datasets_func - if callable(func): - payload = func(dataset_ids) - res = delete_datasets(get_http_api_auth, payload) - assert res["code"] == 108, res - assert "lacks permission for dataset" in res["message"], res - - res = list_datasets(get_http_api_auth) - assert len(res["data"]) == 3, res - - @pytest.mark.p2 - def test_ids_duplicate(self, get_http_api_auth, add_datasets_func): - dataset_ids = add_datasets_func - payload = {"ids": dataset_ids + dataset_ids} - res = delete_datasets(get_http_api_auth, payload) - assert res["code"] == 101, res - assert "Duplicate ids:" in res["message"], res - - res = list_datasets(get_http_api_auth) - assert len(res["data"]) == 3, res - - @pytest.mark.p2 - def test_repeated_delete(self, get_http_api_auth, add_datasets_func): - dataset_ids = add_datasets_func - payload = {"ids": dataset_ids} - res = delete_datasets(get_http_api_auth, payload) - assert res["code"] == 0, res - - res = delete_datasets(get_http_api_auth, payload) - assert res["code"] == 108, res - assert "lacks permission for dataset" in res["message"], res - - @pytest.mark.p2 - @pytest.mark.usefixtures("add_dataset_func") - def test_field_unsupported(self, get_http_api_auth): - payload = {"unknown_field": "unknown_field"} - res = delete_datasets(get_http_api_auth, payload) - assert res["code"] == 101, res - assert "Extra inputs are not permitted" in res["message"], res - - res = list_datasets(get_http_api_auth) - assert len(res["data"]) == 1, res diff --git a/sdk/python/test/test_http_api/test_dataset_mangement/test_list_datasets.py b/sdk/python/test/test_http_api/test_dataset_mangement/test_list_datasets.py deleted file mode 100644 index d81584aa585..00000000000 --- a/sdk/python/test/test_http_api/test_dataset_mangement/test_list_datasets.py +++ /dev/null @@ -1,339 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import uuid -from concurrent.futures import ThreadPoolExecutor - -import pytest -from common import INVALID_API_TOKEN, list_datasets -from libs.auth import RAGFlowHttpApiAuth -from libs.utils import is_sorted - - -class TestAuthorization: - @pytest.mark.p1 - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_auth_invalid(self, auth, expected_code, expected_message): - res = list_datasets(auth) - assert res["code"] == expected_code, res - assert res["message"] == expected_message, res - - -class TestCapability: - @pytest.mark.p3 - def test_concurrent_list(self, get_http_api_auth): - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [executor.submit(list_datasets, get_http_api_auth) for i in range(100)] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses), responses - - -@pytest.mark.usefixtures("add_datasets") -class TestDatasetsList: - @pytest.mark.p1 - def test_params_unset(self, get_http_api_auth): - res = list_datasets(get_http_api_auth, None) - assert res["code"] == 0, res - assert len(res["data"]) == 5, res - - @pytest.mark.p2 - def test_params_empty(self, get_http_api_auth): - res = list_datasets(get_http_api_auth, {}) - assert res["code"] == 0, res - assert len(res["data"]) == 5, res - - @pytest.mark.p1 - @pytest.mark.parametrize( - "params, expected_page_size", - [ - ({"page": 2, "page_size": 2}, 2), - ({"page": 3, "page_size": 2}, 1), - ({"page": 4, "page_size": 2}, 0), - ({"page": "2", "page_size": 2}, 2), - ({"page": 1, "page_size": 10}, 5), - ], - ids=["normal_middle_page", "normal_last_partial_page", "beyond_max_page", "string_page_number", "full_data_single_page"], - ) - def test_page(self, get_http_api_auth, params, expected_page_size): - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 0, res - assert len(res["data"]) == expected_page_size, res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "params, expected_code, expected_message", - [ - ({"page": 0}, 101, "Input should be greater than or equal to 1"), - ({"page": "a"}, 101, "Input should be a valid integer, unable to parse string as an integer"), - ], - ids=["page_0", "page_a"], - ) - def test_page_invalid(self, get_http_api_auth, params, expected_code, expected_message): - res = list_datasets(get_http_api_auth, params=params) - assert res["code"] == expected_code, res - assert expected_message in res["message"], res - - @pytest.mark.p2 - def test_page_none(self, get_http_api_auth): - params = {"page": None} - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 0, res - assert len(res["data"]) == 5, res - - @pytest.mark.p1 - @pytest.mark.parametrize( - "params, expected_page_size", - [ - ({"page_size": 1}, 1), - ({"page_size": 3}, 3), - ({"page_size": 5}, 5), - ({"page_size": 6}, 5), - ({"page_size": "1"}, 1), - ], - ids=["min_valid_page_size", "medium_page_size", "page_size_equals_total", "page_size_exceeds_total", "string_type_page_size"], - ) - def test_page_size(self, get_http_api_auth, params, expected_page_size): - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 0, res - assert len(res["data"]) == expected_page_size, res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "params, expected_code, expected_message", - [ - ({"page_size": 0}, 101, "Input should be greater than or equal to 1"), - ({"page_size": "a"}, 101, "Input should be a valid integer, unable to parse string as an integer"), - ], - ) - def test_page_size_invalid(self, get_http_api_auth, params, expected_code, expected_message): - res = list_datasets(get_http_api_auth, params) - assert res["code"] == expected_code, res - assert expected_message in res["message"], res - - @pytest.mark.p2 - def test_page_size_none(self, get_http_api_auth): - params = {"page_size": None} - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 0, res - assert len(res["data"]) == 5, res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "params, assertions", - [ - ({"orderby": "create_time"}, lambda r: (is_sorted(r["data"], "create_time", True))), - ({"orderby": "update_time"}, lambda r: (is_sorted(r["data"], "update_time", True))), - ({"orderby": "CREATE_TIME"}, lambda r: (is_sorted(r["data"], "create_time", True))), - ({"orderby": "UPDATE_TIME"}, lambda r: (is_sorted(r["data"], "update_time", True))), - ({"orderby": " create_time "}, lambda r: (is_sorted(r["data"], "update_time", True))), - ], - ids=["orderby_create_time", "orderby_update_time", "orderby_create_time_upper", "orderby_update_time_upper", "whitespace"], - ) - def test_orderby(self, get_http_api_auth, params, assertions): - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 0, res - if callable(assertions): - assert assertions(res), res - - @pytest.mark.p3 - @pytest.mark.parametrize( - "params", - [ - {"orderby": ""}, - {"orderby": "unknown"}, - ], - ids=["empty", "unknown"], - ) - def test_orderby_invalid(self, get_http_api_auth, params): - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 101, res - assert "Input should be 'create_time' or 'update_time'" in res["message"], res - - @pytest.mark.p3 - def test_orderby_none(self, get_http_api_auth): - params = {"order_by": None} - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 0, res - assert is_sorted(res["data"], "create_time", True), res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "params, assertions", - [ - ({"desc": True}, lambda r: (is_sorted(r["data"], "create_time", True))), - ({"desc": False}, lambda r: (is_sorted(r["data"], "create_time", False))), - ({"desc": "true"}, lambda r: (is_sorted(r["data"], "create_time", True))), - ({"desc": "false"}, lambda r: (is_sorted(r["data"], "create_time", False))), - ({"desc": 1}, lambda r: (is_sorted(r["data"], "create_time", True))), - ({"desc": 0}, lambda r: (is_sorted(r["data"], "create_time", False))), - ({"desc": "yes"}, lambda r: (is_sorted(r["data"], "create_time", True))), - ({"desc": "no"}, lambda r: (is_sorted(r["data"], "create_time", False))), - ({"desc": "y"}, lambda r: (is_sorted(r["data"], "create_time", True))), - ({"desc": "n"}, lambda r: (is_sorted(r["data"], "create_time", False))), - ], - ids=["desc=True", "desc=False", "desc=true", "desc=false", "desc=1", "desc=0", "desc=yes", "desc=no", "desc=y", "desc=n"], - ) - def test_desc(self, get_http_api_auth, params, assertions): - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 0, res - if callable(assertions): - assert assertions(res), res - - @pytest.mark.p3 - @pytest.mark.parametrize( - "params", - [ - {"desc": 3.14}, - {"desc": "unknown"}, - ], - ids=["empty", "unknown"], - ) - def test_desc_invalid(self, get_http_api_auth, params): - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 101, res - assert "Input should be a valid boolean, unable to interpret input" in res["message"], res - - @pytest.mark.p3 - def test_desc_none(self, get_http_api_auth): - params = {"desc": None} - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 0, res - assert is_sorted(res["data"], "create_time", True), res - - @pytest.mark.p1 - def test_name(self, get_http_api_auth): - params = {"name": "dataset_1"} - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 0, res - assert len(res["data"]) == 1, res - assert res["data"][0]["name"] == "dataset_1", res - - @pytest.mark.p2 - def test_name_wrong(self, get_http_api_auth): - params = {"name": "wrong name"} - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 108, res - assert "lacks permission for dataset" in res["message"], res - - @pytest.mark.p2 - def test_name_empty(self, get_http_api_auth): - params = {"name": ""} - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 0, res - assert len(res["data"]) == 5, res - - @pytest.mark.p2 - def test_name_none(self, get_http_api_auth): - params = {"name": None} - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 0, res - assert len(res["data"]) == 5, res - - @pytest.mark.p1 - def test_id(self, get_http_api_auth, add_datasets): - dataset_ids = add_datasets - params = {"id": dataset_ids[0]} - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 0 - assert len(res["data"]) == 1 - assert res["data"][0]["id"] == dataset_ids[0] - - @pytest.mark.p2 - def test_id_not_uuid(self, get_http_api_auth): - params = {"id": "not_uuid"} - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 101, res - assert "Invalid UUID1 format" in res["message"], res - - @pytest.mark.p2 - def test_id_not_uuid1(self, get_http_api_auth): - params = {"id": uuid.uuid4().hex} - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 101, res - assert "Invalid UUID1 format" in res["message"], res - - @pytest.mark.p2 - def test_id_wrong_uuid(self, get_http_api_auth): - params = {"id": "d94a8dc02c9711f0930f7fbc369eab6d"} - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 108, res - assert "lacks permission for dataset" in res["message"], res - - @pytest.mark.p2 - def test_id_empty(self, get_http_api_auth): - params = {"id": ""} - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 101, res - assert "Invalid UUID1 format" in res["message"], res - - @pytest.mark.p2 - def test_id_none(self, get_http_api_auth): - params = {"id": None} - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 0, res - assert len(res["data"]) == 5, res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "func, name, expected_num", - [ - (lambda r: r[0], "dataset_0", 1), - (lambda r: r[0], "dataset_1", 0), - ], - ids=["name_and_id_match", "name_and_id_mismatch"], - ) - def test_name_and_id(self, get_http_api_auth, add_datasets, func, name, expected_num): - dataset_ids = add_datasets - if callable(func): - params = {"id": func(dataset_ids), "name": name} - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 0, res - assert len(res["data"]) == expected_num, res - - @pytest.mark.p3 - @pytest.mark.parametrize( - "dataset_id, name", - [ - (lambda r: r[0], "wrong_name"), - (uuid.uuid1().hex, "dataset_0"), - ], - ids=["name", "id"], - ) - def test_name_and_id_wrong(self, get_http_api_auth, add_datasets, dataset_id, name): - dataset_ids = add_datasets - if callable(dataset_id): - params = {"id": dataset_id(dataset_ids), "name": name} - else: - params = {"id": dataset_id, "name": name} - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 108, res - assert "lacks permission for dataset" in res["message"], res - - @pytest.mark.p2 - def test_field_unsupported(self, get_http_api_auth): - params = {"unknown_field": "unknown_field"} - res = list_datasets(get_http_api_auth, params) - assert res["code"] == 101, res - assert "Extra inputs are not permitted" in res["message"], res diff --git a/sdk/python/test/test_http_api/test_dataset_mangement/test_update_dataset.py b/sdk/python/test/test_http_api/test_dataset_mangement/test_update_dataset.py deleted file mode 100644 index ba1d279c824..00000000000 --- a/sdk/python/test/test_http_api/test_dataset_mangement/test_update_dataset.py +++ /dev/null @@ -1,819 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import uuid -from concurrent.futures import ThreadPoolExecutor - -import pytest -from common import DATASET_NAME_LIMIT, INVALID_API_TOKEN, list_datasets, update_dataset -from hypothesis import HealthCheck, example, given, settings -from libs.auth import RAGFlowHttpApiAuth -from libs.utils import encode_avatar -from libs.utils.file_utils import create_image_file -from libs.utils.hypothesis_utils import valid_names - -# TODO: Missing scenario for updating embedding_model with chunk_count != 0 - - -class TestAuthorization: - @pytest.mark.p1 - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ids=["empty_auth", "invalid_api_token"], - ) - def test_auth_invalid(self, auth, expected_code, expected_message): - res = update_dataset(auth, "dataset_id") - assert res["code"] == expected_code, res - assert res["message"] == expected_message, res - - -class TestRquest: - @pytest.mark.p3 - def test_bad_content_type(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - BAD_CONTENT_TYPE = "text/xml" - res = update_dataset(get_http_api_auth, dataset_id, {"name": "bad_content_type"}, headers={"Content-Type": BAD_CONTENT_TYPE}) - assert res["code"] == 101, res - assert res["message"] == f"Unsupported content type: Expected application/json, got {BAD_CONTENT_TYPE}", res - - @pytest.mark.p3 - @pytest.mark.parametrize( - "payload, expected_message", - [ - ("a", "Malformed JSON syntax: Missing commas/brackets or invalid encoding"), - ('"a"', "Invalid request payload: expected object, got str"), - ], - ids=["malformed_json_syntax", "invalid_request_payload_type"], - ) - def test_payload_bad(self, get_http_api_auth, add_dataset_func, payload, expected_message): - dataset_id = add_dataset_func - res = update_dataset(get_http_api_auth, dataset_id, data=payload) - assert res["code"] == 101, res - assert res["message"] == expected_message, res - - @pytest.mark.p2 - def test_payload_empty(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - res = update_dataset(get_http_api_auth, dataset_id, {}) - assert res["code"] == 101, res - assert res["message"] == "No properties were modified", res - - @pytest.mark.p3 - def test_payload_unset(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - res = update_dataset(get_http_api_auth, dataset_id, None) - assert res["code"] == 101, res - assert res["message"] == "Malformed JSON syntax: Missing commas/brackets or invalid encoding", res - - -class TestCapability: - @pytest.mark.p3 - def test_update_dateset_concurrent(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [executor.submit(update_dataset, get_http_api_auth, dataset_id, {"name": f"dataset_{i}"}) for i in range(100)] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses), responses - - -class TestDatasetUpdate: - @pytest.mark.p3 - def test_dataset_id_not_uuid(self, get_http_api_auth): - payload = {"name": "not uuid"} - res = update_dataset(get_http_api_auth, "not_uuid", payload) - assert res["code"] == 101, res - assert "Invalid UUID1 format" in res["message"], res - - @pytest.mark.p3 - def test_dataset_id_not_uuid1(self, get_http_api_auth): - payload = {"name": "not uuid1"} - res = update_dataset(get_http_api_auth, uuid.uuid4().hex, payload) - assert res["code"] == 101, res - assert "Invalid UUID1 format" in res["message"], res - - @pytest.mark.p3 - def test_dataset_id_wrong_uuid(self, get_http_api_auth): - payload = {"name": "wrong uuid"} - res = update_dataset(get_http_api_auth, "d94a8dc02c9711f0930f7fbc369eab6d", payload) - assert res["code"] == 108, res - assert "lacks permission for dataset" in res["message"], res - - @pytest.mark.p1 - @given(name=valid_names()) - @example("a" * 128) - @settings(max_examples=20, suppress_health_check=[HealthCheck.function_scoped_fixture]) - def test_name(self, get_http_api_auth, add_dataset_func, name): - dataset_id = add_dataset_func - payload = {"name": name} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 0, res - - res = list_datasets(get_http_api_auth) - assert res["code"] == 0, res - assert res["data"][0]["name"] == name, res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "name, expected_message", - [ - ("", "String should have at least 1 character"), - (" ", "String should have at least 1 character"), - ("a" * (DATASET_NAME_LIMIT + 1), "String should have at most 128 characters"), - (0, "Input should be a valid string"), - (None, "Input should be a valid string"), - ], - ids=["empty_name", "space_name", "too_long_name", "invalid_name", "None_name"], - ) - def test_name_invalid(self, get_http_api_auth, add_dataset_func, name, expected_message): - dataset_id = add_dataset_func - payload = {"name": name} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 101, res - assert expected_message in res["message"], res - - @pytest.mark.p3 - def test_name_duplicated(self, get_http_api_auth, add_datasets_func): - dataset_ids = add_datasets_func[0] - name = "dataset_1" - payload = {"name": name} - res = update_dataset(get_http_api_auth, dataset_ids, payload) - assert res["code"] == 102, res - assert res["message"] == f"Dataset name '{name}' already exists", res - - @pytest.mark.p3 - def test_name_case_insensitive(self, get_http_api_auth, add_datasets_func): - dataset_id = add_datasets_func[0] - name = "DATASET_1" - payload = {"name": name} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 102, res - assert res["message"] == f"Dataset name '{name}' already exists", res - - @pytest.mark.p2 - def test_avatar(self, get_http_api_auth, add_dataset_func, tmp_path): - dataset_id = add_dataset_func - fn = create_image_file(tmp_path / "ragflow_test.png") - payload = { - "avatar": f"data:image/png;base64,{encode_avatar(fn)}", - } - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 0, res - - res = list_datasets(get_http_api_auth) - assert res["code"] == 0, res - assert res["data"][0]["avatar"] == f"data:image/png;base64,{encode_avatar(fn)}", res - - @pytest.mark.p2 - def test_avatar_exceeds_limit_length(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - payload = {"avatar": "a" * 65536} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 101, res - assert "String should have at most 65535 characters" in res["message"], res - - @pytest.mark.p3 - @pytest.mark.parametrize( - "avatar_prefix, expected_message", - [ - ("", "Missing MIME prefix. Expected format: data:;base64,"), - ("data:image/png;base64", "Missing MIME prefix. Expected format: data:;base64,"), - ("invalid_mine_prefix:image/png;base64,", "Invalid MIME prefix format. Must start with 'data:'"), - ("data:unsupported_mine_type;base64,", "Unsupported MIME type. Allowed: ['image/jpeg', 'image/png']"), - ], - ids=["empty_prefix", "missing_comma", "unsupported_mine_type", "invalid_mine_type"], - ) - def test_avatar_invalid_prefix(self, get_http_api_auth, add_dataset_func, tmp_path, avatar_prefix, expected_message): - dataset_id = add_dataset_func - fn = create_image_file(tmp_path / "ragflow_test.png") - payload = {"avatar": f"{avatar_prefix}{encode_avatar(fn)}"} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 101, res - assert expected_message in res["message"], res - - @pytest.mark.p3 - def test_avatar_none(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - payload = {"avatar": None} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 0, res - - res = list_datasets(get_http_api_auth) - assert res["code"] == 0, res - assert res["data"][0]["avatar"] is None, res - - @pytest.mark.p2 - def test_description(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - payload = {"description": "description"} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 0 - - res = list_datasets(get_http_api_auth, {"id": dataset_id}) - assert res["code"] == 0, res - assert res["data"][0]["description"] == "description" - - @pytest.mark.p2 - def test_description_exceeds_limit_length(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - payload = {"description": "a" * 65536} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 101, res - assert "String should have at most 65535 characters" in res["message"], res - - @pytest.mark.p3 - def test_description_none(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - payload = {"description": None} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 0, res - - res = list_datasets(get_http_api_auth, {"id": dataset_id}) - assert res["code"] == 0, res - assert res["data"][0]["description"] is None - - @pytest.mark.p1 - @pytest.mark.parametrize( - "embedding_model", - [ - "BAAI/bge-small-en-v1.5@Builtin", - "embedding-3@ZHIPU-AI", - ], - ids=["builtin_baai", "tenant_zhipu"], - ) - def test_embedding_model(self, get_http_api_auth, add_dataset_func, embedding_model): - dataset_id = add_dataset_func - payload = {"embedding_model": embedding_model} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 0, res - - res = list_datasets(get_http_api_auth) - assert res["code"] == 0, res - assert res["data"][0]["embedding_model"] == embedding_model, res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "name, embedding_model", - [ - ("unknown_llm_name", "unknown@ZHIPU-AI"), - ("unknown_llm_factory", "embedding-3@unknown"), - ("tenant_no_auth_default_tenant_llm", "text-embedding-v3@Tongyi-Qianwen"), - ("tenant_no_auth", "text-embedding-3-small@OpenAI"), - ], - ids=["unknown_llm_name", "unknown_llm_factory", "tenant_no_auth_default_tenant_llm", "tenant_no_auth"], - ) - def test_embedding_model_invalid(self, get_http_api_auth, add_dataset_func, name, embedding_model): - dataset_id = add_dataset_func - payload = {"name": name, "embedding_model": embedding_model} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 101, res - if "tenant_no_auth" in name: - assert res["message"] == f"Unauthorized model: <{embedding_model}>", res - else: - assert res["message"] == f"Unsupported model: <{embedding_model}>", res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "name, embedding_model", - [ - ("missing_at", "BAAI/bge-small-en-v1.5Builtin"), - ("missing_model_name", "@Builtin"), - ("missing_provider", "BAAI/bge-small-en-v1.5@"), - ("whitespace_only_model_name", " @Builtin"), - ("whitespace_only_provider", "BAAI/bge-small-en-v1.5@ "), - ], - ids=["missing_at", "empty_model_name", "empty_provider", "whitespace_only_model_name", "whitespace_only_provider"], - ) - def test_embedding_model_format(self, get_http_api_auth, add_dataset_func, name, embedding_model): - dataset_id = add_dataset_func - payload = {"name": name, "embedding_model": embedding_model} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 101, res - if name == "missing_at": - assert "Embedding model identifier must follow @ format" in res["message"], res - else: - assert "Both model_name and provider must be non-empty strings" in res["message"], res - - @pytest.mark.p2 - def test_embedding_model_none(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - payload = {"embedding_model": None} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 101, res - assert "Input should be a valid string" in res["message"], res - - @pytest.mark.p1 - @pytest.mark.parametrize( - "permission", - [ - "me", - "team", - "ME", - "TEAM", - " ME ", - ], - ids=["me", "team", "me_upercase", "team_upercase", "whitespace"], - ) - def test_permission(self, get_http_api_auth, add_dataset_func, permission): - dataset_id = add_dataset_func - payload = {"permission": permission} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 0, res - - res = list_datasets(get_http_api_auth) - assert res["code"] == 0, res - assert res["data"][0]["permission"] == permission.lower().strip(), res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "permission", - [ - "", - "unknown", - list(), - ], - ids=["empty", "unknown", "type_error"], - ) - def test_permission_invalid(self, get_http_api_auth, add_dataset_func, permission): - dataset_id = add_dataset_func - payload = {"permission": permission} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 101 - assert "Input should be 'me' or 'team'" in res["message"] - - @pytest.mark.p3 - def test_permission_none(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - payload = {"permission": None} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 101, res - assert "Input should be 'me' or 'team'" in res["message"], res - - @pytest.mark.p1 - @pytest.mark.parametrize( - "chunk_method", - [ - "naive", - "book", - "email", - "laws", - "manual", - "one", - "paper", - "picture", - "presentation", - "qa", - "table", - "tag", - ], - ids=["naive", "book", "email", "laws", "manual", "one", "paper", "picture", "presentation", "qa", "table", "tag"], - ) - def test_chunk_method(self, get_http_api_auth, add_dataset_func, chunk_method): - dataset_id = add_dataset_func - payload = {"chunk_method": chunk_method} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 0, res - - res = list_datasets(get_http_api_auth) - assert res["code"] == 0, res - assert res["data"][0]["chunk_method"] == chunk_method, res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "chunk_method", - [ - "", - "unknown", - list(), - ], - ids=["empty", "unknown", "type_error"], - ) - def test_chunk_method_invalid(self, get_http_api_auth, add_dataset_func, chunk_method): - dataset_id = add_dataset_func - payload = {"chunk_method": chunk_method} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 101, res - assert "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table' or 'tag'" in res["message"], res - - @pytest.mark.p3 - def test_chunk_method_none(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - payload = {"chunk_method": None} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 101, res - assert "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table' or 'tag'" in res["message"], res - - @pytest.mark.p2 - @pytest.mark.parametrize("pagerank", [0, 50, 100], ids=["min", "mid", "max"]) - def test_pagerank(self, get_http_api_auth, add_dataset_func, pagerank): - dataset_id = add_dataset_func - payload = {"pagerank": pagerank} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 0 - - res = list_datasets(get_http_api_auth, {"id": dataset_id}) - assert res["code"] == 0, res - assert res["data"][0]["pagerank"] == pagerank - - @pytest.mark.p2 - @pytest.mark.parametrize( - "pagerank, expected_message", - [ - (-1, "Input should be greater than or equal to 0"), - (101, "Input should be less than or equal to 100"), - ], - ids=["min_limit", "max_limit"], - ) - def test_pagerank_invalid(self, get_http_api_auth, add_dataset_func, pagerank, expected_message): - dataset_id = add_dataset_func - payload = {"pagerank": pagerank} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 101, res - assert expected_message in res["message"], res - - @pytest.mark.p3 - def test_pagerank_none(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - payload = {"pagerank": None} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 101, res - assert "Input should be a valid integer" in res["message"], res - - @pytest.mark.p1 - @pytest.mark.parametrize( - "parser_config", - [ - {"auto_keywords": 0}, - {"auto_keywords": 16}, - {"auto_keywords": 32}, - {"auto_questions": 0}, - {"auto_questions": 5}, - {"auto_questions": 10}, - {"chunk_token_num": 1}, - {"chunk_token_num": 1024}, - {"chunk_token_num": 2048}, - {"delimiter": "\n"}, - {"delimiter": " "}, - {"html4excel": True}, - {"html4excel": False}, - {"layout_recognize": "DeepDOC"}, - {"layout_recognize": "Plain Text"}, - {"tag_kb_ids": ["1", "2"]}, - {"topn_tags": 1}, - {"topn_tags": 5}, - {"topn_tags": 10}, - {"filename_embd_weight": 0.1}, - {"filename_embd_weight": 0.5}, - {"filename_embd_weight": 1.0}, - {"task_page_size": 1}, - {"task_page_size": None}, - {"pages": [[1, 100]]}, - {"pages": None}, - {"graphrag": {"use_graphrag": True}}, - {"graphrag": {"use_graphrag": False}}, - {"graphrag": {"entity_types": ["age", "sex", "height", "weight"]}}, - {"graphrag": {"method": "general"}}, - {"graphrag": {"method": "light"}}, - {"graphrag": {"community": True}}, - {"graphrag": {"community": False}}, - {"graphrag": {"resolution": True}}, - {"graphrag": {"resolution": False}}, - {"raptor": {"use_raptor": True}}, - {"raptor": {"use_raptor": False}}, - {"raptor": {"prompt": "Who are you?"}}, - {"raptor": {"max_token": 1}}, - {"raptor": {"max_token": 1024}}, - {"raptor": {"max_token": 2048}}, - {"raptor": {"threshold": 0.0}}, - {"raptor": {"threshold": 0.5}}, - {"raptor": {"threshold": 1.0}}, - {"raptor": {"max_cluster": 1}}, - {"raptor": {"max_cluster": 512}}, - {"raptor": {"max_cluster": 1024}}, - {"raptor": {"random_seed": 0}}, - ], - ids=[ - "auto_keywords_min", - "auto_keywords_mid", - "auto_keywords_max", - "auto_questions_min", - "auto_questions_mid", - "auto_questions_max", - "chunk_token_num_min", - "chunk_token_num_mid", - "chunk_token_num_max", - "delimiter", - "delimiter_space", - "html4excel_true", - "html4excel_false", - "layout_recognize_DeepDOC", - "layout_recognize_navie", - "tag_kb_ids", - "topn_tags_min", - "topn_tags_mid", - "topn_tags_max", - "filename_embd_weight_min", - "filename_embd_weight_mid", - "filename_embd_weight_max", - "task_page_size_min", - "task_page_size_None", - "pages", - "pages_none", - "graphrag_true", - "graphrag_false", - "graphrag_entity_types", - "graphrag_method_general", - "graphrag_method_light", - "graphrag_community_true", - "graphrag_community_false", - "graphrag_resolution_true", - "graphrag_resolution_false", - "raptor_true", - "raptor_false", - "raptor_prompt", - "raptor_max_token_min", - "raptor_max_token_mid", - "raptor_max_token_max", - "raptor_threshold_min", - "raptor_threshold_mid", - "raptor_threshold_max", - "raptor_max_cluster_min", - "raptor_max_cluster_mid", - "raptor_max_cluster_max", - "raptor_random_seed_min", - ], - ) - def test_parser_config(self, get_http_api_auth, add_dataset_func, parser_config): - dataset_id = add_dataset_func - payload = {"parser_config": parser_config} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 0, res - - res = list_datasets(get_http_api_auth) - assert res["code"] == 0, res - for k, v in parser_config.items(): - if isinstance(v, dict): - for kk, vv in v.items(): - assert res["data"][0]["parser_config"][k][kk] == vv, res - else: - assert res["data"][0]["parser_config"][k] == v, res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "parser_config, expected_message", - [ - ({"auto_keywords": -1}, "Input should be greater than or equal to 0"), - ({"auto_keywords": 33}, "Input should be less than or equal to 32"), - ({"auto_keywords": 3.14}, "Input should be a valid integer, got a number with a fractional part"), - ({"auto_keywords": "string"}, "Input should be a valid integer, unable to parse string as an integer"), - ({"auto_questions": -1}, "Input should be greater than or equal to 0"), - ({"auto_questions": 11}, "Input should be less than or equal to 10"), - ({"auto_questions": 3.14}, "Input should be a valid integer, got a number with a fractional part"), - ({"auto_questions": "string"}, "Input should be a valid integer, unable to parse string as an integer"), - ({"chunk_token_num": 0}, "Input should be greater than or equal to 1"), - ({"chunk_token_num": 2049}, "Input should be less than or equal to 2048"), - ({"chunk_token_num": 3.14}, "Input should be a valid integer, got a number with a fractional part"), - ({"chunk_token_num": "string"}, "Input should be a valid integer, unable to parse string as an integer"), - ({"delimiter": ""}, "String should have at least 1 character"), - ({"html4excel": "string"}, "Input should be a valid boolean, unable to interpret input"), - ({"tag_kb_ids": "1,2"}, "Input should be a valid list"), - ({"tag_kb_ids": [1, 2]}, "Input should be a valid string"), - ({"topn_tags": 0}, "Input should be greater than or equal to 1"), - ({"topn_tags": 11}, "Input should be less than or equal to 10"), - ({"topn_tags": 3.14}, "Input should be a valid integer, got a number with a fractional part"), - ({"topn_tags": "string"}, "Input should be a valid integer, unable to parse string as an integer"), - ({"filename_embd_weight": -1}, "Input should be greater than or equal to 0"), - ({"filename_embd_weight": 1.1}, "Input should be less than or equal to 1"), - ({"filename_embd_weight": "string"}, "Input should be a valid number, unable to parse string as a number"), - ({"task_page_size": 0}, "Input should be greater than or equal to 1"), - ({"task_page_size": 3.14}, "Input should be a valid integer, got a number with a fractional part"), - ({"task_page_size": "string"}, "Input should be a valid integer, unable to parse string as an integer"), - ({"pages": "1,2"}, "Input should be a valid list"), - ({"pages": ["1,2"]}, "Input should be a valid list"), - ({"pages": [["string1", "string2"]]}, "Input should be a valid integer, unable to parse string as an integer"), - ({"graphrag": {"use_graphrag": "string"}}, "Input should be a valid boolean, unable to interpret input"), - ({"graphrag": {"entity_types": "1,2"}}, "Input should be a valid list"), - ({"graphrag": {"entity_types": [1, 2]}}, "nput should be a valid string"), - ({"graphrag": {"method": "unknown"}}, "Input should be 'light' or 'general'"), - ({"graphrag": {"method": None}}, "Input should be 'light' or 'general'"), - ({"graphrag": {"community": "string"}}, "Input should be a valid boolean, unable to interpret input"), - ({"graphrag": {"resolution": "string"}}, "Input should be a valid boolean, unable to interpret input"), - ({"raptor": {"use_raptor": "string"}}, "Input should be a valid boolean, unable to interpret input"), - ({"raptor": {"prompt": ""}}, "String should have at least 1 character"), - ({"raptor": {"prompt": " "}}, "String should have at least 1 character"), - ({"raptor": {"max_token": 0}}, "Input should be greater than or equal to 1"), - ({"raptor": {"max_token": 2049}}, "Input should be less than or equal to 2048"), - ({"raptor": {"max_token": 3.14}}, "Input should be a valid integer, got a number with a fractional part"), - ({"raptor": {"max_token": "string"}}, "Input should be a valid integer, unable to parse string as an integer"), - ({"raptor": {"threshold": -0.1}}, "Input should be greater than or equal to 0"), - ({"raptor": {"threshold": 1.1}}, "Input should be less than or equal to 1"), - ({"raptor": {"threshold": "string"}}, "Input should be a valid number, unable to parse string as a number"), - ({"raptor": {"max_cluster": 0}}, "Input should be greater than or equal to 1"), - ({"raptor": {"max_cluster": 1025}}, "Input should be less than or equal to 1024"), - ({"raptor": {"max_cluster": 3.14}}, "Input should be a valid integer, got a number with a fractional par"), - ({"raptor": {"max_cluster": "string"}}, "Input should be a valid integer, unable to parse string as an integer"), - ({"raptor": {"random_seed": -1}}, "Input should be greater than or equal to 0"), - ({"raptor": {"random_seed": 3.14}}, "Input should be a valid integer, got a number with a fractional part"), - ({"raptor": {"random_seed": "string"}}, "Input should be a valid integer, unable to parse string as an integer"), - ({"delimiter": "a" * 65536}, "Parser config exceeds size limit (max 65,535 characters)"), - ], - ids=[ - "auto_keywords_min_limit", - "auto_keywords_max_limit", - "auto_keywords_float_not_allowed", - "auto_keywords_type_invalid", - "auto_questions_min_limit", - "auto_questions_max_limit", - "auto_questions_float_not_allowed", - "auto_questions_type_invalid", - "chunk_token_num_min_limit", - "chunk_token_num_max_limit", - "chunk_token_num_float_not_allowed", - "chunk_token_num_type_invalid", - "delimiter_empty", - "html4excel_type_invalid", - "tag_kb_ids_not_list", - "tag_kb_ids_int_in_list", - "topn_tags_min_limit", - "topn_tags_max_limit", - "topn_tags_float_not_allowed", - "topn_tags_type_invalid", - "filename_embd_weight_min_limit", - "filename_embd_weight_max_limit", - "filename_embd_weight_type_invalid", - "task_page_size_min_limit", - "task_page_size_float_not_allowed", - "task_page_size_type_invalid", - "pages_not_list", - "pages_not_list_in_list", - "pages_not_int_list", - "graphrag_type_invalid", - "graphrag_entity_types_not_list", - "graphrag_entity_types_not_str_in_list", - "graphrag_method_unknown", - "graphrag_method_none", - "graphrag_community_type_invalid", - "graphrag_resolution_type_invalid", - "raptor_type_invalid", - "raptor_prompt_empty", - "raptor_prompt_space", - "raptor_max_token_min_limit", - "raptor_max_token_max_limit", - "raptor_max_token_float_not_allowed", - "raptor_max_token_type_invalid", - "raptor_threshold_min_limit", - "raptor_threshold_max_limit", - "raptor_threshold_type_invalid", - "raptor_max_cluster_min_limit", - "raptor_max_cluster_max_limit", - "raptor_max_cluster_float_not_allowed", - "raptor_max_cluster_type_invalid", - "raptor_random_seed_min_limit", - "raptor_random_seed_float_not_allowed", - "raptor_random_seed_type_invalid", - "parser_config_type_invalid", - ], - ) - def test_parser_config_invalid(self, get_http_api_auth, add_dataset_func, parser_config, expected_message): - dataset_id = add_dataset_func - payload = {"parser_config": parser_config} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 101, res - assert expected_message in res["message"], res - - @pytest.mark.p2 - def test_parser_config_empty(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - payload = {"parser_config": {}} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 0, res - - res = list_datasets(get_http_api_auth) - assert res["code"] == 0, res - assert res["data"][0]["parser_config"] == { - "chunk_token_num": 128, - "delimiter": r"\n", - "html4excel": False, - "layout_recognize": "DeepDOC", - "raptor": {"use_raptor": False}, - }, res - - @pytest.mark.p3 - def test_parser_config_none(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - payload = {"parser_config": None} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 0, res - - res = list_datasets(get_http_api_auth, {"id": dataset_id}) - assert res["code"] == 0, res - assert res["data"][0]["parser_config"] == { - "chunk_token_num": 128, - "delimiter": r"\n", - "html4excel": False, - "layout_recognize": "DeepDOC", - "raptor": {"use_raptor": False}, - }, res - - @pytest.mark.p3 - def test_parser_config_empty_with_chunk_method_change(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - payload = {"chunk_method": "qa", "parser_config": {}} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 0, res - - res = list_datasets(get_http_api_auth) - assert res["code"] == 0, res - assert res["data"][0]["parser_config"] == {"raptor": {"use_raptor": False}}, res - - @pytest.mark.p3 - def test_parser_config_unset_with_chunk_method_change(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - payload = {"chunk_method": "qa"} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 0, res - - res = list_datasets(get_http_api_auth) - assert res["code"] == 0, res - assert res["data"][0]["parser_config"] == {"raptor": {"use_raptor": False}}, res - - @pytest.mark.p3 - def test_parser_config_none_with_chunk_method_change(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - payload = {"chunk_method": "qa", "parser_config": None} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 0, res - - res = list_datasets(get_http_api_auth, {"id": dataset_id}) - assert res["code"] == 0, res - assert res["data"][0]["parser_config"] == {"raptor": {"use_raptor": False}}, res - - @pytest.mark.p2 - @pytest.mark.parametrize( - "payload", - [ - {"id": "id"}, - {"tenant_id": "e57c1966f99211efb41e9e45646e0111"}, - {"created_by": "created_by"}, - {"create_date": "Tue, 11 Mar 2025 13:37:23 GMT"}, - {"create_time": 1741671443322}, - {"update_date": "Tue, 11 Mar 2025 13:37:23 GMT"}, - {"update_time": 1741671443339}, - {"document_count": 1}, - {"chunk_count": 1}, - {"token_num": 1}, - {"status": "1"}, - {"unknown_field": "unknown_field"}, - ], - ) - def test_field_unsupported(self, get_http_api_auth, add_dataset_func, payload): - dataset_id = add_dataset_func - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 101, res - assert "Extra inputs are not permitted" in res["message"], res - - @pytest.mark.p2 - def test_field_unset(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - res = list_datasets(get_http_api_auth) - assert res["code"] == 0, res - original_data = res["data"][0] - - payload = {"name": "default_unset"} - res = update_dataset(get_http_api_auth, dataset_id, payload) - assert res["code"] == 0, res - - res = list_datasets(get_http_api_auth) - assert res["code"] == 0, res - assert res["data"][0]["avatar"] == original_data["avatar"], res - assert res["data"][0]["description"] == original_data["description"], res - assert res["data"][0]["embedding_model"] == original_data["embedding_model"], res - assert res["data"][0]["permission"] == original_data["permission"], res - assert res["data"][0]["chunk_method"] == original_data["chunk_method"], res - assert res["data"][0]["pagerank"] == original_data["pagerank"], res - assert res["data"][0]["parser_config"] == { - "chunk_token_num": 128, - "delimiter": r"\n", - "html4excel": False, - "layout_recognize": "DeepDOC", - "raptor": {"use_raptor": False}, - }, res diff --git a/sdk/python/test/test_http_api/test_file_management_within_dataset/conftest.py b/sdk/python/test/test_http_api/test_file_management_within_dataset/conftest.py deleted file mode 100644 index 3f48b205648..00000000000 --- a/sdk/python/test/test_http_api/test_file_management_within_dataset/conftest.py +++ /dev/null @@ -1,51 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - - -import pytest -from common import bulk_upload_documents, delete_documnets - - -@pytest.fixture(scope="function") -def add_document_func(request, get_http_api_auth, add_dataset, ragflow_tmp_dir): - dataset_id = add_dataset - document_ids = bulk_upload_documents(get_http_api_auth, dataset_id, 1, ragflow_tmp_dir) - - def cleanup(): - delete_documnets(get_http_api_auth, dataset_id, {"ids": document_ids}) - - request.addfinalizer(cleanup) - return dataset_id, document_ids[0] - - -@pytest.fixture(scope="class") -def add_documents(request, get_http_api_auth, add_dataset, ragflow_tmp_dir): - dataset_id = add_dataset - document_ids = bulk_upload_documents(get_http_api_auth, dataset_id, 5, ragflow_tmp_dir) - - def cleanup(): - delete_documnets(get_http_api_auth, dataset_id, {"ids": document_ids}) - - request.addfinalizer(cleanup) - return dataset_id, document_ids - - -@pytest.fixture(scope="function") -def add_documents_func(get_http_api_auth, add_dataset_func, ragflow_tmp_dir): - dataset_id = add_dataset_func - document_ids = bulk_upload_documents(get_http_api_auth, dataset_id, 3, ragflow_tmp_dir) - - return dataset_id, document_ids diff --git a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_delete_documents.py b/sdk/python/test/test_http_api/test_file_management_within_dataset/test_delete_documents.py deleted file mode 100644 index 491cf661a09..00000000000 --- a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_delete_documents.py +++ /dev/null @@ -1,181 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from concurrent.futures import ThreadPoolExecutor - -import pytest -from common import INVALID_API_TOKEN, bulk_upload_documents, delete_documnets, list_documnets -from libs.auth import RAGFlowHttpApiAuth - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = delete_documnets(auth, "dataset_id") - assert res["code"] == expected_code - assert res["message"] == expected_message - - -class TestDocumentsDeletion: - @pytest.mark.p1 - @pytest.mark.parametrize( - "payload, expected_code, expected_message, remaining", - [ - (None, 0, "", 0), - ({"ids": []}, 0, "", 0), - ({"ids": ["invalid_id"]}, 102, "Documents not found: ['invalid_id']", 3), - ( - {"ids": ["\n!?。;!?\"'"]}, - 102, - """Documents not found: [\'\\n!?。;!?"\\\'\']""", - 3, - ), - ( - "not json", - 100, - "AttributeError(\"'str' object has no attribute 'get'\")", - 3, - ), - (lambda r: {"ids": r[:1]}, 0, "", 2), - (lambda r: {"ids": r}, 0, "", 0), - ], - ) - def test_basic_scenarios( - self, - get_http_api_auth, - add_documents_func, - payload, - expected_code, - expected_message, - remaining, - ): - dataset_id, document_ids = add_documents_func - if callable(payload): - payload = payload(document_ids) - res = delete_documnets(get_http_api_auth, dataset_id, payload) - assert res["code"] == expected_code - if res["code"] != 0: - assert res["message"] == expected_message - - res = list_documnets(get_http_api_auth, dataset_id) - assert len(res["data"]["docs"]) == remaining - assert res["data"]["total"] == remaining - - @pytest.mark.p3 - @pytest.mark.parametrize( - "dataset_id, expected_code, expected_message", - [ - ("", 100, ""), - ( - "invalid_dataset_id", - 102, - "You don't own the dataset invalid_dataset_id. ", - ), - ], - ) - def test_invalid_dataset_id(self, get_http_api_auth, add_documents_func, dataset_id, expected_code, expected_message): - _, document_ids = add_documents_func - res = delete_documnets(get_http_api_auth, dataset_id, {"ids": document_ids[:1]}) - assert res["code"] == expected_code - assert res["message"] == expected_message - - @pytest.mark.p2 - @pytest.mark.parametrize( - "payload", - [ - lambda r: {"ids": ["invalid_id"] + r}, - lambda r: {"ids": r[:1] + ["invalid_id"] + r[1:3]}, - lambda r: {"ids": r + ["invalid_id"]}, - ], - ) - def test_delete_partial_invalid_id(self, get_http_api_auth, add_documents_func, payload): - dataset_id, document_ids = add_documents_func - if callable(payload): - payload = payload(document_ids) - res = delete_documnets(get_http_api_auth, dataset_id, payload) - assert res["code"] == 102 - assert res["message"] == "Documents not found: ['invalid_id']" - - res = list_documnets(get_http_api_auth, dataset_id) - assert len(res["data"]["docs"]) == 0 - assert res["data"]["total"] == 0 - - @pytest.mark.p2 - def test_repeated_deletion(self, get_http_api_auth, add_documents_func): - dataset_id, document_ids = add_documents_func - res = delete_documnets(get_http_api_auth, dataset_id, {"ids": document_ids}) - assert res["code"] == 0 - - res = delete_documnets(get_http_api_auth, dataset_id, {"ids": document_ids}) - assert res["code"] == 102 - assert "Documents not found" in res["message"] - - @pytest.mark.p2 - def test_duplicate_deletion(self, get_http_api_auth, add_documents_func): - dataset_id, document_ids = add_documents_func - res = delete_documnets(get_http_api_auth, dataset_id, {"ids": document_ids + document_ids}) - assert res["code"] == 0 - assert "Duplicate document ids" in res["data"]["errors"][0] - assert res["data"]["success_count"] == 3 - - res = list_documnets(get_http_api_auth, dataset_id) - assert len(res["data"]["docs"]) == 0 - assert res["data"]["total"] == 0 - - -@pytest.mark.p3 -def test_concurrent_deletion(get_http_api_auth, add_dataset, tmp_path): - documnets_num = 100 - dataset_id = add_dataset - document_ids = bulk_upload_documents(get_http_api_auth, dataset_id, documnets_num, tmp_path) - - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [ - executor.submit( - delete_documnets, - get_http_api_auth, - dataset_id, - {"ids": document_ids[i : i + 1]}, - ) - for i in range(documnets_num) - ] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses) - - -@pytest.mark.p3 -def test_delete_1k(get_http_api_auth, add_dataset, tmp_path): - documnets_num = 1_000 - dataset_id = add_dataset - document_ids = bulk_upload_documents(get_http_api_auth, dataset_id, documnets_num, tmp_path) - res = list_documnets(get_http_api_auth, dataset_id) - assert res["data"]["total"] == documnets_num - - res = delete_documnets(get_http_api_auth, dataset_id, {"ids": document_ids}) - assert res["code"] == 0 - - res = list_documnets(get_http_api_auth, dataset_id) - assert res["data"]["total"] == 0 diff --git a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_download_document.py b/sdk/python/test/test_http_api/test_file_management_within_dataset/test_download_document.py deleted file mode 100644 index f90172b5ee9..00000000000 --- a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_download_document.py +++ /dev/null @@ -1,178 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import json -from concurrent.futures import ThreadPoolExecutor - -import pytest -from common import INVALID_API_TOKEN, bulk_upload_documents, download_document, upload_documnets -from libs.auth import RAGFlowHttpApiAuth -from libs.utils import compare_by_hash -from requests import codes - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, tmp_path, auth, expected_code, expected_message): - res = download_document(auth, "dataset_id", "document_id", tmp_path / "ragflow_tes.txt") - assert res.status_code == codes.ok - with (tmp_path / "ragflow_tes.txt").open("r") as f: - response_json = json.load(f) - assert response_json["code"] == expected_code - assert response_json["message"] == expected_message - - -@pytest.mark.p1 -@pytest.mark.parametrize( - "generate_test_files", - [ - "docx", - "excel", - "ppt", - "image", - "pdf", - "txt", - "md", - "json", - "eml", - "html", - ], - indirect=True, -) -def test_file_type_validation(get_http_api_auth, add_dataset, generate_test_files, request): - dataset_id = add_dataset - fp = generate_test_files[request.node.callspec.params["generate_test_files"]] - res = upload_documnets(get_http_api_auth, dataset_id, [fp]) - document_id = res["data"][0]["id"] - - res = download_document( - get_http_api_auth, - dataset_id, - document_id, - fp.with_stem("ragflow_test_download"), - ) - assert res.status_code == codes.ok - assert compare_by_hash( - fp, - fp.with_stem("ragflow_test_download"), - ) - - -class TestDocumentDownload: - @pytest.mark.p3 - @pytest.mark.parametrize( - "document_id, expected_code, expected_message", - [ - ( - "invalid_document_id", - 102, - "The dataset not own the document invalid_document_id.", - ), - ], - ) - def test_invalid_document_id(self, get_http_api_auth, add_documents, tmp_path, document_id, expected_code, expected_message): - dataset_id, _ = add_documents - res = download_document( - get_http_api_auth, - dataset_id, - document_id, - tmp_path / "ragflow_test_download_1.txt", - ) - assert res.status_code == codes.ok - with (tmp_path / "ragflow_test_download_1.txt").open("r") as f: - response_json = json.load(f) - assert response_json["code"] == expected_code - assert response_json["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "dataset_id, expected_code, expected_message", - [ - ("", 100, ""), - ( - "invalid_dataset_id", - 102, - "You do not own the dataset invalid_dataset_id.", - ), - ], - ) - def test_invalid_dataset_id(self, get_http_api_auth, add_documents, tmp_path, dataset_id, expected_code, expected_message): - _, document_ids = add_documents - res = download_document( - get_http_api_auth, - dataset_id, - document_ids[0], - tmp_path / "ragflow_test_download_1.txt", - ) - assert res.status_code == codes.ok - with (tmp_path / "ragflow_test_download_1.txt").open("r") as f: - response_json = json.load(f) - assert response_json["code"] == expected_code - assert response_json["message"] == expected_message - - @pytest.mark.p3 - def test_same_file_repeat(self, get_http_api_auth, add_documents, tmp_path, ragflow_tmp_dir): - num = 5 - dataset_id, document_ids = add_documents - for i in range(num): - res = download_document( - get_http_api_auth, - dataset_id, - document_ids[0], - tmp_path / f"ragflow_test_download_{i}.txt", - ) - assert res.status_code == codes.ok - assert compare_by_hash( - ragflow_tmp_dir / "ragflow_test_upload_0.txt", - tmp_path / f"ragflow_test_download_{i}.txt", - ) - - -@pytest.mark.p3 -def test_concurrent_download(get_http_api_auth, add_dataset, tmp_path): - document_count = 20 - dataset_id = add_dataset - document_ids = bulk_upload_documents(get_http_api_auth, dataset_id, document_count, tmp_path) - - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [ - executor.submit( - download_document, - get_http_api_auth, - dataset_id, - document_ids[i], - tmp_path / f"ragflow_test_download_{i}.txt", - ) - for i in range(document_count) - ] - responses = [f.result() for f in futures] - assert all(r.status_code == codes.ok for r in responses) - for i in range(document_count): - assert compare_by_hash( - tmp_path / f"ragflow_test_upload_{i}.txt", - tmp_path / f"ragflow_test_download_{i}.txt", - ) diff --git a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_list_documents.py b/sdk/python/test/test_http_api/test_file_management_within_dataset/test_list_documents.py deleted file mode 100644 index 5c5d48619e4..00000000000 --- a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_list_documents.py +++ /dev/null @@ -1,357 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from concurrent.futures import ThreadPoolExecutor - -import pytest -from common import INVALID_API_TOKEN, list_documnets -from libs.auth import RAGFlowHttpApiAuth -from libs.utils import is_sorted - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = list_documnets(auth, "dataset_id") - assert res["code"] == expected_code - assert res["message"] == expected_message - - -class TestDocumentsList: - @pytest.mark.p1 - def test_default(self, get_http_api_auth, add_documents): - dataset_id, _ = add_documents - res = list_documnets(get_http_api_auth, dataset_id) - assert res["code"] == 0 - assert len(res["data"]["docs"]) == 5 - assert res["data"]["total"] == 5 - - @pytest.mark.p3 - @pytest.mark.parametrize( - "dataset_id, expected_code, expected_message", - [ - ("", 100, ""), - ( - "invalid_dataset_id", - 102, - "You don't own the dataset invalid_dataset_id. ", - ), - ], - ) - def test_invalid_dataset_id(self, get_http_api_auth, dataset_id, expected_code, expected_message): - res = list_documnets(get_http_api_auth, dataset_id) - assert res["code"] == expected_code - assert res["message"] == expected_message - - @pytest.mark.p1 - @pytest.mark.parametrize( - "params, expected_code, expected_page_size, expected_message", - [ - ({"page": None, "page_size": 2}, 0, 2, ""), - ({"page": 0, "page_size": 2}, 0, 2, ""), - ({"page": 2, "page_size": 2}, 0, 2, ""), - ({"page": 3, "page_size": 2}, 0, 1, ""), - ({"page": "3", "page_size": 2}, 0, 1, ""), - pytest.param( - {"page": -1, "page_size": 2}, - 100, - 0, - "1064", - marks=pytest.mark.skip(reason="issues/5851"), - ), - pytest.param( - {"page": "a", "page_size": 2}, - 100, - 0, - """ValueError("invalid literal for int() with base 10: \'a\'")""", - marks=pytest.mark.skip(reason="issues/5851"), - ), - ], - ) - def test_page( - self, - get_http_api_auth, - add_documents, - params, - expected_code, - expected_page_size, - expected_message, - ): - dataset_id, _ = add_documents - res = list_documnets(get_http_api_auth, dataset_id, params=params) - assert res["code"] == expected_code - if expected_code == 0: - assert len(res["data"]["docs"]) == expected_page_size - assert res["data"]["total"] == 5 - else: - assert res["message"] == expected_message - - @pytest.mark.p1 - @pytest.mark.parametrize( - "params, expected_code, expected_page_size, expected_message", - [ - ({"page_size": None}, 0, 5, ""), - ({"page_size": 0}, 0, 0, ""), - ({"page_size": 1}, 0, 1, ""), - ({"page_size": 6}, 0, 5, ""), - ({"page_size": "1"}, 0, 1, ""), - pytest.param( - {"page_size": -1}, - 100, - 0, - "1064", - marks=pytest.mark.skip(reason="issues/5851"), - ), - pytest.param( - {"page_size": "a"}, - 100, - 0, - """ValueError("invalid literal for int() with base 10: \'a\'")""", - marks=pytest.mark.skip(reason="issues/5851"), - ), - ], - ) - def test_page_size( - self, - get_http_api_auth, - add_documents, - params, - expected_code, - expected_page_size, - expected_message, - ): - dataset_id, _ = add_documents - res = list_documnets(get_http_api_auth, dataset_id, params=params) - assert res["code"] == expected_code - if expected_code == 0: - assert len(res["data"]["docs"]) == expected_page_size - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "params, expected_code, assertions, expected_message", - [ - ({"orderby": None}, 0, lambda r: (is_sorted(r["data"]["docs"], "create_time", True)), ""), - ({"orderby": "create_time"}, 0, lambda r: (is_sorted(r["data"]["docs"], "create_time", True)), ""), - ({"orderby": "update_time"}, 0, lambda r: (is_sorted(r["data"]["docs"], "update_time", True)), ""), - pytest.param({"orderby": "name", "desc": "False"}, 0, lambda r: (is_sorted(r["data"]["docs"], "name", False)), "", marks=pytest.mark.skip(reason="issues/5851")), - pytest.param({"orderby": "unknown"}, 102, 0, "orderby should be create_time or update_time", marks=pytest.mark.skip(reason="issues/5851")), - ], - ) - def test_orderby( - self, - get_http_api_auth, - add_documents, - params, - expected_code, - assertions, - expected_message, - ): - dataset_id, _ = add_documents - res = list_documnets(get_http_api_auth, dataset_id, params=params) - assert res["code"] == expected_code - if expected_code == 0: - if callable(assertions): - assert assertions(res) - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "params, expected_code, assertions, expected_message", - [ - ({"desc": None}, 0, lambda r: (is_sorted(r["data"]["docs"], "create_time", True)), ""), - ({"desc": "true"}, 0, lambda r: (is_sorted(r["data"]["docs"], "create_time", True)), ""), - ({"desc": "True"}, 0, lambda r: (is_sorted(r["data"]["docs"], "create_time", True)), ""), - ({"desc": True}, 0, lambda r: (is_sorted(r["data"]["docs"], "create_time", True)), ""), - pytest.param({"desc": "false"}, 0, lambda r: (is_sorted(r["data"]["docs"], "create_time", False)), "", marks=pytest.mark.skip(reason="issues/5851")), - ({"desc": "False"}, 0, lambda r: (is_sorted(r["data"]["docs"], "create_time", False)), ""), - ({"desc": False}, 0, lambda r: (is_sorted(r["data"]["docs"], "create_time", False)), ""), - ({"desc": "False", "orderby": "update_time"}, 0, lambda r: (is_sorted(r["data"]["docs"], "update_time", False)), ""), - pytest.param({"desc": "unknown"}, 102, 0, "desc should be true or false", marks=pytest.mark.skip(reason="issues/5851")), - ], - ) - def test_desc( - self, - get_http_api_auth, - add_documents, - params, - expected_code, - assertions, - expected_message, - ): - dataset_id, _ = add_documents - res = list_documnets(get_http_api_auth, dataset_id, params=params) - assert res["code"] == expected_code - if expected_code == 0: - if callable(assertions): - assert assertions(res) - else: - assert res["message"] == expected_message - - @pytest.mark.p2 - @pytest.mark.parametrize( - "params, expected_num", - [ - ({"keywords": None}, 5), - ({"keywords": ""}, 5), - ({"keywords": "0"}, 1), - ({"keywords": "ragflow_test_upload"}, 5), - ({"keywords": "unknown"}, 0), - ], - ) - def test_keywords(self, get_http_api_auth, add_documents, params, expected_num): - dataset_id, _ = add_documents - res = list_documnets(get_http_api_auth, dataset_id, params=params) - assert res["code"] == 0 - assert len(res["data"]["docs"]) == expected_num - assert res["data"]["total"] == expected_num - - @pytest.mark.p1 - @pytest.mark.parametrize( - "params, expected_code, expected_num, expected_message", - [ - ({"name": None}, 0, 5, ""), - ({"name": ""}, 0, 5, ""), - ({"name": "ragflow_test_upload_0.txt"}, 0, 1, ""), - ( - {"name": "unknown.txt"}, - 102, - 0, - "You don't own the document unknown.txt.", - ), - ], - ) - def test_name( - self, - get_http_api_auth, - add_documents, - params, - expected_code, - expected_num, - expected_message, - ): - dataset_id, _ = add_documents - res = list_documnets(get_http_api_auth, dataset_id, params=params) - assert res["code"] == expected_code - if expected_code == 0: - if params["name"] in [None, ""]: - assert len(res["data"]["docs"]) == expected_num - else: - assert res["data"]["docs"][0]["name"] == params["name"] - else: - assert res["message"] == expected_message - - @pytest.mark.p1 - @pytest.mark.parametrize( - "document_id, expected_code, expected_num, expected_message", - [ - (None, 0, 5, ""), - ("", 0, 5, ""), - (lambda r: r[0], 0, 1, ""), - ("unknown.txt", 102, 0, "You don't own the document unknown.txt."), - ], - ) - def test_id( - self, - get_http_api_auth, - add_documents, - document_id, - expected_code, - expected_num, - expected_message, - ): - dataset_id, document_ids = add_documents - if callable(document_id): - params = {"id": document_id(document_ids)} - else: - params = {"id": document_id} - res = list_documnets(get_http_api_auth, dataset_id, params=params) - - assert res["code"] == expected_code - if expected_code == 0: - if params["id"] in [None, ""]: - assert len(res["data"]["docs"]) == expected_num - else: - assert res["data"]["docs"][0]["id"] == params["id"] - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "document_id, name, expected_code, expected_num, expected_message", - [ - (lambda r: r[0], "ragflow_test_upload_0.txt", 0, 1, ""), - (lambda r: r[0], "ragflow_test_upload_1.txt", 0, 0, ""), - (lambda r: r[0], "unknown", 102, 0, "You don't own the document unknown."), - ( - "id", - "ragflow_test_upload_0.txt", - 102, - 0, - "You don't own the document id.", - ), - ], - ) - def test_name_and_id( - self, - get_http_api_auth, - add_documents, - document_id, - name, - expected_code, - expected_num, - expected_message, - ): - dataset_id, document_ids = add_documents - if callable(document_id): - params = {"id": document_id(document_ids), "name": name} - else: - params = {"id": document_id, "name": name} - - res = list_documnets(get_http_api_auth, dataset_id, params=params) - if expected_code == 0: - assert len(res["data"]["docs"]) == expected_num - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - def test_concurrent_list(self, get_http_api_auth, add_documents): - dataset_id, _ = add_documents - - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [executor.submit(list_documnets, get_http_api_auth, dataset_id) for i in range(100)] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses) - - @pytest.mark.p3 - def test_invalid_params(self, get_http_api_auth, add_documents): - dataset_id, _ = add_documents - params = {"a": "b"} - res = list_documnets(get_http_api_auth, dataset_id, params=params) - assert res["code"] == 0 - assert len(res["data"]["docs"]) == 5 diff --git a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_parse_documents.py b/sdk/python/test/test_http_api/test_file_management_within_dataset/test_parse_documents.py deleted file mode 100644 index 0689f717277..00000000000 --- a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_parse_documents.py +++ /dev/null @@ -1,217 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from concurrent.futures import ThreadPoolExecutor - -import pytest -from common import INVALID_API_TOKEN, bulk_upload_documents, list_documnets, parse_documnets -from libs.auth import RAGFlowHttpApiAuth -from libs.utils import wait_for - - -@wait_for(30, 1, "Document parsing timeout") -def condition(_auth, _dataset_id, _document_ids=None): - res = list_documnets(_auth, _dataset_id) - target_docs = res["data"]["docs"] - - if _document_ids is None: - for doc in target_docs: - if doc["run"] != "DONE": - return False - return True - - target_ids = set(_document_ids) - for doc in target_docs: - if doc["id"] in target_ids: - if doc.get("run") != "DONE": - return False - return True - - -def validate_document_details(auth, dataset_id, document_ids): - for document_id in document_ids: - res = list_documnets(auth, dataset_id, params={"id": document_id}) - doc = res["data"]["docs"][0] - assert doc["run"] == "DONE" - assert len(doc["process_begin_at"]) > 0 - assert doc["process_duration"] > 0 - assert doc["progress"] > 0 - assert "Task done" in doc["progress_msg"] - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = parse_documnets(auth, "dataset_id") - assert res["code"] == expected_code - assert res["message"] == expected_message - - -class TestDocumentsParse: - @pytest.mark.parametrize( - "payload, expected_code, expected_message", - [ - pytest.param(None, 102, """AttributeError("\'NoneType\' object has no attribute \'get\'")""", marks=pytest.mark.skip), - pytest.param({"document_ids": []}, 102, "`document_ids` is required", marks=pytest.mark.p1), - pytest.param({"document_ids": ["invalid_id"]}, 102, "Documents not found: ['invalid_id']", marks=pytest.mark.p3), - pytest.param({"document_ids": ["\n!?。;!?\"'"]}, 102, """Documents not found: [\'\\n!?。;!?"\\\'\']""", marks=pytest.mark.p3), - pytest.param("not json", 102, "AttributeError(\"'str' object has no attribute 'get'\")", marks=pytest.mark.skip), - pytest.param(lambda r: {"document_ids": r[:1]}, 0, "", marks=pytest.mark.p1), - pytest.param(lambda r: {"document_ids": r}, 0, "", marks=pytest.mark.p1), - ], - ) - def test_basic_scenarios(self, get_http_api_auth, add_documents_func, payload, expected_code, expected_message): - dataset_id, document_ids = add_documents_func - if callable(payload): - payload = payload(document_ids) - res = parse_documnets(get_http_api_auth, dataset_id, payload) - assert res["code"] == expected_code - if expected_code != 0: - assert res["message"] == expected_message - if expected_code == 0: - condition(get_http_api_auth, dataset_id, payload["document_ids"]) - validate_document_details(get_http_api_auth, dataset_id, payload["document_ids"]) - - @pytest.mark.p3 - @pytest.mark.parametrize( - "dataset_id, expected_code, expected_message", - [ - ("", 100, ""), - ( - "invalid_dataset_id", - 102, - "You don't own the dataset invalid_dataset_id.", - ), - ], - ) - def test_invalid_dataset_id( - self, - get_http_api_auth, - add_documents_func, - dataset_id, - expected_code, - expected_message, - ): - _, document_ids = add_documents_func - res = parse_documnets(get_http_api_auth, dataset_id, {"document_ids": document_ids}) - assert res["code"] == expected_code - assert res["message"] == expected_message - - @pytest.mark.parametrize( - "payload", - [ - pytest.param(lambda r: {"document_ids": ["invalid_id"] + r}, marks=pytest.mark.p3), - pytest.param(lambda r: {"document_ids": r[:1] + ["invalid_id"] + r[1:3]}, marks=pytest.mark.p1), - pytest.param(lambda r: {"document_ids": r + ["invalid_id"]}, marks=pytest.mark.p3), - ], - ) - def test_parse_partial_invalid_document_id(self, get_http_api_auth, add_documents_func, payload): - dataset_id, document_ids = add_documents_func - if callable(payload): - payload = payload(document_ids) - res = parse_documnets(get_http_api_auth, dataset_id, payload) - assert res["code"] == 102 - assert res["message"] == "Documents not found: ['invalid_id']" - - condition(get_http_api_auth, dataset_id) - - validate_document_details(get_http_api_auth, dataset_id, document_ids) - - @pytest.mark.p3 - def test_repeated_parse(self, get_http_api_auth, add_documents_func): - dataset_id, document_ids = add_documents_func - res = parse_documnets(get_http_api_auth, dataset_id, {"document_ids": document_ids}) - assert res["code"] == 0 - - condition(get_http_api_auth, dataset_id) - - res = parse_documnets(get_http_api_auth, dataset_id, {"document_ids": document_ids}) - assert res["code"] == 0 - - @pytest.mark.p3 - def test_duplicate_parse(self, get_http_api_auth, add_documents_func): - dataset_id, document_ids = add_documents_func - res = parse_documnets(get_http_api_auth, dataset_id, {"document_ids": document_ids + document_ids}) - assert res["code"] == 0 - assert "Duplicate document ids" in res["data"]["errors"][0] - assert res["data"]["success_count"] == 3 - - condition(get_http_api_auth, dataset_id) - - validate_document_details(get_http_api_auth, dataset_id, document_ids) - - -@pytest.mark.p3 -def test_parse_100_files(get_http_api_auth, add_dataset_func, tmp_path): - @wait_for(100, 1, "Document parsing timeout") - def condition(_auth, _dataset_id, _document_num): - res = list_documnets(_auth, _dataset_id, {"page_size": _document_num}) - for doc in res["data"]["docs"]: - if doc["run"] != "DONE": - return False - return True - - document_num = 100 - dataset_id = add_dataset_func - document_ids = bulk_upload_documents(get_http_api_auth, dataset_id, document_num, tmp_path) - res = parse_documnets(get_http_api_auth, dataset_id, {"document_ids": document_ids}) - assert res["code"] == 0 - - condition(get_http_api_auth, dataset_id, document_num) - - validate_document_details(get_http_api_auth, dataset_id, document_ids) - - -@pytest.mark.p3 -def test_concurrent_parse(get_http_api_auth, add_dataset_func, tmp_path): - @wait_for(120, 1, "Document parsing timeout") - def condition(_auth, _dataset_id, _document_num): - res = list_documnets(_auth, _dataset_id, {"page_size": _document_num}) - for doc in res["data"]["docs"]: - if doc["run"] != "DONE": - return False - return True - - document_num = 100 - dataset_id = add_dataset_func - document_ids = bulk_upload_documents(get_http_api_auth, dataset_id, document_num, tmp_path) - - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [ - executor.submit( - parse_documnets, - get_http_api_auth, - dataset_id, - {"document_ids": document_ids[i : i + 1]}, - ) - for i in range(document_num) - ] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses) - - condition(get_http_api_auth, dataset_id, document_num) - - validate_document_details(get_http_api_auth, dataset_id, document_ids) diff --git a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_stop_parse_documents.py b/sdk/python/test/test_http_api/test_file_management_within_dataset/test_stop_parse_documents.py deleted file mode 100644 index 6f0927930f9..00000000000 --- a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_stop_parse_documents.py +++ /dev/null @@ -1,202 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from concurrent.futures import ThreadPoolExecutor -from time import sleep - -import pytest -from common import INVALID_API_TOKEN, bulk_upload_documents, list_documnets, parse_documnets, stop_parse_documnets -from libs.auth import RAGFlowHttpApiAuth -from libs.utils import wait_for - - -def validate_document_parse_done(auth, dataset_id, document_ids): - for document_id in document_ids: - res = list_documnets(auth, dataset_id, params={"id": document_id}) - doc = res["data"]["docs"][0] - assert doc["run"] == "DONE" - assert len(doc["process_begin_at"]) > 0 - assert doc["process_duration"] > 0 - assert doc["progress"] > 0 - assert "Task done" in doc["progress_msg"] - - -def validate_document_parse_cancel(auth, dataset_id, document_ids): - for document_id in document_ids: - res = list_documnets(auth, dataset_id, params={"id": document_id}) - doc = res["data"]["docs"][0] - assert doc["run"] == "CANCEL" - assert len(doc["process_begin_at"]) > 0 - assert doc["progress"] == 0.0 - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = stop_parse_documnets(auth, "dataset_id") - assert res["code"] == expected_code - assert res["message"] == expected_message - - -@pytest.mark.skip -class TestDocumentsParseStop: - @pytest.mark.parametrize( - "payload, expected_code, expected_message", - [ - pytest.param(None, 102, """AttributeError("\'NoneType\' object has no attribute \'get\'")""", marks=pytest.mark.skip), - pytest.param({"document_ids": []}, 102, "`document_ids` is required", marks=pytest.mark.p1), - pytest.param({"document_ids": ["invalid_id"]}, 102, "You don't own the document invalid_id.", marks=pytest.mark.p3), - pytest.param({"document_ids": ["\n!?。;!?\"'"]}, 102, """You don\'t own the document \n!?。;!?"\'.""", marks=pytest.mark.p3), - pytest.param("not json", 102, "AttributeError(\"'str' object has no attribute 'get'\")", marks=pytest.mark.skip), - pytest.param(lambda r: {"document_ids": r[:1]}, 0, "", marks=pytest.mark.p1), - pytest.param(lambda r: {"document_ids": r}, 0, "", marks=pytest.mark.p1), - ], - ) - def test_basic_scenarios(self, get_http_api_auth, add_documents_func, payload, expected_code, expected_message): - @wait_for(10, 1, "Document parsing timeout") - def condition(_auth, _dataset_id, _document_ids): - for _document_id in _document_ids: - res = list_documnets(_auth, _dataset_id, {"id": _document_id}) - if res["data"]["docs"][0]["run"] != "DONE": - return False - return True - - dataset_id, document_ids = add_documents_func - parse_documnets(get_http_api_auth, dataset_id, {"document_ids": document_ids}) - - if callable(payload): - payload = payload(document_ids) - - res = stop_parse_documnets(get_http_api_auth, dataset_id, payload) - assert res["code"] == expected_code - if expected_code == 0: - completed_document_ids = list(set(document_ids) - set(payload["document_ids"])) - condition(get_http_api_auth, dataset_id, completed_document_ids) - validate_document_parse_cancel(get_http_api_auth, dataset_id, payload["document_ids"]) - validate_document_parse_done(get_http_api_auth, dataset_id, completed_document_ids) - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "invalid_dataset_id, expected_code, expected_message", - [ - ("", 100, ""), - ( - "invalid_dataset_id", - 102, - "You don't own the dataset invalid_dataset_id.", - ), - ], - ) - def test_invalid_dataset_id( - self, - get_http_api_auth, - add_documents_func, - invalid_dataset_id, - expected_code, - expected_message, - ): - dataset_id, document_ids = add_documents_func - parse_documnets(get_http_api_auth, dataset_id, {"document_ids": document_ids}) - res = stop_parse_documnets(get_http_api_auth, invalid_dataset_id, {"document_ids": document_ids}) - assert res["code"] == expected_code - assert res["message"] == expected_message - - @pytest.mark.skip - @pytest.mark.parametrize( - "payload", - [ - lambda r: {"document_ids": ["invalid_id"] + r}, - lambda r: {"document_ids": r[:1] + ["invalid_id"] + r[1:3]}, - lambda r: {"document_ids": r + ["invalid_id"]}, - ], - ) - def test_stop_parse_partial_invalid_document_id(self, get_http_api_auth, add_documents_func, payload): - dataset_id, document_ids = add_documents_func - parse_documnets(get_http_api_auth, dataset_id, {"document_ids": document_ids}) - - if callable(payload): - payload = payload(document_ids) - res = stop_parse_documnets(get_http_api_auth, dataset_id, payload) - assert res["code"] == 102 - assert res["message"] == "You don't own the document invalid_id." - - validate_document_parse_cancel(get_http_api_auth, dataset_id, document_ids) - - @pytest.mark.p3 - def test_repeated_stop_parse(self, get_http_api_auth, add_documents_func): - dataset_id, document_ids = add_documents_func - parse_documnets(get_http_api_auth, dataset_id, {"document_ids": document_ids}) - res = stop_parse_documnets(get_http_api_auth, dataset_id, {"document_ids": document_ids}) - assert res["code"] == 0 - - res = stop_parse_documnets(get_http_api_auth, dataset_id, {"document_ids": document_ids}) - assert res["code"] == 102 - assert res["message"] == "Can't stop parsing document with progress at 0 or 1" - - @pytest.mark.p3 - def test_duplicate_stop_parse(self, get_http_api_auth, add_documents_func): - dataset_id, document_ids = add_documents_func - parse_documnets(get_http_api_auth, dataset_id, {"document_ids": document_ids}) - res = stop_parse_documnets(get_http_api_auth, dataset_id, {"document_ids": document_ids + document_ids}) - assert res["code"] == 0 - assert res["data"]["success_count"] == 3 - assert f"Duplicate document ids: {document_ids[0]}" in res["data"]["errors"] - - -@pytest.mark.skip(reason="unstable") -def test_stop_parse_100_files(get_http_api_auth, add_dataset_func, tmp_path): - document_num = 100 - dataset_id = add_dataset_func - document_ids = bulk_upload_documents(get_http_api_auth, dataset_id, document_num, tmp_path) - parse_documnets(get_http_api_auth, dataset_id, {"document_ids": document_ids}) - sleep(1) - res = stop_parse_documnets(get_http_api_auth, dataset_id, {"document_ids": document_ids}) - assert res["code"] == 0 - validate_document_parse_cancel(get_http_api_auth, dataset_id, document_ids) - - -@pytest.mark.skip(reason="unstable") -def test_concurrent_parse(get_http_api_auth, add_dataset_func, tmp_path): - document_num = 50 - dataset_id = add_dataset_func - document_ids = bulk_upload_documents(get_http_api_auth, dataset_id, document_num, tmp_path) - parse_documnets(get_http_api_auth, dataset_id, {"document_ids": document_ids}) - - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [ - executor.submit( - stop_parse_documnets, - get_http_api_auth, - dataset_id, - {"document_ids": document_ids[i : i + 1]}, - ) - for i in range(document_num) - ] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses) - validate_document_parse_cancel(get_http_api_auth, dataset_id, document_ids) diff --git a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_update_document.py b/sdk/python/test/test_http_api/test_file_management_within_dataset/test_update_document.py deleted file mode 100644 index 29dbc55bef2..00000000000 --- a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_update_document.py +++ /dev/null @@ -1,547 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - - -import pytest -from common import DOCUMENT_NAME_LIMIT, INVALID_API_TOKEN, list_documnets, update_documnet -from libs.auth import RAGFlowHttpApiAuth - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = update_documnet(auth, "dataset_id", "document_id") - assert res["code"] == expected_code - assert res["message"] == expected_message - - -class TestDocumentsUpdated: - @pytest.mark.p1 - @pytest.mark.parametrize( - "name, expected_code, expected_message", - [ - ("new_name.txt", 0, ""), - ( - f"{'a' * (DOCUMENT_NAME_LIMIT - 3)}.txt", - 101, - "The name should be less than 128 bytes.", - ), - ( - 0, - 100, - """AttributeError("\'int\' object has no attribute \'encode\'")""", - ), - ( - None, - 100, - """AttributeError("\'NoneType\' object has no attribute \'encode\'")""", - ), - ( - "", - 101, - "The extension of file can't be changed", - ), - ( - "ragflow_test_upload_0", - 101, - "The extension of file can't be changed", - ), - ( - "ragflow_test_upload_1.txt", - 102, - "Duplicated document name in the same dataset.", - ), - ( - "RAGFLOW_TEST_UPLOAD_1.TXT", - 0, - "", - ), - ], - ) - def test_name(self, get_http_api_auth, add_documents, name, expected_code, expected_message): - dataset_id, document_ids = add_documents - res = update_documnet(get_http_api_auth, dataset_id, document_ids[0], {"name": name}) - assert res["code"] == expected_code - if expected_code == 0: - res = list_documnets(get_http_api_auth, dataset_id, {"id": document_ids[0]}) - assert res["data"]["docs"][0]["name"] == name - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "document_id, expected_code, expected_message", - [ - ("", 100, ""), - ( - "invalid_document_id", - 102, - "The dataset doesn't own the document.", - ), - ], - ) - def test_invalid_document_id(self, get_http_api_auth, add_documents, document_id, expected_code, expected_message): - dataset_id, _ = add_documents - res = update_documnet(get_http_api_auth, dataset_id, document_id, {"name": "new_name.txt"}) - assert res["code"] == expected_code - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "dataset_id, expected_code, expected_message", - [ - ("", 100, ""), - ( - "invalid_dataset_id", - 102, - "You don't own the dataset.", - ), - ], - ) - def test_invalid_dataset_id(self, get_http_api_auth, add_documents, dataset_id, expected_code, expected_message): - _, document_ids = add_documents - res = update_documnet(get_http_api_auth, dataset_id, document_ids[0], {"name": "new_name.txt"}) - assert res["code"] == expected_code - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "meta_fields, expected_code, expected_message", - [({"test": "test"}, 0, ""), ("test", 102, "meta_fields must be a dictionary")], - ) - def test_meta_fields(self, get_http_api_auth, add_documents, meta_fields, expected_code, expected_message): - dataset_id, document_ids = add_documents - res = update_documnet(get_http_api_auth, dataset_id, document_ids[0], {"meta_fields": meta_fields}) - if expected_code == 0: - res = list_documnets(get_http_api_auth, dataset_id, {"id": document_ids[0]}) - assert res["data"]["docs"][0]["meta_fields"] == meta_fields - else: - assert res["message"] == expected_message - - @pytest.mark.p2 - @pytest.mark.parametrize( - "chunk_method, expected_code, expected_message", - [ - ("naive", 0, ""), - ("manual", 0, ""), - ("qa", 0, ""), - ("table", 0, ""), - ("paper", 0, ""), - ("book", 0, ""), - ("laws", 0, ""), - ("presentation", 0, ""), - ("picture", 0, ""), - ("one", 0, ""), - ("knowledge_graph", 0, ""), - ("email", 0, ""), - ("tag", 0, ""), - ("", 102, "`chunk_method` doesn't exist"), - ( - "other_chunk_method", - 102, - "`chunk_method` other_chunk_method doesn't exist", - ), - ], - ) - def test_chunk_method(self, get_http_api_auth, add_documents, chunk_method, expected_code, expected_message): - dataset_id, document_ids = add_documents - res = update_documnet(get_http_api_auth, dataset_id, document_ids[0], {"chunk_method": chunk_method}) - assert res["code"] == expected_code - if expected_code == 0: - res = list_documnets(get_http_api_auth, dataset_id, {"id": document_ids[0]}) - if chunk_method == "": - assert res["data"]["docs"][0]["chunk_method"] == "naive" - else: - assert res["data"]["docs"][0]["chunk_method"] == chunk_method - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "payload, expected_code, expected_message", - [ - ({"chunk_count": 1}, 102, "Can't change `chunk_count`."), - pytest.param( - {"create_date": "Fri, 14 Mar 2025 16:53:42 GMT"}, - 102, - "The input parameters are invalid.", - marks=pytest.mark.skip(reason="issues/6104"), - ), - pytest.param( - {"create_time": 1}, - 102, - "The input parameters are invalid.", - marks=pytest.mark.skip(reason="issues/6104"), - ), - pytest.param( - {"created_by": "ragflow_test"}, - 102, - "The input parameters are invalid.", - marks=pytest.mark.skip(reason="issues/6104"), - ), - pytest.param( - {"dataset_id": "ragflow_test"}, - 102, - "The input parameters are invalid.", - marks=pytest.mark.skip(reason="issues/6104"), - ), - pytest.param( - {"id": "ragflow_test"}, - 102, - "The input parameters are invalid.", - marks=pytest.mark.skip(reason="issues/6104"), - ), - pytest.param( - {"location": "ragflow_test.txt"}, - 102, - "The input parameters are invalid.", - marks=pytest.mark.skip(reason="issues/6104"), - ), - pytest.param( - {"process_begin_at": 1}, - 102, - "The input parameters are invalid.", - marks=pytest.mark.skip(reason="issues/6104"), - ), - pytest.param( - {"process_duration": 1.0}, - 102, - "The input parameters are invalid.", - marks=pytest.mark.skip(reason="issues/6104"), - ), - pytest.param({"progress": 1.0}, 102, "Can't change `progress`."), - pytest.param( - {"progress_msg": "ragflow_test"}, - 102, - "The input parameters are invalid.", - marks=pytest.mark.skip(reason="issues/6104"), - ), - pytest.param( - {"run": "ragflow_test"}, - 102, - "The input parameters are invalid.", - marks=pytest.mark.skip(reason="issues/6104"), - ), - pytest.param( - {"size": 1}, - 102, - "The input parameters are invalid.", - marks=pytest.mark.skip(reason="issues/6104"), - ), - pytest.param( - {"source_type": "ragflow_test"}, - 102, - "The input parameters are invalid.", - marks=pytest.mark.skip(reason="issues/6104"), - ), - pytest.param( - {"thumbnail": "ragflow_test"}, - 102, - "The input parameters are invalid.", - marks=pytest.mark.skip(reason="issues/6104"), - ), - ({"token_count": 1}, 102, "Can't change `token_count`."), - pytest.param( - {"type": "ragflow_test"}, - 102, - "The input parameters are invalid.", - marks=pytest.mark.skip(reason="issues/6104"), - ), - pytest.param( - {"update_date": "Fri, 14 Mar 2025 16:33:17 GMT"}, - 102, - "The input parameters are invalid.", - marks=pytest.mark.skip(reason="issues/6104"), - ), - pytest.param( - {"update_time": 1}, - 102, - "The input parameters are invalid.", - marks=pytest.mark.skip(reason="issues/6104"), - ), - ], - ) - def test_invalid_field( - self, - get_http_api_auth, - add_documents, - payload, - expected_code, - expected_message, - ): - dataset_id, document_ids = add_documents - res = update_documnet(get_http_api_auth, dataset_id, document_ids[0], payload) - assert res["code"] == expected_code - assert res["message"] == expected_message - - -class TestUpdateDocumentParserConfig: - @pytest.mark.p2 - @pytest.mark.parametrize( - "chunk_method, parser_config, expected_code, expected_message", - [ - ("naive", {}, 0, ""), - ( - "naive", - { - "chunk_token_num": 128, - "layout_recognize": "DeepDOC", - "html4excel": False, - "delimiter": r"\n", - "task_page_size": 12, - "raptor": {"use_raptor": False}, - }, - 0, - "", - ), - pytest.param( - "naive", - {"chunk_token_num": -1}, - 100, - "AssertionError('chunk_token_num should be in range from 1 to 100000000')", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"chunk_token_num": 0}, - 100, - "AssertionError('chunk_token_num should be in range from 1 to 100000000')", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"chunk_token_num": 100000000}, - 100, - "AssertionError('chunk_token_num should be in range from 1 to 100000000')", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"chunk_token_num": 3.14}, - 102, - "", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"chunk_token_num": "1024"}, - 100, - "", - marks=pytest.mark.skip(reason="issues/6098"), - ), - ( - "naive", - {"layout_recognize": "DeepDOC"}, - 0, - "", - ), - ( - "naive", - {"layout_recognize": "Naive"}, - 0, - "", - ), - ("naive", {"html4excel": True}, 0, ""), - ("naive", {"html4excel": False}, 0, ""), - pytest.param( - "naive", - {"html4excel": 1}, - 100, - "AssertionError('html4excel should be True or False')", - marks=pytest.mark.skip(reason="issues/6098"), - ), - ("naive", {"delimiter": ""}, 0, ""), - ("naive", {"delimiter": "`##`"}, 0, ""), - pytest.param( - "naive", - {"delimiter": 1}, - 100, - "", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"task_page_size": -1}, - 100, - "AssertionError('task_page_size should be in range from 1 to 100000000')", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"task_page_size": 0}, - 100, - "AssertionError('task_page_size should be in range from 1 to 100000000')", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"task_page_size": 100000000}, - 100, - "AssertionError('task_page_size should be in range from 1 to 100000000')", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"task_page_size": 3.14}, - 100, - "", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"task_page_size": "1024"}, - 100, - "", - marks=pytest.mark.skip(reason="issues/6098"), - ), - ("naive", {"raptor": {"use_raptor": True}}, 0, ""), - ("naive", {"raptor": {"use_raptor": False}}, 0, ""), - pytest.param( - "naive", - {"invalid_key": "invalid_value"}, - 100, - """AssertionError("Abnormal \'parser_config\'. Invalid key: invalid_key")""", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"auto_keywords": -1}, - 100, - "AssertionError('auto_keywords should be in range from 0 to 32')", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"auto_keywords": 32}, - 100, - "AssertionError('auto_keywords should be in range from 0 to 32')", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"auto_questions": 3.14}, - 100, - "", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"auto_keywords": "1024"}, - 100, - "", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"auto_questions": -1}, - 100, - "AssertionError('auto_questions should be in range from 0 to 10')", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"auto_questions": 10}, - 100, - "AssertionError('auto_questions should be in range from 0 to 10')", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"auto_questions": 3.14}, - 100, - "", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"auto_questions": "1024"}, - 100, - "", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"topn_tags": -1}, - 100, - "AssertionError('topn_tags should be in range from 0 to 10')", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"topn_tags": 10}, - 100, - "AssertionError('topn_tags should be in range from 0 to 10')", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"topn_tags": 3.14}, - 100, - "", - marks=pytest.mark.skip(reason="issues/6098"), - ), - pytest.param( - "naive", - {"topn_tags": "1024"}, - 100, - "", - marks=pytest.mark.skip(reason="issues/6098"), - ), - ], - ) - def test_parser_config( - self, - get_http_api_auth, - add_documents, - chunk_method, - parser_config, - expected_code, - expected_message, - ): - dataset_id, document_ids = add_documents - res = update_documnet( - get_http_api_auth, - dataset_id, - document_ids[0], - {"chunk_method": chunk_method, "parser_config": parser_config}, - ) - assert res["code"] == expected_code - if expected_code == 0: - res = list_documnets(get_http_api_auth, dataset_id, {"id": document_ids[0]}) - if parser_config == {}: - assert res["data"]["docs"][0]["parser_config"] == { - "chunk_token_num": 128, - "delimiter": r"\n", - "html4excel": False, - "layout_recognize": "DeepDOC", - "raptor": {"use_raptor": False}, - } - else: - for k, v in parser_config.items(): - assert res["data"]["docs"][0]["parser_config"][k] == v - if expected_code != 0 or expected_message: - assert res["message"] == expected_message diff --git a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_upload_documents.py b/sdk/python/test/test_http_api/test_file_management_within_dataset/test_upload_documents.py deleted file mode 100644 index 9d8269538ca..00000000000 --- a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_upload_documents.py +++ /dev/null @@ -1,218 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import string -from concurrent.futures import ThreadPoolExecutor - -import pytest -import requests -from common import DOCUMENT_NAME_LIMIT, FILE_API_URL, HOST_ADDRESS, INVALID_API_TOKEN, list_datasets, upload_documnets -from libs.auth import RAGFlowHttpApiAuth -from libs.utils.file_utils import create_txt_file -from requests_toolbelt import MultipartEncoder - - -@pytest.mark.p1 -@pytest.mark.usefixtures("clear_datasets") -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = upload_documnets(auth, "dataset_id") - assert res["code"] == expected_code - assert res["message"] == expected_message - - -class TestDocumentsUpload: - @pytest.mark.p1 - def test_valid_single_upload(self, get_http_api_auth, add_dataset_func, tmp_path): - dataset_id = add_dataset_func - fp = create_txt_file(tmp_path / "ragflow_test.txt") - res = upload_documnets(get_http_api_auth, dataset_id, [fp]) - assert res["code"] == 0 - assert res["data"][0]["dataset_id"] == dataset_id - assert res["data"][0]["name"] == fp.name - - @pytest.mark.p1 - @pytest.mark.parametrize( - "generate_test_files", - [ - "docx", - "excel", - "ppt", - "image", - "pdf", - "txt", - "md", - "json", - "eml", - "html", - ], - indirect=True, - ) - def test_file_type_validation(self, get_http_api_auth, add_dataset_func, generate_test_files, request): - dataset_id = add_dataset_func - fp = generate_test_files[request.node.callspec.params["generate_test_files"]] - res = upload_documnets(get_http_api_auth, dataset_id, [fp]) - assert res["code"] == 0 - assert res["data"][0]["dataset_id"] == dataset_id - assert res["data"][0]["name"] == fp.name - - @pytest.mark.p2 - @pytest.mark.parametrize( - "file_type", - ["exe", "unknown"], - ) - def test_unsupported_file_type(self, get_http_api_auth, add_dataset_func, tmp_path, file_type): - dataset_id = add_dataset_func - fp = tmp_path / f"ragflow_test.{file_type}" - fp.touch() - res = upload_documnets(get_http_api_auth, dataset_id, [fp]) - assert res["code"] == 500 - assert res["message"] == f"ragflow_test.{file_type}: This type of file has not been supported yet!" - - @pytest.mark.p2 - def test_missing_file(self, get_http_api_auth, add_dataset_func): - dataset_id = add_dataset_func - res = upload_documnets(get_http_api_auth, dataset_id) - assert res["code"] == 101 - assert res["message"] == "No file part!" - - @pytest.mark.p3 - def test_empty_file(self, get_http_api_auth, add_dataset_func, tmp_path): - dataset_id = add_dataset_func - fp = tmp_path / "empty.txt" - fp.touch() - - res = upload_documnets(get_http_api_auth, dataset_id, [fp]) - assert res["code"] == 0 - assert res["data"][0]["size"] == 0 - - @pytest.mark.p3 - def test_filename_empty(self, get_http_api_auth, add_dataset_func, tmp_path): - dataset_id = add_dataset_func - fp = create_txt_file(tmp_path / "ragflow_test.txt") - url = f"{HOST_ADDRESS}{FILE_API_URL}".format(dataset_id=dataset_id) - fields = (("file", ("", fp.open("rb"))),) - m = MultipartEncoder(fields=fields) - res = requests.post( - url=url, - headers={"Content-Type": m.content_type}, - auth=get_http_api_auth, - data=m, - ) - assert res.json()["code"] == 101 - assert res.json()["message"] == "No file selected!" - - @pytest.mark.p2 - def test_filename_exceeds_max_length(self, get_http_api_auth, add_dataset_func, tmp_path): - dataset_id = add_dataset_func - # filename_length = 129 - fp = create_txt_file(tmp_path / f"{'a' * (DOCUMENT_NAME_LIMIT - 3)}.txt") - res = upload_documnets(get_http_api_auth, dataset_id, [fp]) - assert res["code"] == 101 - assert res["message"] == "File name should be less than 128 bytes." - - @pytest.mark.p2 - def test_invalid_dataset_id(self, get_http_api_auth, tmp_path): - fp = create_txt_file(tmp_path / "ragflow_test.txt") - res = upload_documnets(get_http_api_auth, "invalid_dataset_id", [fp]) - assert res["code"] == 100 - assert res["message"] == """LookupError("Can\'t find the dataset with ID invalid_dataset_id!")""" - - @pytest.mark.p2 - def test_duplicate_files(self, get_http_api_auth, add_dataset_func, tmp_path): - dataset_id = add_dataset_func - fp = create_txt_file(tmp_path / "ragflow_test.txt") - res = upload_documnets(get_http_api_auth, dataset_id, [fp, fp]) - assert res["code"] == 0 - assert len(res["data"]) == 2 - for i in range(len(res["data"])): - assert res["data"][i]["dataset_id"] == dataset_id - expected_name = fp.name - if i != 0: - expected_name = f"{fp.stem}({i}){fp.suffix}" - assert res["data"][i]["name"] == expected_name - - @pytest.mark.p2 - def test_same_file_repeat(self, get_http_api_auth, add_dataset_func, tmp_path): - dataset_id = add_dataset_func - fp = create_txt_file(tmp_path / "ragflow_test.txt") - for i in range(10): - res = upload_documnets(get_http_api_auth, dataset_id, [fp]) - assert res["code"] == 0 - assert len(res["data"]) == 1 - assert res["data"][0]["dataset_id"] == dataset_id - expected_name = fp.name - if i != 0: - expected_name = f"{fp.stem}({i}){fp.suffix}" - assert res["data"][0]["name"] == expected_name - - @pytest.mark.p3 - def test_filename_special_characters(self, get_http_api_auth, add_dataset_func, tmp_path): - dataset_id = add_dataset_func - illegal_chars = '<>:"/\\|?*' - translation_table = str.maketrans({char: "_" for char in illegal_chars}) - safe_filename = string.punctuation.translate(translation_table) - fp = tmp_path / f"{safe_filename}.txt" - fp.write_text("Sample text content") - - res = upload_documnets(get_http_api_auth, dataset_id, [fp]) - assert res["code"] == 0 - assert len(res["data"]) == 1 - assert res["data"][0]["dataset_id"] == dataset_id - assert res["data"][0]["name"] == fp.name - - @pytest.mark.p1 - def test_multiple_files(self, get_http_api_auth, add_dataset_func, tmp_path): - dataset_id = add_dataset_func - expected_document_count = 20 - fps = [] - for i in range(expected_document_count): - fp = create_txt_file(tmp_path / f"ragflow_test_{i}.txt") - fps.append(fp) - res = upload_documnets(get_http_api_auth, dataset_id, fps) - assert res["code"] == 0 - - res = list_datasets(get_http_api_auth, {"id": dataset_id}) - assert res["data"][0]["document_count"] == expected_document_count - - @pytest.mark.p3 - def test_concurrent_upload(self, get_http_api_auth, add_dataset_func, tmp_path): - dataset_id = add_dataset_func - - expected_document_count = 20 - fps = [] - for i in range(expected_document_count): - fp = create_txt_file(tmp_path / f"ragflow_test_{i}.txt") - fps.append(fp) - - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [executor.submit(upload_documnets, get_http_api_auth, dataset_id, fps[i : i + 1]) for i in range(expected_document_count)] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses) - - res = list_datasets(get_http_api_auth, {"id": dataset_id}) - assert res["data"][0]["document_count"] == expected_document_count diff --git a/sdk/python/test/test_http_api/test_session_management/conftest.py b/sdk/python/test/test_http_api/test_session_management/conftest.py deleted file mode 100644 index 23ef37ec82f..00000000000 --- a/sdk/python/test/test_http_api/test_session_management/conftest.py +++ /dev/null @@ -1,53 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import pytest -from common import create_session_with_chat_assistant, delete_session_with_chat_assistants - - -@pytest.fixture(scope="class") -def add_sessions_with_chat_assistant(request, get_http_api_auth, add_chat_assistants): - _, _, chat_assistant_ids = add_chat_assistants - - def cleanup(): - for chat_assistant_id in chat_assistant_ids: - delete_session_with_chat_assistants(get_http_api_auth, chat_assistant_id) - - request.addfinalizer(cleanup) - - session_ids = [] - for i in range(5): - res = create_session_with_chat_assistant(get_http_api_auth, chat_assistant_ids[0], {"name": f"session_with_chat_assistant_{i}"}) - session_ids.append(res["data"]["id"]) - - return chat_assistant_ids[0], session_ids - - -@pytest.fixture(scope="function") -def add_sessions_with_chat_assistant_func(request, get_http_api_auth, add_chat_assistants): - _, _, chat_assistant_ids = add_chat_assistants - - def cleanup(): - for chat_assistant_id in chat_assistant_ids: - delete_session_with_chat_assistants(get_http_api_auth, chat_assistant_id) - - request.addfinalizer(cleanup) - - session_ids = [] - for i in range(5): - res = create_session_with_chat_assistant(get_http_api_auth, chat_assistant_ids[0], {"name": f"session_with_chat_assistant_{i}"}) - session_ids.append(res["data"]["id"]) - - return chat_assistant_ids[0], session_ids diff --git a/sdk/python/test/test_http_api/test_session_management/test_create_session_with_chat_assistant.py b/sdk/python/test/test_http_api/test_session_management/test_create_session_with_chat_assistant.py deleted file mode 100644 index 17ebce11c08..00000000000 --- a/sdk/python/test/test_http_api/test_session_management/test_create_session_with_chat_assistant.py +++ /dev/null @@ -1,117 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from concurrent.futures import ThreadPoolExecutor - -import pytest -from common import INVALID_API_TOKEN, SESSION_WITH_CHAT_NAME_LIMIT, create_session_with_chat_assistant, delete_chat_assistants, list_session_with_chat_assistants -from libs.auth import RAGFlowHttpApiAuth - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = create_session_with_chat_assistant(auth, "chat_assistant_id") - assert res["code"] == expected_code - assert res["message"] == expected_message - - -@pytest.mark.usefixtures("clear_session_with_chat_assistants") -class TestSessionWithChatAssistantCreate: - @pytest.mark.p1 - @pytest.mark.parametrize( - "payload, expected_code, expected_message", - [ - ({"name": "valid_name"}, 0, ""), - pytest.param({"name": "a" * (SESSION_WITH_CHAT_NAME_LIMIT + 1)}, 102, "", marks=pytest.mark.skip(reason="issues/")), - pytest.param({"name": 1}, 100, "", marks=pytest.mark.skip(reason="issues/")), - ({"name": ""}, 102, "`name` can not be empty."), - ({"name": "duplicated_name"}, 0, ""), - ({"name": "case insensitive"}, 0, ""), - ], - ) - def test_name(self, get_http_api_auth, add_chat_assistants, payload, expected_code, expected_message): - _, _, chat_assistant_ids = add_chat_assistants - if payload["name"] == "duplicated_name": - create_session_with_chat_assistant(get_http_api_auth, chat_assistant_ids[0], payload) - elif payload["name"] == "case insensitive": - create_session_with_chat_assistant(get_http_api_auth, chat_assistant_ids[0], {"name": payload["name"].upper()}) - - res = create_session_with_chat_assistant(get_http_api_auth, chat_assistant_ids[0], payload) - assert res["code"] == expected_code, res - if expected_code == 0: - assert res["data"]["name"] == payload["name"] - assert res["data"]["chat_id"] == chat_assistant_ids[0] - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "chat_assistant_id, expected_code, expected_message", - [ - ("", 100, ""), - ("invalid_chat_assistant_id", 102, "You do not own the assistant."), - ], - ) - def test_invalid_chat_assistant_id(self, get_http_api_auth, chat_assistant_id, expected_code, expected_message): - res = create_session_with_chat_assistant(get_http_api_auth, chat_assistant_id, {"name": "valid_name"}) - assert res["code"] == expected_code - assert res["message"] == expected_message - - @pytest.mark.p3 - def test_concurrent_create_session(self, get_http_api_auth, add_chat_assistants): - chunk_num = 1000 - _, _, chat_assistant_ids = add_chat_assistants - res = list_session_with_chat_assistants(get_http_api_auth, chat_assistant_ids[0]) - if res["code"] != 0: - assert False, res - chunks_count = len(res["data"]) - - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [ - executor.submit( - create_session_with_chat_assistant, - get_http_api_auth, - chat_assistant_ids[0], - {"name": f"session with chat assistant test {i}"}, - ) - for i in range(chunk_num) - ] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses) - res = list_session_with_chat_assistants(get_http_api_auth, chat_assistant_ids[0], {"page_size": chunk_num}) - if res["code"] != 0: - assert False, res - assert len(res["data"]) == chunks_count + chunk_num - - @pytest.mark.p3 - def test_add_session_to_deleted_chat_assistant(self, get_http_api_auth, add_chat_assistants): - _, _, chat_assistant_ids = add_chat_assistants - res = delete_chat_assistants(get_http_api_auth, {"ids": [chat_assistant_ids[0]]}) - assert res["code"] == 0 - res = create_session_with_chat_assistant(get_http_api_auth, chat_assistant_ids[0], {"name": "valid_name"}) - assert res["code"] == 102 - assert res["message"] == "You do not own the assistant." diff --git a/sdk/python/test/test_http_api/test_session_management/test_delete_sessions_with_chat_assistant.py b/sdk/python/test/test_http_api/test_session_management/test_delete_sessions_with_chat_assistant.py deleted file mode 100644 index f92739b599b..00000000000 --- a/sdk/python/test/test_http_api/test_session_management/test_delete_sessions_with_chat_assistant.py +++ /dev/null @@ -1,170 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from concurrent.futures import ThreadPoolExecutor - -import pytest -from common import INVALID_API_TOKEN, batch_add_sessions_with_chat_assistant, delete_session_with_chat_assistants, list_session_with_chat_assistants -from libs.auth import RAGFlowHttpApiAuth - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = delete_session_with_chat_assistants(auth, "chat_assistant_id") - assert res["code"] == expected_code - assert res["message"] == expected_message - - -class TestSessionWithChatAssistantDelete: - @pytest.mark.p3 - @pytest.mark.parametrize( - "chat_assistant_id, expected_code, expected_message", - [ - ("", 100, ""), - ( - "invalid_chat_assistant_id", - 102, - "You don't own the chat", - ), - ], - ) - def test_invalid_chat_assistant_id(self, get_http_api_auth, add_sessions_with_chat_assistant_func, chat_assistant_id, expected_code, expected_message): - _, session_ids = add_sessions_with_chat_assistant_func - res = delete_session_with_chat_assistants(get_http_api_auth, chat_assistant_id, {"ids": session_ids}) - assert res["code"] == expected_code - assert res["message"] == expected_message - - @pytest.mark.parametrize( - "payload", - [ - pytest.param(lambda r: {"ids": ["invalid_id"] + r}, marks=pytest.mark.p3), - pytest.param(lambda r: {"ids": r[:1] + ["invalid_id"] + r[1:5]}, marks=pytest.mark.p1), - pytest.param(lambda r: {"ids": r + ["invalid_id"]}, marks=pytest.mark.p3), - ], - ) - def test_delete_partial_invalid_id(self, get_http_api_auth, add_sessions_with_chat_assistant_func, payload): - chat_assistant_id, session_ids = add_sessions_with_chat_assistant_func - if callable(payload): - payload = payload(session_ids) - res = delete_session_with_chat_assistants(get_http_api_auth, chat_assistant_id, payload) - assert res["code"] == 0 - assert res["data"]["errors"][0] == "The chat doesn't own the session invalid_id" - - res = list_session_with_chat_assistants(get_http_api_auth, chat_assistant_id) - if res["code"] != 0: - assert False, res - assert len(res["data"]) == 0 - - @pytest.mark.p3 - def test_repeated_deletion(self, get_http_api_auth, add_sessions_with_chat_assistant_func): - chat_assistant_id, session_ids = add_sessions_with_chat_assistant_func - payload = {"ids": session_ids} - res = delete_session_with_chat_assistants(get_http_api_auth, chat_assistant_id, payload) - assert res["code"] == 0 - - res = delete_session_with_chat_assistants(get_http_api_auth, chat_assistant_id, payload) - assert res["code"] == 102 - assert "The chat doesn't own the session" in res["message"] - - @pytest.mark.p3 - def test_duplicate_deletion(self, get_http_api_auth, add_sessions_with_chat_assistant_func): - chat_assistant_id, session_ids = add_sessions_with_chat_assistant_func - res = delete_session_with_chat_assistants(get_http_api_auth, chat_assistant_id, {"ids": session_ids * 2}) - assert res["code"] == 0 - assert "Duplicate session ids" in res["data"]["errors"][0] - assert res["data"]["success_count"] == 5 - - res = list_session_with_chat_assistants(get_http_api_auth, chat_assistant_id) - if res["code"] != 0: - assert False, res - assert len(res["data"]) == 0 - - @pytest.mark.p3 - def test_concurrent_deletion(self, get_http_api_auth, add_chat_assistants): - sessions_num = 100 - _, _, chat_assistant_ids = add_chat_assistants - session_ids = batch_add_sessions_with_chat_assistant(get_http_api_auth, chat_assistant_ids[0], sessions_num) - - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [ - executor.submit( - delete_session_with_chat_assistants, - get_http_api_auth, - chat_assistant_ids[0], - {"ids": session_ids[i : i + 1]}, - ) - for i in range(sessions_num) - ] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses) - - @pytest.mark.p3 - def test_delete_1k(self, get_http_api_auth, add_chat_assistants): - sessions_num = 1_000 - _, _, chat_assistant_ids = add_chat_assistants - session_ids = batch_add_sessions_with_chat_assistant(get_http_api_auth, chat_assistant_ids[0], sessions_num) - - res = delete_session_with_chat_assistants(get_http_api_auth, chat_assistant_ids[0], {"ids": session_ids}) - assert res["code"] == 0 - - res = list_session_with_chat_assistants(get_http_api_auth, chat_assistant_ids[0]) - if res["code"] != 0: - assert False, res - assert len(res["data"]) == 0 - - @pytest.mark.parametrize( - "payload, expected_code, expected_message, remaining", - [ - pytest.param(None, 0, """TypeError("argument of type \'NoneType\' is not iterable")""", 0, marks=pytest.mark.skip), - pytest.param({"ids": ["invalid_id"]}, 102, "The chat doesn't own the session invalid_id", 5, marks=pytest.mark.p3), - pytest.param("not json", 100, """AttributeError("\'str\' object has no attribute \'get\'")""", 5, marks=pytest.mark.skip), - pytest.param(lambda r: {"ids": r[:1]}, 0, "", 4, marks=pytest.mark.p3), - pytest.param(lambda r: {"ids": r}, 0, "", 0, marks=pytest.mark.p1), - pytest.param({"ids": []}, 0, "", 0, marks=pytest.mark.p3), - ], - ) - def test_basic_scenarios( - self, - get_http_api_auth, - add_sessions_with_chat_assistant_func, - payload, - expected_code, - expected_message, - remaining, - ): - chat_assistant_id, session_ids = add_sessions_with_chat_assistant_func - if callable(payload): - payload = payload(session_ids) - res = delete_session_with_chat_assistants(get_http_api_auth, chat_assistant_id, payload) - assert res["code"] == expected_code - if res["code"] != 0: - assert res["message"] == expected_message - - res = list_session_with_chat_assistants(get_http_api_auth, chat_assistant_id) - if res["code"] != 0: - assert False, res - assert len(res["data"]) == remaining diff --git a/sdk/python/test/test_http_api/test_session_management/test_list_sessions_with_chat_assistant.py b/sdk/python/test/test_http_api/test_session_management/test_list_sessions_with_chat_assistant.py deleted file mode 100644 index e84bd6f1f01..00000000000 --- a/sdk/python/test/test_http_api/test_session_management/test_list_sessions_with_chat_assistant.py +++ /dev/null @@ -1,247 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from concurrent.futures import ThreadPoolExecutor - -import pytest -from common import INVALID_API_TOKEN, delete_chat_assistants, list_session_with_chat_assistants -from libs.auth import RAGFlowHttpApiAuth -from libs.utils import is_sorted - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = list_session_with_chat_assistants(auth, "chat_assistant_id") - assert res["code"] == expected_code - assert res["message"] == expected_message - - -class TestSessionsWithChatAssistantList: - @pytest.mark.p1 - @pytest.mark.parametrize( - "params, expected_code, expected_page_size, expected_message", - [ - ({"page": None, "page_size": 2}, 0, 2, ""), - pytest.param({"page": 0, "page_size": 2}, 100, 0, "ValueError('Search does not support negative slicing.')", marks=pytest.mark.skip), - ({"page": 2, "page_size": 2}, 0, 2, ""), - ({"page": 3, "page_size": 2}, 0, 1, ""), - ({"page": "3", "page_size": 2}, 0, 1, ""), - pytest.param({"page": -1, "page_size": 2}, 100, 0, "ValueError('Search does not support negative slicing.')", marks=pytest.mark.skip), - pytest.param({"page": "a", "page_size": 2}, 100, 0, """ValueError("invalid literal for int() with base 10: \'a\'")""", marks=pytest.mark.skip), - ], - ) - def test_page(self, get_http_api_auth, add_sessions_with_chat_assistant, params, expected_code, expected_page_size, expected_message): - chat_assistant_id, _ = add_sessions_with_chat_assistant - res = list_session_with_chat_assistants(get_http_api_auth, chat_assistant_id, params=params) - assert res["code"] == expected_code - if expected_code == 0: - assert len(res["data"]) == expected_page_size - else: - assert res["message"] == expected_message - - @pytest.mark.p1 - @pytest.mark.parametrize( - "params, expected_code, expected_page_size, expected_message", - [ - ({"page_size": None}, 0, 5, ""), - ({"page_size": 0}, 0, 0, ""), - ({"page_size": 1}, 0, 1, ""), - ({"page_size": 6}, 0, 5, ""), - ({"page_size": "1"}, 0, 1, ""), - pytest.param({"page_size": -1}, 0, 5, "", marks=pytest.mark.skip), - pytest.param({"page_size": "a"}, 100, 0, """ValueError("invalid literal for int() with base 10: \'a\'")""", marks=pytest.mark.skip), - ], - ) - def test_page_size(self, get_http_api_auth, add_sessions_with_chat_assistant, params, expected_code, expected_page_size, expected_message): - chat_assistant_id, _ = add_sessions_with_chat_assistant - res = list_session_with_chat_assistants(get_http_api_auth, chat_assistant_id, params=params) - assert res["code"] == expected_code - if expected_code == 0: - assert len(res["data"]) == expected_page_size - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "params, expected_code, assertions, expected_message", - [ - ({"orderby": None}, 0, lambda r: (is_sorted(r["data"], "create_time", True)), ""), - ({"orderby": "create_time"}, 0, lambda r: (is_sorted(r["data"], "create_time", True)), ""), - ({"orderby": "update_time"}, 0, lambda r: (is_sorted(r["data"], "update_time", True)), ""), - ({"orderby": "name", "desc": "False"}, 0, lambda r: (is_sorted(r["data"], "name", False)), ""), - pytest.param({"orderby": "unknown"}, 102, 0, "orderby should be create_time or update_time", marks=pytest.mark.skip(reason="issues/")), - ], - ) - def test_orderby( - self, - get_http_api_auth, - add_sessions_with_chat_assistant, - params, - expected_code, - assertions, - expected_message, - ): - chat_assistant_id, _ = add_sessions_with_chat_assistant - res = list_session_with_chat_assistants(get_http_api_auth, chat_assistant_id, params=params) - assert res["code"] == expected_code - if expected_code == 0: - if callable(assertions): - assert assertions(res) - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "params, expected_code, assertions, expected_message", - [ - ({"desc": None}, 0, lambda r: (is_sorted(r["data"], "create_time", True)), ""), - ({"desc": "true"}, 0, lambda r: (is_sorted(r["data"], "create_time", True)), ""), - ({"desc": "True"}, 0, lambda r: (is_sorted(r["data"], "create_time", True)), ""), - ({"desc": True}, 0, lambda r: (is_sorted(r["data"], "create_time", True)), ""), - ({"desc": "false"}, 0, lambda r: (is_sorted(r["data"], "create_time", False)), ""), - ({"desc": "False"}, 0, lambda r: (is_sorted(r["data"], "create_time", False)), ""), - ({"desc": False}, 0, lambda r: (is_sorted(r["data"], "create_time", False)), ""), - ({"desc": "False", "orderby": "update_time"}, 0, lambda r: (is_sorted(r["data"], "update_time", False)), ""), - pytest.param({"desc": "unknown"}, 102, 0, "desc should be true or false", marks=pytest.mark.skip(reason="issues/")), - ], - ) - def test_desc( - self, - get_http_api_auth, - add_sessions_with_chat_assistant, - params, - expected_code, - assertions, - expected_message, - ): - chat_assistant_id, _ = add_sessions_with_chat_assistant - res = list_session_with_chat_assistants(get_http_api_auth, chat_assistant_id, params=params) - assert res["code"] == expected_code - if expected_code == 0: - if callable(assertions): - assert assertions(res) - else: - assert res["message"] == expected_message - - @pytest.mark.p1 - @pytest.mark.parametrize( - "params, expected_code, expected_num, expected_message", - [ - ({"name": None}, 0, 5, ""), - ({"name": ""}, 0, 5, ""), - ({"name": "session_with_chat_assistant_1"}, 0, 1, ""), - ({"name": "unknown"}, 0, 0, ""), - ], - ) - def test_name(self, get_http_api_auth, add_sessions_with_chat_assistant, params, expected_code, expected_num, expected_message): - chat_assistant_id, _ = add_sessions_with_chat_assistant - res = list_session_with_chat_assistants(get_http_api_auth, chat_assistant_id, params=params) - assert res["code"] == expected_code - if expected_code == 0: - if params["name"] == "session_with_chat_assistant_1": - assert res["data"][0]["name"] == params["name"] - else: - assert len(res["data"]) == expected_num - else: - assert res["message"] == expected_message - - @pytest.mark.p1 - @pytest.mark.parametrize( - "session_id, expected_code, expected_num, expected_message", - [ - (None, 0, 5, ""), - ("", 0, 5, ""), - (lambda r: r[0], 0, 1, ""), - ("unknown", 0, 0, "The chat doesn't exist"), - ], - ) - def test_id(self, get_http_api_auth, add_sessions_with_chat_assistant, session_id, expected_code, expected_num, expected_message): - chat_assistant_id, session_ids = add_sessions_with_chat_assistant - if callable(session_id): - params = {"id": session_id(session_ids)} - else: - params = {"id": session_id} - - res = list_session_with_chat_assistants(get_http_api_auth, chat_assistant_id, params=params) - assert res["code"] == expected_code - if expected_code == 0: - if params["id"] == session_ids[0]: - assert res["data"][0]["id"] == params["id"] - else: - assert len(res["data"]) == expected_num - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "session_id, name, expected_code, expected_num, expected_message", - [ - (lambda r: r[0], "session_with_chat_assistant_0", 0, 1, ""), - (lambda r: r[0], "session_with_chat_assistant_100", 0, 0, ""), - (lambda r: r[0], "unknown", 0, 0, ""), - ("id", "session_with_chat_assistant_0", 0, 0, ""), - ], - ) - def test_name_and_id(self, get_http_api_auth, add_sessions_with_chat_assistant, session_id, name, expected_code, expected_num, expected_message): - chat_assistant_id, session_ids = add_sessions_with_chat_assistant - if callable(session_id): - params = {"id": session_id(session_ids), "name": name} - else: - params = {"id": session_id, "name": name} - - res = list_session_with_chat_assistants(get_http_api_auth, chat_assistant_id, params=params) - assert res["code"] == expected_code - if expected_code == 0: - assert len(res["data"]) == expected_num - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - def test_concurrent_list(self, get_http_api_auth, add_sessions_with_chat_assistant): - chat_assistant_id, _ = add_sessions_with_chat_assistant - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [executor.submit(list_session_with_chat_assistants, get_http_api_auth, chat_assistant_id) for i in range(100)] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses) - - @pytest.mark.p3 - def test_invalid_params(self, get_http_api_auth, add_sessions_with_chat_assistant): - chat_assistant_id, _ = add_sessions_with_chat_assistant - params = {"a": "b"} - res = list_session_with_chat_assistants(get_http_api_auth, chat_assistant_id, params=params) - assert res["code"] == 0 - assert len(res["data"]) == 5 - - @pytest.mark.p3 - def test_list_chats_after_deleting_associated_chat_assistant(self, get_http_api_auth, add_sessions_with_chat_assistant): - chat_assistant_id, _ = add_sessions_with_chat_assistant - res = delete_chat_assistants(get_http_api_auth, {"ids": [chat_assistant_id]}) - assert res["code"] == 0 - - res = list_session_with_chat_assistants(get_http_api_auth, chat_assistant_id) - assert res["code"] == 102 - assert "You don't own the assistant" in res["message"] diff --git a/sdk/python/test/test_http_api/test_session_management/test_update_session_with_chat_assistant.py b/sdk/python/test/test_http_api/test_session_management/test_update_session_with_chat_assistant.py deleted file mode 100644 index b88bec50984..00000000000 --- a/sdk/python/test/test_http_api/test_session_management/test_update_session_with_chat_assistant.py +++ /dev/null @@ -1,148 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from concurrent.futures import ThreadPoolExecutor -from random import randint - -import pytest -from common import INVALID_API_TOKEN, SESSION_WITH_CHAT_NAME_LIMIT, delete_chat_assistants, list_session_with_chat_assistants, update_session_with_chat_assistant -from libs.auth import RAGFlowHttpApiAuth - - -@pytest.mark.p1 -class TestAuthorization: - @pytest.mark.parametrize( - "auth, expected_code, expected_message", - [ - (None, 0, "`Authorization` can't be empty"), - ( - RAGFlowHttpApiAuth(INVALID_API_TOKEN), - 109, - "Authentication error: API key is invalid!", - ), - ], - ) - def test_invalid_auth(self, auth, expected_code, expected_message): - res = update_session_with_chat_assistant(auth, "chat_assistant_id", "session_id") - assert res["code"] == expected_code - assert res["message"] == expected_message - - -class TestSessionWithChatAssistantUpdate: - @pytest.mark.parametrize( - "payload, expected_code, expected_message", - [ - pytest.param({"name": "valid_name"}, 0, "", marks=pytest.mark.p1), - pytest.param({"name": "a" * (SESSION_WITH_CHAT_NAME_LIMIT + 1)}, 102, "", marks=pytest.mark.skip(reason="issues/")), - pytest.param({"name": 1}, 100, "", marks=pytest.mark.skip(reason="issues/")), - pytest.param({"name": ""}, 102, "`name` can not be empty.", marks=pytest.mark.p3), - pytest.param({"name": "duplicated_name"}, 0, "", marks=pytest.mark.p3), - pytest.param({"name": "case insensitive"}, 0, "", marks=pytest.mark.p3), - ], - ) - def test_name(self, get_http_api_auth, add_sessions_with_chat_assistant_func, payload, expected_code, expected_message): - chat_assistant_id, session_ids = add_sessions_with_chat_assistant_func - if payload["name"] == "duplicated_name": - update_session_with_chat_assistant(get_http_api_auth, chat_assistant_id, session_ids[0], payload) - elif payload["name"] == "case insensitive": - update_session_with_chat_assistant(get_http_api_auth, chat_assistant_id, session_ids[0], {"name": payload["name"].upper()}) - - res = update_session_with_chat_assistant(get_http_api_auth, chat_assistant_id, session_ids[0], payload) - assert res["code"] == expected_code, res - if expected_code == 0: - res = list_session_with_chat_assistants(get_http_api_auth, chat_assistant_id, {"id": session_ids[0]}) - assert res["data"][0]["name"] == payload["name"] - else: - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "chat_assistant_id, expected_code, expected_message", - [ - ("", 100, ""), - pytest.param("invalid_chat_assistant_id", 102, "Session does not exist", marks=pytest.mark.skip(reason="issues/")), - ], - ) - def test_invalid_chat_assistant_id(self, get_http_api_auth, add_sessions_with_chat_assistant_func, chat_assistant_id, expected_code, expected_message): - _, session_ids = add_sessions_with_chat_assistant_func - res = update_session_with_chat_assistant(get_http_api_auth, chat_assistant_id, session_ids[0], {"name": "valid_name"}) - assert res["code"] == expected_code - assert res["message"] == expected_message - - @pytest.mark.p3 - @pytest.mark.parametrize( - "session_id, expected_code, expected_message", - [ - ("", 100, ""), - ("invalid_session_id", 102, "Session does not exist"), - ], - ) - def test_invalid_session_id(self, get_http_api_auth, add_sessions_with_chat_assistant_func, session_id, expected_code, expected_message): - chat_assistant_id, _ = add_sessions_with_chat_assistant_func - res = update_session_with_chat_assistant(get_http_api_auth, chat_assistant_id, session_id, {"name": "valid_name"}) - assert res["code"] == expected_code - assert res["message"] == expected_message - - @pytest.mark.p3 - def test_repeated_update_session(self, get_http_api_auth, add_sessions_with_chat_assistant_func): - chat_assistant_id, session_ids = add_sessions_with_chat_assistant_func - res = update_session_with_chat_assistant(get_http_api_auth, chat_assistant_id, session_ids[0], {"name": "valid_name_1"}) - assert res["code"] == 0 - - res = update_session_with_chat_assistant(get_http_api_auth, chat_assistant_id, session_ids[0], {"name": "valid_name_2"}) - assert res["code"] == 0 - - @pytest.mark.p3 - @pytest.mark.parametrize( - "payload, expected_code, expected_message", - [ - pytest.param({"unknown_key": "unknown_value"}, 100, "ValueError", marks=pytest.mark.skip), - ({}, 0, ""), - pytest.param(None, 100, "TypeError", marks=pytest.mark.skip), - ], - ) - def test_invalid_params(self, get_http_api_auth, add_sessions_with_chat_assistant_func, payload, expected_code, expected_message): - chat_assistant_id, session_ids = add_sessions_with_chat_assistant_func - res = update_session_with_chat_assistant(get_http_api_auth, chat_assistant_id, session_ids[0], payload) - assert res["code"] == expected_code - if expected_code != 0: - assert expected_message in res["message"] - - @pytest.mark.p3 - def test_concurrent_update_session(self, get_http_api_auth, add_sessions_with_chat_assistant_func): - chunk_num = 50 - chat_assistant_id, session_ids = add_sessions_with_chat_assistant_func - - with ThreadPoolExecutor(max_workers=5) as executor: - futures = [ - executor.submit( - update_session_with_chat_assistant, - get_http_api_auth, - chat_assistant_id, - session_ids[randint(0, 4)], - {"name": f"update session test {i}"}, - ) - for i in range(chunk_num) - ] - responses = [f.result() for f in futures] - assert all(r["code"] == 0 for r in responses) - - @pytest.mark.p3 - def test_update_session_to_deleted_chat_assistant(self, get_http_api_auth, add_sessions_with_chat_assistant_func): - chat_assistant_id, session_ids = add_sessions_with_chat_assistant_func - delete_chat_assistants(get_http_api_auth, {"ids": [chat_assistant_id]}) - res = update_session_with_chat_assistant(get_http_api_auth, chat_assistant_id, session_ids[0], {"name": "valid_name"}) - assert res["code"] == 102 - assert res["message"] == "You do not own the session" diff --git a/sdk/python/test/test_sdk_api/common.py b/sdk/python/test/test_sdk_api/common.py deleted file mode 100644 index fe6aa88b7b1..00000000000 --- a/sdk/python/test/test_sdk_api/common.py +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import os - -HOST_ADDRESS = os.getenv('HOST_ADDRESS', 'http://127.0.0.1:9380') diff --git a/sdk/python/test/test_sdk_api/get_email.py b/sdk/python/test/test_sdk_api/get_email.py deleted file mode 100644 index 7238922b703..00000000000 --- a/sdk/python/test/test_sdk_api/get_email.py +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -def test_get_email(get_email): - print("\nEmail account:", flush=True) - print(f"{get_email}\n", flush=True) diff --git a/sdk/python/test/test_sdk_api/t_agent.py b/sdk/python/test/test_sdk_api/t_agent.py deleted file mode 100644 index 2fcd0e535e7..00000000000 --- a/sdk/python/test/test_sdk_api/t_agent.py +++ /dev/null @@ -1,36 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -from ragflow_sdk import RAGFlow, Agent -from common import HOST_ADDRESS -import pytest - - -@pytest.mark.skip(reason="") -def test_list_agents_with_success(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - rag.list_agents() - - -@pytest.mark.skip(reason="") -def test_converse_with_agent_with_success(get_api_key_fixture): - API_KEY = "ragflow-BkOGNhYjIyN2JiODExZWY5MzVhMDI0Mm" - agent_id = "ebfada2eb2bc11ef968a0242ac120006" - rag = RAGFlow(API_KEY, HOST_ADDRESS) - lang = "Chinese" - file = "How is the weather tomorrow?" - Agent.ask(agent_id=agent_id, rag=rag, lang=lang, file=file) diff --git a/sdk/python/test/test_sdk_api/t_chat.py b/sdk/python/test/test_sdk_api/t_chat.py deleted file mode 100644 index f15b52f3115..00000000000 --- a/sdk/python/test/test_sdk_api/t_chat.py +++ /dev/null @@ -1,131 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -from common import HOST_ADDRESS -from ragflow_sdk import RAGFlow -from ragflow_sdk.modules.chat import Chat - - -def test_create_chat_with_name(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - kb = rag.create_dataset(name="test_create_chat") - display_name = "ragflow.txt" - with open("test_data/ragflow.txt", "rb") as file: - blob = file.read() - document = {"display_name": display_name, "blob": blob} - documents = [] - documents.append(document) - docs = kb.upload_documents(documents) - for doc in docs: - doc.add_chunk("This is a test to add chunk") - llm = Chat.LLM( - rag, - { - "model_name": "glm-4-flash@ZHIPU-AI", - "temperature": 0.1, - "top_p": 0.3, - "presence_penalty": 0.4, - "frequency_penalty": 0.7, - "max_tokens": 512, - }, - ) - rag.create_chat("test_create_chat", dataset_ids=[kb.id], llm=llm) - - -def test_update_chat_with_name(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - kb = rag.create_dataset(name="test_update_chat") - display_name = "ragflow.txt" - with open("test_data/ragflow.txt", "rb") as file: - blob = file.read() - document = {"display_name": display_name, "blob": blob} - documents = [] - documents.append(document) - docs = kb.upload_documents(documents) - for doc in docs: - doc.add_chunk("This is a test to add chunk") - llm = Chat.LLM( - rag, - { - "model_name": "glm-4-flash@ZHIPU-AI", - "temperature": 0.1, - "top_p": 0.3, - "presence_penalty": 0.4, - "frequency_penalty": 0.7, - "max_tokens": 512, - }, - ) - chat = rag.create_chat("test_update_chat", dataset_ids=[kb.id], llm=llm) - chat.update({"name": "new_chat"}) - - -def test_delete_chats_with_success(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - kb = rag.create_dataset(name="test_delete_chat") - display_name = "ragflow.txt" - with open("test_data/ragflow.txt", "rb") as file: - blob = file.read() - document = {"display_name": display_name, "blob": blob} - documents = [] - documents.append(document) - docs = kb.upload_documents(documents) - for doc in docs: - doc.add_chunk("This is a test to add chunk") - llm = Chat.LLM( - rag, - { - "model_name": "glm-4-flash@ZHIPU-AI", - "temperature": 0.1, - "top_p": 0.3, - "presence_penalty": 0.4, - "frequency_penalty": 0.7, - "max_tokens": 512, - }, - ) - chat = rag.create_chat("test_delete_chat", dataset_ids=[kb.id], llm=llm) - rag.delete_chats(ids=[chat.id]) - - -def test_list_chats_with_success(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - kb = rag.create_dataset(name="test_list_chats") - display_name = "ragflow.txt" - with open("test_data/ragflow.txt", "rb") as file: - blob = file.read() - document = {"display_name": display_name, "blob": blob} - documents = [] - documents.append(document) - docs = kb.upload_documents(documents) - for doc in docs: - doc.add_chunk("This is a test to add chunk") - llm = Chat.LLM( - rag, - { - "model_name": "glm-4-flash@ZHIPU-AI", - "temperature": 0.1, - "top_p": 0.3, - "presence_penalty": 0.4, - "frequency_penalty": 0.7, - "max_tokens": 512, - }, - ) - rag.create_chat("test_list_1", dataset_ids=[kb.id], llm=llm) - rag.create_chat("test_list_2", dataset_ids=[kb.id], llm=llm) - rag.list_chats() diff --git a/sdk/python/test/test_sdk_api/t_chunk.py b/sdk/python/test/test_sdk_api/t_chunk.py deleted file mode 100644 index df2bfcad315..00000000000 --- a/sdk/python/test/test_sdk_api/t_chunk.py +++ /dev/null @@ -1,216 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -from ragflow_sdk import RAGFlow -from common import HOST_ADDRESS -from time import sleep - - -def test_parse_document_with_txt(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_parse_document") - name = 'ragflow_test.txt' - with open("test_data/ragflow_test.txt", "rb") as file: - blob = file.read() - docs = ds.upload_documents([{"display_name": name, "blob": blob}]) - doc = docs[0] - ds.async_parse_documents(document_ids=[doc.id]) - ''' - for n in range(100): - if doc.progress == 1: - break - sleep(1) - else: - raise Exception("Run time ERROR: Document parsing did not complete in time.") - ''' - - -def test_parse_and_cancel_document(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_parse_and_cancel_document") - name = 'ragflow_test.txt' - with open("test_data/ragflow_test.txt", "rb") as file: - blob = file.read() - docs = ds.upload_documents([{"display_name": name, "blob": blob}]) - doc = docs[0] - ds.async_parse_documents(document_ids=[doc.id]) - sleep(1) - if 0 < doc.progress < 1: - ds.async_cancel_parse_documents(document_ids=[doc.id]) - - -def test_bulk_parse_documents(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_bulk_parse_and_cancel_documents") - with open("test_data/ragflow.txt", "rb") as file: - blob = file.read() - documents = [ - {'display_name': 'test1.txt', 'blob': blob}, - {'display_name': 'test2.txt', 'blob': blob}, - {'display_name': 'test3.txt', 'blob': blob} - ] - docs = ds.upload_documents(documents) - ids = [doc.id for doc in docs] - ds.async_parse_documents(ids) - ''' - for n in range(100): - all_completed = all(doc.progress == 1 for doc in docs) - if all_completed: - break - sleep(1) - else: - raise Exception("Run time ERROR: Bulk document parsing did not complete in time.") - ''' - - -def test_list_chunks_with_success(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_list_chunks_with_success") - with open("test_data/ragflow_test.txt", "rb") as file: - blob = file.read() - ''' - # chunk_size = 1024 * 1024 - # chunks = [blob[i:i + chunk_size] for i in range(0, len(blob), chunk_size)] - documents = [ - {'display_name': f'chunk_{i}.txt', 'blob': chunk} for i, chunk in enumerate(chunks) - ] - ''' - documents = [{"display_name": "test_list_chunks_with_success.txt", "blob": blob}] - docs = ds.upload_documents(documents) - ids = [doc.id for doc in docs] - ds.async_parse_documents(ids) - ''' - for n in range(100): - all_completed = all(doc.progress == 1 for doc in docs) - if all_completed: - break - sleep(1) - else: - raise Exception("Run time ERROR: Chunk document parsing did not complete in time.") - ''' - doc = docs[0] - doc.list_chunks() - - -def test_add_chunk_with_success(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_add_chunk_with_success") - with open("test_data/ragflow_test.txt", "rb") as file: - blob = file.read() - ''' - # chunk_size = 1024 * 1024 - # chunks = [blob[i:i + chunk_size] for i in range(0, len(blob), chunk_size)] - documents = [ - {'display_name': f'chunk_{i}.txt', 'blob': chunk} for i, chunk in enumerate(chunks) - ] - ''' - documents = [{"display_name": "test_list_chunks_with_success.txt", "blob": blob}] - docs = ds.upload_documents(documents) - doc = docs[0] - doc.add_chunk(content="This is a chunk addition test") - - -def test_delete_chunk_with_success(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_delete_chunk_with_success") - with open("test_data/ragflow_test.txt", "rb") as file: - blob = file.read() - ''' - # chunk_size = 1024 * 1024 - # chunks = [blob[i:i + chunk_size] for i in range(0, len(blob), chunk_size)] - documents = [ - {'display_name': f'chunk_{i}.txt', 'blob': chunk} for i, chunk in enumerate(chunks) - ] - ''' - documents = [{"display_name": "test_delete_chunk_with_success.txt", "blob": blob}] - docs = ds.upload_documents(documents) - doc = docs[0] - chunk = doc.add_chunk(content="This is a chunk addition test") - sleep(5) - doc.delete_chunks([chunk.id]) - - -def test_update_chunk_content(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_update_chunk_content_with_success") - with open("test_data/ragflow_test.txt", "rb") as file: - blob = file.read() - ''' - # chunk_size = 1024 * 1024 - # chunks = [blob[i:i + chunk_size] for i in range(0, len(blob), chunk_size)] - documents = [ - {'display_name': f'chunk_{i}.txt', 'blob': chunk} for i, chunk in enumerate(chunks) - ] - ''' - documents = [{"display_name": "test_update_chunk_content_with_success.txt", "blob": blob}] - docs = ds.upload_documents(documents) - doc = docs[0] - chunk = doc.add_chunk(content="This is a chunk addition test") - # For Elasticsearch, the chunk is not searchable in shot time (~2s). - sleep(3) - chunk.update({"content": "This is a updated content"}) - - -def test_update_chunk_available(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_update_chunk_available_with_success") - with open("test_data/ragflow_test.txt", "rb") as file: - blob = file.read() - ''' - # chunk_size = 1024 * 1024 - # chunks = [blob[i:i + chunk_size] for i in range(0, len(blob), chunk_size)] - documents = [ - {'display_name': f'chunk_{i}.txt', 'blob': chunk} for i, chunk in enumerate(chunks) - ] - ''' - documents = [{"display_name": "test_update_chunk_available_with_success.txt", "blob": blob}] - docs = ds.upload_documents(documents) - doc = docs[0] - chunk = doc.add_chunk(content="This is a chunk addition test") - # For Elasticsearch, the chunk is not searchable in shot time (~2s). - sleep(3) - chunk.update({"available": 0}) - - -def test_retrieve_chunks(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="retrieval") - with open("test_data/ragflow_test.txt", "rb") as file: - blob = file.read() - ''' - # chunk_size = 1024 * 1024 - # chunks = [blob[i:i + chunk_size] for i in range(0, len(blob), chunk_size)] - documents = [ - {'display_name': f'chunk_{i}.txt', 'blob': chunk} for i, chunk in enumerate(chunks) - ] - ''' - documents = [{"display_name": "test_retrieve_chunks.txt", "blob": blob}] - docs = ds.upload_documents(documents) - doc = docs[0] - doc.add_chunk(content="This is a chunk addition test") - rag.retrieve(dataset_ids=[ds.id], document_ids=[doc.id]) - rag.delete_datasets(ids=[ds.id]) - -# test different parameters for the retrieval diff --git a/sdk/python/test/test_sdk_api/t_dataset.py b/sdk/python/test/test_sdk_api/t_dataset.py deleted file mode 100644 index 9673422ea91..00000000000 --- a/sdk/python/test/test_sdk_api/t_dataset.py +++ /dev/null @@ -1,77 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import random - -import pytest -from common import HOST_ADDRESS -from ragflow_sdk import RAGFlow - - -def test_create_dataset_with_name(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - rag.create_dataset("test_create_dataset_with_name") - - -def test_create_dataset_with_duplicated_name(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - rag.create_dataset("test_create_dataset_with_duplicated_name") - with pytest.raises(Exception) as exc_info: - rag.create_dataset("test_create_dataset_with_duplicated_name") - assert str(exc_info.value) == "Dataset name 'test_create_dataset_with_duplicated_name' already exists" - - -def test_create_dataset_with_random_chunk_method(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - valid_chunk_methods = ["naive", "manual", "qa", "table", "paper", "book", "laws", "presentation", "picture", "one", "email"] - random_chunk_method = random.choice(valid_chunk_methods) - rag.create_dataset("test_create_dataset_with_random_chunk_method", chunk_method=random_chunk_method) - - -def test_create_dataset_with_invalid_parameter(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - chunk_method = "invalid_chunk_method" - with pytest.raises(Exception) as exc_info: - rag.create_dataset("test_create_dataset_with_invalid_chunk_method", chunk_method=chunk_method) - assert ( - str(exc_info.value) - == f"Field: - Message: - Value: <{chunk_method}>" - ) - - -def test_update_dataset_with_name(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset("test_update_dataset") - ds.update({"name": "updated_dataset"}) - - -def test_delete_datasets_with_success(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset("test_delete_dataset") - rag.delete_datasets(ids=[ds.id]) - - -def test_list_datasets_with_success(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - rag.create_dataset("test_list_datasets") - rag.list_datasets() diff --git a/sdk/python/test/test_sdk_api/t_document.py b/sdk/python/test/test_sdk_api/t_document.py deleted file mode 100644 index 733b9bb5a5b..00000000000 --- a/sdk/python/test/test_sdk_api/t_document.py +++ /dev/null @@ -1,198 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -from ragflow_sdk import RAGFlow -from common import HOST_ADDRESS -import pytest - - -def test_upload_document_with_success(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_upload_document") - blob = b"Sample document content for test." - with open("test_data/ragflow.txt", "rb") as file: - blob_2 = file.read() - document_infos = [] - document_infos.append({"display_name": "test_1.txt", "blob": blob}) - document_infos.append({"display_name": "test_2.txt", "blob": blob_2}) - ds.upload_documents(document_infos) - - -def test_update_document_with_success(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_update_document") - blob = b"Sample document content for test." - document_infos = [{"display_name": "test.txt", "blob": blob}] - docs = ds.upload_documents(document_infos) - doc = docs[0] - doc.update({"chunk_method": "manual", "name": "manual.txt"}) - - -def test_download_document_with_success(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_download_document") - blob = b"Sample document content for test." - document_infos = [{"display_name": "test_1.txt", "blob": blob}] - docs = ds.upload_documents(document_infos) - doc = docs[0] - with open("test_download.txt", "wb+") as file: - file.write(doc.download()) - - -def test_list_documents_in_dataset_with_success(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_list_documents") - blob = b"Sample document content for test." - document_infos = [{"display_name": "test.txt", "blob": blob}] - ds.upload_documents(document_infos) - ds.list_documents(keywords="test", page=1, page_size=12) - - -def test_delete_documents_in_dataset_with_success(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_delete_documents") - name = "test_delete_documents.txt" - blob = b"Sample document content for test." - document_infos = [{"display_name": name, "blob": blob}] - docs = ds.upload_documents(document_infos) - ds.delete_documents([docs[0].id]) - - -# upload and parse the document with different in different parse method. -def test_upload_and_parse_pdf_documents_with_general_parse_method(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_pdf_document") - with open("test_data/test.pdf", "rb") as file: - blob = file.read() - document_infos = [{"display_name": "test.pdf", "blob": blob}] - docs = ds.upload_documents(document_infos) - doc = docs[0] - ds.async_parse_documents([doc.id]) - - -def test_upload_and_parse_docx_documents_with_general_parse_method(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_docx_document") - with open("test_data/test.docx", "rb") as file: - blob = file.read() - document_infos = [{"display_name": "test.docx", "blob": blob}] - docs = ds.upload_documents(document_infos) - doc = docs[0] - ds.async_parse_documents([doc.id]) - - -def test_upload_and_parse_excel_documents_with_general_parse_method(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_excel_document") - with open("test_data/test.xlsx", "rb") as file: - blob = file.read() - document_infos = [{"display_name": "test.xlsx", "blob": blob}] - docs = ds.upload_documents(document_infos) - doc = docs[0] - ds.async_parse_documents([doc.id]) - - -def test_upload_and_parse_ppt_documents_with_general_parse_method(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_ppt_document") - with open("test_data/test.ppt", "rb") as file: - blob = file.read() - document_infos = [{"display_name": "test.ppt", "blob": blob}] - docs = ds.upload_documents(document_infos) - doc = docs[0] - ds.async_parse_documents([doc.id]) - - -def test_upload_and_parse_image_documents_with_general_parse_method(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_image_document") - with open("test_data/test.jpg", "rb") as file: - blob = file.read() - document_infos = [{"display_name": "test.jpg", "blob": blob}] - docs = ds.upload_documents(document_infos) - doc = docs[0] - ds.async_parse_documents([doc.id]) - - -def test_upload_and_parse_txt_documents_with_general_parse_method(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_txt_document") - with open("test_data/test.txt", "rb") as file: - blob = file.read() - document_infos = [{"display_name": "test.txt", "blob": blob}] - docs = ds.upload_documents(document_infos) - doc = docs[0] - ds.async_parse_documents([doc.id]) - - -def test_upload_and_parse_md_documents_with_general_parse_method(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_md_document") - with open("test_data/test.md", "rb") as file: - blob = file.read() - document_infos = [{"display_name": "test.md", "blob": blob}] - docs = ds.upload_documents(document_infos) - doc = docs[0] - ds.async_parse_documents([doc.id]) - - -def test_upload_and_parse_json_documents_with_general_parse_method(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_json_document") - with open("test_data/test.json", "rb") as file: - blob = file.read() - document_infos = [{"display_name": "test.json", "blob": blob}] - docs = ds.upload_documents(document_infos) - doc = docs[0] - ds.async_parse_documents([doc.id]) - - -@pytest.mark.skip(reason="") -def test_upload_and_parse_eml_documents_with_general_parse_method(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_eml_document") - with open("test_data/test.eml", "rb") as file: - blob = file.read() - document_infos = [{"display_name": "test.eml", "blob": blob}] - docs = ds.upload_documents(document_infos) - doc = docs[0] - ds.async_parse_documents([doc.id]) - - -def test_upload_and_parse_html_documents_with_general_parse_method(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - ds = rag.create_dataset(name="test_html_document") - with open("test_data/test.html", "rb") as file: - blob = file.read() - document_infos = [{"display_name": "test.html", "blob": blob}] - docs = ds.upload_documents(document_infos) - doc = docs[0] - ds.async_parse_documents([doc.id]) diff --git a/sdk/python/test/test_sdk_api/t_session.py b/sdk/python/test/test_sdk_api/t_session.py deleted file mode 100644 index 81cc33eb5ef..00000000000 --- a/sdk/python/test/test_sdk_api/t_session.py +++ /dev/null @@ -1,145 +0,0 @@ -# -# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -from ragflow_sdk import RAGFlow -from common import HOST_ADDRESS -import pytest - - -def test_create_session_with_success(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - kb = rag.create_dataset(name="test_create_session") - display_name = "ragflow.txt" - with open("test_data/ragflow.txt", "rb") as file: - blob = file.read() - document = {"display_name": display_name, "blob": blob} - documents = [] - documents.append(document) - docs = kb.upload_documents(documents) - for doc in docs: - doc.add_chunk("This is a test to add chunk") - assistant = rag.create_chat("test_create_session", dataset_ids=[kb.id]) - assistant.create_session() - - -def test_create_conversation_with_success(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - kb = rag.create_dataset(name="test_create_conversation") - display_name = "ragflow.txt" - with open("test_data/ragflow.txt", "rb") as file: - blob = file.read() - document = {"display_name": display_name, "blob": blob} - documents = [] - documents.append(document) - docs = kb.upload_documents(documents) - for doc in docs: - doc.add_chunk("This is a test to add chunk") - assistant = rag.create_chat("test_create_conversation", dataset_ids=[kb.id]) - session = assistant.create_session() - question = "What is AI" - for ans in session.ask(question): - pass - - # assert not ans.content.startswith("**ERROR**"), "Please check this error." - - -def test_delete_sessions_with_success(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - kb = rag.create_dataset(name="test_delete_session") - display_name = "ragflow.txt" - with open("test_data/ragflow.txt", "rb") as file: - blob = file.read() - document = {"display_name": display_name, "blob": blob} - documents = [] - documents.append(document) - docs = kb.upload_documents(documents) - for doc in docs: - doc.add_chunk("This is a test to add chunk") - assistant = rag.create_chat("test_delete_session", dataset_ids=[kb.id]) - session = assistant.create_session() - assistant.delete_sessions(ids=[session.id]) - - -def test_update_session_with_name(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - kb = rag.create_dataset(name="test_update_session") - display_name = "ragflow.txt" - with open("test_data/ragflow.txt", "rb") as file: - blob = file.read() - document = {"display_name": display_name, "blob": blob} - documents = [] - documents.append(document) - docs = kb.upload_documents(documents) - for doc in docs: - doc.add_chunk("This is a test to add chunk") - assistant = rag.create_chat("test_update_session", dataset_ids=[kb.id]) - session = assistant.create_session(name="old session") - session.update({"name": "new session"}) - - -def test_list_sessions_with_success(get_api_key_fixture): - API_KEY = get_api_key_fixture - rag = RAGFlow(API_KEY, HOST_ADDRESS) - kb = rag.create_dataset(name="test_list_session") - display_name = "ragflow.txt" - with open("test_data/ragflow.txt", "rb") as file: - blob = file.read() - document = {"display_name": display_name, "blob": blob} - documents = [] - documents.append(document) - docs = kb.upload_documents(documents) - for doc in docs: - doc.add_chunk("This is a test to add chunk") - assistant = rag.create_chat("test_list_session", dataset_ids=[kb.id]) - assistant.create_session("test_1") - assistant.create_session("test_2") - assistant.list_sessions() - - -@pytest.mark.skip(reason="") -def test_create_agent_session_with_success(get_api_key_fixture): - API_KEY = "ragflow-BkOGNhYjIyN2JiODExZWY5MzVhMDI0Mm" - rag = RAGFlow(API_KEY, HOST_ADDRESS) - agent = rag.list_agents(id="2e45b5209c1011efa3e90242ac120006")[0] - agent.create_session() - - -@pytest.mark.skip(reason="") -def test_create_agent_conversation_with_success(get_api_key_fixture): - API_KEY = "ragflow-BkOGNhYjIyN2JiODExZWY5MzVhMDI0Mm" - rag = RAGFlow(API_KEY, HOST_ADDRESS) - agent = rag.list_agents(id="2e45b5209c1011efa3e90242ac120006")[0] - session = agent.create_session() - session.ask("What is this job") - - -@pytest.mark.skip(reason="") -def test_list_agent_sessions_with_success(get_api_key_fixture): - API_KEY = "ragflow-BkOGNhYjIyN2JiODExZWY5MzVhMDI0Mm" - rag = RAGFlow(API_KEY, HOST_ADDRESS) - agent = rag.list_agents(id="2e45b5209c1011efa3e90242ac120006")[0] - agent.list_sessions() - -@pytest.mark.skip(reason="") -def test_delete_session_of_agent_with_success(get_api_key_fixture): - API_KEY = "ragflow-BkOGNhYjIyN2JiODExZWY5MzVhMDI0Mm" - rag = RAGFlow(API_KEY, HOST_ADDRESS) - agent = rag.list_agents(id="2e45b5209c1011efa3e90242ac120006")[0] - agent.delete_sessions(ids=["test_1"]) diff --git a/sdk/python/test/test_sdk_api/test_data/ragflow.txt b/sdk/python/test/test_sdk_api/test_data/ragflow.txt deleted file mode 100644 index ad9ccb8db2d..00000000000 --- a/sdk/python/test/test_sdk_api/test_data/ragflow.txt +++ /dev/null @@ -1 +0,0 @@ -{"data":null,"code":100,"message":"TypeError(\"download_document() got an unexpected keyword argument 'tenant_id'\")"} diff --git a/sdk/python/test/test_sdk_api/test_data/ragflow_test.txt b/sdk/python/test/test_sdk_api/test_data/ragflow_test.txt deleted file mode 100644 index 350f25c5400..00000000000 --- a/sdk/python/test/test_sdk_api/test_data/ragflow_test.txt +++ /dev/null @@ -1,29 +0,0 @@ - - -Introducing RagFlow: Revolutionizing Natural Language Processing with Retrieval-Augmented Generation - -In the ever-evolving landscape of Natural Language Processing (NLP), new techniques and frameworks continue to push the boundaries of what machines can understand and generate from human language. Among these innovative advancements, RagFlow stands out as a pioneering approach that combines the power of retrieval and generation to revolutionize the way we interact with text-based data. - -What is RagFlow? - -RagFlow, short for Retrieval-Augmented Generation Flow, is a framework designed to enhance the capabilities of NLP models by integrating a retrieval component into the generation process. This approach leverages large-scale knowledge bases and text corpora to retrieve relevant information that can inform and enrich the output generated by the model. By doing so, RagFlow enables models to produce more accurate, informative, and contextually relevant responses, surpassing the limitations of traditional generation-only or retrieval-only systems. - -The Core Concept - -At its core, RagFlow operates on two fundamental principles: - -Retrieval: The first step involves identifying and retrieving relevant information from a vast collection of text sources. This can include web pages, academic articles, books, or any other form of unstructured text data. RagFlow employs advanced retrieval algorithms, often based on neural networks and vector similarity, to quickly and accurately locate the most pertinent information for a given query or task. -Generation: Once relevant information has been retrieved, RagFlow leverages generative NLP models to produce the final output. These models, such as transformers or GPT-like architectures, are trained to understand the context provided by the retrieved information and generate coherent, fluent text that incorporates this knowledge. The integration of retrieval and generation allows RagFlow to generate responses that are not only grammatically correct but also semantically rich and contextually appropriate. -Advantages of RagFlow - -Increased Accuracy and Relevance: By incorporating retrieved information, RagFlow can generate responses that are more accurate and relevant to the user's query or task. This is particularly useful in domains where factual accuracy and contextual relevance are crucial, such as question answering, summarization, and knowledge-intensive dialogue systems. -Scalability and Flexibility: RagFlow's reliance on large-scale text corpora and retrieval algorithms makes it highly scalable to new domains and datasets. As more data becomes available, the retrieval component can be easily updated to incorporate new information, while the generative model can be fine-tuned to adapt to specific tasks or user preferences. -Improved Efficiency: By leveraging pre-existing knowledge bases and retrieval algorithms, RagFlow can reduce the computational burden on the generative model. This allows the model to focus on generating high-quality output rather than searching for relevant information from scratch, resulting in improved efficiency and faster response times. -Applications and Future Directions - -RagFlow has the potential to transform a wide range of NLP applications, including but not limited to: - -Question Answering Systems: By retrieving relevant passages and generating precise answers, RagFlow can enhance the accuracy and comprehensiveness of question answering systems. -Document Summarization: By identifying key information and generating concise summaries, RagFlow can help users quickly grasp the main points of lengthy documents. -Creative Writing and Storytelling: By incorporating retrieved elements into the generation process, RagFlow can inspire and augment creative writing, enabling machines to produce more engaging and original stories. -As the field of NLP continues to evolve, RagFlow represents a promising direction for leveraging the power of both retrieval and generation. With further research and development, we can expect to see even more sophisticated and versatile RagFlow-based systems that push the boundaries of what machines can achieve with human language. \ No newline at end of file diff --git a/sdk/python/test/test_sdk_api/test_data/test.docx b/sdk/python/test/test_sdk_api/test_data/test.docx deleted file mode 100644 index 2eba99d1cb5f5811d85b21e0e4b71e0fec3926a0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19146 zcmeHv19xT1y7r1~yOWO5v8|46+qP}nPRF*{VaK*@tHUpQpL^~;XW#Svf_vv0HOHE( z>UnCeIo_J}s!CP@1QZnj4uAvz0E7UBI2#pXAON5c3;;j@KmuzB+E_apSv%?|y4e~z zXnk|Fviy<{3QV300RC+Mf5-pgC(w{MYTieODEt`o9x&asB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yVBvvS{Ucv18pLL92Zk)j1QLGz0An5A5o<1!Q!^fJo*5Y#Vv=ed z4h>v7(%p4+YGVhv+}SRA>t=L>`@;w-Ibz^N-+TDQolr5&^2f_PuREZxSdw58Ee+@% z`8AZI1&>So>2@o2MfbHJJ9HP~n@!($qZTLeI4H}1zt;6*2rTM4AbsbjC$ECP>&}l_ zT-I@~i1E8mtf+-Shn#{$-0 zH_K3l%ISG%?mrX2|B)UJ1Wfa(7ysu?d;TE|f1Urs7Cy2P|4#7l+lu@J1psnB$K1bc zGV*ue-}hVi3)=meu>NPP=3iG<{2l)93o`x!0|4vj{{{d5EYJ8m)8BLC|Kdu-`u}9i z|DEFR8Iyle{Q5Lf{t{ulh;0_T6n|2@$47e4OWKfC|$u-D(g zf47(Z0*7$@7x-`1)885XuGRj<@Rj$!82(Mi{X72O)rY^(0KhXp0PsJQiNC}D{T=_W g@I;}1f&bSVUseL_Q@j8G*v}8pr-asv{BiaF0A2ki^Z)<= diff --git a/sdk/python/test/test_sdk_api/test_data/test.html b/sdk/python/test/test_sdk_api/test_data/test.html deleted file mode 100644 index ba3cded0338..00000000000 --- a/sdk/python/test/test_sdk_api/test_data/test.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - Sample HTML 1 - - - - Sample HTML 1 -

Minime vero, inquit ille, consentit.

- -

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Inscite autem medicinae et gubernationis ultimum cum ultimo sapientiae comparatur. Cur igitur, cum de re conveniat, non malumus usitate loqui?

- -
    -
  1. Si qua in iis corrigere voluit, deteriora fecit.
  2. -
  3. At quicum ioca seria, ut dicitur, quicum arcana, quicum occulta omnia?
  4. -
  5. An dolor longissimus quisque miserrimus, voluptatem non optabiliorem diuturnitas facit?
  6. -
  7. Multoque hoc melius nos veriusque quam Stoici.
  8. -
  9. Stuprata per vim Lucretia a regis filio testata civis se ipsa interemit.
  10. -
  11. Ego vero isti, inquam, permitto.
  12. -
- - -

Graecum enim hunc versum nostis omnes-: Suavis laborum est praeteritorum memoria. Qui enim existimabit posse se miserum esse beatus non erit. Si qua in iis corrigere voluit, deteriora fecit. Si qua in iis corrigere voluit, deteriora fecit. Dic in quovis conventu te omnia facere, ne doleas. Tu quidem reddes;

- -
    -
  • Duo Reges: constructio interrete.
  • -
  • Contineo me ab exemplis.
  • -
  • Quo plebiscito decreta a senatu est consuli quaestio Cn.
  • -
  • Quicquid porro animo cernimus, id omne oritur a sensibus;
  • -
  • Eam si varietatem diceres, intellegerem, ut etiam non dicente te intellego;
  • -
  • Qua ex cognitione facilior facta est investigatio rerum occultissimarum.
  • -
- - -
- Me igitur ipsum ames oportet, non mea, si veri amici futuri sumus. -
- - - \ No newline at end of file diff --git a/sdk/python/test/test_sdk_api/test_data/test.jpg b/sdk/python/test/test_sdk_api/test_data/test.jpg deleted file mode 100644 index ff2d4ebf8ecf9f4947d286221fd2be57aecd5a28..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 88731 zcmb5VS5#AL7d5;|0-=Y{L`o8qAk~JTfU$IvRh8gym3=Cz z8X8C>Qeh7oi$-A85lF=UE+Qg46)Fam6&II9D8dyH|IgcQ8vqvMbH2UE&_&& z?6w0M0007kMgI4^|NjPtfJ8;apn$l9aJPk=aJL8;3>i1fQo>?a0no}PyPr& z%+W^ytr(iff*KSnVJsThJ@Zcgi7R7|`Yu?8?V)NK-Ux3LUPDa;_`mM}h=2evL^u$_ zoyXw+=LR6*&_KY#p$ZhxBczOV$R#9{!312+l&lT$H~36J0aZ0&JL`#sCx(j zO1otdFni_U>QYT`Hl#o-lO?kY*!Q}XxsDcU-YCLsFYhO~!py^$%0r^YPB+I!_UL30 zZw3AYnbOAX&fuOome1v?-b0Q4#v6w~Zvy8OerSn4Ut`5Q{TjO^`pc3)t}CPbD)RP|9na8q5->Vcz5x{bWfcCOEiAHrjCz$)N3= zj0yCQotR}PrqjzWO1Qcz62y{G8?)kl8n|}op20PwDmBqGaVKHK6U69nL~Q2Op=$~T zhCCw{%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?fSVhflc#f$<^=h-Wakyb-tX4l2d@m9vO8F_+_ura(&Ac`WGiV{U71hce+o1@AFTchkq9mi`H=I+xLXJSb1Ps!7pB8eiIWC6!X z;f4PIgzKx0RT4=e({J5zHrTpPM7aozS(YfwK=hCREDNy;C{bQb*Z|$UKABy|B?2);C zv(#GV7k=~rzk%(ndf7Y)NDk!41Up<-}i zU$!vF2y@apo00;%mImd$Headq$uBqnhA$g4C@WxsK^%|O zu|x6`?JXlSnRf`jp<{h~4*vS)XVWY`Xgaadv0qVP z?(k!OXyait`(E>s&Sff-5@JvRS5*Os2dvTLf*X)*19ji=cf-D6Zac8cET(CGysZ&+ zC#pWRYbb3`-AX!${{Rm=PT@4agY`xq)qlfc?lFEI9;49>tA8T)U(;G$2{U480CUwR zEzg0i7&7mTG%H(Q2S)UsMt0M(ZW$<>Zr`WWj?XUa86gM6V*chPZ;W6;b{+jhK;2 zHQ!NB>TEpr$4rcFysnV3!x%-E>NsjrGVoj_l6y0Z7f# pKH@tQ^Qx`93HSLvu=>3jQ3UJfrsrF$?W}440Cn0==r?$u|JnJE4*388 diff --git a/sdk/python/test/test_sdk_api/test_data/test.json b/sdk/python/test/test_sdk_api/test_data/test.json deleted file mode 100644 index a0c8c82e954..00000000000 --- a/sdk/python/test/test_sdk_api/test_data/test.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "单车": [ - "自行车" - ], - "青禾服装": [ - "青禾服饰" - ], - "救济灾民": [ - "救助", - "灾民救济", - "赈济" - ], - "左移": [], - "低速": [], - "雨果网": [], - "钢小二": [ - "成立于2013年,位于江苏省无锡市,是一家以从事研究和试验发展为主的企业" - ], - "第五项": [ - "5项" - ], - "铸排机": [ - "机排", - "排铸机", - "排铸" - ], - "金淳高分子": [], - "麦门冬汤": [], - "错位": [], - "佰特吉姆": [], - "楼体": [], - "展美科技": [ - "美展" - ], - "中寮": [], - "贪官汙吏": [ - "...", - "贪吏", - "贪官污吏" - ], - "掩蔽部": [ - "掩 蔽 部" - ], - "海宏智能": [], - "中寰": [], - "万次": [], - "领星资本": [ - "星领" - ], - "肯讯": [], - "坎肩": [], - "爱农人": [], - "易美餐": [], - "寸丝半粟": [], - "罗丹萍": [], - "转导物": [], - "泊寓": [], - "万欧": [ - "欧万" - ], - "友聚惠": [ - "友惠", - "惠友" - ], - "舞牙弄爪": [ - ":形容凶猛的样子,比喻威胁、恐吓", - "原形容猛兽的凶相,后常用来比喻猖狂凶恶的样子", - "成语解释:原形容猛兽的凶相,后常用来比喻猖狂凶恶的样子", - "原形容猛兽的凶相,后常用来比喻猖狂(好工具hao86.com", - "牙舞爪", - "形容猛兽凶恶可怕。也比喻猖狂凶恶", - "舞爪" - ], - "上海致上": [ - "上海上", - "上海市" - ], - "迪因加": [], - "李正茂": [], - "君来投": [], - "双掌空": [ - "双掌 空", - "空掌", - "两手空空" - ], - "浩石": [ - "石浩", - "皓石" - ], - "云阅文学": [], - "阿斯帕": [], - "中导": [], - "以诚相待": [], - "中融金服": [], - "尚股网": [], - "叶立钦": [ - "叶利钦" - ], - "新信钱包": [ - "信信" - ], - "赛苏投资": [ - "投资者" - ], - "售价": [], - "帮医网": [] -} \ No newline at end of file diff --git a/sdk/python/test/test_sdk_api/test_data/test.md b/sdk/python/test/test_sdk_api/test_data/test.md deleted file mode 100644 index 0639b98ba1c..00000000000 --- a/sdk/python/test/test_sdk_api/test_data/test.md +++ /dev/null @@ -1,21 +0,0 @@ -Quod equidem non reprehendo; -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quibus natura iure responderit non esse verum aliunde finem beate vivendi, a se principia rei gerendae peti; Quae enim adhuc protulisti, popularia sunt, ego autem a te elegantiora desidero. Duo Reges: constructio interrete. Tum Lucius: Mihi vero ista valde probata sunt, quod item fratri puto. Bestiarum vero nullum iudicium puto. Nihil enim iam habes, quod ad corpus referas; Deinde prima illa, quae in congressu solemus: Quid tu, inquit, huc? Et homini, qui ceteris animantibus plurimum praestat, praecipue a natura nihil datum esse dicemus? - -Iam id ipsum absurdum, maximum malum neglegi. Quod ea non occurrentia fingunt, vincunt Aristonem; Atqui perspicuum est hominem e corpore animoque constare, cum primae sint animi partes, secundae corporis. Fieri, inquam, Triari, nullo pacto potest, ut non dicas, quid non probes eius, a quo dissentias. Equidem e Cn. An dubium est, quin virtus ita maximam partem optineat in rebus humanis, ut reliquas obruat? - -Quis istum dolorem timet? -Summus dolor plures dies manere non potest? Dicet pro me ipsa virtus nec dubitabit isti vestro beato M. Tubulum fuisse, qua illum, cuius is condemnatus est rogatione, P. Quod si ita sit, cur opera philosophiae sit danda nescio. - -Ex eorum enim scriptis et institutis cum omnis doctrina liberalis, omnis historia. -Quod si ita est, sequitur id ipsum, quod te velle video, omnes semper beatos esse sapientes. Cum enim fertur quasi torrens oratio, quamvis multa cuiusque modi rapiat, nihil tamen teneas, nihil apprehendas, nusquam orationem rapidam coerceas. Ita redarguitur ipse a sese, convincunturque scripta eius probitate ipsius ac moribus. At quanta conantur! Mundum hunc omnem oppidum esse nostrum! Incendi igitur eos, qui audiunt, vides. Vide, ne magis, inquam, tuum fuerit, cum re idem tibi, quod mihi, videretur, non nova te rebus nomina inponere. Qui-vere falsone, quaerere mittimus-dicitur oculis se privasse; Si ista mala sunt, in quae potest incidere sapiens, sapientem esse non esse ad beate vivendum satis. At vero si ad vitem sensus accesserit, ut appetitum quendam habeat et per se ipsa moveatur, quid facturam putas? - -Quem si tenueris, non modo meum Ciceronem, sed etiam me ipsum abducas licebit. -Stulti autem malorum memoria torquentur, sapientes bona praeterita grata recordatione renovata delectant. -Esse enim quam vellet iniquus iustus poterat inpune. -Quae autem natura suae primae institutionis oblita est? -Verum tamen cum de rebus grandioribus dicas, ipsae res verba rapiunt; -Hoc est non modo cor non habere, sed ne palatum quidem. -Voluptatem cum summum bonum diceret, primum in eo ipso parum vidit, deinde hoc quoque alienum; Sed tu istuc dixti bene Latine, parum plane. Nam haec ipsa mihi erunt in promptu, quae modo audivi, nec ante aggrediar, quam te ab istis, quos dicis, instructum videro. Fatebuntur Stoici haec omnia dicta esse praeclare, neque eam causam Zenoni desciscendi fuisse. Non autem hoc: igitur ne illud quidem. Ratio quidem vestra sic cogit. Cum audissem Antiochum, Brute, ut solebam, cum M. An quod ita callida est, ut optime possit architectari voluptates? - -Idemne, quod iucunde? -Haec mihi videtur delicatior, ut ita dicam, molliorque ratio, quam virtutis vis gravitasque postulat. Sed quoniam et advesperascit et mihi ad villam revertendum est, nunc quidem hactenus; Cuius ad naturam apta ratio vera illa et summa lex a philosophis dicitur. Neque solum ea communia, verum etiam paria esse dixerunt. Sed nunc, quod agimus; A mene tu? \ No newline at end of file diff --git a/sdk/python/test/test_sdk_api/test_data/test.pdf b/sdk/python/test/test_sdk_api/test_data/test.pdf deleted file mode 100644 index 72d0d21d38fa2baaedec331f7171d89eb6c4a253..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 65715 zcmb@u1yo&2lQ4R45AN;~+}+*X9S-j91P|`+?j&e{K+xds5FofiaF=(Id+&TR-#;_! z{cpXlUi(yaRoAZWu0wV8*&9k_aY+UiMs|40zLLIn%pLJK6vHn^zdKY zw!(>sKBx(fKK=IM{P-YthdsXe>qq+R=`Oof&Wx^s`Q4@O-31uo!P)K=(;`t>W9zMH z(xTyGVb(-IP2J0e&;cB=1@C*V2(ja?xEJ(*{+{tJ!LOVAFOQdfhp#S=>OiJ(AjNGF zg!DNWqHBjWr73^Lj*pVq?5=)yaS zgC_xm^Bf`vV&PaQSarfx7v+HUt2XL0X+0QR6WHKZd!G>mf~#_4J88Q$y6s^JBFjk% z>(9(+S`oOyv-<_lvVuz8_?+hoTZKG9Rz(Xc6kA-m40jnn-fhS2nRiit5@zqE((Fem z%=!$@)v$znjfvt2Dd8H{c5bppO-3urYc8D8F$A%fRzgX*zgxu2VTtI4zs%cWGof9~ zOEzN8R>=E-X`qK6yfGYyN?Db;*tGQ^GjuHfu0&zG21>Cn3f)u}MK{xN^lUllWQ^d)d5hTLmQ?w^7C6wbqpR{% zjkEEk39PVS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hX%Scf3s&8SXStX>p!=Y{bT?BG5?1K zGj*kZRq(IPFaHqyV@`*Hc33Z_sMUZ|woU3;!#X`j;pG&OS zcRj!JYkz4vgBEQ5FShM>Ex&UQe`z6w9&e#qerF Date: Thu, 8 Jan 2026 16:11:50 +0800 Subject: [PATCH 065/335] Fix: apply kb setting while re-parsing.... (#12501) ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/document_app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/api/apps/document_app.py b/api/apps/document_app.py index 4fcc07e65c8..58d576ed255 100644 --- a/api/apps/document_app.py +++ b/api/apps/document_app.py @@ -615,6 +615,7 @@ def _run_sync(): e, kb = KnowledgebaseService.get_by_id(doc.kb_id) if not e: raise LookupError("Can't find this dataset!") + doc.parser_config["llm_id"] = kb.parser_config.get("llm_id") doc.parser_config["enable_metadata"] = kb.parser_config.get("enable_metadata", False) doc.parser_config["metadata"] = kb.parser_config.get("metadata", {}) DocumentService.update_parser_config(doc.id, doc.parser_config) From a093e616cf27c35c06078678ea4ce4ba2248087b Mon Sep 17 00:00:00 2001 From: Magicbook1108 Date: Thu, 8 Jan 2026 16:12:08 +0800 Subject: [PATCH 066/335] Fix: add multimodel models in chat api (#12496) ### What problem does this PR solve? Fix: add multimodel models in chat api #11986 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Co-authored-by: Kevin Hu --- api/apps/sdk/chat.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/apps/sdk/chat.py b/api/apps/sdk/chat.py index 1efb628f1bc..4321d736619 100644 --- a/api/apps/sdk/chat.py +++ b/api/apps/sdk/chat.py @@ -51,7 +51,9 @@ async def create(tenant_id): req["llm_id"] = llm.pop("model_name") if req.get("llm_id") is not None: llm_name, llm_factory = TenantLLMService.split_model_name_and_factory(req["llm_id"]) - if not TenantLLMService.query(tenant_id=tenant_id, llm_name=llm_name, llm_factory=llm_factory, model_type="chat"): + model_type = llm.get("model_type") + model_type = model_type if model_type in ["chat", "image2text"] else "chat" + if not TenantLLMService.query(tenant_id=tenant_id, llm_name=llm_name, llm_factory=llm_factory, model_type=model_type): return get_error_data_result(f"`model_name` {req.get('llm_id')} doesn't exist") req["llm_setting"] = req.pop("llm") e, tenant = TenantService.get_by_id(tenant_id) From 14c250e3d7abe4c6ce77ebaadb2a7196d672ebcc Mon Sep 17 00:00:00 2001 From: Jin Hai Date: Thu, 8 Jan 2026 16:44:53 +0800 Subject: [PATCH 067/335] Fix adding column error (#12503) ### What problem does this PR solve? 1. Fix redundant column adding 2. Refactor the code ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [x] Refactoring --------- Signed-off-by: Jin Hai --- api/db/db_models.py | 280 +++++++++++--------------------------------- 1 file changed, 71 insertions(+), 209 deletions(-) diff --git a/api/db/db_models.py b/api/db/db_models.py index 77b357dcf07..080613b84c9 100644 --- a/api/db/db_models.py +++ b/api/db/db_models.py @@ -1205,223 +1205,85 @@ class SystemSettings(DataBaseModel): class Meta: db_table = "system_settings" -def migrate_db(): - logging.disable(logging.ERROR) - migrator = DatabaseMigrator[settings.DATABASE_TYPE.upper()].value(DB) - try: - migrate(migrator.add_column("file", "source_type", CharField(max_length=128, null=False, default="", help_text="where dose this document come from", index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("tenant", "rerank_id", CharField(max_length=128, null=False, default="BAAI/bge-reranker-v2-m3", help_text="default rerank model ID"))) - except Exception: - pass - try: - migrate(migrator.add_column("dialog", "rerank_id", CharField(max_length=128, null=False, default="", help_text="default rerank model ID"))) - except Exception: - pass - try: - migrate(migrator.add_column("dialog", "top_k", IntegerField(default=1024))) - except Exception: - pass - try: - migrate(migrator.alter_column_type("tenant_llm", "api_key", CharField(max_length=2048, null=True, help_text="API KEY", index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("api_token", "source", CharField(max_length=16, null=True, help_text="none|agent|dialog", index=True))) - except Exception: - pass +def alter_db_add_column(migrator, table_name, column_name, column_type): try: - migrate(migrator.add_column("tenant", "tts_id", CharField(max_length=256, null=True, help_text="default tts model ID", index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("api_4_conversation", "source", CharField(max_length=16, null=True, help_text="none|agent|dialog", index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("task", "retry_count", IntegerField(default=0))) - except Exception: - pass - try: - migrate(migrator.alter_column_type("api_token", "dialog_id", CharField(max_length=32, null=True, index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("tenant_llm", "max_tokens", IntegerField(default=8192, index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("api_4_conversation", "dsl", JSONField(null=True, default={}))) - except Exception: - pass - try: - migrate(migrator.add_column("knowledgebase", "pagerank", IntegerField(default=0, index=False))) - except Exception: - pass - try: - migrate(migrator.add_column("api_token", "beta", CharField(max_length=255, null=True, index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("task", "digest", TextField(null=True, help_text="task digest", default=""))) - except Exception: - pass + migrate(migrator.add_column(table_name, column_name, column_type)) + except OperationalError as ex: + error_codes = [1060] + error_messages = ['Duplicate column name'] + + should_skip_error = ( + (hasattr(ex, 'args') and ex.args and ex.args[0] in error_codes) or + (str(ex) in error_messages) + ) - try: - migrate(migrator.add_column("task", "chunk_ids", LongTextField(null=True, help_text="chunk ids", default=""))) - except Exception: - pass - try: - migrate(migrator.add_column("conversation", "user_id", CharField(max_length=255, null=True, help_text="user_id", index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("document", "meta_fields", JSONField(null=True, default={}))) - except Exception: - pass - try: - migrate(migrator.add_column("task", "task_type", CharField(max_length=32, null=False, default=""))) - except Exception: - pass - try: - migrate(migrator.add_column("task", "priority", IntegerField(default=0))) - except Exception: - pass - try: - migrate(migrator.add_column("user_canvas", "permission", CharField(max_length=16, null=False, help_text="me|team", default="me", index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("llm", "is_tools", BooleanField(null=False, help_text="support tools", default=False))) - except Exception: - pass - try: - migrate(migrator.add_column("mcp_server", "variables", JSONField(null=True, help_text="MCP Server variables", default=dict))) - except Exception: - pass - try: - migrate(migrator.rename_column("task", "process_duation", "process_duration")) - except Exception: - pass - try: - migrate(migrator.rename_column("document", "process_duation", "process_duration")) - except Exception: - pass - try: - migrate(migrator.add_column("document", "suffix", CharField(max_length=32, null=False, default="", help_text="The real file extension suffix", index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("api_4_conversation", "errors", TextField(null=True, help_text="errors"))) - except Exception: - pass - try: - migrate(migrator.add_column("dialog", "meta_data_filter", JSONField(null=True, default={}))) - except Exception: - pass - try: - migrate(migrator.alter_column_type("canvas_template", "title", JSONField(null=True, default=dict, help_text="Canvas title"))) - except Exception: - pass - try: - migrate(migrator.alter_column_type("canvas_template", "description", JSONField(null=True, default=dict, help_text="Canvas description"))) - except Exception: - pass - try: - migrate(migrator.add_column("user_canvas", "canvas_category", CharField(max_length=32, null=False, default="agent_canvas", help_text="agent_canvas|dataflow_canvas", index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("canvas_template", "canvas_category", CharField(max_length=32, null=False, default="agent_canvas", help_text="agent_canvas|dataflow_canvas", index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("knowledgebase", "pipeline_id", CharField(max_length=32, null=True, help_text="Pipeline ID", index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("document", "pipeline_id", CharField(max_length=32, null=True, help_text="Pipeline ID", index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("knowledgebase", "graphrag_task_id", CharField(max_length=32, null=True, help_text="Gragh RAG task ID", index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("knowledgebase", "raptor_task_id", CharField(max_length=32, null=True, help_text="RAPTOR task ID", index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("knowledgebase", "graphrag_task_finish_at", DateTimeField(null=True))) - except Exception: - pass - try: - migrate(migrator.add_column("knowledgebase", "raptor_task_finish_at", CharField(null=True))) - except Exception: - pass - try: - migrate(migrator.add_column("knowledgebase", "mindmap_task_id", CharField(max_length=32, null=True, help_text="Mindmap task ID", index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("knowledgebase", "mindmap_task_finish_at", CharField(null=True))) - except Exception: - pass - try: - migrate(migrator.alter_column_type("tenant_llm", "api_key", TextField(null=True, help_text="API KEY"))) - except Exception: - pass - try: - migrate(migrator.add_column("tenant_llm", "status", CharField(max_length=1, null=False, help_text="is it validate(0: wasted, 1: validate)", default="1", index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("connector2kb", "auto_parse", CharField(max_length=1, null=False, default="1", index=False))) - except Exception: - pass - try: - migrate(migrator.add_column("llm_factories", "rank", IntegerField(default=0, index=False))) - except Exception: - pass + if not should_skip_error: + logging.critical(f"Failed to add {settings.DATABASE_TYPE.upper()}.{table_name} column {column_name}, operation error: {ex}") - # RAG Evaluation tables - try: - migrate(migrator.add_column("evaluation_datasets", "id", CharField(max_length=32, primary_key=True))) - except Exception: - pass - try: - migrate(migrator.add_column("evaluation_datasets", "tenant_id", CharField(max_length=32, null=False, index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("evaluation_datasets", "name", CharField(max_length=255, null=False, index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("evaluation_datasets", "description", TextField(null=True))) - except Exception: - pass - try: - migrate(migrator.add_column("evaluation_datasets", "kb_ids", JSONField(null=False))) - except Exception: - pass - try: - migrate(migrator.add_column("evaluation_datasets", "created_by", CharField(max_length=32, null=False, index=True))) - except Exception: - pass - try: - migrate(migrator.add_column("evaluation_datasets", "create_time", BigIntegerField(null=False, index=True))) - except Exception: + except Exception as ex: + logging.critical(f"Failed to add {settings.DATABASE_TYPE.upper()}.{table_name} column {column_name}, error: {ex}") pass + +def alter_db_column_type(migrator, table_name, column_name, new_column_type): try: - migrate(migrator.add_column("evaluation_datasets", "update_time", BigIntegerField(null=False))) - except Exception: + migrate(migrator.alter_column_type(table_name, column_name, new_column_type)) + except Exception as ex: + logging.critical(f"Failed to alter {settings.DATABASE_TYPE.upper()}.{table_name} column {column_name} type, error: {ex}") pass + +def alter_db_rename_column(migrator, table_name, old_column_name, new_column_name): try: - migrate(migrator.add_column("evaluation_datasets", "status", IntegerField(null=False, default=1))) + migrate(migrator.rename_column(table_name, old_column_name, new_column_name)) except Exception: + # rename fail will lead to a weired error. + # logging.critical(f"Failed to rename {settings.DATABASE_TYPE.upper()}.{table_name} column {old_column_name} to {new_column_name}, error: {ex}") pass +def migrate_db(): + logging.disable(logging.ERROR) + migrator = DatabaseMigrator[settings.DATABASE_TYPE.upper()].value(DB) + alter_db_add_column(migrator, "file", "source_type", CharField(max_length=128, null=False, default="", help_text="where dose this document come from", index=True)) + alter_db_add_column(migrator, "tenant", "rerank_id", CharField(max_length=128, null=False, default="BAAI/bge-reranker-v2-m3", help_text="default rerank model ID")) + alter_db_add_column(migrator, "dialog", "rerank_id", CharField(max_length=128, null=False, default="", help_text="default rerank model ID")) + alter_db_column_type(migrator, "dialog", "top_k", IntegerField(default=1024)) + alter_db_add_column(migrator, "tenant_llm", "api_key", CharField(max_length=2048, null=True, help_text="API KEY", index=True)) + alter_db_add_column(migrator, "api_token", "source", CharField(max_length=16, null=True, help_text="none|agent|dialog", index=True)) + alter_db_add_column(migrator, "tenant", "tts_id", CharField(max_length=256, null=True, help_text="default tts model ID", index=True)) + alter_db_add_column(migrator, "api_4_conversation", "source", CharField(max_length=16, null=True, help_text="none|agent|dialog", index=True)) + alter_db_add_column(migrator, "task", "retry_count", IntegerField(default=0)) + alter_db_column_type(migrator, "api_token", "dialog_id", CharField(max_length=32, null=True, index=True)) + alter_db_add_column(migrator, "tenant_llm", "max_tokens", IntegerField(default=8192, index=True)) + alter_db_add_column(migrator, "api_4_conversation", "dsl", JSONField(null=True, default={})) + alter_db_add_column(migrator, "knowledgebase", "pagerank", IntegerField(default=0, index=False)) + alter_db_add_column(migrator, "api_token", "beta", CharField(max_length=255, null=True, index=True)) + alter_db_add_column(migrator, "task", "digest", TextField(null=True, help_text="task digest", default="")) + alter_db_add_column(migrator, "task", "chunk_ids", LongTextField(null=True, help_text="chunk ids", default="")) + alter_db_add_column(migrator, "conversation", "user_id", CharField(max_length=255, null=True, help_text="user_id", index=True)) + alter_db_add_column(migrator, "document", "meta_fields", JSONField(null=True, default={})) + alter_db_add_column(migrator, "task", "task_type", CharField(max_length=32, null=False, default="")) + alter_db_add_column(migrator, "task", "priority", IntegerField(default=0)) + alter_db_add_column(migrator, "user_canvas", "permission", CharField(max_length=16, null=False, help_text="me|team", default="me", index=True)) + alter_db_add_column(migrator, "llm", "is_tools", BooleanField(null=False, help_text="support tools", default=False)) + alter_db_add_column(migrator, "mcp_server", "variables", JSONField(null=True, help_text="MCP Server variables", default=dict)) + alter_db_rename_column(migrator, "task", "process_duation", "process_duration") + alter_db_rename_column(migrator, "document", "process_duation", "process_duration") + alter_db_add_column(migrator, "document", "suffix", CharField(max_length=32, null=False, default="", help_text="The real file extension suffix", index=True)) + alter_db_add_column(migrator, "api_4_conversation", "errors", TextField(null=True, help_text="errors")) + alter_db_add_column(migrator, "dialog", "meta_data_filter", JSONField(null=True, default={})) + alter_db_column_type(migrator, "canvas_template", "title", JSONField(null=True, default=dict, help_text="Canvas title")) + alter_db_column_type(migrator, "canvas_template", "description", JSONField(null=True, default=dict, help_text="Canvas description")) + alter_db_add_column(migrator, "user_canvas", "canvas_category", CharField(max_length=32, null=False, default="agent_canvas", help_text="agent_canvas|dataflow_canvas", index=True)) + alter_db_add_column(migrator, "canvas_template", "canvas_category", CharField(max_length=32, null=False, default="agent_canvas", help_text="agent_canvas|dataflow_canvas", index=True)) + alter_db_add_column(migrator, "knowledgebase", "pipeline_id", CharField(max_length=32, null=True, help_text="Pipeline ID", index=True)) + alter_db_add_column(migrator, "document", "pipeline_id", CharField(max_length=32, null=True, help_text="Pipeline ID", index=True)) + alter_db_add_column(migrator, "knowledgebase", "graphrag_task_id", CharField(max_length=32, null=True, help_text="Gragh RAG task ID", index=True)) + alter_db_add_column(migrator, "knowledgebase", "raptor_task_id", CharField(max_length=32, null=True, help_text="RAPTOR task ID", index=True)) + alter_db_add_column(migrator, "knowledgebase", "graphrag_task_finish_at", DateTimeField(null=True)) + alter_db_add_column(migrator, "knowledgebase", "raptor_task_finish_at", CharField(null=True)) + alter_db_add_column(migrator, "knowledgebase", "mindmap_task_id", CharField(max_length=32, null=True, help_text="Mindmap task ID", index=True)) + alter_db_add_column(migrator, "knowledgebase", "mindmap_task_finish_at", CharField(null=True)) + alter_db_column_type(migrator, "tenant_llm", "api_key", TextField(null=True, help_text="API KEY")) + alter_db_add_column(migrator, "tenant_llm", "status", CharField(max_length=1, null=False, help_text="is it validate(0: wasted, 1: validate)", default="1", index=True)) + alter_db_add_column(migrator, "connector2kb", "auto_parse", CharField(max_length=1, null=False, default="1", index=False)) + alter_db_add_column(migrator, "llm_factories", "rank", IntegerField(default=0, index=False)) logging.disable(logging.NOTSET) From 455fd04050621faf067507cc7eb6c16e51caca87 Mon Sep 17 00:00:00 2001 From: balibabu Date: Thu, 8 Jan 2026 19:42:45 +0800 Subject: [PATCH 068/335] Refactor: Replace Ant Design with shadcn in SparkModal, TencentCloudModal, HunyuanModal, and GoogleModal. #1036 (#12510) ### What problem does this PR solve? Refactor: Replace Ant Design with shadcn in SparkModal, TencentCloudModal, HunyuanModal, and GoogleModal. #1036 ### Type of change - [x] Refactoring --- .../modal/google-modal/index.tsx | 229 +++++++++------- .../modal/hunyuan-modal/index.tsx | 118 ++++---- .../modal/next-tencent-modal/index.tsx | 236 ++++++++-------- .../setting-model/modal/spark-modal/index.tsx | 258 +++++++++--------- .../system-model-setting-modal/index.tsx | 132 --------- 5 files changed, 446 insertions(+), 527 deletions(-) delete mode 100644 web/src/pages/user-setting/setting-model/modal/system-model-setting-modal/index.tsx diff --git a/web/src/pages/user-setting/setting-model/modal/google-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/google-modal/index.tsx index 47a7dd77cab..4dbbe073221 100644 --- a/web/src/pages/user-setting/setting-model/modal/google-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/google-modal/index.tsx @@ -1,17 +1,15 @@ -import { useTranslate } from '@/hooks/common-hooks'; +import { + DynamicForm, + FormFieldConfig, + FormFieldType, +} from '@/components/dynamic-form'; +import { Modal } from '@/components/ui/modal/modal'; +import { useCommonTranslation, useTranslate } from '@/hooks/common-hooks'; import { IModalProps } from '@/interfaces/common'; import { IAddLlmRequestBody } from '@/interfaces/request/llm'; -import { Form, Input, InputNumber, Modal, Select } from 'antd'; +import { FieldValues } from 'react-hook-form'; import { LLMHeader } from '../../components/llm-header'; -type FieldType = IAddLlmRequestBody & { - google_project_id: string; - google_region: string; - google_service_account_key: string; -}; - -const { Option } = Select; - const GoogleModal = ({ visible, hideModal, @@ -19,114 +17,137 @@ const GoogleModal = ({ loading, llmFactory, }: IModalProps & { llmFactory: string }) => { - const [form] = Form.useForm(); - const { t } = useTranslate('setting'); - const handleOk = async () => { - const values = await form.validateFields(); + const { t: tc } = useCommonTranslation(); + + const fields: FormFieldConfig[] = [ + { + name: 'model_type', + label: t('modelType'), + type: FormFieldType.Select, + required: true, + options: [ + { label: 'chat', value: 'chat' }, + { label: 'image2text', value: 'image2text' }, + ], + defaultValue: 'chat', + validation: { + message: t('modelTypeMessage'), + }, + }, + { + name: 'llm_name', + label: t('modelID'), + type: FormFieldType.Text, + required: true, + placeholder: t('GoogleModelIDMessage'), + validation: { + message: t('GoogleModelIDMessage'), + }, + }, + { + name: 'google_project_id', + label: t('addGoogleProjectID'), + type: FormFieldType.Text, + required: true, + placeholder: t('GoogleProjectIDMessage'), + validation: { + message: t('GoogleProjectIDMessage'), + }, + }, + { + name: 'google_region', + label: t('addGoogleRegion'), + type: FormFieldType.Text, + required: true, + placeholder: t('GoogleRegionMessage'), + validation: { + message: t('GoogleRegionMessage'), + }, + }, + { + name: 'google_service_account_key', + label: t('addGoogleServiceAccountKey'), + type: FormFieldType.Text, + required: true, + placeholder: t('GoogleServiceAccountKeyMessage'), + validation: { + message: t('GoogleServiceAccountKeyMessage'), + }, + }, + { + name: 'max_tokens', + label: t('maxTokens'), + type: FormFieldType.Number, + required: true, + placeholder: t('maxTokensTip'), + validation: { + min: 0, + message: t('maxTokensMinMessage'), + }, + customValidate: (value: any) => { + if (value === undefined || value === null || value === '') { + return t('maxTokensMessage'); + } + if (value < 0) { + return t('maxTokensMinMessage'); + } + return true; + }, + }, + ]; + + const handleOk = async (values?: FieldValues) => { + if (!values) return; const data = { - ...values, llm_factory: llmFactory, + model_type: values.model_type, + llm_name: values.llm_name, + google_project_id: values.google_project_id, + google_region: values.google_region, + google_service_account_key: values.google_service_account_key, max_tokens: values.max_tokens, - }; + } as IAddLlmRequestBody; - onOk?.(data); - }; - - const handleKeyDown = async (e: React.KeyboardEvent) => { - if (e.key === 'Enter') { - await handleOk(); - } + await onOk?.(data); }; return ( } - open={visible} - onOk={handleOk} - onCancel={hideModal} - okButtonProps={{ loading }} + open={visible || false} + onOpenChange={(open) => !open && hideModal?.()} + maskClosable={false} + footer={

} > -
- - label={t('modelType')} - name="model_type" - initialValue={'chat'} - rules={[{ required: true, message: t('modelTypeMessage') }]} - > - - - - label={t('modelID')} - name="llm_name" - rules={[{ required: true, message: t('GoogleModelIDMessage') }]} - > - - - - label={t('addGoogleProjectID')} - name="google_project_id" - rules={[{ required: true, message: t('GoogleProjectIDMessage') }]} - > - - - - label={t('addGoogleRegion')} - name="google_region" - rules={[{ required: true, message: t('GoogleRegionMessage') }]} - > - - - - label={t('addGoogleServiceAccountKey')} - name="google_service_account_key" - rules={[ - { required: true, message: t('GoogleServiceAccountKeyMessage') }, - ]} - > - { + // Form submission is handled by SavingButton + }} + defaultValues={ + { + model_type: 'chat', + } as FieldValues + } + labelClassName="font-normal" + > +
+ { + hideModal?.(); + }} /> - - - label={t('maxTokens')} - name="max_tokens" - rules={[ - { required: true, message: t('maxTokensMessage') }, - { - type: 'number', - message: t('maxTokensInvalidMessage'), - }, - ({}) => ({ - validator(_, value) { - if (value < 0) { - return Promise.reject(new Error(t('maxTokensMinMessage'))); - } - return Promise.resolve(); - }, - }), - ]} - > - { + handleOk(values); + }} /> - - +
+ ); }; diff --git a/web/src/pages/user-setting/setting-model/modal/hunyuan-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/hunyuan-modal/index.tsx index b4e91c1a297..30c1fbd5097 100644 --- a/web/src/pages/user-setting/setting-model/modal/hunyuan-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/hunyuan-modal/index.tsx @@ -1,16 +1,15 @@ -import { useTranslate } from '@/hooks/common-hooks'; +import { + DynamicForm, + FormFieldConfig, + FormFieldType, +} from '@/components/dynamic-form'; +import { Modal } from '@/components/ui/modal/modal'; +import { useCommonTranslation, useTranslate } from '@/hooks/common-hooks'; import { IModalProps } from '@/interfaces/common'; import { IAddLlmRequestBody } from '@/interfaces/request/llm'; -import { Form, Input, Modal } from 'antd'; -import omit from 'lodash/omit'; +import { FieldValues } from 'react-hook-form'; import { LLMHeader } from '../../components/llm-header'; -type FieldType = IAddLlmRequestBody & { - vision: boolean; - hunyuan_sid: string; - hunyuan_sk: string; -}; - const HunyuanModal = ({ visible, hideModal, @@ -18,70 +17,73 @@ const HunyuanModal = ({ loading, llmFactory, }: IModalProps & { llmFactory: string }) => { - const [form] = Form.useForm(); - const { t } = useTranslate('setting'); + const { t: tc } = useCommonTranslation(); - const handleOk = async () => { - const values = await form.validateFields(); - const modelType = - values.model_type === 'chat' && values.vision - ? 'image2text' - : values.model_type; + const fields: FormFieldConfig[] = [ + { + name: 'hunyuan_sid', + label: t('addHunyuanSID'), + type: FormFieldType.Text, + required: true, + placeholder: t('HunyuanSIDMessage'), + validation: { + message: t('HunyuanSIDMessage'), + }, + }, + { + name: 'hunyuan_sk', + label: t('addHunyuanSK'), + type: FormFieldType.Text, + required: true, + placeholder: t('HunyuanSKMessage'), + validation: { + message: t('HunyuanSKMessage'), + }, + }, + ]; + + const handleOk = async (values?: FieldValues) => { + if (!values) return; const data = { - ...omit(values, ['vision']), - model_type: modelType, + hunyuan_sid: values.hunyuan_sid as string, + hunyuan_sk: values.hunyuan_sk as string, llm_factory: llmFactory, - }; - console.info(data); - - onOk?.(data); - }; + } as unknown as IAddLlmRequestBody; - const handleKeyDown = async (e: React.KeyboardEvent) => { - if (e.key === 'Enter') { - await handleOk(); - } + await onOk?.(data); }; return ( } - open={visible} - onOk={handleOk} - onCancel={hideModal} - okButtonProps={{ loading }} - confirmLoading={loading} + open={visible || false} + onOpenChange={(open) => !open && hideModal?.()} + maskClosable={false} + footer={
} + className="max-w-[600px]" > -
{}} + labelClassName="font-normal" > - - label={t('addHunyuanSID')} - name="hunyuan_sid" - rules={[{ required: true, message: t('HunyuanSIDMessage') }]} - > - + { + hideModal?.(); + }} /> - - - label={t('addHunyuanSK')} - name="hunyuan_sk" - rules={[{ required: true, message: t('HunyuanSKMessage') }]} - > - { + handleOk(values); + }} /> - - +
+ ); }; diff --git a/web/src/pages/user-setting/setting-model/modal/next-tencent-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/next-tencent-modal/index.tsx index 4214cce7422..5d0329e8dec 100644 --- a/web/src/pages/user-setting/setting-model/modal/next-tencent-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/next-tencent-modal/index.tsx @@ -1,135 +1,155 @@ -import { useTranslate } from '@/hooks/common-hooks'; +import { + DynamicForm, + FormFieldConfig, + FormFieldType, +} from '@/components/dynamic-form'; +import { Modal } from '@/components/ui/modal/modal'; +import { useCommonTranslation, useTranslate } from '@/hooks/common-hooks'; import { IModalProps } from '@/interfaces/common'; import { IAddLlmRequestBody } from '@/interfaces/request/llm'; -import { Flex, Form, Input, Modal, Select, Space } from 'antd'; -import omit from 'lodash/omit'; +import { FieldValues } from 'react-hook-form'; import { LLMHeader } from '../../components/llm-header'; -type FieldType = IAddLlmRequestBody & { - TencentCloud_sid: string; - TencentCloud_sk: string; -}; - -const { Option } = Select; - const TencentCloudModal = ({ visible, hideModal, onOk, loading, llmFactory, -}: IModalProps & { llmFactory: string }) => { - const [form] = Form.useForm(); - +}: IModalProps> & { + llmFactory: string; +}) => { const { t } = useTranslate('setting'); + const { t: tc } = useCommonTranslation(); + + const fields: FormFieldConfig[] = [ + { + name: 'model_type', + label: t('modelType'), + type: FormFieldType.Select, + required: true, + options: [{ label: 'speech2text', value: 'speech2text' }], + defaultValue: 'speech2text', + validation: { + message: t('modelTypeMessage'), + }, + }, + { + name: 'llm_name', + label: t('modelName'), + type: FormFieldType.Select, + required: true, + options: [ + { label: '16k_zh', value: '16k_zh' }, + { label: '16k_zh_large', value: '16k_zh_large' }, + { label: '16k_multi_lang', value: '16k_multi_lang' }, + { label: '16k_zh_dialect', value: '16k_zh_dialect' }, + { label: '16k_en', value: '16k_en' }, + { label: '16k_yue', value: '16k_yue' }, + { label: '16k_zh-PY', value: '16k_zh-PY' }, + { label: '16k_ja', value: '16k_ja' }, + { label: '16k_ko', value: '16k_ko' }, + { label: '16k_vi', value: '16k_vi' }, + { label: '16k_ms', value: '16k_ms' }, + { label: '16k_id', value: '16k_id' }, + { label: '16k_fil', value: '16k_fil' }, + { label: '16k_th', value: '16k_th' }, + { label: '16k_pt', value: '16k_pt' }, + { label: '16k_tr', value: '16k_tr' }, + { label: '16k_ar', value: '16k_ar' }, + { label: '16k_es', value: '16k_es' }, + { label: '16k_hi', value: '16k_hi' }, + { label: '16k_fr', value: '16k_fr' }, + { label: '16k_zh_medical', value: '16k_zh_medical' }, + { label: '16k_de', value: '16k_de' }, + ], + defaultValue: '16k_zh', + validation: { + message: t('SparkModelNameMessage'), + }, + }, + { + name: 'TencentCloud_sid', + label: t('addTencentCloudSID'), + type: FormFieldType.Text, + required: true, + placeholder: t('TencentCloudSIDMessage'), + validation: { + message: t('TencentCloudSIDMessage'), + }, + }, + { + name: 'TencentCloud_sk', + label: t('addTencentCloudSK'), + type: FormFieldType.Text, + required: true, + placeholder: t('TencentCloudSKMessage'), + validation: { + message: t('TencentCloudSKMessage'), + }, + }, + ]; + + const handleOk = async (values?: FieldValues) => { + if (!values) return; - const handleOk = async () => { - const values = await form.validateFields(); const modelType = values.model_type; const data = { - ...omit(values), model_type: modelType, + llm_name: values.llm_name as string, + TencentCloud_sid: values.TencentCloud_sid as string, + TencentCloud_sk: values.TencentCloud_sk as string, llm_factory: llmFactory, - max_tokens: 16000, - }; - console.info(data); - - onOk?.(data); - }; + } as Omit; - const handleKeyDown = async (e: React.KeyboardEvent) => { - if (e.key === 'Enter') { - await handleOk(); - } + await onOk?.(data); }; return ( } - open={visible} - onOk={handleOk} - onCancel={hideModal} - okButtonProps={{ loading }} - footer={(originNode: React.ReactNode) => { - return ( - - - {t('TencentCloudLink')} - - {originNode} - - ); - }} - confirmLoading={loading} + open={visible || false} + onOpenChange={(open) => !open && hideModal?.()} + maskClosable={false} + footer={null} > -
- - label={t('modelType')} - name="model_type" - initialValue={'speech2text'} - rules={[{ required: true, message: t('modelTypeMessage') }]} - > - - - - label={t('modelName')} - name="llm_name" - initialValue={'16k_zh'} - rules={[{ required: true, message: t('SparkModelNameMessage') }]} - > - - - - label={t('addTencentCloudSID')} - name="TencentCloud_sid" - rules={[{ required: true, message: t('TencentCloudSIDMessage') }]} - > - - - - label={t('addTencentCloudSK')} - name="TencentCloud_sk" - rules={[{ required: true, message: t('TencentCloudSKMessage') }]} - > - - - + {}} + defaultValues={ + { + model_type: 'speech2text', + llm_name: '16k_zh', + } as FieldValues + } + labelClassName="font-normal" + > +
+ + {t('TencentCloudLink')} + +
+ { + hideModal?.(); + }} + /> + { + handleOk(values); + }} + /> +
+
+
); }; diff --git a/web/src/pages/user-setting/setting-model/modal/spark-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/spark-modal/index.tsx index 67dcf21c2a9..bac3c3b1d71 100644 --- a/web/src/pages/user-setting/setting-model/modal/spark-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/spark-modal/index.tsx @@ -1,20 +1,16 @@ -import { useTranslate } from '@/hooks/common-hooks'; +import { + DynamicForm, + FormFieldConfig, + FormFieldType, +} from '@/components/dynamic-form'; +import { Modal } from '@/components/ui/modal/modal'; +import { useCommonTranslation, useTranslate } from '@/hooks/common-hooks'; import { IModalProps } from '@/interfaces/common'; import { IAddLlmRequestBody } from '@/interfaces/request/llm'; -import { Form, Input, InputNumber, Modal, Select } from 'antd'; import omit from 'lodash/omit'; +import { FieldValues } from 'react-hook-form'; import { LLMHeader } from '../../components/llm-header'; -type FieldType = IAddLlmRequestBody & { - vision: boolean; - spark_api_password: string; - spark_app_id: string; - spark_api_secret: string; - spark_api_key: string; -}; - -const { Option } = Select; - const SparkModal = ({ visible, hideModal, @@ -22,12 +18,102 @@ const SparkModal = ({ loading, llmFactory, }: IModalProps & { llmFactory: string }) => { - const [form] = Form.useForm(); - const { t } = useTranslate('setting'); + const { t: tc } = useCommonTranslation(); + + const fields: FormFieldConfig[] = [ + { + name: 'model_type', + label: t('modelType'), + type: FormFieldType.Select, + required: true, + options: [ + { label: 'chat', value: 'chat' }, + { label: 'tts', value: 'tts' }, + ], + defaultValue: 'chat', + validation: { + message: t('modelTypeMessage'), + }, + }, + { + name: 'llm_name', + label: t('modelName'), + type: FormFieldType.Text, + required: true, + placeholder: t('modelNameMessage'), + validation: { + message: t('SparkModelNameMessage'), + }, + }, + { + name: 'spark_api_password', + label: t('addSparkAPIPassword'), + type: FormFieldType.Text, + required: true, + placeholder: t('SparkAPIPasswordMessage'), + validation: { + message: t('SparkAPIPasswordMessage'), + }, + }, + { + name: 'spark_app_id', + label: t('addSparkAPPID'), + type: FormFieldType.Text, + required: true, + placeholder: t('SparkAPPIDMessage'), + validation: { + message: t('SparkAPPIDMessage'), + }, + dependencies: ['model_type'], + shouldRender: (formValues: any) => { + return formValues?.model_type === 'tts'; + }, + }, + { + name: 'spark_api_secret', + label: t('addSparkAPISecret'), + type: FormFieldType.Text, + required: true, + placeholder: t('SparkAPISecretMessage'), + validation: { + message: t('SparkAPISecretMessage'), + }, + dependencies: ['model_type'], + shouldRender: (formValues: any) => { + return formValues?.model_type === 'tts'; + }, + }, + { + name: 'spark_api_key', + label: t('addSparkAPIKey'), + type: FormFieldType.Text, + required: true, + placeholder: t('SparkAPIKeyMessage'), + validation: { + message: t('SparkAPIKeyMessage'), + }, + dependencies: ['model_type'], + shouldRender: (formValues: any) => { + return formValues?.model_type === 'tts'; + }, + }, + { + name: 'max_tokens', + label: t('maxTokens'), + type: FormFieldType.Number, + required: true, + placeholder: t('maxTokensTip'), + validation: { + min: 0, + message: t('maxTokensInvalidMessage'), + }, + }, + ]; + + const handleOk = async (values?: FieldValues) => { + if (!values) return; - const handleOk = async () => { - const values = await form.validateFields(); const modelType = values.model_type === 'chat' && values.vision ? 'image2text' @@ -39,124 +125,46 @@ const SparkModal = ({ llm_factory: llmFactory, max_tokens: values.max_tokens, }; - console.info(data); - - onOk?.(data); - }; - const handleKeyDown = async (e: React.KeyboardEvent) => { - if (e.key === 'Enter') { - await handleOk(); - } + await onOk?.(data as IAddLlmRequestBody); }; return ( } - open={visible} - onOk={handleOk} - onCancel={hideModal} - okButtonProps={{ loading }} - confirmLoading={loading} + open={visible || false} + onOpenChange={(open) => !open && hideModal?.()} + maskClosable={false} + footer={
} > -
- - label={t('modelType')} - name="model_type" - initialValue={'chat'} - rules={[{ required: true, message: t('modelTypeMessage') }]} - > - - - - label={t('modelName')} - name="llm_name" - rules={[{ required: true, message: t('SparkModelNameMessage') }]} - > - - - - label={t('addSparkAPIPassword')} - name="spark_api_password" - rules={[{ required: true, message: t('SparkAPIPasswordMessage') }]} - > - { + console.log(data); + }} + defaultValues={ + { + model_type: 'chat', + vision: false, + } as FieldValues + } + labelClassName="font-normal" + > +
+ { + hideModal?.(); + }} /> - - - {({ getFieldValue }) => - getFieldValue('model_type') === 'tts' && ( - - label={t('addSparkAPPID')} - name="spark_app_id" - rules={[{ required: true, message: t('SparkAPPIDMessage') }]} - > - - - ) - } - - - {({ getFieldValue }) => - getFieldValue('model_type') === 'tts' && ( - - label={t('addSparkAPISecret')} - name="spark_api_secret" - rules={[ - { required: true, message: t('SparkAPISecretMessage') }, - ]} - > - - - ) - } - - - {({ getFieldValue }) => - getFieldValue('model_type') === 'tts' && ( - - label={t('addSparkAPIKey')} - name="spark_api_key" - rules={[{ required: true, message: t('SparkAPIKeyMessage') }]} - > - - - ) - } - - - label={t('maxTokens')} - name="max_tokens" - rules={[ - { required: true, message: t('maxTokensMessage') }, - { - type: 'number', - message: t('maxTokensInvalidMessage'), - }, - ({}) => ({ - validator(_, value) { - if (value < 0) { - return Promise.reject(new Error(t('maxTokensMinMessage'))); - } - return Promise.resolve(); - }, - }), - ]} - > - { + handleOk(values); + }} /> - - +
+
); }; diff --git a/web/src/pages/user-setting/setting-model/modal/system-model-setting-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/system-model-setting-modal/index.tsx deleted file mode 100644 index 110a3317c1e..00000000000 --- a/web/src/pages/user-setting/setting-model/modal/system-model-setting-modal/index.tsx +++ /dev/null @@ -1,132 +0,0 @@ -import { IModalManagerChildrenProps } from '@/components/modal-manager'; -import { LlmModelType } from '@/constants/knowledge'; -import { useTranslate } from '@/hooks/common-hooks'; -import { - ISystemModelSettingSavingParams, - useComposeLlmOptionsByModelTypes, -} from '@/hooks/use-llm-request'; -import { Form, Modal, Select } from 'antd'; -import { useEffect } from 'react'; -import { useFetchSystemModelSettingOnMount } from '../../hooks'; - -interface IProps extends Omit { - loading: boolean; - onOk: ( - payload: Omit, - ) => void; -} - -const SystemModelSettingModal = ({ - visible, - hideModal, - onOk, - loading, -}: IProps) => { - const [form] = Form.useForm(); - const { systemSetting: initialValues, allOptions } = - useFetchSystemModelSettingOnMount(); - const { t } = useTranslate('setting'); - - const handleOk = async () => { - const values = await form.validateFields(); - onOk({ - ...values, - asr_id: values.asr_id ?? '', - embd_id: values.embd_id ?? '', - img2txt_id: values.img2txt_id ?? '', - llm_id: values.llm_id ?? '', - }); - }; - - useEffect(() => { - if (visible) { - form.setFieldsValue(initialValues); - } - }, [form, initialValues, visible]); - - const onFormLayoutChange = () => {}; - - const modelOptions = useComposeLlmOptionsByModelTypes([ - LlmModelType.Chat, - LlmModelType.Image2text, - ]); - - return ( - -
- - - - - - - - - -
-
- ); -}; - -export default SystemModelSettingModal; From 9562762af2807006f68fa1fa3c7bfdf45884ebca Mon Sep 17 00:00:00 2001 From: lys1313013 Date: Fri, 9 Jan 2026 10:19:40 +0800 Subject: [PATCH 069/335] docs: fix embedding model switching tooltip (#12517) ### What problem does this PR solve? After version 0.22.1, the embedding model supports switching; the corresponding tooltip needs to be updated. ### Type of change - [x] Documentation Update --- web/src/locales/de.ts | 2 +- web/src/locales/en.ts | 2 +- web/src/locales/fr.ts | 2 +- web/src/locales/id.ts | 2 +- web/src/locales/it.ts | 2 +- web/src/locales/ja.ts | 2 +- web/src/locales/pt-br.ts | 2 +- web/src/locales/ru.ts | 2 +- web/src/locales/vi.ts | 2 +- web/src/locales/zh-traditional.ts | 2 +- web/src/locales/zh.ts | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/web/src/locales/de.ts b/web/src/locales/de.ts index 4297ad73e01..a3860f5abd0 100644 --- a/web/src/locales/de.ts +++ b/web/src/locales/de.ts @@ -448,7 +448,7 @@ Prozedurales Gedächtnis: Erlernte Fähigkeiten, Gewohnheiten und automatisierte chunkTokenNumber: 'Empfohlene Chunk-Größe', chunkTokenNumberMessage: 'Chunk-Token-Anzahl ist erforderlich', embeddingModelTip: - 'Das Standard-Embedding-Modell der Wissensdatenbank. Es kann nicht geändert werden, sobald die Wissensdatenbank Chunks enthält. Um zu einem anderen Standard-Embedding-Modell zu wechseln, müssen alle vorhandenen Chunks in der Wissensdatenbank gelöscht werden.', + 'Das Standard-Embedding-Modell der Wissensdatenbank. Sobald die Wissensdatenbank Chunks enthält, führt das System beim Wechsel des Embedding-Modells eine Kompatibilitätsprüfung durch: Es zieht zufällig einige Chunks als Stichprobe, kodiert sie mit dem neuen Embedding-Modell neu und berechnet die Kosinusähnlichkeit zwischen neuen und alten Vektoren. Ein Wechsel ist nur möglich, wenn die durchschnittliche Ähnlichkeit der Stichprobe ≥ 0.9 ist. Andernfalls müssen Sie alle Chunks in der Wissensdatenbank löschen, bevor Sie das Modell ändern können.', permissionsTip: 'Wenn auf "Team" gesetzt, können alle Teammitglieder die Wissensdatenbank verwalten.', chunkTokenNumberTip: diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index 42458e61684..315d9d3a299 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -482,7 +482,7 @@ Example: A 1 KB message with 1024-dim embedding uses ~9 KB. The 5 MB default lim chunkTokenNumber: 'Recommended chunk size', chunkTokenNumberMessage: 'Chunk token number for text is required', embeddingModelTip: - 'The default embedding model for the knowledge base. It cannot be changed once the knowledge base has chunks. To switch to a different default embedding model, you must delete all existing chunks in the knowledge base.', + 'The default embedding model used by the knowledge base. Once the knowledge base has chunks, when switching the embedding model, the system randomly samples a few chunks for a compatibility check, re-embeds them with the new embedding model, and computes cosine similarity between the new and old vectors. Switching is allowed only when the average similarity of the sample is ≥ 0.9. Otherwise, you must delete all chunks in the knowledge base before you can change it.', permissionsTip: "If it is set to 'Team', all your team members will be able to manage the knowledge base.", chunkTokenNumberTip: diff --git a/web/src/locales/fr.ts b/web/src/locales/fr.ts index dd691a2457b..a664bc349d0 100644 --- a/web/src/locales/fr.ts +++ b/web/src/locales/fr.ts @@ -211,7 +211,7 @@ export default { chunkTokenNumber: 'Taille de segment recommandée', chunkTokenNumberMessage: 'Le nombre de tokens par segment est requis', embeddingModelTip: - 'Modèle d’embedding par défaut. Ne peut pas être modifié si la base contient déjà des segments. Pour le changer, vous devez supprimer tous les segments existants.', + 'Modèle d’embedding par défaut de la base de connaissances. Une fois que la base de connaissances contient des segments, lors du changement de modèle d’embedding, le système prélève aléatoirement quelques segments pour un contrôle de compatibilité, les ré-encode avec le nouveau modèle d’embedding et calcule la similarité cosinus entre les nouveaux et anciens vecteurs. Le basculement est autorisé uniquement si la similarité moyenne de l’échantillon est ≥ 0.9. Sinon, vous devez supprimer tous les segments de la base de connaissances avant de pouvoir le modifier.', permissionsTip: "Si défini sur 'Équipe', tous les membres de votre équipe pourront gérer cette base.", chunkTokenNumberTip: diff --git a/web/src/locales/id.ts b/web/src/locales/id.ts index 11f78f819a2..61a728b1b14 100644 --- a/web/src/locales/id.ts +++ b/web/src/locales/id.ts @@ -179,7 +179,7 @@ export default { chunkTokenNumber: 'Ukuran potongan yang disarankan', chunkTokenNumberMessage: 'Jumlah token potongan diperlukan', embeddingModelTip: - 'Model embedding default dari basis pengetahuan. Tidak dapat diubah setelah basis pengetahuan memiliki potongan data (chunks). Untuk beralih ke model embedding default yang berbeda, Anda harus menghapus semua potongan data yang ada di basis pengetahuan.', + 'Model embedding default untuk basis pengetahuan. Setelah basis pengetahuan memiliki chunk, saat mengganti model embedding sistem akan mengambil beberapa chunk secara acak untuk pemeriksaan kompatibilitas, meng-encode ulang dengan model embedding baru, dan menghitung kemiripan kosinus antara vektor baru dan vektor lama. Pergantian hanya diizinkan jika rata-rata kemiripan sampel ≥ 0.9. Jika tidak, Anda harus menghapus semua chunk di basis pengetahuan sebelum dapat mengubahnya.', permissionsTip: "Jika izinnya 'Tim', semua anggota tim dapat memanipulasi basis pengetahuan.", chunkTokenNumberTip: diff --git a/web/src/locales/it.ts b/web/src/locales/it.ts index ce41f3ccfda..cb44b07533c 100644 --- a/web/src/locales/it.ts +++ b/web/src/locales/it.ts @@ -353,7 +353,7 @@ export default { chunkTokenNumber: 'Dimensione chunk raccomandata', chunkTokenNumberMessage: 'Il numero di token per chunk è richiesto', embeddingModelTip: - 'Il modello di embedding predefinito per la base di conoscenza. Non può essere cambiato una volta che la base di conoscenza ha chunk.', + 'Il modello di embedding predefinito della base di conoscenza. Una volta che la base di conoscenza contiene chunk, quando si cambia il modello di embedding il sistema estrae casualmente alcuni chunk per una verifica di compatibilità, li ricodifica con il nuovo modello di embedding e calcola la similarità coseno tra i vettori nuovi e quelli vecchi. Il cambio è consentito solo se la similarità media del campione è ≥ 0.9. In caso contrario, è necessario eliminare tutti i chunk nella base di conoscenza prima di poterlo modificare.', permissionsTip: "Se impostato su 'Team', tutti i membri del team potranno gestire la base di conoscenza.", chunkTokenNumberTip: diff --git a/web/src/locales/ja.ts b/web/src/locales/ja.ts index 79e7fbc562f..9eda792e24b 100644 --- a/web/src/locales/ja.ts +++ b/web/src/locales/ja.ts @@ -188,7 +188,7 @@ export default { chunkTokenNumber: '推奨チャンクサイズ', chunkTokenNumberMessage: 'チャンクトークン数は必須です', embeddingModelTip: - 'ナレッジベースのデフォルトの埋め込みモデルです。ナレッジベースにチャンクが存在する場合、変更することはできません。別のデフォルト埋め込みモデルに切り替えるには、ナレッジベース内のすべての既存チャンクを削除する必要があります。', + 'ナレッジベースで使用されるデフォルトの埋め込みモデルです。ナレッジベースにチャンクが作成された後に埋め込みモデルを変更する場合、システムは互換性チェックのためにいくつかのチャンクをランダムに抽出し、新しい埋め込みモデルで再エンコードして新旧ベクトルのコサイン類似度を計算します。サンプルの平均類似度が ≥ 0.9 の場合のみ切り替えできます。平均類似度が 0.9 未満の場合は、変更する前にナレッジベース内のすべてのチャンクを削除する必要があります。', permissionsTip: '「チーム」に設定すると、全てのチームメンバーがナレッジベースを管理できます。', chunkTokenNumberTip: diff --git a/web/src/locales/pt-br.ts b/web/src/locales/pt-br.ts index 5cb3b19917a..25bbab94f48 100644 --- a/web/src/locales/pt-br.ts +++ b/web/src/locales/pt-br.ts @@ -217,7 +217,7 @@ export default { chunkTokenNumber: 'Tamanho de bloco recomendado', chunkTokenNumberMessage: 'O número de tokens por fragmento é obrigatório', embeddingModelTip: - 'O modelo de embedding padrão da base de conhecimento. Não pode ser alterado uma vez que a base de conhecimento tenha chunks. Para mudar para um modelo de embedding padrão diferente, é necessário excluir todos os chunks existentes na base de conhecimento.', + 'O modelo de embedding padrão da base de conhecimento. Depois que a base de conhecimento já possui chunks, ao trocar o modelo de embedding o sistema sorteia alguns chunks para verificação de compatibilidade, os re-embebe com o novo modelo de embedding e calcula a similaridade cosseno entre os vetores novos e antigos. A troca só é permitida quando a similaridade média da amostra é ≥ 0.9. Caso contrário, é necessário excluir todos os chunks da base de conhecimento antes de poder alterar.', permissionsTip: "Se definido como 'Equipe', todos os membros da equipe poderão gerenciar a base de conhecimento.", chunkTokenNumberTip: diff --git a/web/src/locales/ru.ts b/web/src/locales/ru.ts index 2744b10d4f8..404577a8591 100644 --- a/web/src/locales/ru.ts +++ b/web/src/locales/ru.ts @@ -339,7 +339,7 @@ export default { chunkTokenNumber: 'Рекомендуемый размер чанка', chunkTokenNumberMessage: 'Требуется количество токенов чанка для текста', embeddingModelTip: - 'Модель эмбеддингов по умолчанию для базы знаний. Она не может быть изменена после того, как в базе знаний есть чанки. Чтобы переключиться на другую модель эмбеддингов по умолчанию, вы должны удалить все существующие чанки в базе знаний.', + 'Модель эмбеддингов по умолчанию для базы знаний. После того как в базе знаний появились чанки, при смене модели эмбеддингов система случайным образом выбирает несколько чанков для проверки совместимости, заново кодирует их новой моделью эмбеддингов и вычисляет косинусное сходство между новыми и старыми векторами. Переключение возможно только если среднее сходство по выборке ≥ 0.9. В противном случае необходимо удалить все чанки в базе знаний, чтобы изменить модель.', permissionsTip: "Если установлено значение 'Команда', все члены вашей команды смогут управлять базой знаний.", chunkTokenNumberTip: diff --git a/web/src/locales/vi.ts b/web/src/locales/vi.ts index ad1c059dc86..b57dad6e7f6 100644 --- a/web/src/locales/vi.ts +++ b/web/src/locales/vi.ts @@ -198,7 +198,7 @@ export default { chunkTokenNumber: 'Kích thước khối được khuyến nghị', chunkTokenNumberMessage: 'Số token khối là bắt buộc', embeddingModelTip: - 'Mô hình nhúng mặc định của cơ sở tri thức. Không thể thay đổi khi cơ sở tri thức đã có các đoạn dữ liệu. Để chuyển sang mô hình nhúng mặc định khác, bạn phải xóa tất cả các đoạn dữ liệu hiện có trong cơ sở tri thức.', + 'Mô hình nhúng mặc định của cơ sở tri thức. Khi cơ sở tri thức đã có các đoạn (chunk), lúc thay đổi mô hình nhúng, hệ thống sẽ lấy ngẫu nhiên một số chunk để kiểm tra tương thích, mã hóa lại bằng mô hình nhúng mới và tính độ tương đồng cosine giữa vector mới và vector cũ. Chỉ cho phép chuyển khi độ tương đồng trung bình của mẫu ≥ 0.9. Nếu không, bạn phải xóa tất cả các chunk trong cơ sở tri thức trước khi có thể thay đổi.', permissionsTip: 'Nếu được đặt thành "Đội", tất cả các thành viên trong nhóm sẽ có thể quản lý cơ sở kiến thức.', chunkTokenNumberTip: diff --git a/web/src/locales/zh-traditional.ts b/web/src/locales/zh-traditional.ts index 8eb147351ff..65bb4e08b8e 100644 --- a/web/src/locales/zh-traditional.ts +++ b/web/src/locales/zh-traditional.ts @@ -218,7 +218,7 @@ export default { chunkTokenNumber: '建議文本塊大小', chunkTokenNumberMessage: '塊Token數是必填項', embeddingModelTip: - '知識庫的預設嵌入模型。一旦知識庫已有資料區塊,則無法更改。若要切換到不同的預設嵌入模型,必須刪除知識庫中所有現有的資料區塊。', + '知識庫採用的默認嵌入模型。一旦知識庫內已經產生了文本塊,更換嵌入模型時,系統將隨機抽取若干 chunk 進行兼容性校驗,使用新嵌入模型重新編碼並計算新舊向量的餘弦相似度,樣本平均相似度需 ≥ 0.9 方可切換。否則,必須刪除知識庫內的所有文本塊後才能更改。', permissionsTip: '如果權限是“團隊”,則所有團隊成員都可以操作知識庫。', chunkTokenNumberTip: '建議的生成文本塊的 token 數閾值。如果切分得到的小文本段 token 數達不到這一閾值,系統就會不斷與之後的文本段合併,直至再合併下一個文本段會超過這一閾值為止,此時產生一個最終文本塊。如果系統在切分文本段時始終沒有遇到文本分段標識符,即便文本段 token 數已經超過這一閾值,系統也不會生成新文本塊。', diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts index 18e9273b1ca..8cbb409aad1 100644 --- a/web/src/locales/zh.ts +++ b/web/src/locales/zh.ts @@ -444,7 +444,7 @@ export default { chunkTokenNumber: '建议文本块大小', chunkTokenNumberMessage: '块Token数是必填项', embeddingModelTip: - '知识库采用的默认嵌入模型。 一旦知识库内已经产生了文本块后,你将无法更改默认的嵌入模型,除非删除知识库内的所有文本块。', + '知识库采用的默认嵌入模型。一旦知识库内已经产生了文本块,更换嵌入模型时,系统将随机抽取若干 chunk 进行兼容性校验,使用新嵌入模型重新编码并计算新旧向量的余弦相似度,样本平均相似度需 ≥ 0.9 方可切换。否则,必须删除知识库内的所有文本块后才能更改。', permissionsTip: '如果把知识库权限设为“团队”,则所有团队成员都可以操作该知识库。', chunkTokenNumberTip: From f522391d1ea5aa0c41536891558c7bc16130c69f Mon Sep 17 00:00:00 2001 From: Stephen Hu <812791840@qq.com> Date: Fri, 9 Jan 2026 10:19:51 +0800 Subject: [PATCH 070/335] Fix: "AttributeError(\"'list' object has no attribute 'get'\")" (#12518) ### What problem does this PR solve? https://github.com/infiniflow/ragflow/issues/12515 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/sdk/session.py | 2 +- rag/prompts/generator.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/api/apps/sdk/session.py b/api/apps/sdk/session.py index ceba4b40e2e..03140b60b7c 100644 --- a/api/apps/sdk/session.py +++ b/api/apps/sdk/session.py @@ -425,7 +425,7 @@ async def streamed_response_generator(chat_id, dia, msg): ], } if need_reference: - response["choices"][0]["message"]["reference"] = chunks_format(answer.get("reference", [])) + response["choices"][0]["message"]["reference"] = chunks_format(answer.get("reference", {})) return jsonify(response) diff --git a/rag/prompts/generator.py b/rag/prompts/generator.py index 7c071466317..25fd4702e61 100644 --- a/rag/prompts/generator.py +++ b/rag/prompts/generator.py @@ -38,6 +38,8 @@ def get_value(d, k1, k2): def chunks_format(reference): + if not reference or (reference is not dict): + return [] return [ { "id": get_value(chunk, "chunk_id", "id"), From a2db3e3292c7aa376f5b77419811b8b432632515 Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Fri, 9 Jan 2026 13:41:24 +0800 Subject: [PATCH 071/335] Fix: Bugs fixed (#12524) ### What problem does this PR solve? Fix: Bugs fixed - The issue of filter conditions not being able to be deleted on the knowledge base file page - The issue of metadata filter conditions not working. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- .../list-filter-bar/filter-popover.tsx | 123 ++++++++---------- .../use-handle-filter-submit.ts | 55 +++++++- web/src/hooks/use-document-request.ts | 9 +- web/src/pages/dataset/dataset/index.tsx | 7 +- 4 files changed, 119 insertions(+), 75 deletions(-) diff --git a/web/src/components/list-filter-bar/filter-popover.tsx b/web/src/components/list-filter-bar/filter-popover.tsx index bbd0d94f7bb..6b787d1711e 100644 --- a/web/src/components/list-filter-bar/filter-popover.tsx +++ b/web/src/components/list-filter-bar/filter-popover.tsx @@ -11,18 +11,12 @@ import { useMemo, useState, } from 'react'; -import { FieldPath, useForm } from 'react-hook-form'; -import { z } from 'zod'; +import { useForm } from 'react-hook-form'; +import { z, ZodArray, ZodString } from 'zod'; import { Button } from '@/components/ui/button'; -import { - Form, - FormField, - FormItem, - FormLabel, - FormMessage, -} from '@/components/ui/form'; +import { Form, FormItem, FormLabel, FormMessage } from '@/components/ui/form'; import { t } from 'i18next'; import { FilterField } from './filter-field'; import { FilterChange, FilterCollection, FilterValue } from './interface'; @@ -71,37 +65,35 @@ function CheckboxFormMultiple({ }, {}); }, [resolvedFilters]); - // const FormSchema = useMemo(() => { - // if (resolvedFilters.length === 0) { - // return z.object({}); - // } - - // return z.object( - // resolvedFilters.reduce< - // Record< - // string, - // ZodArray | z.ZodObject | z.ZodOptional - // > - // >((pre, cur) => { - // const hasNested = cur.list?.some( - // (item) => item.list && item.list.length > 0, - // ); - - // if (hasNested) { - // pre[cur.field] = z - // .record(z.string(), z.array(z.string().optional()).optional()) - // .optional(); - // } else { - // pre[cur.field] = z.array(z.string().optional()).optional(); - // } - - // return pre; - // }, {}), - // ); - // }, [resolvedFilters]); const FormSchema = useMemo(() => { - return z.object({}); - }, []); + if (resolvedFilters.length === 0) { + return z.object({}); + } + return z.object( + resolvedFilters.reduce< + Record< + string, + ZodArray | z.ZodObject | z.ZodOptional + > + >((pre, cur) => { + const hasNested = cur.list?.some( + (item) => item.list && item.list.length > 0, + ); + if (hasNested) { + pre[cur.field] = z + .record(z.string(), z.array(z.string().optional()).optional()) + .optional(); + } else { + pre[cur.field] = z.array(z.string().optional()).optional(); + } + + return pre; + }, {}), + ); + }, [resolvedFilters]); + // const FormSchema = useMemo(() => { + // return z.object({}); + // }, []); const form = useForm>({ resolver: resolvedFilters.length > 0 ? zodResolver(FormSchema) : undefined, @@ -178,37 +170,28 @@ function CheckboxFormMultiple({ {notInfilterGroup && notInfilterGroup.map((x) => { return ( - > - } - render={() => ( - -
- - {x.label} - -
- {x.list?.length && - x.list.map((item) => { - return ( - - ); - })} - -
- )} - /> + +
+ + {x.label} + +
+ {x.list?.length && + x.list.map((item) => { + return ( + + ); + })} + +
); })}
diff --git a/web/src/components/list-filter-bar/use-handle-filter-submit.ts b/web/src/components/list-filter-bar/use-handle-filter-submit.ts index 189a8d6b843..d764454e41b 100644 --- a/web/src/components/list-filter-bar/use-handle-filter-submit.ts +++ b/web/src/components/list-filter-bar/use-handle-filter-submit.ts @@ -1,7 +1,42 @@ import { useGetPaginationWithRouter } from '@/hooks/logic-hooks'; import { useCallback, useState } from 'react'; -import { FilterChange, FilterValue } from './interface'; +import { + FilterChange, + FilterCollection, + FilterType, + FilterValue, +} from './interface'; +const getFilterIds = (filter: FilterType): string[] => { + let ids: string[] = []; + if (!filter.list) { + ids = [filter.id]; + } + + if (filter.list && Array.isArray(filter.list)) { + for (const item of filter.list) { + ids = ids.concat(getFilterIds(item)); + } + } + + return ids; +}; + +const mergeFilterValue = ( + filterValue: FilterValue, + ids: string[], +): FilterValue => { + let value = {} as FilterValue; + for (const key in filterValue) { + if (Array.isArray(filterValue[key])) { + const keyIds = filterValue[key] as string[]; + value[key] = ids.filter((id) => keyIds.includes(id)); + } else if (typeof filterValue[key] === 'object') { + value[key] = mergeFilterValue(filterValue[key], ids); + } + } + return value; +}; export function useHandleFilterSubmit() { const [filterValue, setFilterValue] = useState({}); const { setPagination } = useGetPaginationWithRouter(); @@ -13,5 +48,21 @@ export function useHandleFilterSubmit() { [setPagination], ); - return { filterValue, setFilterValue, handleFilterSubmit }; + const checkValue = useCallback((filters: FilterCollection[]) => { + if (!filters?.length || !filterValue) { + return; + } + let validFields = filters.reduce((pre, cur) => { + return [...pre, ...getFilterIds(cur as FilterType)]; + }, [] as string[]); + if (!validFields.length) { + return; + } + setFilterValue((preValue) => { + const newValue: FilterValue = mergeFilterValue(preValue, validFields); + return newValue; + }); + }, []); + + return { filterValue, setFilterValue, handleFilterSubmit, checkValue }; } diff --git a/web/src/hooks/use-document-request.ts b/web/src/hooks/use-document-request.ts index 709dd20d473..22fd1dc5bda 100644 --- a/web/src/hooks/use-document-request.ts +++ b/web/src/hooks/use-document-request.ts @@ -94,8 +94,10 @@ export const useFetchDocumentList = () => { const { searchString, handleInputChange } = useHandleSearchChange(); const { pagination, setPagination } = useGetPaginationWithRouter(); const { id } = useParams(); + const queryClient = useQueryClient(); const debouncedSearchString = useDebounce(searchString, { wait: 500 }); - const { filterValue, handleFilterSubmit } = useHandleFilterSubmit(); + const { filterValue, handleFilterSubmit, checkValue } = + useHandleFilterSubmit(); const [docs, setDocs] = useState([]); const isLoop = useMemo(() => { return docs.some((doc) => doc.run === '1'); @@ -144,6 +146,9 @@ export const useFetchDocumentList = () => { }, ); if (ret.data.code === 0) { + queryClient.invalidateQueries({ + queryKey: [DocumentApiAction.FetchDocumentFilter], + }); return ret.data.data; } @@ -173,6 +178,7 @@ export const useFetchDocumentList = () => { setPagination, filterValue, handleFilterSubmit, + checkValue, }; }; @@ -191,7 +197,6 @@ export const useGetDocumentFilter = (): { DocumentApiAction.FetchDocumentFilter, debouncedSearchString, knowledgeId, - open, ], queryFn: async () => { const { data } = await kbService.documentFilter({ diff --git a/web/src/pages/dataset/dataset/index.tsx b/web/src/pages/dataset/dataset/index.tsx index b8028309969..1bebdcdad6c 100644 --- a/web/src/pages/dataset/dataset/index.tsx +++ b/web/src/pages/dataset/dataset/index.tsx @@ -14,7 +14,7 @@ import { useRowSelection } from '@/hooks/logic-hooks/use-row-selection'; import { useFetchDocumentList } from '@/hooks/use-document-request'; import { useFetchKnowledgeBaseConfiguration } from '@/hooks/use-knowledge-request'; import { Pen, Upload } from 'lucide-react'; -import { useMemo } from 'react'; +import { useEffect, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { MetadataType, @@ -48,6 +48,7 @@ export default function Dataset() { filterValue, handleFilterSubmit, loading, + checkValue, } = useFetchDocumentList(); const refreshCount = useMemo(() => { @@ -75,6 +76,10 @@ export default function Dataset() { config: metadataConfig, } = useManageMetadata(); + useEffect(() => { + checkValue(filters); + }, [filters]); + const { rowSelection, rowSelectionIsEmpty, setRowSelection, selectedCount } = useRowSelection(); From 0878526ba86aba47b33b5e1596d3110dbe8218cd Mon Sep 17 00:00:00 2001 From: balibabu Date: Fri, 9 Jan 2026 13:42:28 +0800 Subject: [PATCH 072/335] Refactor: Refactoring OllamaModal using shadcn. #1036 (#12530) ### What problem does this PR solve? Refactor: Refactoring OllamaModal using shadcn. #1036 ### Type of change - [x] Refactoring --- .../user-setting/setting-model/hooks.tsx | 2 +- .../user-setting/setting-model/index.tsx | 20 +- .../modal/ollama-modal/index.tsx | 426 +++++++++--------- web/tsconfig.json | 4 +- 4 files changed, 231 insertions(+), 221 deletions(-) diff --git a/web/src/pages/user-setting/setting-model/hooks.tsx b/web/src/pages/user-setting/setting-model/hooks.tsx index ceb80f248b6..237999fef90 100644 --- a/web/src/pages/user-setting/setting-model/hooks.tsx +++ b/web/src/pages/user-setting/setting-model/hooks.tsx @@ -117,7 +117,7 @@ export const useSubmitOllama = () => { const [selectedLlmFactory, setSelectedLlmFactory] = useState(''); const [editMode, setEditMode] = useState(false); const [initialValues, setInitialValues] = useState< - Partial | undefined + Partial & { provider_order?: string } >(); const { addLlm, loading } = useAddLlm(); const { diff --git a/web/src/pages/user-setting/setting-model/index.tsx b/web/src/pages/user-setting/setting-model/index.tsx index af7907bb0eb..1b549496c63 100644 --- a/web/src/pages/user-setting/setting-model/index.tsx +++ b/web/src/pages/user-setting/setting-model/index.tsx @@ -229,15 +229,17 @@ const ModelProviders = () => { onOk={onApiKeySavingOk} llmFactory={llmFactory} > - + {llmAddingVisible && ( + + )} > = { [LLMFactory.Ollama]: 'https://github.com/infiniflow/ragflow/blob/main/docs/guides/models/deploy_local_llm.mdx', [LLMFactory.Xinference]: @@ -43,7 +32,49 @@ const llmFactoryToUrlMap = { [LLMFactory.VLLM]: 'https://docs.vllm.ai/en/latest/', [LLMFactory.TokenPony]: 'https://docs.tokenpony.cn/#/', }; -type LlmFactory = keyof typeof llmFactoryToUrlMap; + +const optionsMap: Partial< + Record +> & { + Default: { label: string; value: string }[]; +} = { + [LLMFactory.HuggingFace]: [ + { label: 'embedding', value: 'embedding' }, + { label: 'chat', value: 'chat' }, + { label: 'rerank', value: 'rerank' }, + ], + [LLMFactory.LMStudio]: [ + { label: 'chat', value: 'chat' }, + { label: 'embedding', value: 'embedding' }, + { label: 'image2text', value: 'image2text' }, + ], + [LLMFactory.Xinference]: [ + { label: 'chat', value: 'chat' }, + { label: 'embedding', value: 'embedding' }, + { label: 'rerank', value: 'rerank' }, + { label: 'image2text', value: 'image2text' }, + { label: 'sequence2text', value: 'speech2text' }, + { label: 'tts', value: 'tts' }, + ], + [LLMFactory.ModelScope]: [{ label: 'chat', value: 'chat' }], + [LLMFactory.GPUStack]: [ + { label: 'chat', value: 'chat' }, + { label: 'embedding', value: 'embedding' }, + { label: 'rerank', value: 'rerank' }, + { label: 'sequence2text', value: 'speech2text' }, + { label: 'tts', value: 'tts' }, + ], + [LLMFactory.OpenRouter]: [ + { label: 'chat', value: 'chat' }, + { label: 'image2text', value: 'image2text' }, + ], + Default: [ + { label: 'chat', value: 'chat' }, + { label: 'embedding', value: 'embedding' }, + { label: 'rerank', value: 'rerank' }, + { label: 'image2text', value: 'image2text' }, + ], +}; const OllamaModal = ({ visible, @@ -53,215 +84,192 @@ const OllamaModal = ({ llmFactory, editMode = false, initialValues, -}: IModalProps & { +}: IModalProps & { provider_order?: string }> & { llmFactory: string; editMode?: boolean; - initialValues?: Partial; }) => { - const [form] = Form.useForm(); - const { t } = useTranslate('setting'); + const { t: tc } = useCommonTranslation(); - const handleOk = async () => { - const values = await form.validateFields(); - const modelType = - values.model_type === 'chat' && values.vision - ? 'image2text' - : values.model_type; + const url = + llmFactoryToUrlMap[llmFactory as LLMFactory] || + 'https://github.com/infiniflow/ragflow/blob/main/docs/guides/models/deploy_local_llm.mdx'; - const data = { - ...omit(values, ['vision']), - model_type: modelType, - llm_factory: llmFactory, - max_tokens: values.max_tokens, + const fields = useMemo(() => { + const getOptions = (factory: string) => { + return optionsMap[factory as LLMFactory] || optionsMap.Default; }; - console.info(data); - onOk?.(data); - }; + const baseFields: FormFieldConfig[] = [ + { + name: 'model_type', + label: t('modelType'), + type: FormFieldType.Select, + required: true, + options: getOptions(llmFactory), + validation: { + message: t('modelTypeMessage'), + }, + }, + { + name: 'llm_name', + label: t(llmFactory === 'Xinference' ? 'modelUid' : 'modelName'), + type: FormFieldType.Text, + required: true, + placeholder: t('modelNameMessage'), + validation: { + message: t('modelNameMessage'), + }, + }, + { + name: 'api_base', + label: t('addLlmBaseUrl'), + type: FormFieldType.Text, + required: true, + placeholder: t('baseUrlNameMessage'), + validation: { + message: t('baseUrlNameMessage'), + }, + }, + { + name: 'api_key', + label: t('apiKey'), + type: FormFieldType.Text, + required: false, + placeholder: t('apiKeyMessage'), + }, + { + name: 'max_tokens', + label: t('maxTokens'), + type: FormFieldType.Number, + required: true, + placeholder: t('maxTokensTip'), + validation: { + message: t('maxTokensMessage'), + }, + customValidate: (value: any) => { + if (value !== undefined && value !== null && value !== '') { + if (typeof value !== 'number') { + return t('maxTokensInvalidMessage'); + } + if (value < 0) { + return t('maxTokensMinMessage'); + } + } + return true; + }, + }, + ]; - const handleKeyDown = async (e: React.KeyboardEvent) => { - if (e.key === 'Enter') { - await handleOk(); + // Add provider_order field only for OpenRouter + if (llmFactory === 'OpenRouter') { + baseFields.push({ + name: 'provider_order', + label: 'Provider Order', + type: FormFieldType.Text, + required: false, + tooltip: 'Comma-separated provider list, e.g. Groq,Fireworks', + placeholder: 'Groq,Fireworks', + }); } - }; - useEffect(() => { - if (visible && editMode && initialValues) { - const formValues = { - llm_name: initialValues.llm_name, - model_type: initialValues.model_type, - api_base: initialValues.api_base, + // Add vision switch (conditional on model_type === 'chat') + baseFields.push({ + name: 'vision', + label: t('vision'), + type: FormFieldType.Switch, + required: false, + dependencies: ['model_type'], + shouldRender: (formValues: any) => { + return formValues?.model_type === 'chat'; + }, + }); + + return baseFields; + }, [llmFactory, t]); + + const defaultValues: FieldValues = useMemo(() => { + if (editMode && initialValues) { + return { + llm_name: initialValues.llm_name || '', + model_type: initialValues.model_type || 'chat', + api_base: initialValues.api_base || '', max_tokens: initialValues.max_tokens || 8192, api_key: '', - ...initialValues, + vision: initialValues.model_type === 'image2text', + provider_order: initialValues.provider_order || '', }; - form.setFieldsValue(formValues); - } else if (visible && !editMode) { - form.resetFields(); } - }, [visible, editMode, initialValues, form]); + return { + model_type: + llmFactory in optionsMap + ? optionsMap[llmFactory as LLMFactory]?.at(0)?.value + : 'embedding', + vision: false, + }; + }, [editMode, initialValues, llmFactory]); - const url = - llmFactoryToUrlMap[llmFactory as LlmFactory] || - 'https://github.com/infiniflow/ragflow/blob/main/docs/guides/models/deploy_local_llm.mdx'; - const optionsMap = { - [LLMFactory.HuggingFace]: [ - { value: 'embedding', label: 'embedding' }, - { value: 'chat', label: 'chat' }, - { value: 'rerank', label: 'rerank' }, - ], - [LLMFactory.LMStudio]: [ - { value: 'chat', label: 'chat' }, - { value: 'embedding', label: 'embedding' }, - { value: 'image2text', label: 'image2text' }, - ], - [LLMFactory.Xinference]: [ - { value: 'chat', label: 'chat' }, - { value: 'embedding', label: 'embedding' }, - { value: 'rerank', label: 'rerank' }, - { value: 'image2text', label: 'image2text' }, - { value: 'speech2text', label: 'sequence2text' }, - { value: 'tts', label: 'tts' }, - ], - [LLMFactory.ModelScope]: [{ value: 'chat', label: 'chat' }], - [LLMFactory.GPUStack]: [ - { value: 'chat', label: 'chat' }, - { value: 'embedding', label: 'embedding' }, - { value: 'rerank', label: 'rerank' }, - { value: 'speech2text', label: 'sequence2text' }, - { value: 'tts', label: 'tts' }, - ], - [LLMFactory.OpenRouter]: [ - { value: 'chat', label: 'chat' }, - { value: 'image2text', label: 'image2text' }, - ], - Default: [ - { value: 'chat', label: 'chat' }, - { value: 'embedding', label: 'embedding' }, - { value: 'rerank', label: 'rerank' }, - { value: 'image2text', label: 'image2text' }, - ], - }; - const getOptions = (factory: string) => { - return optionsMap[factory as keyof typeof optionsMap] || optionsMap.Default; + const handleOk = async (values?: FieldValues) => { + if (!values) return; + + const modelType = + values.model_type === 'chat' && values.vision + ? 'image2text' + : values.model_type; + + const data: IAddLlmRequestBody & { provider_order?: string } = { + llm_factory: llmFactory, + llm_name: values.llm_name as string, + model_type: modelType, + api_base: values.api_base as string, + api_key: values.api_key as string, + max_tokens: values.max_tokens as number, + }; + + // Add provider_order only if it exists (for OpenRouter) + if (values.provider_order) { + data.provider_order = values.provider_order as string; + } + + await onOk?.(data); }; + return ( } - open={visible} - onOk={handleOk} - onCancel={hideModal} - okButtonProps={{ loading }} - footer={(originNode: React.ReactNode) => { - return ( - - - {t('ollamaLink', { name: llmFactory })} - - {originNode} - - ); - }} + open={visible || false} + onOpenChange={(open) => !open && hideModal?.()} + maskClosable={false} + footer={<>} + footerClassName="py-1" > -
{}} + defaultValues={defaultValues} + labelClassName="font-normal" > - - label={t('modelType')} - name="model_type" - initialValue={'embedding'} - rules={[{ required: true, message: t('modelTypeMessage') }]} - > - - - - label={t(llmFactory === 'Xinference' ? 'modelUid' : 'modelName')} - name="llm_name" - rules={[{ required: true, message: t('modelNameMessage') }]} - > - - - - label={t('addLlmBaseUrl')} - name="api_base" - rules={[{ required: true, message: t('baseUrlNameMessage') }]} - > - - - - label={t('apiKey')} - name="api_key" - rules={[{ required: false, message: t('apiKeyMessage') }]} - > - - - - label={t('maxTokens')} - name="max_tokens" - rules={[ - { required: true, message: t('maxTokensMessage') }, - { - type: 'number', - message: t('maxTokensInvalidMessage'), - }, - ({}) => ({ - validator(_, value) { - if (value < 0) { - return Promise.reject(new Error(t('maxTokensMinMessage'))); - } - return Promise.resolve(); - }, - }), - ]} - > - - - {llmFactory === LLMFactory.OpenRouter && ( - - label="Provider Order" - name="provider_order" - tooltip="Comma-separated provider list, e.g. Groq,Fireworks" - rules={[]} - > - - - )} - - - {({ getFieldValue }) => - getFieldValue('model_type') === 'chat' && ( - - - - ) - } - - +
+ + {t('ollamaLink', { name: llmFactory })} + +
+ { + hideModal?.(); + }} + /> + { + handleOk(values); + }} + /> +
+
+
); }; diff --git a/web/tsconfig.json b/web/tsconfig.json index 513f1cca1f4..93c63b7e231 100644 --- a/web/tsconfig.json +++ b/web/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { - "target": "ES2020", + "target": "ES2022", "useDefineForClassFields": true, - "lib": ["ES2020", "DOM", "DOM.Iterable"], + "lib": ["ES2022", "DOM", "DOM.Iterable"], "module": "ESNext", "skipLibCheck": true, From fbe55cef0543c2ae1da34b0e83a1c5f0766ce3df Mon Sep 17 00:00:00 2001 From: He Wang Date: Fri, 9 Jan 2026 14:19:32 +0800 Subject: [PATCH 073/335] fix: keep password in opendal config to fix connection initialization (#12529) ### What problem does this PR solve? If we delete the password in kwargs, func 'init_db_config' will fail, so we need to keep this field. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/utils/opendal_conn.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/rag/utils/opendal_conn.py b/rag/utils/opendal_conn.py index b27e8d13246..b2a364b6029 100644 --- a/rag/utils/opendal_conn.py +++ b/rag/utils/opendal_conn.py @@ -56,12 +56,6 @@ def get_opendal_config(): "has_credentials": any(k in kwargs for k in ("password", "connection_string")), } logging.info("Loaded OpenDAL configuration (non sensitive fields only): %s", safe_log_info) - - # For safety, explicitly remove sensitive keys from kwargs after use - if "password" in kwargs: - del kwargs["password"] - if "connection_string" in kwargs: - del kwargs["connection_string"] return kwargs except Exception as e: logging.error("Failed to load OpenDAL configuration from yaml: %s", str(e)) From b65daeb945ccb0e53a273d29ad9b54678eb9ae08 Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Fri, 9 Jan 2026 17:37:17 +0800 Subject: [PATCH 074/335] Fix: Baiduyiyan key invaild (#12531) ### What problem does this PR solve? Fix: Baiduyiyan key invaild ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/constants/llm.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/src/constants/llm.ts b/web/src/constants/llm.ts index 19c4684d7c1..d603dbf4f94 100644 --- a/web/src/constants/llm.ts +++ b/web/src/constants/llm.ts @@ -141,7 +141,8 @@ export const APIMapUrl = { [LLMFactory.HuggingFace]: 'https://huggingface.co/settings/tokens', [LLMFactory.Mistral]: 'https://console.mistral.ai/api-keys/', [LLMFactory.Cohere]: 'https://dashboard.cohere.com/api-keys', - [LLMFactory.BaiduYiYan]: 'https://wenxin.baidu.com/user/key', + [LLMFactory.BaiduYiYan]: + 'https://console.bce.baidu.com/qianfan/ais/console/apiKey', [LLMFactory.Meituan]: 'https://longcat.chat/platform/api_keys', [LLMFactory.Bedrock]: 'https://us-east-1.console.aws.amazon.com/iam/home?region=us-east-2#/users', From 64b1e0b4c3ffe11bd5f69a2d28938ec63ce90b70 Mon Sep 17 00:00:00 2001 From: balibabu Date: Fri, 9 Jan 2026 17:39:40 +0800 Subject: [PATCH 075/335] Feat: The translation model type options should be consistent with the model's labels. #1036 (#12537) ### What problem does this PR solve? Feat: The translation model type options should be consistent with the model's labels. #1036 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- .../hooks/logic-hooks/use-build-options.ts | 19 +++++ web/src/locales/en.ts | 9 ++ .../modal/azure-openai-modal/index.tsx | 8 +- .../modal/bedrock-modal/index.tsx | 7 +- .../modal/fish-audio-modal/index.tsx | 4 +- .../modal/google-modal/index.tsx | 7 +- .../modal/next-tencent-modal/index.tsx | 4 +- .../modal/ollama-modal/index.tsx | 85 +++++++++---------- .../setting-model/modal/spark-modal/index.tsx | 7 +- .../modal/volcengine-modal/index.tsx | 8 +- .../setting-model/modal/yiyan-modal/index.tsx | 8 +- 11 files changed, 94 insertions(+), 72 deletions(-) diff --git a/web/src/hooks/logic-hooks/use-build-options.ts b/web/src/hooks/logic-hooks/use-build-options.ts index 62370e9bd8b..e0d09bc6eb1 100644 --- a/web/src/hooks/logic-hooks/use-build-options.ts +++ b/web/src/hooks/logic-hooks/use-build-options.ts @@ -1,5 +1,6 @@ import { SwitchLogicOperator } from '@/constants/agent'; import { buildOptions } from '@/utils/form'; +import { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; export function useBuildSwitchLogicOperatorOptions() { @@ -10,3 +11,21 @@ export function useBuildSwitchLogicOperatorOptions() { 'flow.switchLogicOperatorOptions', ); } + +export function useBuildModelTypeOptions() { + const { t } = useTranslation(); + + const buildModelTypeOptions = useCallback( + (list: string[]) => { + return list.map((x) => ({ + value: x, + label: t(`setting.modelTypes.${x}`), + })); + }, + [t], + ); + + return { + buildModelTypeOptions, + }; +} diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index 315d9d3a299..a15edf75da1 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -1233,6 +1233,15 @@ Example: Virtual Hosted Style`, 'Vision Language Model with LMDeploy Engine (Experimental)', }, }, + modelTypes: { + chat: 'Chat', + embedding: 'Embedding', + rerank: 'Rerank', + sequence2text: 'sequence2text', + tts: 'TTS', + image2text: 'OCR', + speech2text: 'ASR', + }, }, message: { registered: 'Registered!', diff --git a/web/src/pages/user-setting/setting-model/modal/azure-openai-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/azure-openai-modal/index.tsx index f08770e07d6..fca1bd976c9 100644 --- a/web/src/pages/user-setting/setting-model/modal/azure-openai-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/azure-openai-modal/index.tsx @@ -5,6 +5,7 @@ import { } from '@/components/dynamic-form'; import { Modal } from '@/components/ui/modal/modal'; import { useCommonTranslation, useTranslate } from '@/hooks/common-hooks'; +import { useBuildModelTypeOptions } from '@/hooks/logic-hooks/use-build-options'; import { IModalProps } from '@/interfaces/common'; import { IAddLlmRequestBody } from '@/interfaces/request/llm'; import { FieldValues } from 'react-hook-form'; @@ -19,6 +20,7 @@ const AzureOpenAIModal = ({ }: IModalProps & { llmFactory: string }) => { const { t } = useTranslate('setting'); const { t: tg } = useCommonTranslation(); + const { buildModelTypeOptions } = useBuildModelTypeOptions(); const fields: FormFieldConfig[] = [ { @@ -26,11 +28,7 @@ const AzureOpenAIModal = ({ label: t('modelType'), type: FormFieldType.Select, required: true, - options: [ - { label: 'chat', value: 'chat' }, - { label: 'embedding', value: 'embedding' }, - { label: 'image2text', value: 'image2text' }, - ], + options: buildModelTypeOptions(['chat', 'embedding', 'image2text']), defaultValue: 'embedding', validation: { message: t('modelTypeMessage'), diff --git a/web/src/pages/user-setting/setting-model/modal/bedrock-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/bedrock-modal/index.tsx index 664eb9a2f59..c8ccaa3a2c8 100644 --- a/web/src/pages/user-setting/setting-model/modal/bedrock-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/bedrock-modal/index.tsx @@ -6,6 +6,7 @@ import { Input } from '@/components/ui/input'; import { Modal } from '@/components/ui/modal/modal'; import { Segmented } from '@/components/ui/segmented'; import { useCommonTranslation, useTranslate } from '@/hooks/common-hooks'; +import { useBuildModelTypeOptions } from '@/hooks/logic-hooks/use-build-options'; import { IModalProps } from '@/interfaces/common'; import { IAddLlmRequestBody } from '@/interfaces/request/llm'; import { zodResolver } from '@hookform/resolvers/zod'; @@ -32,6 +33,7 @@ const BedrockModal = ({ }: IModalProps & { llmFactory: string }) => { const { t } = useTranslate('setting'); const { t: ct } = useCommonTranslation(); + const { buildModelTypeOptions } = useBuildModelTypeOptions(); const FormSchema = z .object({ @@ -160,10 +162,7 @@ const BedrockModal = ({ )} diff --git a/web/src/pages/user-setting/setting-model/modal/fish-audio-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/fish-audio-modal/index.tsx index 3ce52cef9aa..6962eeb7a8a 100644 --- a/web/src/pages/user-setting/setting-model/modal/fish-audio-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/fish-audio-modal/index.tsx @@ -5,6 +5,7 @@ import { } from '@/components/dynamic-form'; import { Modal } from '@/components/ui/modal/modal'; import { useCommonTranslation, useTranslate } from '@/hooks/common-hooks'; +import { useBuildModelTypeOptions } from '@/hooks/logic-hooks/use-build-options'; import { IModalProps } from '@/interfaces/common'; import { IAddLlmRequestBody } from '@/interfaces/request/llm'; import { FieldValues } from 'react-hook-form'; @@ -19,6 +20,7 @@ const FishAudioModal = ({ }: IModalProps & { llmFactory: string }) => { const { t } = useTranslate('setting'); const { t: tc } = useCommonTranslation(); + const { buildModelTypeOptions } = useBuildModelTypeOptions(); const fields: FormFieldConfig[] = [ { @@ -26,7 +28,7 @@ const FishAudioModal = ({ label: t('modelType'), type: FormFieldType.Select, required: true, - options: [{ label: 'tts', value: 'tts' }], + options: buildModelTypeOptions(['tts']), defaultValue: 'tts', validation: { message: t('modelTypeMessage') }, }, diff --git a/web/src/pages/user-setting/setting-model/modal/google-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/google-modal/index.tsx index 4dbbe073221..75e52d8abff 100644 --- a/web/src/pages/user-setting/setting-model/modal/google-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/google-modal/index.tsx @@ -5,6 +5,7 @@ import { } from '@/components/dynamic-form'; import { Modal } from '@/components/ui/modal/modal'; import { useCommonTranslation, useTranslate } from '@/hooks/common-hooks'; +import { useBuildModelTypeOptions } from '@/hooks/logic-hooks/use-build-options'; import { IModalProps } from '@/interfaces/common'; import { IAddLlmRequestBody } from '@/interfaces/request/llm'; import { FieldValues } from 'react-hook-form'; @@ -19,6 +20,7 @@ const GoogleModal = ({ }: IModalProps & { llmFactory: string }) => { const { t } = useTranslate('setting'); const { t: tc } = useCommonTranslation(); + const { buildModelTypeOptions } = useBuildModelTypeOptions(); const fields: FormFieldConfig[] = [ { @@ -26,10 +28,7 @@ const GoogleModal = ({ label: t('modelType'), type: FormFieldType.Select, required: true, - options: [ - { label: 'chat', value: 'chat' }, - { label: 'image2text', value: 'image2text' }, - ], + options: buildModelTypeOptions(['chat', 'image2text']), defaultValue: 'chat', validation: { message: t('modelTypeMessage'), diff --git a/web/src/pages/user-setting/setting-model/modal/next-tencent-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/next-tencent-modal/index.tsx index 5d0329e8dec..2bc80a1a087 100644 --- a/web/src/pages/user-setting/setting-model/modal/next-tencent-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/next-tencent-modal/index.tsx @@ -5,6 +5,7 @@ import { } from '@/components/dynamic-form'; import { Modal } from '@/components/ui/modal/modal'; import { useCommonTranslation, useTranslate } from '@/hooks/common-hooks'; +import { useBuildModelTypeOptions } from '@/hooks/logic-hooks/use-build-options'; import { IModalProps } from '@/interfaces/common'; import { IAddLlmRequestBody } from '@/interfaces/request/llm'; import { FieldValues } from 'react-hook-form'; @@ -21,6 +22,7 @@ const TencentCloudModal = ({ }) => { const { t } = useTranslate('setting'); const { t: tc } = useCommonTranslation(); + const { buildModelTypeOptions } = useBuildModelTypeOptions(); const fields: FormFieldConfig[] = [ { @@ -28,7 +30,7 @@ const TencentCloudModal = ({ label: t('modelType'), type: FormFieldType.Select, required: true, - options: [{ label: 'speech2text', value: 'speech2text' }], + options: buildModelTypeOptions(['speech2text']), defaultValue: 'speech2text', validation: { message: t('modelTypeMessage'), diff --git a/web/src/pages/user-setting/setting-model/modal/ollama-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/ollama-modal/index.tsx index bdce2e15cf1..8b0fe00f17b 100644 --- a/web/src/pages/user-setting/setting-model/modal/ollama-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/ollama-modal/index.tsx @@ -6,6 +6,7 @@ import { import { Modal } from '@/components/ui/modal/modal'; import { LLMFactory } from '@/constants/llm'; import { useCommonTranslation, useTranslate } from '@/hooks/common-hooks'; +import { useBuildModelTypeOptions } from '@/hooks/logic-hooks/use-build-options'; import { IModalProps } from '@/interfaces/common'; import { IAddLlmRequestBody } from '@/interfaces/request/llm'; import { useMemo } from 'react'; @@ -33,49 +34,6 @@ const llmFactoryToUrlMap: Partial> = { [LLMFactory.TokenPony]: 'https://docs.tokenpony.cn/#/', }; -const optionsMap: Partial< - Record -> & { - Default: { label: string; value: string }[]; -} = { - [LLMFactory.HuggingFace]: [ - { label: 'embedding', value: 'embedding' }, - { label: 'chat', value: 'chat' }, - { label: 'rerank', value: 'rerank' }, - ], - [LLMFactory.LMStudio]: [ - { label: 'chat', value: 'chat' }, - { label: 'embedding', value: 'embedding' }, - { label: 'image2text', value: 'image2text' }, - ], - [LLMFactory.Xinference]: [ - { label: 'chat', value: 'chat' }, - { label: 'embedding', value: 'embedding' }, - { label: 'rerank', value: 'rerank' }, - { label: 'image2text', value: 'image2text' }, - { label: 'sequence2text', value: 'speech2text' }, - { label: 'tts', value: 'tts' }, - ], - [LLMFactory.ModelScope]: [{ label: 'chat', value: 'chat' }], - [LLMFactory.GPUStack]: [ - { label: 'chat', value: 'chat' }, - { label: 'embedding', value: 'embedding' }, - { label: 'rerank', value: 'rerank' }, - { label: 'sequence2text', value: 'speech2text' }, - { label: 'tts', value: 'tts' }, - ], - [LLMFactory.OpenRouter]: [ - { label: 'chat', value: 'chat' }, - { label: 'image2text', value: 'image2text' }, - ], - Default: [ - { label: 'chat', value: 'chat' }, - { label: 'embedding', value: 'embedding' }, - { label: 'rerank', value: 'rerank' }, - { label: 'image2text', value: 'image2text' }, - ], -}; - const OllamaModal = ({ visible, hideModal, @@ -90,6 +48,47 @@ const OllamaModal = ({ }) => { const { t } = useTranslate('setting'); const { t: tc } = useCommonTranslation(); + const { buildModelTypeOptions } = useBuildModelTypeOptions(); + + const optionsMap: Partial< + Record + > & { + Default: { label: string; value: string }[]; + } = { + [LLMFactory.HuggingFace]: buildModelTypeOptions([ + 'embedding', + 'chat', + 'rerank', + ]), + [LLMFactory.LMStudio]: buildModelTypeOptions([ + 'chat', + 'embedding', + 'image2text', + ]), + [LLMFactory.Xinference]: buildModelTypeOptions([ + 'chat', + 'embedding', + 'rerank', + 'image2text', + 'speech2text', + 'tts', + ]), + [LLMFactory.ModelScope]: buildModelTypeOptions(['chat']), + [LLMFactory.GPUStack]: buildModelTypeOptions([ + 'chat', + 'embedding', + 'rerank', + 'speech2text', + 'tts', + ]), + [LLMFactory.OpenRouter]: buildModelTypeOptions(['chat', 'image2text']), + Default: buildModelTypeOptions([ + 'chat', + 'embedding', + 'rerank', + 'image2text', + ]), + }; const url = llmFactoryToUrlMap[llmFactory as LLMFactory] || diff --git a/web/src/pages/user-setting/setting-model/modal/spark-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/spark-modal/index.tsx index bac3c3b1d71..9f119d2dee1 100644 --- a/web/src/pages/user-setting/setting-model/modal/spark-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/spark-modal/index.tsx @@ -5,6 +5,7 @@ import { } from '@/components/dynamic-form'; import { Modal } from '@/components/ui/modal/modal'; import { useCommonTranslation, useTranslate } from '@/hooks/common-hooks'; +import { useBuildModelTypeOptions } from '@/hooks/logic-hooks/use-build-options'; import { IModalProps } from '@/interfaces/common'; import { IAddLlmRequestBody } from '@/interfaces/request/llm'; import omit from 'lodash/omit'; @@ -20,6 +21,7 @@ const SparkModal = ({ }: IModalProps & { llmFactory: string }) => { const { t } = useTranslate('setting'); const { t: tc } = useCommonTranslation(); + const { buildModelTypeOptions } = useBuildModelTypeOptions(); const fields: FormFieldConfig[] = [ { @@ -27,10 +29,7 @@ const SparkModal = ({ label: t('modelType'), type: FormFieldType.Select, required: true, - options: [ - { label: 'chat', value: 'chat' }, - { label: 'tts', value: 'tts' }, - ], + options: buildModelTypeOptions(['chat', 'tts']), defaultValue: 'chat', validation: { message: t('modelTypeMessage'), diff --git a/web/src/pages/user-setting/setting-model/modal/volcengine-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/volcengine-modal/index.tsx index 388fbe5d6e9..cd8646d3221 100644 --- a/web/src/pages/user-setting/setting-model/modal/volcengine-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/volcengine-modal/index.tsx @@ -5,6 +5,7 @@ import { } from '@/components/dynamic-form'; import { Modal } from '@/components/ui/modal/modal'; import { useCommonTranslation, useTranslate } from '@/hooks/common-hooks'; +import { useBuildModelTypeOptions } from '@/hooks/logic-hooks/use-build-options'; import { IModalProps } from '@/interfaces/common'; import { IAddLlmRequestBody } from '@/interfaces/request/llm'; import { FieldValues } from 'react-hook-form'; @@ -24,6 +25,7 @@ const VolcEngineModal = ({ }: IModalProps & { llmFactory: string }) => { const { t } = useTranslate('setting'); const { t: tc } = useCommonTranslation(); + const { buildModelTypeOptions } = useBuildModelTypeOptions(); const fields: FormFieldConfig[] = [ { @@ -31,11 +33,7 @@ const VolcEngineModal = ({ label: t('modelType'), type: FormFieldType.Select, required: true, - options: [ - { label: 'chat', value: 'chat' }, - { label: 'embedding', value: 'embedding' }, - { label: 'image2text', value: 'image2text' }, - ], + options: buildModelTypeOptions(['chat', 'embedding', 'image2text']), defaultValue: 'chat', }, { diff --git a/web/src/pages/user-setting/setting-model/modal/yiyan-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/yiyan-modal/index.tsx index 511f9607765..ed05845cff3 100644 --- a/web/src/pages/user-setting/setting-model/modal/yiyan-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/yiyan-modal/index.tsx @@ -5,6 +5,7 @@ import { } from '@/components/dynamic-form'; import { Modal } from '@/components/ui/modal/modal'; import { useCommonTranslation, useTranslate } from '@/hooks/common-hooks'; +import { useBuildModelTypeOptions } from '@/hooks/logic-hooks/use-build-options'; import { IModalProps } from '@/interfaces/common'; import { IAddLlmRequestBody } from '@/interfaces/request/llm'; import { FieldValues } from 'react-hook-form'; @@ -19,6 +20,7 @@ const YiyanModal = ({ }: IModalProps & { llmFactory: string }) => { const { t } = useTranslate('setting'); const { t: tc } = useCommonTranslation(); + const { buildModelTypeOptions } = useBuildModelTypeOptions(); const fields: FormFieldConfig[] = [ { @@ -26,11 +28,7 @@ const YiyanModal = ({ label: t('modelType'), type: FormFieldType.Select, required: true, - options: [ - { label: 'chat', value: 'chat' }, - { label: 'embedding', value: 'embedding' }, - { label: 'rerank', value: 'rerank' }, - ], + options: buildModelTypeOptions(['chat', 'embedding', 'rerank']), defaultValue: 'chat', }, { From f9d4179bf27f337aac7b1db2ea0f9ca1e255d22f Mon Sep 17 00:00:00 2001 From: Lynn Date: Fri, 9 Jan 2026 17:45:58 +0800 Subject: [PATCH 076/335] =?UTF-8?q?Feat=EF=BC=9Amemory=20sdk=20(#12538)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What problem does this PR solve? Move memory and message apis to /api, and add sdk support. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- api/apps/{memories_app.py => sdk/memories.py} | 12 +- api/apps/{messages_app.py => sdk/messages.py} | 12 +- docs/references/http_api_reference.md | 72 ++++---- sdk/python/ragflow_sdk/__init__.py | 4 +- sdk/python/ragflow_sdk/modules/memory.py | 95 ++++++++++ sdk/python/ragflow_sdk/ragflow.py | 82 +++++++++ .../test_memory_management/conftest.py | 52 ++++++ .../test_create_memory.py | 108 ++++++++++++ .../test_list_memory.py | 116 ++++++++++++ .../test_memory_management/test_rm_memory.py | 52 ++++++ .../test_update_memory.py | 164 +++++++++++++++++ .../test_message_management/conftest.py | 166 ++++++++++++++++++ .../test_add_message.py | 151 ++++++++++++++++ .../test_forget_message.py | 54 ++++++ .../test_get_message_content.py | 53 ++++++ .../test_get_recent_message.py | 64 +++++++ .../test_list_message.py | 101 +++++++++++ .../test_search_message.py | 79 +++++++++ .../test_update_message_status.py | 73 ++++++++ test/testcases/test_web_api/common.py | 4 +- .../test_memory_app/test_create_memory.py | 2 +- web/src/utils/api.ts | 20 ++- 22 files changed, 1475 insertions(+), 61 deletions(-) rename api/apps/{memories_app.py => sdk/memories.py} (96%) rename api/apps/{messages_app.py => sdk/messages.py} (92%) create mode 100644 sdk/python/ragflow_sdk/modules/memory.py create mode 100644 test/testcases/test_sdk_api/test_memory_management/conftest.py create mode 100644 test/testcases/test_sdk_api/test_memory_management/test_create_memory.py create mode 100644 test/testcases/test_sdk_api/test_memory_management/test_list_memory.py create mode 100644 test/testcases/test_sdk_api/test_memory_management/test_rm_memory.py create mode 100644 test/testcases/test_sdk_api/test_memory_management/test_update_memory.py create mode 100644 test/testcases/test_sdk_api/test_message_management/conftest.py create mode 100644 test/testcases/test_sdk_api/test_message_management/test_add_message.py create mode 100644 test/testcases/test_sdk_api/test_message_management/test_forget_message.py create mode 100644 test/testcases/test_sdk_api/test_message_management/test_get_message_content.py create mode 100644 test/testcases/test_sdk_api/test_message_management/test_get_recent_message.py create mode 100644 test/testcases/test_sdk_api/test_message_management/test_list_message.py create mode 100644 test/testcases/test_sdk_api/test_message_management/test_search_message.py create mode 100644 test/testcases/test_sdk_api/test_message_management/test_update_message_status.py diff --git a/api/apps/memories_app.py b/api/apps/sdk/memories.py similarity index 96% rename from api/apps/memories_app.py rename to api/apps/sdk/memories.py index 0ced960e305..ceaa93fe66c 100644 --- a/api/apps/memories_app.py +++ b/api/apps/sdk/memories.py @@ -31,7 +31,7 @@ from common.constants import MemoryType, RetCode, ForgettingPolicy -@manager.route("", methods=["POST"]) # noqa: F821 +@manager.route("/memories", methods=["POST"]) # noqa: F821 @login_required @validate_request("name", "memory_type", "embd_id", "llm_id") async def create_memory(): @@ -68,7 +68,7 @@ async def create_memory(): return get_json_result(message=str(e), code=RetCode.SERVER_ERROR) -@manager.route("/", methods=["PUT"]) # noqa: F821 +@manager.route("/memories/", methods=["PUT"]) # noqa: F821 @login_required async def update_memory(memory_id): req = await get_request_json() @@ -152,7 +152,7 @@ async def update_memory(memory_id): return get_json_result(message=str(e), code=RetCode.SERVER_ERROR) -@manager.route("/", methods=["DELETE"]) # noqa: F821 +@manager.route("/memories/", methods=["DELETE"]) # noqa: F821 @login_required async def delete_memory(memory_id): memory = MemoryService.get_by_memory_id(memory_id) @@ -168,7 +168,7 @@ async def delete_memory(memory_id): return get_json_result(message=str(e), code=RetCode.SERVER_ERROR) -@manager.route("", methods=["GET"]) # noqa: F821 +@manager.route("/memories", methods=["GET"]) # noqa: F821 @login_required async def list_memory(): args = request.args @@ -202,7 +202,7 @@ async def list_memory(): return get_json_result(message=str(e), code=RetCode.SERVER_ERROR) -@manager.route("//config", methods=["GET"]) # noqa: F821 +@manager.route("/memories//config", methods=["GET"]) # noqa: F821 @login_required async def get_memory_config(memory_id): memory = MemoryService.get_with_owner_name_by_id(memory_id) @@ -211,7 +211,7 @@ async def get_memory_config(memory_id): return get_json_result(message=True, data=format_ret_data_from_memory(memory)) -@manager.route("/", methods=["GET"]) # noqa: F821 +@manager.route("/memories/", methods=["GET"]) # noqa: F821 @login_required async def get_memory_detail(memory_id): args = request.args diff --git a/api/apps/messages_app.py b/api/apps/sdk/messages.py similarity index 92% rename from api/apps/messages_app.py rename to api/apps/sdk/messages.py index e9e5ca14e3e..5ed5902188a 100644 --- a/api/apps/messages_app.py +++ b/api/apps/sdk/messages.py @@ -24,7 +24,7 @@ from common.constants import RetCode -@manager.route("", methods=["POST"]) # noqa: F821 +@manager.route("/messages", methods=["POST"]) # noqa: F821 @login_required @validate_request("memory_id", "agent_id", "session_id", "user_input", "agent_response") async def add_message(): @@ -48,7 +48,7 @@ async def add_message(): return get_json_result(code=RetCode.SERVER_ERROR, message="Some messages failed to add. Detail:" + msg) -@manager.route("/:", methods=["DELETE"]) # noqa: F821 +@manager.route("/messages/:", methods=["DELETE"]) # noqa: F821 @login_required async def forget_message(memory_id: str, message_id: int): @@ -67,7 +67,7 @@ async def forget_message(memory_id: str, message_id: int): return get_json_result(code=RetCode.SERVER_ERROR, message=f"Failed to forget message '{message_id}' in memory '{memory_id}'.") -@manager.route("/:", methods=["PUT"]) # noqa: F821 +@manager.route("/messages/:", methods=["PUT"]) # noqa: F821 @login_required @validate_request("status") async def update_message(memory_id: str, message_id: int): @@ -87,7 +87,7 @@ async def update_message(memory_id: str, message_id: int): return get_json_result(code=RetCode.SERVER_ERROR, message=f"Failed to set status for message '{message_id}' in memory '{memory_id}'.") -@manager.route("/search", methods=["GET"]) # noqa: F821 +@manager.route("/messages/search", methods=["GET"]) # noqa: F821 @login_required async def search_message(): args = request.args @@ -120,7 +120,7 @@ async def search_message(): return get_json_result(message=True, data=res) -@manager.route("", methods=["GET"]) # noqa: F821 +@manager.route("/messages", methods=["GET"]) # noqa: F821 @login_required async def get_messages(): args = request.args @@ -144,7 +144,7 @@ async def get_messages(): return get_json_result(message=True, data=res) -@manager.route("/:/content", methods=["GET"]) # noqa: F821 +@manager.route("/messages/:/content", methods=["GET"]) # noqa: F821 @login_required async def get_message_content(memory_id:str, message_id: int): memory = MemoryService.get_by_memory_id(memory_id) diff --git a/docs/references/http_api_reference.md b/docs/references/http_api_reference.md index 8c2170ce4de..f12b93a5213 100644 --- a/docs/references/http_api_reference.md +++ b/docs/references/http_api_reference.md @@ -4924,14 +4924,14 @@ Failure: ### Create Memory -**POST** `/v1/memories` +**POST** `/api/v1/memories` Create a new memory. #### Request - Method: POST -- URL: `/v1/memories` +- URL: `/api/v1/memories` - Headers: - `'Content-Type: application/json'` - `'Authorization: Bearer '` @@ -4944,7 +4944,7 @@ Create a new memory. ##### Request example ```bash -curl --location 'http://{address}/v1/memories' \ +curl --location 'http://{address}/api/v1/memories' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ' \ --data-raw '{ @@ -5014,14 +5014,14 @@ Failure: ### Update Memory -**PUT** `/v1/memories/{memory_id}` +**PUT** `/api/v1/memories/{memory_id}` Updates configurations for a specified memory. #### Request - Method: PUT -- URL: `/v1/memories/{memory_id}` +- URL: `/api/v1/memories/{memory_id}` - Headers: - `'Content-Type: application/json'` - `'Authorization: Bearer '` @@ -5040,7 +5040,7 @@ Updates configurations for a specified memory. ##### Request example ```bash -curl --location --request PUT 'http://{address}/v1/memories/d6775d4eeada11f08ca284ba59bc53c7' \ +curl --location --request PUT 'http://{address}/api/v1/memories/d6775d4eeada11f08ca284ba59bc53c7' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ' \ --data '{ @@ -5139,14 +5139,14 @@ Failure: ### List Memory -**GET** `/v1/memories?tenant_id={tenant_ids}&memory_type={memory_types}&storage_type={storage_type}&keywords={keywords}&page={page}&page_size={page_size}` +**GET** `/api/v1/memories?tenant_id={tenant_ids}&memory_type={memory_types}&storage_type={storage_type}&keywords={keywords}&page={page}&page_size={page_size}` List memories. #### Request - Method: GET -- URL: `/v1/memories?tenant_id={tenant_ids}&memory_type={memory_types}&storage_type={storage_type}&keywords={keywords}&page={page}&page_size={page_size}` +- URL: `/api/v1/memories?tenant_id={tenant_ids}&memory_type={memory_types}&storage_type={storage_type}&keywords={keywords}&page={page}&page_size={page_size}` - Headers: - `'Content-Type: application/json'` - `'Authorization: Bearer '` @@ -5154,7 +5154,7 @@ List memories. ##### Request example ```bash -curl --location 'http://{address}/v1/memories?keywords=&page_size=50&page=1&memory_type=semantic%2Cepisodic' \ +curl --location 'http://{address}/api/v1/memories?keywords=&page_size=50&page=1&memory_type=semantic%2Cepisodic' \ --header 'Authorization: Bearer ' ``` @@ -5235,14 +5235,14 @@ Failure: ### Get Memory Config -**GET** `/v1/memories/{memory_id}/config` +**GET** `/api/v1/memories/{memory_id}/config` Get the configuration of a specified memory. #### Request - Method: GET -- URL: `/v1/memories/{memory_id}/config` +- URL: `/api/v1/memories/{memory_id}/config` - Headers: - `'Content-Type: application/json'` - `'Authorization: Bearer '` @@ -5250,7 +5250,7 @@ Get the configuration of a specified memory. ##### Request example ```bash -curl --location 'http://{address}/v1/memories/6c8983badede11f083f184ba59bc53c7/config' \ +curl --location 'http://{address}/api/v1/memories/6c8983badede11f083f184ba59bc53c7/config' \ --header 'Authorization: Bearer ' ``` @@ -5312,12 +5312,12 @@ Failure ### Delete Memory -**DELETE** `/v1/memories/{memory_id}` +**DELETE** `/api/v1/memories/{memory_id}` #### Request - Method: DELETE -- URL: `/v1/memories/{memory_id}` +- URL: `/api/v1/memories/{memory_id}` - Headers: - Headers: - `'Content-Type: application/json'` @@ -5326,7 +5326,7 @@ Failure ##### Request example ```bash -curl --location --request DELETE 'http://{address}/v1/memories/d6775d4eeada11f08ca284ba59bc53c7' \ +curl --location --request DELETE 'http://{address}/api/v1/memories/d6775d4eeada11f08ca284ba59bc53c7' \ --header 'Authorization: Bearer ' ``` @@ -5362,14 +5362,14 @@ Failure ### List messages of a memory -**GET** `/v1/memories/{memory_id}?agent_id={agent_id}&keywords={session_id}&page={page}&page_size={page_size}` +**GET** `/api/v1/memories/{memory_id}?agent_id={agent_id}&keywords={session_id}&page={page}&page_size={page_size}` List the messages of a specified memory. #### Request - Method: GET -- URL: `/v1/memories/{memory_id}?agent_id={agent_id}&keywords={session_id}&page={page}&page_size={page_size}` +- URL: `/api/v1/memories/{memory_id}?agent_id={agent_id}&keywords={session_id}&page={page}&page_size={page_size}` - Headers: - `'Content-Type: application/json'` - `'Authorization: Bearer '` @@ -5377,7 +5377,7 @@ List the messages of a specified memory. ##### Request example ```bash -curl --location 'http://{address}/v1/memories/6c8983badede11f083f184ba59bc53c?page=1' \ +curl --location 'http://{address}/api/v1/memories/6c8983badede11f083f184ba59bc53c?page=1' \ --header 'Authorization: Bearer ' ``` @@ -5489,14 +5489,14 @@ Failure ### Add Message -**POST** `/v1/messages` +**POST** `/api/v1/messages` Add a message to specified memories. #### Request - Method: POST -- URL: `/v1/messages` +- URL: `/api/v1/messages` - Headers: - `'Content-Type: application/json'` - `'Authorization: Bearer '` @@ -5511,7 +5511,7 @@ Add a message to specified memories. ##### Request example ```bash -curl --location 'http://{address}/v1/messages' \ +curl --location 'http://{address}/api/v1/messages' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ' \ --data '{ @@ -5577,14 +5577,14 @@ Failure ### Forget Message -**DELETE** `/v1/messages/{memory_id}:{message_id}` +**DELETE** `/api/v1/messages/{memory_id}:{message_id}` Forget a specified message. After forgetting, this message will not be retrieved by agents, and it will also be prioritized for cleanup by the forgetting policy. #### Request - Method: DELETE -- URL: `/v1/messages/{memory_id}:{message_id}` +- URL: `/api/v1/messages/{memory_id}:{message_id}` - Headers: - `'Content-Type: application/json'` - `'Authorization: Bearer '` @@ -5592,7 +5592,7 @@ Forget a specified message. After forgetting, this message will not be retrieved ##### Request example ```bash -curl --location --request DELETE 'http://{address}/v1/messages/6c8983badede11f083f184ba59bc53c7:272' \ +curl --location --request DELETE 'http://{address}/api/v1/messages/6c8983badede11f083f184ba59bc53c7:272' \ --header 'Authorization: Bearer ' ``` @@ -5632,14 +5632,14 @@ Failure ### Update message status -**PUT** `/v1/messages/{memory_id}:{message_id}` +**PUT** `/api/v1/messages/{memory_id}:{message_id}` Update message status, enable or disable a message. Once a message is disabled, it will not be retrieved by agents. #### Request - Method: PUT -- URL: `/v1/messages/{memory_id}:{message_id}` +- URL: `/api/v1/messages/{memory_id}:{message_id}` - Headers: - `'Content-Type: application/json'` - `'Authorization: Bearer '` @@ -5649,7 +5649,7 @@ Update message status, enable or disable a message. Once a message is disabled, ##### Request example ```bash -curl --location --request PUT 'http://{address}/v1/messages/6c8983badede11f083f184ba59bc53c7:270' \ +curl --location --request PUT 'http://{address}/api/v1/messages/6c8983badede11f083f184ba59bc53c7:270' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ' \ --data '{ @@ -5695,14 +5695,14 @@ Failure ### Search Message -**GET** `/v1/messages/search?query={question}&memory_id={memory_id}&similarity_threshold={similarity_threshold}&keywords_similarity_weight={keywords_similarity_weight}&top_n={top_n}` +**GET** `/api/v1/messages/search?query={question}&memory_id={memory_id}&similarity_threshold={similarity_threshold}&keywords_similarity_weight={keywords_similarity_weight}&top_n={top_n}` Searches and retrieves messages from memory based on the provided `query` and other configuration parameters. #### Request - Method: GET -- URL: `/v1/messages/search?query={question}&memory_id={memory_id}&similarity_threshold={similarity_threshold}&keywords_similarity_weight={keywords_similarity_weight}&top_n={top_n}` +- URL: `/api/v1/messages/search?query={question}&memory_id={memory_id}&similarity_threshold={similarity_threshold}&keywords_similarity_weight={keywords_similarity_weight}&top_n={top_n}` - Headers: - `'Content-Type: application/json'` - `'Authorization: Bearer '` @@ -5710,7 +5710,7 @@ Searches and retrieves messages from memory based on the provided `query` and ot ##### Request example ```bash -curl --location 'http://{address}/v1/messages/search?query=%22who%20are%20you%3F%22&memory_id=6c8983badede11f083f184ba59bc53c7&similarity_threshold=0.2&keywords_similarity_weight=0.7&top_n=10' \ +curl --location 'http://{address}/api/v1/messages/search?query=%22who%20are%20you%3F%22&memory_id=6c8983badede11f083f184ba59bc53c7&similarity_threshold=0.2&keywords_similarity_weight=0.7&top_n=10' \ --header 'Authorization: Bearer ' ``` @@ -5789,14 +5789,14 @@ Failure ### Get Recent Messages -**GET** `/v1/messages?memory_id={memory_id}&agent_id={agent_id}&session_id={session_id}&limit={limit}` +**GET** `/api/v1/messages?memory_id={memory_id}&agent_id={agent_id}&session_id={session_id}&limit={limit}` Retrieves the most recent messages from specified memories. Typically accepts a `limit` parameter to control the number of messages returned. #### Request - Method: GET -- URL: `/v1/messages?memory_id={memory_id}&agent_id={agent_id}&session_id={session_id}&limit={limit}` +- URL: `/api/v1/messages?memory_id={memory_id}&agent_id={agent_id}&session_id={session_id}&limit={limit}` - Headers: - `'Content-Type: application/json'` - `'Authorization: Bearer '` @@ -5804,7 +5804,7 @@ Retrieves the most recent messages from specified memories. Typically accepts a ##### Request example ```bash -curl --location 'http://{address}/v1/messages?memory_id=6c8983badede11f083f184ba59bc53c7&limit=10' \ +curl --location 'http://{address}/api/v1/messages?memory_id=6c8983badede11f083f184ba59bc53c7&limit=10' \ --header 'Authorization: Bearer ' ``` @@ -5867,14 +5867,14 @@ Failure ### Get Message Content -**GET** `/v1/messages/{memory_id}:{message_id}/content` +**GET** `/api/v1/messages/{memory_id}:{message_id}/content` Retrieves the full content and embed vector of a specific message using its unique message ID. #### Request - Method: GET -- URL: `/v1/messages/{memory_id}:{message_id}/content` +- URL: `/api/v1/messages/{memory_id}:{message_id}/content` - Headers: - `'Content-Type: application/json'` - `'Authorization: Bearer '` @@ -5882,7 +5882,7 @@ Retrieves the full content and embed vector of a specific message using its uniq ##### Request example ```bash -curl --location 'http://{address}/v1/messages/6c8983badede11f083f184ba59bc53c7:270/content' \ +curl --location 'http://{address}/api/v1/messages/6c8983badede11f083f184ba59bc53c7:270/content' \ --header 'Authorization: Bearer ' ``` diff --git a/sdk/python/ragflow_sdk/__init__.py b/sdk/python/ragflow_sdk/__init__.py index ea383cfc366..62ddff7160b 100644 --- a/sdk/python/ragflow_sdk/__init__.py +++ b/sdk/python/ragflow_sdk/__init__.py @@ -26,6 +26,7 @@ from .modules.document import Document from .modules.chunk import Chunk from .modules.agent import Agent +from .modules.memory import Memory __version__ = importlib.metadata.version("ragflow_sdk") @@ -36,5 +37,6 @@ "Session", "Document", "Chunk", - "Agent" + "Agent", + "Memory" ] diff --git a/sdk/python/ragflow_sdk/modules/memory.py b/sdk/python/ragflow_sdk/modules/memory.py new file mode 100644 index 00000000000..4005deeac36 --- /dev/null +++ b/sdk/python/ragflow_sdk/modules/memory.py @@ -0,0 +1,95 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from .base import Base + + +class Memory(Base): + + def __init__(self, rag, res_dict): + self.id = "" + self.name = "" + self.avatar = None + self.tenant_id = None + self.owner_name = "" + self.memory_type = ["raw"] + self.storage_type = "table" + self.embd_id = "" + self.llm_id = "" + self.permissions = "me" + self.description = "" + self.memory_size = 5 * 1024 * 1024 + self.forgetting_policy = "FIFO" + self.temperature = 0.5, + self.system_prompt = "" + self.user_prompt = "" + for k in list(res_dict.keys()): + if k not in self.__dict__: + res_dict.pop(k) + super().__init__(rag, res_dict) + + def update(self, update_dict: dict): + res = self.put(f"/memories/{self.id}", update_dict) + res = res.json() + if res.get("code") != 0: + raise Exception(res["message"]) + self._update_from_dict(self.rag, res.get("data", {})) + return self + + def get_config(self): + res = self.get(f"/memories/{self.id}/config") + res = res.json() + if res.get("code") != 0: + raise Exception(res["message"]) + self._update_from_dict(self.rag, res.get("data", {})) + return self + + def list_memory_messages(self, agent_id: str | list[str]=None, keywords: str=None, page: int=1, page_size: int=50): + params = { + "agent_id": agent_id, + "keywords": keywords, + "page": page, + "page_size": page_size + } + res = self.get(f"/memories/{self.id}", params) + res = res.json() + if res.get("code") != 0: + raise Exception(res["message"]) + return res["data"] + + def forget_message(self, message_id: int): + res = self.rm(f"/messages/{self.id}:{message_id}", {}) + res = res.json() + if res.get("code") != 0: + raise Exception(res["message"]) + return True + + def update_message_status(self, message_id: int, status: bool): + update_message = { + "status": status + } + res = self.put(f"/messages/{self.id}:{message_id}", update_message) + res = res.json() + if res.get("code") != 0: + raise Exception(res["message"]) + return True + + def get_message_content(self, message_id: int) -> dict: + res = self.get(f"/messages/{self.id}:{message_id}/content") + res = res.json() + if res.get("code") != 0: + raise Exception(res["message"]) + return res["data"] diff --git a/sdk/python/ragflow_sdk/ragflow.py b/sdk/python/ragflow_sdk/ragflow.py index da8a3d33692..11aa5d4a2a6 100644 --- a/sdk/python/ragflow_sdk/ragflow.py +++ b/sdk/python/ragflow_sdk/ragflow.py @@ -21,6 +21,7 @@ from .modules.chat import Chat from .modules.chunk import Chunk from .modules.dataset import DataSet +from .modules.memory import Memory class RAGFlow: @@ -289,3 +290,84 @@ def delete_agent(self, agent_id: str) -> None: if res.get("code") != 0: raise Exception(res["message"]) + + def create_memory(self, name: str, memory_type: list[str], embd_id: str, llm_id: str): + payload = {"name": name, "memory_type": memory_type, "embd_id": embd_id, "llm_id": llm_id} + res = self.post("/memories", payload) + res = res.json() + if res.get("code") != 0: + raise Exception(res["message"]) + return Memory(self, res["data"]) + + def list_memory(self, page: int = 1, page_size: int = 50, tenant_id: str | list[str] = None, memory_type: str | list[str] = None, storage_type: str = None, keywords: str = None) -> dict: + res = self.get( + "/memories", + { + "page": page, + "page_size": page_size, + "tenant_id": tenant_id, + "memory_type": memory_type, + "storage_type": storage_type, + "keywords": keywords, + } + ) + res = res.json() + if res.get("code") != 0: + raise Exception(res["message"]) + result_list = [] + for data in res["data"]["memory_list"]: + result_list.append(Memory(self, data)) + return { + "memory_list": result_list, + "total_count": res["data"]["total_count"] + } + + def delete_memory(self, memory_id: str): + res = self.delete(f"/memories/{memory_id}", {}) + res = res.json() + if res.get("code") != 0: + raise Exception(res["message"]) + + def add_message(self, memory_id: list[str], agent_id: str, session_id: str, user_input: str, agent_response: str, user_id: str = "") -> str: + payload = { + "memory_id": memory_id, + "agent_id": agent_id, + "session_id": session_id, + "user_input": user_input, + "agent_response": agent_response, + "user_id": user_id + } + res = self.post("/messages", payload) + res = res.json() + if res.get("code") != 0: + raise Exception(res["message"]) + return res["message"] + + def search_message(self, query: str, memory_id: list[str], agent_id: str=None, session_id: str=None, similarity_threshold: float=0.2, keywords_similarity_weight: float=0.7, top_n: int=10) -> list[dict]: + params = { + "query": query, + "memory_id": memory_id, + "agent_id": agent_id, + "session_id": session_id, + "similarity_threshold": similarity_threshold, + "keywords_similarity_weight": keywords_similarity_weight, + "top_n": top_n + } + res = self.get("/messages/search", params) + res = res.json() + if res.get("code") != 0: + raise Exception(res["message"]) + return res["data"] + + def get_recent_messages(self, memory_id: list[str], agent_id: str=None, session_id: str=None, limit: int=10) -> list[dict]: + params = { + "memory_id": memory_id, + "agent_id": agent_id, + "session_id": session_id, + "limit": limit + } + res = self.get("/messages", params) + res = res.json() + if res.get("code") != 0: + raise Exception(res["message"]) + return res["data"] diff --git a/test/testcases/test_sdk_api/test_memory_management/conftest.py b/test/testcases/test_sdk_api/test_memory_management/conftest.py new file mode 100644 index 00000000000..516b4089677 --- /dev/null +++ b/test/testcases/test_sdk_api/test_memory_management/conftest.py @@ -0,0 +1,52 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import pytest +import random + +@pytest.fixture(scope="class") +def add_memory_func(client, request): + def cleanup(): + memory_list_res = client.list_memory() + exist_memory_ids = [memory.id for memory in memory_list_res["memory_list"]] + for memory_id in exist_memory_ids: + client.delete_memory(memory_id) + + request.addfinalizer(cleanup) + + memory_ids = [] + for i in range(3): + payload = { + "name": f"test_memory_{i}", + "memory_type": ["raw"] + random.choices(["semantic", "episodic", "procedural"], k=random.randint(0, 3)), + "embd_id": "BAAI/bge-large-zh-v1.5@SILICONFLOW", + "llm_id": "glm-4-flash@ZHIPU-AI" + } + res = client.create_memory(**payload) + memory_ids.append(res.id) + request.cls.memory_ids = memory_ids + return memory_ids + + +@pytest.fixture(scope="class") +def delete_test_memory(client, request): + def cleanup(): + memory_list_res = client.list_memory() + exist_memory_ids = [memory.id for memory in memory_list_res["memory_list"]] + for memory_id in exist_memory_ids: + client.delete_memory(memory_id) + + request.addfinalizer(cleanup) + return diff --git a/test/testcases/test_sdk_api/test_memory_management/test_create_memory.py b/test/testcases/test_sdk_api/test_memory_management/test_create_memory.py new file mode 100644 index 00000000000..35e836579cf --- /dev/null +++ b/test/testcases/test_sdk_api/test_memory_management/test_create_memory.py @@ -0,0 +1,108 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import random +import re + +import pytest +from configs import INVALID_API_TOKEN, HOST_ADDRESS +from ragflow_sdk import RAGFlow +from hypothesis import example, given, settings +from utils.hypothesis_utils import valid_names + + +class TestAuthorization: + @pytest.mark.p1 + @pytest.mark.parametrize( + "invalid_auth, expected_message", + [ + (None, ""), + (INVALID_API_TOKEN, ""), + ], + ids=["empty_auth", "invalid_api_token"] + ) + def test_auth_invalid(self, invalid_auth, expected_message): + client = RAGFlow(invalid_auth, HOST_ADDRESS) + with pytest.raises(Exception) as exception_info: + client.create_memory(**{"name": "test_memory", "memory_type": ["raw"], "embd_id": "BAAI/bge-large-zh-v1.5@SILICONFLOW", "llm_id": "glm-4-flash@ZHIPU-AI"}) + assert str(exception_info.value) == expected_message, str(exception_info.value) + + +@pytest.mark.usefixtures("delete_test_memory") +class TestMemoryCreate: + @pytest.mark.p1 + @given(name=valid_names()) + @example("e" * 128) + @settings(max_examples=20) + def test_name(self, client, name): + payload = { + "name": name, + "memory_type": ["raw"] + random.choices(["semantic", "episodic", "procedural"], k=random.randint(0, 3)), + "embd_id": "BAAI/bge-large-zh-v1.5@SILICONFLOW", + "llm_id": "glm-4-flash@ZHIPU-AI" + } + memory = client.create_memory(**payload) + pattern = rf'^{name}|{name}(?:\((\d+)\))?$' + escaped_name = re.escape(memory.name) + assert re.match(pattern, escaped_name), str(memory) + + @pytest.mark.p2 + @pytest.mark.parametrize( + "name, expected_message", + [ + ("", "Memory name cannot be empty or whitespace."), + (" ", "Memory name cannot be empty or whitespace."), + ("a" * 129, f"Memory name '{'a'*129}' exceeds limit of 128."), + ], + ids=["empty_name", "space_name", "too_long_name"], + ) + def test_name_invalid(self, client, name, expected_message): + payload = { + "name": name, + "memory_type": ["raw"] + random.choices(["semantic", "episodic", "procedural"], k=random.randint(0, 3)), + "embd_id": "BAAI/bge-large-zh-v1.5@SILICONFLOW", + "llm_id": "glm-4-flash@ZHIPU-AI" + } + with pytest.raises(Exception) as exception_info: + client.create_memory(**payload) + assert str(exception_info.value) == expected_message, str(exception_info.value) + + @pytest.mark.p2 + @given(name=valid_names()) + def test_type_invalid(self, client, name): + payload = { + "name": name, + "memory_type": ["something"], + "embd_id": "BAAI/bge-large-zh-v1.5@SILICONFLOW", + "llm_id": "glm-4-flash@ZHIPU-AI" + } + with pytest.raises(Exception) as exception_info: + client.create_memory(**payload) + assert str(exception_info.value) == f"Memory type '{ {'something'} }' is not supported.", str(exception_info.value) + + @pytest.mark.p3 + def test_name_duplicated(self, client): + name = "duplicated_name_test" + payload = { + "name": name, + "memory_type": ["raw"] + random.choices(["semantic", "episodic", "procedural"], k=random.randint(0, 3)), + "embd_id": "BAAI/bge-large-zh-v1.5@SILICONFLOW", + "llm_id": "glm-4-flash@ZHIPU-AI" + } + res1 = client.create_memory(**payload) + assert res1.name == name, str(res1) + + res2 = client.create_memory(**payload) + assert res2.name == f"{name}(1)", str(res2) diff --git a/test/testcases/test_sdk_api/test_memory_management/test_list_memory.py b/test/testcases/test_sdk_api/test_memory_management/test_list_memory.py new file mode 100644 index 00000000000..79180db2948 --- /dev/null +++ b/test/testcases/test_sdk_api/test_memory_management/test_list_memory.py @@ -0,0 +1,116 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from concurrent.futures import ThreadPoolExecutor, as_completed + +import pytest +from ragflow_sdk import RAGFlow +from configs import INVALID_API_TOKEN, HOST_ADDRESS + +class TestAuthorization: + @pytest.mark.p1 + @pytest.mark.parametrize( + "invalid_auth, expected_message", + [ + (None, ""), + (INVALID_API_TOKEN, ""), + ], + ) + def test_auth_invalid(self, invalid_auth, expected_message): + client = RAGFlow(invalid_auth, HOST_ADDRESS) + with pytest.raises(Exception) as exception_info: + client.list_memory() + assert str(exception_info.value) == expected_message, str(exception_info.value) + + +class TestCapability: + @pytest.mark.p3 + def test_capability(self, client): + count = 100 + with ThreadPoolExecutor(max_workers=5) as executor: + futures = [executor.submit(client.list_memory) for _ in range(count)] + responses = list(as_completed(futures)) + assert len(responses) == count, responses + assert all(future.result()["code"] == 0 for future in futures) + +@pytest.mark.usefixtures("add_memory_func") +class TestMemoryList: + @pytest.mark.p1 + def test_params_unset(self, client): + res = client.list_memory() + assert len(res["memory_list"]) == 3, str(res) + assert res["total_count"] == 3, str(res) + + @pytest.mark.p1 + def test_params_empty(self, client): + res = client.list_memory(**{}) + assert len(res["memory_list"]) == 3, str(res) + assert res["total_count"] == 3, str(res) + + @pytest.mark.p1 + @pytest.mark.parametrize( + "params, expected_page_size", + [ + ({"page": 1, "page_size": 10}, 3), + ({"page": 2, "page_size": 10}, 0), + ({"page": 1, "page_size": 2}, 2), + ({"page": 2, "page_size": 2}, 1), + ({"page": 5, "page_size": 10}, 0), + ], + ids=["normal_first_page", "beyond_max_page", "normal_last_partial_page" , "normal_middle_page", + "full_data_single_page"], + ) + def test_page(self, client, params, expected_page_size): + # have added 3 memories in fixture + res = client.list_memory(**params) + assert len(res["memory_list"]) == expected_page_size, str(res) + assert res["total_count"] == 3, str(res) + + @pytest.mark.p2 + def test_filter_memory_type(self, client): + res = client.list_memory(**{"memory_type": ["semantic"]}) + for memory in res["memory_list"]: + assert "semantic" in memory.memory_type, str(memory) + + @pytest.mark.p2 + def test_filter_multi_memory_type(self, client): + res = client.list_memory(**{"memory_type": ["episodic", "procedural"]}) + for memory in res["memory_list"]: + assert "episodic" in memory.memory_type or "procedural" in memory.memory_type, str(memory) + + @pytest.mark.p2 + def test_filter_storage_type(self, client): + res = client.list_memory(**{"storage_type": "table"}) + for memory in res["memory_list"]: + assert memory.storage_type == "table", str(memory) + + @pytest.mark.p2 + def test_match_keyword(self, client): + res = client.list_memory(**{"keywords": "s"}) + for memory in res["memory_list"]: + assert "s" in memory.name, str(memory) + + @pytest.mark.p1 + def test_get_config(self, client): + memory_list = client.list_memory() + assert len(memory_list["memory_list"]) > 0, str(memory_list) + memory = memory_list["memory_list"][0] + memory_id = memory.id + memory_config = memory.get_config() + assert memory_config.id == memory_id, memory_config + for field in ["name", "avatar", "tenant_id", "owner_name", "memory_type", "storage_type", + "embd_id", "llm_id", "permissions", "description", "memory_size", "forgetting_policy", + "temperature", "system_prompt", "user_prompt"]: + assert hasattr(memory, field), memory_config diff --git a/test/testcases/test_sdk_api/test_memory_management/test_rm_memory.py b/test/testcases/test_sdk_api/test_memory_management/test_rm_memory.py new file mode 100644 index 00000000000..a8340f6b3df --- /dev/null +++ b/test/testcases/test_sdk_api/test_memory_management/test_rm_memory.py @@ -0,0 +1,52 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import pytest +from ragflow_sdk import RAGFlow +from configs import INVALID_API_TOKEN, HOST_ADDRESS + +class TestAuthorization: + @pytest.mark.p1 + @pytest.mark.parametrize( + "invalid_auth, expected_message", + [ + (None, ""), + (INVALID_API_TOKEN, ""), + ], + ) + def test_auth_invalid(self, invalid_auth, expected_message): + client = RAGFlow(invalid_auth, HOST_ADDRESS) + with pytest.raises(Exception) as exception_info: + client.delete_memory("some_memory_id") + assert str(exception_info.value) == expected_message, str(exception_info.value) + + +@pytest.mark.usefixtures("add_memory_func") +class TestMemoryDelete: + @pytest.mark.p1 + def test_memory_id(self, client): + memory_ids = self.memory_ids + client.delete_memory(memory_ids[0]) + res = client.list_memory() + assert res["total_count"] == 2, res + + @pytest.mark.p2 + def test_id_wrong_uuid(self, client): + with pytest.raises(Exception) as exception_info: + client.delete_memory("d94a8dc02c9711f0930f7fbc369eab6d") + assert exception_info.value, str(exception_info.value) + + res = client.list_memory() + assert len(res["memory_list"]) == 2, res diff --git a/test/testcases/test_sdk_api/test_memory_management/test_update_memory.py b/test/testcases/test_sdk_api/test_memory_management/test_update_memory.py new file mode 100644 index 00000000000..9b5e9d70f31 --- /dev/null +++ b/test/testcases/test_sdk_api/test_memory_management/test_update_memory.py @@ -0,0 +1,164 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import random +import pytest +from configs import INVALID_API_TOKEN, HOST_ADDRESS +from ragflow_sdk import RAGFlow, Memory +from hypothesis import HealthCheck, example, given, settings +from utils import encode_avatar +from utils.file_utils import create_image_file +from utils.hypothesis_utils import valid_names + + +class TestAuthorization: + @pytest.mark.p1 + @pytest.mark.parametrize( + "invalid_auth, expected_message", + [ + (None, ""), + (INVALID_API_TOKEN, ""), + ], + ids=["empty_auth", "invalid_api_token"] + ) + def test_auth_invalid(self, invalid_auth, expected_message): + + with pytest.raises(Exception) as exception_info: + client = RAGFlow(invalid_auth, HOST_ADDRESS) + memory = Memory(client, {"id": "memory_id"}) + memory.update({"name": "New_Name"}) + assert str(exception_info.value) == expected_message, str(exception_info.value) + +@pytest.mark.usefixtures("add_memory_func") +class TestMemoryUpdate: + + @pytest.mark.p1 + @given(name=valid_names()) + @example("f" * 128) + @settings(max_examples=20, suppress_health_check=[HealthCheck.function_scoped_fixture]) + def test_name(self, client, name): + memory_ids = self.memory_ids + update_dict = {"name": name} + memory = Memory(client, {"id": random.choice(memory_ids)}) + res = memory.update(update_dict) + assert res.name == name, str(res) + + @pytest.mark.p2 + @pytest.mark.parametrize( + "name, expected_message", + [ + ("", "Memory name cannot be empty or whitespace."), + (" ", "Memory name cannot be empty or whitespace."), + ("a" * 129, f"Memory name '{'a' * 129}' exceeds limit of 128."), + ] + ) + def test_name_invalid(self, client, name, expected_message): + memory_ids = self.memory_ids + update_dict = {"name": name} + memory = Memory(client, {"id": random.choice(memory_ids)}) + with pytest.raises(Exception) as exception_info: + memory.update(update_dict) + assert str(exception_info.value) == expected_message, str(exception_info.value) + + @pytest.mark.p2 + def test_duplicate_name(self, client): + memory_ids = self.memory_ids + update_dict = {"name": "Test_Memory"} + memory_0 = Memory(client, {"id": memory_ids[0]}) + res_0 = memory_0.update(update_dict) + assert res_0.name == "Test_Memory", str(res_0) + + memory_1 = Memory(client, {"id": memory_ids[1]}) + res_1 = memory_1.update(update_dict) + assert res_1.name == "Test_Memory(1)", str(res_1) + + @pytest.mark.p1 + def test_avatar(self, client, tmp_path): + memory_ids = self.memory_ids + fn = create_image_file(tmp_path / "ragflow_test.png") + update_dict = {"avatar": f"data:image/png;base64,{encode_avatar(fn)}"} + memory = Memory(client, {"id": random.choice(memory_ids)}) + res = memory.update(update_dict) + assert res.avatar == f"data:image/png;base64,{encode_avatar(fn)}", str(res) + + @pytest.mark.p1 + def test_description(self, client): + memory_ids = self.memory_ids + description = "This is a test description." + update_dict = {"description": description} + memory = Memory(client, {"id": random.choice(memory_ids)}) + res = memory.update(update_dict) + assert res.description == description, str(res) + + @pytest.mark.p1 + def test_llm(self, client): + memory_ids = self.memory_ids + llm_id = "glm-4@ZHIPU-AI" + update_dict = {"llm_id": llm_id} + memory = Memory(client, {"id": random.choice(memory_ids)}) + res = memory.update(update_dict) + assert res.llm_id == llm_id, str(res) + + @pytest.mark.p1 + @pytest.mark.parametrize( + "permission", + [ + "me", + "team" + ], + ids=["me", "team"] + ) + def test_permission(self, client, permission): + memory_ids = self.memory_ids + update_dict = {"permissions": permission} + memory = Memory(client, {"id": random.choice(memory_ids)}) + res = memory.update(update_dict) + assert res.permissions == permission.lower().strip(), str(res) + + @pytest.mark.p1 + def test_memory_size(self, client): + memory_ids = self.memory_ids + memory_size = 1048576 # 1 MB + update_dict = {"memory_size": memory_size} + memory = Memory(client, {"id": random.choice(memory_ids)}) + res = memory.update(update_dict) + assert res.memory_size == memory_size, str(res) + + @pytest.mark.p1 + def test_temperature(self, client): + memory_ids = self.memory_ids + temperature = 0.7 + update_dict = {"temperature": temperature} + memory = Memory(client, {"id": random.choice(memory_ids)}) + res = memory.update(update_dict) + assert res.temperature == temperature, str(res) + + @pytest.mark.p1 + def test_system_prompt(self, client): + memory_ids = self.memory_ids + system_prompt = "This is a system prompt." + update_dict = {"system_prompt": system_prompt} + memory = Memory(client, {"id": random.choice(memory_ids)}) + res = memory.update(update_dict) + assert res.system_prompt == system_prompt, str(res) + + @pytest.mark.p1 + def test_user_prompt(self, client): + memory_ids = self.memory_ids + user_prompt = "This is a user prompt." + update_dict = {"user_prompt": user_prompt} + memory = Memory(client, {"id": random.choice(memory_ids)}) + res = memory.update(update_dict) + assert res.user_prompt == user_prompt, res diff --git a/test/testcases/test_sdk_api/test_message_management/conftest.py b/test/testcases/test_sdk_api/test_message_management/conftest.py new file mode 100644 index 00000000000..a93dd6fdf75 --- /dev/null +++ b/test/testcases/test_sdk_api/test_message_management/conftest.py @@ -0,0 +1,166 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import time +import uuid + +import pytest +import random + + +@pytest.fixture(scope="class") +def add_empty_raw_type_memory(client, request): + def cleanup(): + memory_list_res = client.list_memory() + exist_memory_ids = [memory.id for memory in memory_list_res["memory_list"]] + for _memory_id in exist_memory_ids: + client.delete_memory(_memory_id) + request.addfinalizer(cleanup) + payload = { + "name": "test_memory_0", + "memory_type": ["raw"], + "embd_id": "BAAI/bge-small-en-v1.5@Builtin", + "llm_id": "glm-4-flash@ZHIPU-AI" + } + res = client.create_memory(**payload) + memory_id = res.id + request.cls.memory_id = memory_id + request.cls.memory_type = payload["memory_type"] + return memory_id + + +@pytest.fixture(scope="class") +def add_empty_multiple_type_memory(client, request): + def cleanup(): + memory_list_res = client.list_memory() + exist_memory_ids = [memory.id for memory in memory_list_res["memory_list"]] + for _memory_id in exist_memory_ids: + client.delete_memory(_memory_id) + request.addfinalizer(cleanup) + payload = { + "name": "test_memory_0", + "memory_type": ["raw"] + random.choices(["semantic", "episodic", "procedural"], k=random.randint(1, 3)), + "embd_id": "BAAI/bge-small-en-v1.5@Builtin", + "llm_id": "glm-4-flash@ZHIPU-AI" + } + res = client.create_memory(**payload) + memory_id = res.id + request.cls.memory_id = memory_id + request.cls.memory_type = payload["memory_type"] + return memory_id + + +@pytest.fixture(scope="class") +def add_2_multiple_type_memory(client, request): + def cleanup(): + memory_list_res = client.list_memory() + exist_memory_ids = [memory.id for memory in memory_list_res["memory_list"]] + for _memory_id in exist_memory_ids: + client.delete_memory(_memory_id) + + request.addfinalizer(cleanup) + memory_ids = [] + for i in range(2): + payload = { + "name": f"test_memory_{i}", + "memory_type": ["raw"] + random.choices(["semantic", "episodic", "procedural"], k=random.randint(1, 3)), + "embd_id": "BAAI/bge-small-en-v1.5@Builtin", + "llm_id": "glm-4-flash@ZHIPU-AI" + } + res = client.create_memory(**payload) + memory_ids.append(res.id) + request.cls.memory_ids = memory_ids + return memory_ids + + +@pytest.fixture(scope="class") +def add_memory_with_multiple_type_message_func(client, request): + def cleanup(): + memory_list_res = client.list_memory() + exist_memory_ids = [mem.id for mem in memory_list_res["memory_list"]] + for _memory_id in exist_memory_ids: + client.delete_memory(_memory_id) + + request.addfinalizer(cleanup) + + payload = { + "name": "test_memory_0", + "memory_type": ["raw"] + random.choices(["semantic", "episodic", "procedural"], k=random.randint(1, 3)), + "embd_id": "BAAI/bge-small-en-v1.5@Builtin", + "llm_id": "glm-4-flash@ZHIPU-AI" + } + memory = client.create_memory(**payload) + memory_id = memory.id + agent_id = uuid.uuid4().hex + message_payload = { + "memory_id": [memory_id], + "agent_id": agent_id, + "session_id": uuid.uuid4().hex, + "user_id": "", + "user_input": "what is coriander?", + "agent_response": """ +Coriander is a versatile herb with two main edible parts, and its name can refer to both: +1. Leaves and Stems (often called Cilantro or Fresh Coriander): These are the fresh, green, fragrant leaves and tender stems of the plant Coriandrum sativum. They have a bright, citrusy, and sometimes pungent flavor. Cilantro is widely used as a garnish or key ingredient in cuisines like Mexican, Indian, Thai, and Middle Eastern. +2. Seeds (called Coriander Seeds): These are the dried, golden-brown seeds of the same plant. When ground, they become coriander powder. The seeds have a warm, nutty, floral, and slightly citrusy taste, completely different from the fresh leaves. They are a fundamental spice in curries, stews, pickles, and baking. +Key Point of Confusion: The naming differs by region. In North America, "coriander" typically refers to the seeds, while "cilantro" refers to the fresh leaves. In the UK, Europe, and many other parts of the world, "coriander" refers to the fresh herb, and the seeds are called "coriander seeds." +""" + } + client.add_message(**message_payload) + request.cls.memory_id = memory_id + request.cls.agent_id = agent_id + time.sleep(2) # make sure refresh to index before search + return memory_id + + +@pytest.fixture(scope="class") +def add_memory_with_5_raw_message_func(client, request): + def cleanup(): + memory_list_res = client.list_memory() + exist_memory_ids = [mem.id for mem in memory_list_res["memory_list"]] + for _memory_id in exist_memory_ids: + client.delete_memory(_memory_id) + + request.addfinalizer(cleanup) + + payload = { + "name": "test_memory_1", + "memory_type": ["raw"], + "embd_id": "BAAI/bge-small-en-v1.5@Builtin", + "llm_id": "glm-4-flash@ZHIPU-AI" + } + memory = client.create_memory(**payload) + memory_id = memory.id + agent_ids = [uuid.uuid4().hex for _ in range(2)] + session_ids = [uuid.uuid4().hex for _ in range(5)] + for i in range(5): + message_payload = { + "memory_id": [memory_id], + "agent_id": agent_ids[i % 2], + "session_id": session_ids[i], + "user_id": "", + "user_input": "what is coriander?", + "agent_response": """ +Coriander is a versatile herb with two main edible parts, and its name can refer to both: +1. Leaves and Stems (often called Cilantro or Fresh Coriander): These are the fresh, green, fragrant leaves and tender stems of the plant Coriandrum sativum. They have a bright, citrusy, and sometimes pungent flavor. Cilantro is widely used as a garnish or key ingredient in cuisines like Mexican, Indian, Thai, and Middle Eastern. +2. Seeds (called Coriander Seeds): These are the dried, golden-brown seeds of the same plant. When ground, they become coriander powder. The seeds have a warm, nutty, floral, and slightly citrusy taste, completely different from the fresh leaves. They are a fundamental spice in curries, stews, pickles, and baking. +Key Point of Confusion: The naming differs by region. In North America, "coriander" typically refers to the seeds, while "cilantro" refers to the fresh leaves. In the UK, Europe, and many other parts of the world, "coriander" refers to the fresh herb, and the seeds are called "coriander seeds." +""" + } + client.add_message(**message_payload) + request.cls.memory_id = memory_id + request.cls.agent_ids = agent_ids + request.cls.session_ids = session_ids + time.sleep(2) # make sure refresh to index before search + return memory_id diff --git a/test/testcases/test_sdk_api/test_message_management/test_add_message.py b/test/testcases/test_sdk_api/test_message_management/test_add_message.py new file mode 100644 index 00000000000..d7ed7bb0f4b --- /dev/null +++ b/test/testcases/test_sdk_api/test_message_management/test_add_message.py @@ -0,0 +1,151 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import time +import uuid +import pytest +from ragflow_sdk import RAGFlow, Memory +from configs import INVALID_API_TOKEN, HOST_ADDRESS + +class TestAuthorization: + @pytest.mark.p1 + @pytest.mark.parametrize( + "invalid_auth, expected_message", + [ + (None, ""), + (INVALID_API_TOKEN, ""), + ], + ) + def test_auth_invalid(self, invalid_auth, expected_message): + client = RAGFlow(invalid_auth, HOST_ADDRESS) + with pytest.raises(Exception) as exception_info: + client.add_message(**{ + "memory_id": [""], + "agent_id": "", + "session_id": "", + "user_id": "", + "user_input": "what is pineapple?", + "agent_response": "" + }) + assert str(exception_info.value) == expected_message, str(exception_info.value) + + +@pytest.mark.usefixtures("add_empty_raw_type_memory") +class TestAddRawMessage: + + @pytest.mark.p1 + def test_add_raw_message(self, client): + memory_id = self.memory_id + agent_id = uuid.uuid4().hex + session_id = uuid.uuid4().hex + message_payload = { + "memory_id": [memory_id], + "agent_id": agent_id, + "session_id": session_id, + "user_id": "", + "user_input": "what is pineapple?", + "agent_response": """ +A pineapple is a tropical fruit known for its sweet, tangy flavor and distinctive, spiky appearance. Here are the key facts: +Scientific Name: Ananas comosus +Physical Description: It has a tough, spiky, diamond-patterned outer skin (rind) that is usually green, yellow, or brownish. Inside, the juicy yellow flesh surrounds a fibrous core. +Growth: Unlike most fruits, pineapples do not grow on trees. They grow from a central stem as a composite fruit, meaning they are formed from many individual berries that fuse together around the core. They grow on a short, leafy plant close to the ground. +Uses: Pineapples are eaten fresh, cooked, grilled, juiced, or canned. They are a popular ingredient in desserts, fruit salads, savory dishes (like pizzas or ham glazes), smoothies, and cocktails. +Nutrition: They are a good source of Vitamin C, manganese, and contain an enzyme called bromelain, which aids in digestion and can tenderize meat. +Symbolism: The pineapple is a traditional symbol of hospitality and welcome in many cultures. +Are you asking about the fruit itself, or its use in a specific context? +""" + } + add_res = client.add_message(**message_payload) + assert add_res == "All add to task.", str(add_res) + time.sleep(2) # make sure refresh to index before search + memory = Memory(client, {"id": memory_id}) + message_res = memory.list_memory_messages(**{"agent_id": agent_id, "keywords": session_id}) + assert message_res["messages"]["total_count"] > 0 + for message in message_res["messages"]["message_list"]: + assert message["agent_id"] == agent_id, message + assert message["session_id"] == session_id, message + + +@pytest.mark.usefixtures("add_empty_multiple_type_memory") +class TestAddMultipleTypeMessage: + + @pytest.mark.p1 + def test_add_multiple_type_message(self, client): + memory_id = self.memory_id + agent_id = uuid.uuid4().hex + session_id = uuid.uuid4().hex + message_payload = { + "memory_id": [memory_id], + "agent_id": agent_id, + "session_id": session_id, + "user_id": "", + "user_input": "what is pineapple?", + "agent_response": """ +A pineapple is a tropical fruit known for its sweet, tangy flavor and distinctive, spiky appearance. Here are the key facts: +Scientific Name: Ananas comosus +Physical Description: It has a tough, spiky, diamond-patterned outer skin (rind) that is usually green, yellow, or brownish. Inside, the juicy yellow flesh surrounds a fibrous core. +Growth: Unlike most fruits, pineapples do not grow on trees. They grow from a central stem as a composite fruit, meaning they are formed from many individual berries that fuse together around the core. They grow on a short, leafy plant close to the ground. +Uses: Pineapples are eaten fresh, cooked, grilled, juiced, or canned. They are a popular ingredient in desserts, fruit salads, savory dishes (like pizzas or ham glazes), smoothies, and cocktails. +Nutrition: They are a good source of Vitamin C, manganese, and contain an enzyme called bromelain, which aids in digestion and can tenderize meat. +Symbolism: The pineapple is a traditional symbol of hospitality and welcome in many cultures. +Are you asking about the fruit itself, or its use in a specific context? +""" + } + add_res = client.add_message(**message_payload) + assert add_res == "All add to task.", str(add_res) + time.sleep(2) # make sure refresh to index before search + memory = Memory(client, {"id": memory_id}) + message_res = memory.list_memory_messages(**{"agent_id": agent_id, "keywords": session_id}) + assert message_res["messages"]["total_count"] > 0 + for message in message_res["messages"]["message_list"]: + assert message["agent_id"] == agent_id, message + assert message["session_id"] == session_id, message + + +@pytest.mark.usefixtures("add_2_multiple_type_memory") +class TestAddToMultipleMemory: + + @pytest.mark.p1 + def test_add_to_multiple_memory(self, client): + memory_ids = self.memory_ids + agent_id = uuid.uuid4().hex + session_id = uuid.uuid4().hex + message_payload = { + "memory_id": memory_ids, + "agent_id": agent_id, + "session_id": session_id, + "user_id": "", + "user_input": "what is pineapple?", + "agent_response": """ +A pineapple is a tropical fruit known for its sweet, tangy flavor and distinctive, spiky appearance. Here are the key facts: +Scientific Name: Ananas comosus +Physical Description: It has a tough, spiky, diamond-patterned outer skin (rind) that is usually green, yellow, or brownish. Inside, the juicy yellow flesh surrounds a fibrous core. +Growth: Unlike most fruits, pineapples do not grow on trees. They grow from a central stem as a composite fruit, meaning they are formed from many individual berries that fuse together around the core. They grow on a short, leafy plant close to the ground. +Uses: Pineapples are eaten fresh, cooked, grilled, juiced, or canned. They are a popular ingredient in desserts, fruit salads, savory dishes (like pizzas or ham glazes), smoothies, and cocktails. +Nutrition: They are a good source of Vitamin C, manganese, and contain an enzyme called bromelain, which aids in digestion and can tenderize meat. +Symbolism: The pineapple is a traditional symbol of hospitality and welcome in many cultures. +Are you asking about the fruit itself, or its use in a specific context? +""" + } + add_res = client.add_message(**message_payload) + assert add_res == "All add to task.", str(add_res) + time.sleep(2) # make sure refresh to index before search + for memory_id in memory_ids: + memory = Memory(client, {"id": memory_id}) + message_res = memory.list_memory_messages(**{"agent_id": agent_id, "keywords": session_id}) + assert message_res["messages"]["total_count"] > 0 + for message in message_res["messages"]["message_list"]: + assert message["agent_id"] == agent_id, message + assert message["session_id"] == session_id, message diff --git a/test/testcases/test_sdk_api/test_message_management/test_forget_message.py b/test/testcases/test_sdk_api/test_message_management/test_forget_message.py new file mode 100644 index 00000000000..92d8527e392 --- /dev/null +++ b/test/testcases/test_sdk_api/test_message_management/test_forget_message.py @@ -0,0 +1,54 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import random +import pytest +from ragflow_sdk import RAGFlow, Memory +from configs import INVALID_API_TOKEN, HOST_ADDRESS + + +class TestAuthorization: + @pytest.mark.p1 + @pytest.mark.parametrize( + "invalid_auth, expected_message", + [ + (None, ""), + (INVALID_API_TOKEN, ""), + ], + ) + def test_auth_invalid(self, invalid_auth, expected_message): + client = RAGFlow(invalid_auth, HOST_ADDRESS) + with pytest.raises(Exception) as exception_info: + memory = Memory(client, {"id": "empty_memory_id"}) + memory.forget_message(0) + assert str(exception_info.value) == expected_message, str(exception_info.value) + + +@pytest.mark.usefixtures("add_memory_with_5_raw_message_func") +class TestForgetMessage: + + @pytest.mark.p1 + def test_forget_message(self, client): + memory_id = self.memory_id + memory = Memory(client, {"id": memory_id}) + list_res = memory.list_memory_messages() + assert len(list_res["messages"]["message_list"]) > 0 + + message = random.choice(list_res["messages"]["message_list"]) + res = memory.forget_message(message["message_id"]) + assert res, str(res) + + forgot_message_res = memory.get_message_content(message["message_id"]) + assert forgot_message_res["forget_at"] not in ["-", ""], forgot_message_res diff --git a/test/testcases/test_sdk_api/test_message_management/test_get_message_content.py b/test/testcases/test_sdk_api/test_message_management/test_get_message_content.py new file mode 100644 index 00000000000..a09d22336f5 --- /dev/null +++ b/test/testcases/test_sdk_api/test_message_management/test_get_message_content.py @@ -0,0 +1,53 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import random + +import pytest +from ragflow_sdk import RAGFlow, Memory +from configs import INVALID_API_TOKEN, HOST_ADDRESS + +class TestAuthorization: + @pytest.mark.p1 + @pytest.mark.parametrize( + "invalid_auth, expected_message", + [ + (None, ""), + (INVALID_API_TOKEN, ""), + ], + ) + def test_auth_invalid(self, invalid_auth, expected_message): + client = RAGFlow(INVALID_API_TOKEN, HOST_ADDRESS) + with pytest.raises(Exception) as exception_info: + memory = Memory(client, {"id": "empty_memory_id"}) + memory.get_message_content(0) + assert str(exception_info.value) == expected_message, str(exception_info.value) + + +@pytest.mark.usefixtures("add_memory_with_multiple_type_message_func") +class TestGetMessageContent: + + @pytest.mark.p1 + def test_get_message_content(self,client): + memory_id = self.memory_id + recent_messages = client.get_recent_messages([memory_id]) + assert len(recent_messages) > 0, recent_messages + message = random.choice(recent_messages) + message_id = message["message_id"] + memory = Memory(client, {"id": memory_id}) + content_res = memory.get_message_content(message_id) + for field in ["content", "content_embed"]: + assert field in content_res + assert content_res[field] is not None, content_res diff --git a/test/testcases/test_sdk_api/test_message_management/test_get_recent_message.py b/test/testcases/test_sdk_api/test_message_management/test_get_recent_message.py new file mode 100644 index 00000000000..ab5c7a762af --- /dev/null +++ b/test/testcases/test_sdk_api/test_message_management/test_get_recent_message.py @@ -0,0 +1,64 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import random + +import pytest +from ragflow_sdk import RAGFlow +from configs import INVALID_API_TOKEN, HOST_ADDRESS + + +class TestAuthorization: + @pytest.mark.p1 + @pytest.mark.parametrize( + "invalid_auth, expected_message", + [ + (None, ""), + (INVALID_API_TOKEN, ""), + ], + ) + def test_auth_invalid(self, invalid_auth, expected_message): + client = RAGFlow(invalid_auth, HOST_ADDRESS) + with pytest.raises(Exception) as exception_info: + client.get_recent_messages(["some_memory_id"]) + assert str(exception_info.value) == expected_message, str(exception_info.value) + + +@pytest.mark.usefixtures("add_memory_with_5_raw_message_func") +class TestGetRecentMessage: + + @pytest.mark.p1 + def test_get_recent_messages(self, client): + memory_id = self.memory_id + res = client.get_recent_messages([memory_id]) + assert len(res) == 5, res + + @pytest.mark.p2 + def test_filter_recent_messages_by_agent(self, client): + memory_id = self.memory_id + agent_ids = self.agent_ids + agent_id = random.choice(agent_ids) + res = client.get_recent_messages(**{"agent_id": agent_id, "memory_id": [memory_id]}) + for message in res: + assert message["agent_id"] == agent_id, message + + @pytest.mark.p2 + def test_filter_recent_messages_by_session(self, client): + memory_id = self.memory_id + session_ids = self.session_ids + session_id = random.choice(session_ids) + res = client.get_recent_messages(**{"session_id": session_id, "memory_id": [memory_id]}) + for message in res: + assert message["session_id"] == session_id, message diff --git a/test/testcases/test_sdk_api/test_message_management/test_list_message.py b/test/testcases/test_sdk_api/test_message_management/test_list_message.py new file mode 100644 index 00000000000..59795633a9d --- /dev/null +++ b/test/testcases/test_sdk_api/test_message_management/test_list_message.py @@ -0,0 +1,101 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import os +import random + +import pytest +from ragflow_sdk import RAGFlow, Memory +from configs import INVALID_API_TOKEN, HOST_ADDRESS + + +class TestAuthorization: + @pytest.mark.p1 + @pytest.mark.parametrize( + "invalid_auth, expected_message", + [ + (None, ""), + (INVALID_API_TOKEN, ""), + ], + ) + def test_auth_invalid(self, invalid_auth, expected_message): + client = RAGFlow(invalid_auth, HOST_ADDRESS) + with pytest.raises(Exception) as exception_info: + memory = Memory(client, {"id": "empty_memory_id"}) + memory.list_memory_messages() + assert str(exception_info.value) == expected_message, str(exception_info.value) + + +@pytest.mark.usefixtures("add_memory_with_5_raw_message_func") +class TestMessageList: + + @pytest.mark.p1 + def test_params_unset(self, client): + memory_id = self.memory_id + memory = Memory(client, {"id": memory_id}) + res = memory.list_memory_messages() + assert len(res["messages"]["message_list"]) == 5, str(res) + + @pytest.mark.p1 + def test_params_empty(self, client): + memory_id = self.memory_id + memory = Memory(client, {"id": memory_id}) + res = memory.list_memory_messages(**{}) + assert len(res["messages"]["message_list"]) == 5, str(res) + + @pytest.mark.p1 + @pytest.mark.parametrize( + "params, expected_page_size", + [ + ({"page": 1, "page_size": 10}, 5), + ({"page": 2, "page_size": 10}, 0), + ({"page": 1, "page_size": 2}, 2), + ({"page": 3, "page_size": 2}, 1), + ({"page": 5, "page_size": 10}, 0), + ], + ids=["normal_first_page", "beyond_max_page", "normal_last_partial_page", "normal_middle_page", + "full_data_single_page"], + ) + def test_page_size(self, client, params, expected_page_size): + # have added 5 messages in fixture + memory_id = self.memory_id + memory = Memory(client, {"id": memory_id}) + res = memory.list_memory_messages(**params) + assert len(res["messages"]["message_list"]) == expected_page_size, str(res) + + @pytest.mark.p2 + def test_filter_agent_id(self, client): + memory_id = self.memory_id + agent_ids = self.agent_ids + agent_id = random.choice(agent_ids) + memory = Memory(client, {"id": memory_id}) + res = memory.list_memory_messages(**{"agent_id": agent_id}) + for message in res["messages"]["message_list"]: + assert message["agent_id"] == agent_id, message + + @pytest.mark.p2 + @pytest.mark.skipif(os.getenv("DOC_ENGINE") == "infinity", reason="Not support.") + def test_search_keyword(self, client): + memory_id = self.memory_id + session_ids = self.session_ids + session_id = random.choice(session_ids) + slice_start = random.randint(0, len(session_id) - 2) + slice_end = random.randint(slice_start + 1, len(session_id) - 1) + keyword = session_id[slice_start:slice_end] + memory = Memory(client, {"id": memory_id}) + res = memory.list_memory_messages(**{"keywords": keyword}) + assert len(res["messages"]["message_list"]) > 0, res + for message in res["messages"]["message_list"]: + assert keyword in message["session_id"], message diff --git a/test/testcases/test_sdk_api/test_message_management/test_search_message.py b/test/testcases/test_sdk_api/test_message_management/test_search_message.py new file mode 100644 index 00000000000..e1409fd10ea --- /dev/null +++ b/test/testcases/test_sdk_api/test_message_management/test_search_message.py @@ -0,0 +1,79 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import pytest +from ragflow_sdk import RAGFlow, Memory +from configs import INVALID_API_TOKEN, HOST_ADDRESS + +class TestAuthorization: + @pytest.mark.p1 + @pytest.mark.parametrize( + "invalid_auth, expected_message", + [ + (None, ""), + (INVALID_API_TOKEN, ""), + ], + ) + def test_auth_invalid(self, invalid_auth, expected_message): + client = RAGFlow(invalid_auth, HOST_ADDRESS) + with pytest.raises(Exception) as exception_info: + client.search_message("", ["empty_memory_id"]) + assert str(exception_info.value) == expected_message, str(exception_info.value) + + +@pytest.mark.usefixtures("add_memory_with_multiple_type_message_func") +class TestSearchMessage: + + @pytest.mark.p1 + def test_query(self, client): + memory_id = self.memory_id + memory = Memory(client, {"id": memory_id}) + list_res = memory.list_memory_messages() + assert list_res["messages"]["total_count"] > 0 + + query = "Coriander is a versatile herb with two main edible parts. What's its name can refer to?" + res = client.search_message(**{"memory_id": [memory_id], "query": query}) + assert len(res) > 0 + + @pytest.mark.p2 + def test_query_with_agent_filter(self, client): + memory_id = self.memory_id + memory = Memory(client, {"id": memory_id}) + list_res = memory.list_memory_messages() + assert list_res["messages"]["total_count"] > 0 + + agent_id = self.agent_id + query = "Coriander is a versatile herb with two main edible parts. What's its name can refer to?" + res = client.search_message(**{"memory_id": [memory_id], "query": query, "agent_id": agent_id}) + assert len(res) > 0 + for message in res: + assert message["agent_id"] == agent_id, message + + @pytest.mark.p2 + def test_query_with_not_default_params(self, client): + memory_id = self.memory_id + memory = Memory(client, {"id": memory_id}) + list_res = memory.list_memory_messages() + assert list_res["messages"]["total_count"] > 0 + + query = "Coriander is a versatile herb with two main edible parts. What's its name can refer to?" + params = { + "similarity_threshold": 0.1, + "keywords_similarity_weight": 0.6, + "top_n": 4 + } + res = client.search_message(**{"memory_id": [memory_id], "query": query, **params}) + assert len(res) > 0 + assert len(res) <= params["top_n"] diff --git a/test/testcases/test_sdk_api/test_message_management/test_update_message_status.py b/test/testcases/test_sdk_api/test_message_management/test_update_message_status.py new file mode 100644 index 00000000000..263ed93f63d --- /dev/null +++ b/test/testcases/test_sdk_api/test_message_management/test_update_message_status.py @@ -0,0 +1,73 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import random + +import pytest +from ragflow_sdk import RAGFlow, Memory +from configs import INVALID_API_TOKEN, HOST_ADDRESS + + +class TestAuthorization: + @pytest.mark.p1 + @pytest.mark.parametrize( + "invalid_auth, expected_message", + [ + (None, ""), + (INVALID_API_TOKEN, ""), + ], + ) + def test_auth_invalid(self, invalid_auth, expected_message): + client = RAGFlow(invalid_auth, HOST_ADDRESS) + with pytest.raises(Exception) as exception_info: + memory = Memory(client, {"id": "empty_memory_id"}) + memory.update_message_status(0, False) + assert str(exception_info.value) == expected_message, str(exception_info.value) + + +@pytest.mark.usefixtures("add_memory_with_5_raw_message_func") +class TestUpdateMessageStatus: + + @pytest.mark.p1 + def test_update_to_false(self, client): + memory_id = self.memory_id + memory = Memory(client, {"id": memory_id}) + list_res = memory.list_memory_messages() + assert len(list_res["messages"]["message_list"]) > 0, str(list_res) + + message = random.choice(list_res["messages"]["message_list"]) + res = memory.update_message_status(message["message_id"], False) + assert res, str(res) + + updated_message_res = memory.get_message_content(message["message_id"]) + assert not updated_message_res["status"], str(updated_message_res) + + @pytest.mark.p1 + def test_update_to_true(self, client): + memory_id = self.memory_id + memory = Memory(client, {"id": memory_id}) + list_res = memory.list_memory_messages() + assert len(list_res["messages"]["message_list"]) > 0, str(list_res) + # set 1 random message to false first + message = random.choice(list_res["messages"]["message_list"]) + set_to_false_res = memory.update_message_status(message["message_id"], False) + assert set_to_false_res, str(set_to_false_res) + updated_message_res = memory.get_message_content(message["message_id"]) + assert not updated_message_res["status"], updated_message_res + # set to true + set_to_true_res = memory.update_message_status(message["message_id"], True) + assert set_to_true_res, str(set_to_true_res) + res = memory.get_message_content(message["message_id"]) + assert res["status"], res diff --git a/test/testcases/test_web_api/common.py b/test/testcases/test_web_api/common.py index 1407885e5e8..6f7487676b5 100644 --- a/test/testcases/test_web_api/common.py +++ b/test/testcases/test_web_api/common.py @@ -28,8 +28,8 @@ DIALOG_APP_URL = f"/{VERSION}/dialog" # SESSION_WITH_CHAT_ASSISTANT_API_URL = "/api/v1/chats/{chat_id}/sessions" # SESSION_WITH_AGENT_API_URL = "/api/v1/agents/{agent_id}/sessions" -MEMORY_API_URL = f"/{VERSION}/memories" -MESSAGE_API_URL = f"/{VERSION}/messages" +MEMORY_API_URL = f"/api/{VERSION}/memories" +MESSAGE_API_URL = f"/api/{VERSION}/messages" # KB APP diff --git a/test/testcases/test_web_api/test_memory_app/test_create_memory.py b/test/testcases/test_web_api/test_memory_app/test_create_memory.py index e21c9885936..04aedf8a4dc 100644 --- a/test/testcases/test_web_api/test_memory_app/test_create_memory.py +++ b/test/testcases/test_web_api/test_memory_app/test_create_memory.py @@ -21,7 +21,7 @@ from configs import INVALID_API_TOKEN from libs.auth import RAGFlowWebApiAuth from hypothesis import example, given, settings -from test.testcases.utils.hypothesis_utils import valid_names +from utils.hypothesis_utils import valid_names class TestAuthorization: diff --git a/web/src/utils/api.ts b/web/src/utils/api.ts index b43ca9e893d..9091539b3f2 100644 --- a/web/src/utils/api.ts +++ b/web/src/utils/api.ts @@ -236,18 +236,20 @@ export default { retrievalTestShare: `${ExternalApi}${api_host}/searchbots/retrieval_test`, // memory - createMemory: `${api_host}/memories`, - getMemoryList: `${api_host}/memories`, - getMemoryConfig: (id: string) => `${api_host}/memories/${id}/config`, - deleteMemory: (id: string) => `${api_host}/memories/${id}`, - getMemoryDetail: (id: string) => `${api_host}/memories/${id}`, - updateMemorySetting: (id: string) => `${api_host}/memories/${id}`, + createMemory: `${ExternalApi}${api_host}/memories`, + getMemoryList: `${ExternalApi}${api_host}/memories`, + getMemoryConfig: (id: string) => + `${ExternalApi}${api_host}/memories/${id}/config`, + deleteMemory: (id: string) => `${ExternalApi}${api_host}/memories/${id}`, + getMemoryDetail: (id: string) => `${ExternalApi}${api_host}/memories/${id}`, + updateMemorySetting: (id: string) => + `${ExternalApi}${api_host}/memories/${id}`, deleteMemoryMessage: (data: { memory_id: string; message_id: string }) => - `${api_host}/messages/${data.memory_id}:${data.message_id}`, + `${ExternalApi}${api_host}/messages/${data.memory_id}:${data.message_id}`, getMessageContent: (data: { memory_id: string; message_id: string }) => - `${api_host}/messages/${data.memory_id}:${data.message_id}/content`, + `${ExternalApi}${api_host}/messages/${data.memory_id}:${data.message_id}/content`, updateMessageState: (data: { memory_id: string; message_id: string }) => - `${api_host}/messages/${data.memory_id}:${data.message_id}`, + `${ExternalApi}${api_host}/messages/${data.memory_id}:${data.message_id}`, // data pipeline fetchDataflow: (id: string) => `${api_host}/dataflow/get/${id}`, From 6abf55c0488c77fe8a5091d04ed9258822bf0a8b Mon Sep 17 00:00:00 2001 From: "Haiyang.Pu" <761396462@qq.com> Date: Fri, 9 Jan 2026 17:48:20 +0800 Subject: [PATCH 077/335] Feat: support openapi (#12521) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What problem does this PR solve? Support OpenAPI interface description. The issue of not supporting the Swagger interface after upgrading the system framework from Flask to Quart has been resolved. Resolved https://github.com/infiniflow/ragflow/issues/5264 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --------- Co-authored-by: puhaiyang <“761396462@qq.com”> --- api/apps/__init__.py | 35 +++-------------------------------- pyproject.toml | 1 + uv.lock | 24 ++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 32 deletions(-) diff --git a/api/apps/__init__.py b/api/apps/__init__.py index c99e5f0dce3..6e0f89c67bc 100644 --- a/api/apps/__init__.py +++ b/api/apps/__init__.py @@ -19,7 +19,6 @@ from importlib.util import module_from_spec, spec_from_file_location from pathlib import Path from quart import Blueprint, Quart, request, g, current_app, session -from flasgger import Swagger from itsdangerous.url_safe import URLSafeTimedSerializer as Serializer from quart_cors import cors from common.constants import StatusEnum @@ -29,6 +28,7 @@ from api.utils import commands from quart_auth import Unauthorized +from quart_schema import QuartSchema from common import settings from api.utils.api_utils import server_error_response from api.constants import API_VERSION @@ -41,37 +41,8 @@ app = Quart(__name__) app = cors(app, allow_origin="*") -# Add this at the beginning of your file to configure Swagger UI -swagger_config = { - "headers": [], - "specs": [ - { - "endpoint": "apispec", - "route": "/apispec.json", - "rule_filter": lambda rule: True, # Include all endpoints - "model_filter": lambda tag: True, # Include all models - } - ], - "static_url_path": "/flasgger_static", - "swagger_ui": True, - "specs_route": "/apidocs/", -} - -swagger = Swagger( - app, - config=swagger_config, - template={ - "swagger": "2.0", - "info": { - "title": "RAGFlow API", - "description": "", - "version": "1.0.0", - }, - "securityDefinitions": { - "ApiKeyAuth": {"type": "apiKey", "name": "Authorization", "in": "header"} - }, - }, -) +# openapi supported +QuartSchema(app) app.url_map.strict_slashes = False app.json_encoder = CustomJSONEncoder diff --git a/pyproject.toml b/pyproject.toml index 1db1ab84a17..2575194eb50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -152,6 +152,7 @@ dependencies = [ "pygithub>=2.8.1", "asana>=5.2.2", "python-gitlab>=7.0.0", + "quart-schema==0.23.0", ] [dependency-groups] diff --git a/uv.lock b/uv.lock index 426139c4508..82ff34cec7d 100644 --- a/uv.lock +++ b/uv.lock @@ -5534,6 +5534,15 @@ wheels = [ { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b", size = 1225217, upload-time = "2025-06-21T13:39:07.939Z" }, ] +[[package]] +name = "pyhumps" +version = "3.8.0" +source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c4/83/fa6f8fb7accb21f39e8f2b6a18f76f6d90626bdb0a5e5448e5cc9b8ab014/pyhumps-3.8.0.tar.gz", hash = "sha256:498026258f7ee1a8e447c2e28526c0bea9407f9a59c03260aee4bd6c04d681a3", size = 9018, upload-time = "2022-10-21T10:38:59.496Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9e/11/a1938340ecb32d71e47ad4914843775011e6e9da59ba1229f181fef3119e/pyhumps-3.8.0-py3-none-any.whl", hash = "sha256:060e1954d9069f428232a1adda165db0b9d8dfdce1d265d36df7fbff540acfd6", size = 6095, upload-time = "2022-10-21T10:38:58.231Z" }, +] + [[package]] name = "pyjwt" version = "2.8.0" @@ -6161,6 +6170,19 @@ wheels = [ { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ea/31/da390a5a10674481dea2909178973de81fa3a246c0eedcc0e1e4114f52f8/quart_cors-0.8.0-py3-none-any.whl", hash = "sha256:62dc811768e2e1704d2b99d5880e3eb26fc776832305a19ea53db66f63837767", size = 8698, upload-time = "2024-12-27T20:34:29.511Z" }, ] +[[package]] +name = "quart-schema" +version = "0.23.0" +source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } +dependencies = [ + { name = "pyhumps" }, + { name = "quart" }, +] +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/24/65/97b69c76bc8838f0389387c87f480382eea48ca60d5262aeaf4086ad14e2/quart_schema-0.23.0.tar.gz", hash = "sha256:778f36aa80697420a0148807eb324b7d6ca1f10793cd1d0eb4f1c7908d860bdd", size = 24485, upload-time = "2025-12-02T22:01:08.508Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/12/ba/54c4516499bf6549ff47d656b8dc8cd58cea7f6d03d3097aebf1958f4974/quart_schema-0.23.0-py3-none-any.whl", hash = "sha256:f8f217942d433954dfe9860b4d748fe4b111836d8d74e06bc0afc512dd991c80", size = 21682, upload-time = "2025-12-02T22:01:06.522Z" }, +] + [[package]] name = "ragflow" version = "0.23.1" @@ -6251,6 +6273,7 @@ dependencies = [ { name = "qianfan" }, { name = "quart-auth" }, { name = "quart-cors" }, + { name = "quart-schema" }, { name = "ranx" }, { name = "readability-lxml" }, { name = "replicate" }, @@ -6383,6 +6406,7 @@ requires-dist = [ { name = "qianfan", specifier = "==0.4.6" }, { name = "quart-auth", specifier = "==0.11.0" }, { name = "quart-cors", specifier = "==0.8.0" }, + { name = "quart-schema", specifier = "==0.23.0" }, { name = "ranx", specifier = "==0.3.20" }, { name = "readability-lxml", specifier = ">=0.8.4,<1.0.0" }, { name = "replicate", specifier = "==0.31.0" }, From 2e09db02f3a9462379ed9b9a0663e0255f251644 Mon Sep 17 00:00:00 2001 From: Lin Manhui Date: Fri, 9 Jan 2026 17:48:45 +0800 Subject: [PATCH 078/335] feat: add paddleocr parser (#12513) ### What problem does this PR solve? Add PaddleOCR as a new PDF parser. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- api/apps/llm_app.py | 8 +- api/db/services/tenant_llm_service.py | 106 +++-- common/constants.py | 40 +- common/parser_config_utils.py | 3 + conf/llm_factories.json | 8 + deepdoc/parser/paddleocr_parser.py | 400 ++++++++++++++++++ rag/app/book.py | 90 ++-- rag/app/laws.py | 68 ++- rag/app/manual.py | 92 ++-- rag/app/naive.py | 285 ++++++------- rag/app/one.py | 55 +-- rag/app/presentation.py | 69 +-- rag/flow/parser/parser.py | 86 +++- rag/llm/ocr_model.py | 66 ++- web/src/assets/svg/llm/paddleocr.svg | 14 + .../layout-recognize-form-field.tsx | 4 + .../paddleocr-options-form-field.tsx | 95 +++++ web/src/components/svg-icon.tsx | 1 + web/src/constants/llm.ts | 3 + web/src/locales/de.ts | 26 +- web/src/locales/en.ts | 24 +- web/src/locales/es.ts | 25 ++ web/src/locales/fr.ts | 22 + web/src/locales/id.ts | 22 + web/src/locales/it.ts | 22 + web/src/locales/ja.ts | 26 +- web/src/locales/pt-br.ts | 22 + web/src/locales/ru.ts | 24 +- web/src/locales/vi.ts | 22 + web/src/locales/zh-traditional.ts | 22 + web/src/locales/zh.ts | 22 + .../user-setting/setting-model/hooks.tsx | 40 ++ .../user-setting/setting-model/index.tsx | 18 + .../modal/paddleocr-modal/index.tsx | 135 ++++++ 34 files changed, 1511 insertions(+), 454 deletions(-) create mode 100644 deepdoc/parser/paddleocr_parser.py create mode 100644 web/src/assets/svg/llm/paddleocr.svg create mode 100644 web/src/components/paddleocr-options-form-field.tsx create mode 100644 web/src/pages/user-setting/setting-model/modal/paddleocr-modal/index.tsx diff --git a/api/apps/llm_app.py b/api/apps/llm_app.py index 9a68e825606..3272a36add2 100644 --- a/api/apps/llm_app.py +++ b/api/apps/llm_app.py @@ -195,6 +195,9 @@ def apikey_json(keys): elif factory == "MinerU": api_key = apikey_json(["api_key", "provider_order"]) + elif factory == "PaddleOCR": + api_key = apikey_json(["api_key", "provider_order"]) + llm = { "tenant_id": current_user.id, "llm_factory": factory, @@ -230,8 +233,7 @@ def apikey_json(keys): **extra, ) try: - m, tc = await mdl.async_chat(None, [{"role": "user", "content": "Hello! How are you doing!"}], - {"temperature": 0.9}) + m, tc = await mdl.async_chat(None, [{"role": "user", "content": "Hello! How are you doing!"}], {"temperature": 0.9}) if not tc and m.find("**ERROR**:") >= 0: raise Exception(m) except Exception as e: @@ -381,7 +383,7 @@ def list_app(): facts = set([o.to_dict()["llm_factory"] for o in objs if o.api_key and o.status == StatusEnum.VALID.value]) status = {(o.llm_name + "@" + o.llm_factory) for o in objs if o.status == StatusEnum.VALID.value} llms = LLMService.get_all() - llms = [m.to_dict() for m in llms if m.status == StatusEnum.VALID.value and m.fid not in weighted and (m.fid == 'Builtin' or (m.llm_name + "@" + m.fid) in status)] + llms = [m.to_dict() for m in llms if m.status == StatusEnum.VALID.value and m.fid not in weighted and (m.fid == "Builtin" or (m.llm_name + "@" + m.fid) in status)] for m in llms: m["available"] = m["fid"] in facts or m["llm_name"].lower() == "flag-embedding" or m["fid"] in self_deployed if "tei-" in os.getenv("COMPOSE_PROFILES", "") and m["model_type"] == LLMType.EMBEDDING and m["fid"] == "Builtin" and m["llm_name"] == os.getenv("TEI_MODEL", ""): diff --git a/api/db/services/tenant_llm_service.py b/api/db/services/tenant_llm_service.py index 65771f60f41..43f9107b296 100644 --- a/api/db/services/tenant_llm_service.py +++ b/api/db/services/tenant_llm_service.py @@ -19,7 +19,7 @@ from peewee import IntegrityError from langfuse import Langfuse from common import settings -from common.constants import MINERU_DEFAULT_CONFIG, MINERU_ENV_KEYS, LLMType +from common.constants import MINERU_DEFAULT_CONFIG, MINERU_ENV_KEYS, PADDLEOCR_DEFAULT_CONFIG, PADDLEOCR_ENV_KEYS, LLMType from api.db.db_models import DB, LLMFactories, TenantLLM from api.db.services.common_service import CommonService from api.db.services.langfuse_service import TenantLangfuseService @@ -60,10 +60,8 @@ def get_api_key(cls, tenant_id, model_name): @classmethod @DB.connection_context() def get_my_llms(cls, tenant_id): - fields = [cls.model.llm_factory, LLMFactories.logo, LLMFactories.tags, cls.model.model_type, cls.model.llm_name, - cls.model.used_tokens, cls.model.status] - objs = cls.model.select(*fields).join(LLMFactories, on=(cls.model.llm_factory == LLMFactories.name)).where( - cls.model.tenant_id == tenant_id, ~cls.model.api_key.is_null()).dicts() + fields = [cls.model.llm_factory, LLMFactories.logo, LLMFactories.tags, cls.model.model_type, cls.model.llm_name, cls.model.used_tokens, cls.model.status] + objs = cls.model.select(*fields).join(LLMFactories, on=(cls.model.llm_factory == LLMFactories.name)).where(cls.model.tenant_id == tenant_id, ~cls.model.api_key.is_null()).dicts() return list(objs) @@ -90,6 +88,7 @@ def split_model_name_and_factory(model_name): @DB.connection_context() def get_model_config(cls, tenant_id, llm_type, llm_name=None): from api.db.services.llm_service import LLMService + e, tenant = TenantService.get_by_id(tenant_id) if not e: raise LookupError("Tenant not found") @@ -119,9 +118,9 @@ def get_model_config(cls, tenant_id, llm_type, llm_name=None): model_config = cls.get_api_key(tenant_id, mdlnm) if model_config: model_config = model_config.to_dict() - elif llm_type == LLMType.EMBEDDING and fid == 'Builtin' and "tei-" in os.getenv("COMPOSE_PROFILES", "") and mdlnm == os.getenv('TEI_MODEL', ''): + elif llm_type == LLMType.EMBEDDING and fid == "Builtin" and "tei-" in os.getenv("COMPOSE_PROFILES", "") and mdlnm == os.getenv("TEI_MODEL", ""): embedding_cfg = settings.EMBEDDING_CFG - model_config = {"llm_factory": 'Builtin', "api_key": embedding_cfg["api_key"], "llm_name": mdlnm, "api_base": embedding_cfg["base_url"]} + model_config = {"llm_factory": "Builtin", "api_key": embedding_cfg["api_key"], "llm_name": mdlnm, "api_base": embedding_cfg["base_url"]} else: raise LookupError(f"Model({mdlnm}@{fid}) not authorized") @@ -140,33 +139,27 @@ def model_instance(cls, tenant_id, llm_type, llm_name=None, lang="Chinese", **kw if llm_type == LLMType.EMBEDDING.value: if model_config["llm_factory"] not in EmbeddingModel: return None - return EmbeddingModel[model_config["llm_factory"]](model_config["api_key"], model_config["llm_name"], - base_url=model_config["api_base"]) + return EmbeddingModel[model_config["llm_factory"]](model_config["api_key"], model_config["llm_name"], base_url=model_config["api_base"]) elif llm_type == LLMType.RERANK: if model_config["llm_factory"] not in RerankModel: return None - return RerankModel[model_config["llm_factory"]](model_config["api_key"], model_config["llm_name"], - base_url=model_config["api_base"]) + return RerankModel[model_config["llm_factory"]](model_config["api_key"], model_config["llm_name"], base_url=model_config["api_base"]) elif llm_type == LLMType.IMAGE2TEXT.value: if model_config["llm_factory"] not in CvModel: return None - return CvModel[model_config["llm_factory"]](model_config["api_key"], model_config["llm_name"], lang, - base_url=model_config["api_base"], **kwargs) + return CvModel[model_config["llm_factory"]](model_config["api_key"], model_config["llm_name"], lang, base_url=model_config["api_base"], **kwargs) elif llm_type == LLMType.CHAT.value: if model_config["llm_factory"] not in ChatModel: return None - return ChatModel[model_config["llm_factory"]](model_config["api_key"], model_config["llm_name"], - base_url=model_config["api_base"], **kwargs) + return ChatModel[model_config["llm_factory"]](model_config["api_key"], model_config["llm_name"], base_url=model_config["api_base"], **kwargs) elif llm_type == LLMType.SPEECH2TEXT: if model_config["llm_factory"] not in Seq2txtModel: return None - return Seq2txtModel[model_config["llm_factory"]](key=model_config["api_key"], - model_name=model_config["llm_name"], lang=lang, - base_url=model_config["api_base"]) + return Seq2txtModel[model_config["llm_factory"]](key=model_config["api_key"], model_name=model_config["llm_name"], lang=lang, base_url=model_config["api_base"]) elif llm_type == LLMType.TTS: if model_config["llm_factory"] not in TTSModel: return None @@ -216,14 +209,11 @@ def increase_usage(cls, tenant_id, llm_type, used_tokens, llm_name=None): try: num = ( cls.model.update(used_tokens=cls.model.used_tokens + used_tokens) - .where(cls.model.tenant_id == tenant_id, cls.model.llm_name == llm_name, - cls.model.llm_factory == llm_factory if llm_factory else True) + .where(cls.model.tenant_id == tenant_id, cls.model.llm_name == llm_name, cls.model.llm_factory == llm_factory if llm_factory else True) .execute() ) except Exception: - logging.exception( - "TenantLLMService.increase_usage got exception,Failed to update used_tokens for tenant_id=%s, llm_name=%s", - tenant_id, llm_name) + logging.exception("TenantLLMService.increase_usage got exception,Failed to update used_tokens for tenant_id=%s, llm_name=%s", tenant_id, llm_name) return 0 return num @@ -231,9 +221,7 @@ def increase_usage(cls, tenant_id, llm_type, used_tokens, llm_name=None): @classmethod @DB.connection_context() def get_openai_models(cls): - objs = cls.model.select().where((cls.model.llm_factory == "OpenAI"), - ~(cls.model.llm_name == "text-embedding-3-small"), - ~(cls.model.llm_name == "text-embedding-3-large")).dicts() + objs = cls.model.select().where((cls.model.llm_factory == "OpenAI"), ~(cls.model.llm_name == "text-embedding-3-small"), ~(cls.model.llm_name == "text-embedding-3-large")).dicts() return list(objs) @classmethod @@ -298,6 +286,68 @@ def _parse_api_key(raw: str) -> dict: idx += 1 continue + @classmethod + def _collect_paddleocr_env_config(cls) -> dict | None: + cfg = PADDLEOCR_DEFAULT_CONFIG + found = False + for key in PADDLEOCR_ENV_KEYS: + val = os.environ.get(key) + if val: + found = True + cfg[key] = val + return cfg if found else None + + @classmethod + @DB.connection_context() + def ensure_paddleocr_from_env(cls, tenant_id: str) -> str | None: + """ + Ensure a PaddleOCR model exists for the tenant if env variables are present. + Return the existing or newly created llm_name, or None if env not set. + """ + cfg = cls._collect_paddleocr_env_config() + if not cfg: + return None + + saved_paddleocr_models = cls.query(tenant_id=tenant_id, llm_factory="PaddleOCR", model_type=LLMType.OCR.value) + + def _parse_api_key(raw: str) -> dict: + try: + return json.loads(raw or "{}") + except Exception: + return {} + + for item in saved_paddleocr_models: + api_cfg = _parse_api_key(item.api_key) + normalized = {k: api_cfg.get(k, PADDLEOCR_DEFAULT_CONFIG.get(k)) for k in PADDLEOCR_ENV_KEYS} + if normalized == cfg: + return item.llm_name + + used_names = {item.llm_name for item in saved_paddleocr_models} + idx = 1 + base_name = "paddleocr-from-env" + while True: + candidate = f"{base_name}-{idx}" + if candidate in used_names: + idx += 1 + continue + + try: + cls.save( + tenant_id=tenant_id, + llm_factory="PaddleOCR", + llm_name=candidate, + model_type=LLMType.OCR.value, + api_key=json.dumps(cfg), + api_base="", + max_tokens=0, + ) + return candidate + except IntegrityError: + logging.warning("PaddleOCR env model %s already exists for tenant %s, retry with next name", candidate, tenant_id) + used_names.add(candidate) + idx += 1 + continue + @classmethod @DB.connection_context() def delete_by_tenant_id(cls, tenant_id): @@ -306,6 +356,7 @@ def delete_by_tenant_id(cls, tenant_id): @staticmethod def llm_id2llm_type(llm_id: str) -> str | None: from api.db.services.llm_service import LLMService + llm_id, *_ = TenantLLMService.split_model_name_and_factory(llm_id) llm_factories = settings.FACTORY_LLM_INFOS for llm_factory in llm_factories: @@ -340,8 +391,7 @@ def __init__(self, tenant_id, llm_type, llm_name=None, lang="Chinese", **kwargs) langfuse_keys = TenantLangfuseService.filter_by_tenant(tenant_id=tenant_id) self.langfuse = None if langfuse_keys: - langfuse = Langfuse(public_key=langfuse_keys.public_key, secret_key=langfuse_keys.secret_key, - host=langfuse_keys.host) + langfuse = Langfuse(public_key=langfuse_keys.public_key, secret_key=langfuse_keys.secret_key, host=langfuse_keys.host) if langfuse.auth_check(): self.langfuse = langfuse trace_id = self.langfuse.create_trace_id() diff --git a/common/constants.py b/common/constants.py index 4aea764b2c1..de228bbe89a 100644 --- a/common/constants.py +++ b/common/constants.py @@ -20,6 +20,7 @@ SERVICE_CONF = "service_conf.yaml" RAG_FLOW_SERVICE_NAME = "ragflow" + class CustomEnum(Enum): @classmethod def valid(cls, value): @@ -68,13 +69,13 @@ class ActiveEnum(Enum): class LLMType(StrEnum): - CHAT = 'chat' - EMBEDDING = 'embedding' - SPEECH2TEXT = 'speech2text' - IMAGE2TEXT = 'image2text' - RERANK = 'rerank' - TTS = 'tts' - OCR = 'ocr' + CHAT = "chat" + EMBEDDING = "embedding" + SPEECH2TEXT = "speech2text" + IMAGE2TEXT = "image2text" + RERANK = "rerank" + TTS = "tts" + OCR = "ocr" class TaskStatus(StrEnum): @@ -86,8 +87,7 @@ class TaskStatus(StrEnum): SCHEDULE = "5" -VALID_TASK_STATUS = {TaskStatus.UNSTART, TaskStatus.RUNNING, TaskStatus.CANCEL, TaskStatus.DONE, TaskStatus.FAIL, - TaskStatus.SCHEDULE} +VALID_TASK_STATUS = {TaskStatus.UNSTART, TaskStatus.RUNNING, TaskStatus.CANCEL, TaskStatus.DONE, TaskStatus.FAIL, TaskStatus.SCHEDULE} class ParserType(StrEnum): @@ -136,6 +136,7 @@ class FileSource(StrEnum): BITBUCKET = "bitbucket" ZENDESK = "zendesk" + class PipelineTaskType(StrEnum): PARSE = "Parse" DOWNLOAD = "Download" @@ -145,15 +146,17 @@ class PipelineTaskType(StrEnum): MEMORY = "Memory" -VALID_PIPELINE_TASK_TYPES = {PipelineTaskType.PARSE, PipelineTaskType.DOWNLOAD, PipelineTaskType.RAPTOR, - PipelineTaskType.GRAPH_RAG, PipelineTaskType.MINDMAP} +VALID_PIPELINE_TASK_TYPES = {PipelineTaskType.PARSE, PipelineTaskType.DOWNLOAD, PipelineTaskType.RAPTOR, PipelineTaskType.GRAPH_RAG, PipelineTaskType.MINDMAP} + class MCPServerType(StrEnum): SSE = "sse" STREAMABLE_HTTP = "streamable-http" + VALID_MCP_SERVER_TYPES = {MCPServerType.SSE, MCPServerType.STREAMABLE_HTTP} + class Storage(Enum): MINIO = 1 AZURE_SPN = 2 @@ -165,10 +168,10 @@ class Storage(Enum): class MemoryType(Enum): - RAW = 0b0001 # 1 << 0 = 1 (0b00000001) - SEMANTIC = 0b0010 # 1 << 1 = 2 (0b00000010) - EPISODIC = 0b0100 # 1 << 2 = 4 (0b00000100) - PROCEDURAL = 0b1000 # 1 << 3 = 8 (0b00001000) + RAW = 0b0001 # 1 << 0 = 1 (0b00000001) + SEMANTIC = 0b0010 # 1 << 1 = 2 (0b00000010) + EPISODIC = 0b0100 # 1 << 2 = 4 (0b00000100) + PROCEDURAL = 0b1000 # 1 << 3 = 8 (0b00001000) class MemoryStorageType(StrEnum): @@ -239,3 +242,10 @@ class ForgettingPolicy(StrEnum): "MINERU_SERVER_URL": "", "MINERU_DELETE_OUTPUT": 1, } + +PADDLEOCR_ENV_KEYS = ["PADDLEOCR_API_URL", "PADDLEOCR_ACCESS_TOKEN", "PADDLEOCR_ALGORITHM"] +PADDLEOCR_DEFAULT_CONFIG = { + "PADDLEOCR_API_URL": "", + "PADDLEOCR_ACCESS_TOKEN": None, + "PADDLEOCR_ALGORITHM": "PaddleOCR-VL", +} diff --git a/common/parser_config_utils.py b/common/parser_config_utils.py index 0a79f3ad177..0bc7ffc28b3 100644 --- a/common/parser_config_utils.py +++ b/common/parser_config_utils.py @@ -26,5 +26,8 @@ def normalize_layout_recognizer(layout_recognizer_raw: Any) -> tuple[Any, str | if lowered.endswith("@mineru"): parser_model_name = layout_recognizer_raw.rsplit("@", 1)[0] layout_recognizer = "MinerU" + elif lowered.endswith("@paddleocr"): + parser_model_name = layout_recognizer_raw.rsplit("@", 1)[0] + layout_recognizer = "PaddleOCR" return layout_recognizer, parser_model_name diff --git a/conf/llm_factories.json b/conf/llm_factories.json index 451c8f45235..b128f4e67f8 100644 --- a/conf/llm_factories.json +++ b/conf/llm_factories.json @@ -5531,6 +5531,14 @@ "status": "1", "rank": "900", "llm": [] + }, + { + "name": "PaddleOCR", + "logo": "", + "tags": "OCR", + "status": "1", + "rank": "910", + "llm": [] } ] } diff --git a/deepdoc/parser/paddleocr_parser.py b/deepdoc/parser/paddleocr_parser.py new file mode 100644 index 00000000000..fca69da792a --- /dev/null +++ b/deepdoc/parser/paddleocr_parser.py @@ -0,0 +1,400 @@ +# Copyright 2026 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from __future__ import annotations + +import base64 +import logging +import os +import re +from dataclasses import asdict, dataclass, field, fields +from io import BytesIO +from os import PathLike +from pathlib import Path +from typing import Any, Callable, ClassVar, Literal, Optional, Union, Tuple, List + +import requests + +try: + from deepdoc.parser.pdf_parser import RAGFlowPdfParser +except Exception: + + class RAGFlowPdfParser: + pass + + +AlgorithmType = Literal["PaddleOCR-VL"] +SectionTuple = tuple[str, ...] +TableTuple = tuple[str, ...] +ParseResult = tuple[list[SectionTuple], list[TableTuple]] + + +_MARKDOWN_IMAGE_PATTERN = re.compile( + r""" + ]*>\s* + ]*/>\s* +
+ | + ]*/> + """, + re.IGNORECASE | re.VERBOSE | re.DOTALL, +) + + +def _remove_images_from_markdown(markdown: str) -> str: + return _MARKDOWN_IMAGE_PATTERN.sub("", markdown) + + +@dataclass +class PaddleOCRVLConfig: + """Configuration for PaddleOCR-VL algorithm.""" + + use_doc_orientation_classify: Optional[bool] = None + use_doc_unwarping: Optional[bool] = None + use_layout_detection: Optional[bool] = None + use_polygon_points: Optional[bool] = None + use_chart_recognition: Optional[bool] = None + use_seal_recognition: Optional[bool] = None + use_ocr_for_image_block: Optional[bool] = None + layout_threshold: Optional[Union[float, dict]] = None + layout_nms: Optional[bool] = None + layout_unclip_ratio: Optional[Union[float, Tuple[float, float], dict]] = None + layout_merge_bboxes_mode: Optional[Union[str, dict]] = None + prompt_label: Optional[str] = None + format_block_content: Optional[bool] = True + repetition_penalty: Optional[float] = None + temperature: Optional[float] = None + top_p: Optional[float] = None + min_pixels: Optional[int] = None + max_pixels: Optional[int] = None + max_new_tokens: Optional[int] = None + merge_layout_blocks: Optional[bool] = None + markdown_ignore_labels: Optional[List[str]] = None + vlm_extra_args: Optional[dict] = None + + +@dataclass +class PaddleOCRConfig: + """Main configuration for PaddleOCR parser.""" + + api_url: str = "" + access_token: Optional[str] = None + algorithm: AlgorithmType = "PaddleOCR-VL" + request_timeout: int = 600 + prettify_markdown: bool = True + show_formula_number: bool = True + visualize: bool = False + additional_params: dict[str, Any] = field(default_factory=dict) + algorithm_config: dict[str, Any] = field(default_factory=dict) + + @classmethod + def from_dict(cls, config: Optional[dict[str, Any]]) -> "PaddleOCRConfig": + """Create configuration from dictionary.""" + if not config: + return cls() + + cfg = config.copy() + algorithm = cfg.get("algorithm", "PaddleOCR-VL") + + # Validate algorithm + if algorithm not in ("PaddleOCR-VL",): + raise ValueError(f"Unsupported algorithm: {algorithm}") + + # Extract algorithm-specific configuration + algorithm_config: dict[str, Any] = {} + if algorithm == "PaddleOCR-VL": + # Create default PaddleOCRVLConfig object and convert to dict + algorithm_config = asdict(PaddleOCRVLConfig()) + + # Apply user-provided VL config + vl_config = cfg.get("vl") + if isinstance(vl_config, dict): + algorithm_config.update({k: v for k, v in vl_config.items() if v is not None}) + + # Remove processed keys + cfg.pop("vl", None) + + # Prepare initialization arguments + field_names = {field.name for field in fields(cls)} + init_kwargs: dict[str, Any] = {} + + for field_name in field_names: + if field_name in cfg: + init_kwargs[field_name] = cfg[field_name] + + init_kwargs["algorithm_config"] = algorithm_config + + return cls(**init_kwargs) + + @classmethod + def from_kwargs(cls, **kwargs: Any) -> "PaddleOCRConfig": + """Create configuration from keyword arguments.""" + return cls.from_dict(kwargs) + + +class PaddleOCRParser(RAGFlowPdfParser): + """Parser for PDF documents using PaddleOCR API.""" + + _COMMON_FIELD_MAPPING: ClassVar[dict[str, str]] = { + "prettify_markdown": "prettifyMarkdown", + "show_formula_number": "showFormulaNumber", + "visualize": "visualize", + } + + _ALGORITHM_FIELD_MAPPINGS: ClassVar[dict[str, dict[str, str]]] = { + "PaddleOCR-VL": { + "use_doc_orientation_classify": "useDocOrientationClassify", + "use_doc_unwarping": "useDocUnwarping", + "use_layout_detection": "useLayoutDetection", + "use_polygon_points": "usePolygonPoints", + "use_chart_recognition": "useChartRecognition", + "use_seal_recognition": "useSealRecognition", + "use_ocr_for_image_block": "useOcrForImageBlock", + "layout_threshold": "layoutThreshold", + "layout_nms": "layoutNms", + "layout_unclip_ratio": "layoutUnclipRatio", + "layout_merge_bboxes_mode": "layoutMergeBboxesMode", + "prompt_label": "promptLabel", + "format_block_content": "formatBlockContent", + "repetition_penalty": "repetitionPenalty", + "temperature": "temperature", + "top_p": "topP", + "min_pixels": "minPixels", + "max_pixels": "maxPixels", + "max_new_tokens": "maxNewTokens", + "merge_layout_blocks": "mergeLayoutBlocks", + "markdown_ignore_labels": "markdownIgnoreLabels", + "vlm_extra_args": "vlmExtraArgs", + }, + } + + def __init__( + self, + api_url: Optional[str] = None, + access_token: Optional[str] = None, + algorithm: AlgorithmType = "PaddleOCR-VL", + *, + request_timeout: int = 600, + ): + """Initialize PaddleOCR parser.""" + self.api_url = api_url.rstrip("/") if api_url else os.getenv("PADDLEOCR_API_URL", "") + self.access_token = access_token or os.getenv("PADDLEOCR_ACCESS_TOKEN") + self.algorithm = algorithm + self.request_timeout = request_timeout + self.logger = logging.getLogger(self.__class__.__name__) + + # Force PDF file type + self.file_type = 0 + + # Public methods + def check_installation(self) -> tuple[bool, str]: + """Check if the parser is properly installed and configured.""" + if not self.api_url: + return False, "[PaddleOCR] API URL not configured" + + # TODO [@Bobholamovic]: Check URL availability and token validity + + return True, "" + + def parse_pdf( + self, + filepath: str | PathLike[str], + binary: BytesIO | bytes | None = None, + callback: Optional[Callable[[float, str], None]] = None, + *, + parse_method: str = "raw", + api_url: Optional[str] = None, + access_token: Optional[str] = None, + algorithm: Optional[AlgorithmType] = None, + request_timeout: Optional[int] = None, + prettify_markdown: Optional[bool] = None, + show_formula_number: Optional[bool] = None, + visualize: Optional[bool] = None, + additional_params: Optional[dict[str, Any]] = None, + vl_config: Optional[dict[str, Any]] = None, + **kwargs: Any, + ) -> ParseResult: + """Parse PDF document using PaddleOCR API.""" + # Create configuration - pass all kwargs to capture VL config parameters + config_dict = { + "api_url": api_url if api_url is not None else self.api_url, + "access_token": access_token if access_token is not None else self.access_token, + "algorithm": algorithm if algorithm is not None else self.algorithm, + "request_timeout": request_timeout if request_timeout is not None else self.request_timeout, + } + if prettify_markdown is not None: + config_dict["prettify_markdown"] = prettify_markdown + if show_formula_number is not None: + config_dict["show_formula_number"] = show_formula_number + if visualize is not None: + config_dict["visualize"] = visualize + if additional_params is not None: + config_dict["additional_params"] = additional_params + if vl_config is not None: + config_dict["vl"] = vl_config + + # Add any VL config parameters from kwargs + for key, value in kwargs.items(): + if key in {field.name for field in fields(PaddleOCRVLConfig)}: + config_dict[key] = value + + cfg = PaddleOCRConfig.from_dict(config_dict) + + if not cfg.api_url: + raise RuntimeError("[PaddleOCR] API URL missing") + + # Prepare file data + data_bytes = self._prepare_file_data(filepath, binary) + + # Build and send request + result = self._send_request(data_bytes, cfg, callback) + + # Process response + sections = self._transfer_to_sections(result, algorithm=cfg.algorithm, parse_method=parse_method) + if callback: + callback(0.9, f"[PaddleOCR] done, sections: {len(sections)}") + + tables = self._transfer_to_tables(result) + if callback: + callback(1.0, f"[PaddleOCR] done, tables: {len(tables)}") + + return sections, tables + + def _prepare_file_data(self, filepath: str | PathLike[str], binary: BytesIO | bytes | None) -> bytes: + """Prepare file data for API request.""" + source_path = Path(filepath) + + if binary is not None: + if isinstance(binary, (bytes, bytearray)): + return binary + return binary.getbuffer().tobytes() + + if not source_path.exists(): + raise FileNotFoundError(f"[PaddleOCR] file not found: {source_path}") + + return source_path.read_bytes() + + def _build_payload(self, data: bytes, file_type: int, config: PaddleOCRConfig) -> dict[str, Any]: + """Build payload for API request.""" + payload: dict[str, Any] = { + "file": base64.b64encode(data).decode("ascii"), + "fileType": file_type, + } + + # Add common parameters + for param_key, param_value in [ + ("prettify_markdown", config.prettify_markdown), + ("show_formula_number", config.show_formula_number), + ("visualize", config.visualize), + ]: + if param_value is not None: + api_param = self._COMMON_FIELD_MAPPING[param_key] + payload[api_param] = param_value + + # Add algorithm-specific parameters + algorithm_mapping = self._ALGORITHM_FIELD_MAPPINGS.get(config.algorithm, {}) + for param_key, param_value in config.algorithm_config.items(): + if param_value is not None and param_key in algorithm_mapping: + api_param = algorithm_mapping[param_key] + payload[api_param] = param_value + + # Add any additional parameters + if config.additional_params: + payload.update(config.additional_params) + + return payload + + def _send_request(self, data: bytes, config: PaddleOCRConfig, callback: Optional[Callable[[float, str], None]]) -> dict[str, Any]: + """Send request to PaddleOCR API and parse response.""" + # Build payload + payload = self._build_payload(data, self.file_type, config) + + # Prepare headers + headers = {"Content-Type": "application/json", "Client-Platform": "ragflow"} + if config.access_token: + headers["Authorization"] = f"token {config.access_token}" + + self.logger.info("[PaddleOCR] invoking API") + if callback: + callback(0.1, "[PaddleOCR] submitting request") + + # Send request + try: + resp = requests.post(config.api_url, json=payload, headers=headers, timeout=self.request_timeout) + resp.raise_for_status() + except Exception as exc: + if callback: + callback(-1, f"[PaddleOCR] request failed: {exc}") + raise RuntimeError(f"[PaddleOCR] request failed: {exc}") + + # Parse response + try: + response_data = resp.json() + except Exception as exc: + raise RuntimeError(f"[PaddleOCR] response is not JSON: {exc}") from exc + + if callback: + callback(0.8, "[PaddleOCR] response received") + + # Validate response format + if response_data.get("errorCode") != 0 or not isinstance(response_data.get("result"), dict): + if callback: + callback(-1, "[PaddleOCR] invalid response format") + raise RuntimeError("[PaddleOCR] invalid response format") + + return response_data["result"] + + def _transfer_to_sections(self, result: dict[str, Any], algorithm: AlgorithmType, parse_method: str) -> list[SectionTuple]: + """Convert API response to section tuples.""" + sections: list[SectionTuple] = [] + + if algorithm == "PaddleOCR-VL": + layout_parsing_results = result.get("layoutParsingResults", []) + + for page_idx, layout_result in enumerate(layout_parsing_results): + pruned_result = layout_result.get("prunedResult", {}) + parsing_res_list = pruned_result.get("parsing_res_list", []) + + for block in parsing_res_list: + block_content = block.get("block_content", "").strip() + if not block_content: + continue + + # Remove images + block_content = _remove_images_from_markdown(block_content) + + label = block.get("block_label", "") + block_bbox = block.get("block_bbox", [0, 0, 0, 0]) + + tag = f"@@{page_idx + 1}\t{block_bbox[0]}\t{block_bbox[2]}\t{block_bbox[1]}\t{block_bbox[3]}##" + + if parse_method == "manual": + sections.append((block_content, label, tag)) + elif parse_method == "paper": + sections.append((block_content + tag, label)) + else: + sections.append((block_content, tag)) + + return sections + + def _transfer_to_tables(self, result: dict[str, Any]) -> list[TableTuple]: + """Convert API response to table tuples.""" + return [] + + +if __name__ == "__main__": + logging.basicConfig(level=logging.INFO) + parser = PaddleOCRParser(api_url=os.getenv("PADDLEOCR_API_URL", ""), algorithm=os.getenv("PADDLEOCR_ALGORITHM", "PaddleOCR-VL")) + ok, reason = parser.check_installation() + print("PaddleOCR available:", ok, reason) diff --git a/rag/app/book.py b/rag/app/book.py index 86763adf2fc..d3c45b4251f 100644 --- a/rag/app/book.py +++ b/rag/app/book.py @@ -22,9 +22,7 @@ from rag.app import naive from rag.app.naive import by_plaintext, PARSERS from common.parser_config_utils import normalize_layout_recognizer -from rag.nlp import bullets_category, is_english, remove_contents_table, \ - hierarchical_merge, make_colon_as_title, naive_merge, random_choices, tokenize_table, \ - tokenize_chunks, attach_media_context +from rag.nlp import bullets_category, is_english, remove_contents_table, hierarchical_merge, make_colon_as_title, naive_merge, random_choices, tokenize_table, tokenize_chunks, attach_media_context from rag.nlp import rag_tokenizer from deepdoc.parser import PdfParser, HtmlParser from deepdoc.parser.figure_parser import vision_figure_parser_docx_wrapper @@ -32,17 +30,12 @@ class Pdf(PdfParser): - def __call__(self, filename, binary=None, from_page=0, - to_page=100000, zoomin=3, callback=None): + def __call__(self, filename, binary=None, from_page=0, to_page=100000, zoomin=3, callback=None): from timeit import default_timer as timer + start = timer() callback(msg="OCR started") - self.__images__( - filename if not binary else binary, - zoomin, - from_page, - to_page, - callback) + self.__images__(filename if not binary else binary, zoomin, from_page, to_page, callback) callback(msg="OCR finished ({:.2f}s)".format(timer() - start)) start = timer() @@ -62,24 +55,17 @@ def __call__(self, filename, binary=None, from_page=0, self._merge_with_same_bullet() callback(0.8, "Text extraction ({:.2f}s)".format(timer() - start)) - return [(b["text"] + self._line_tag(b, zoomin), b.get("layoutno", "")) - for b in self.boxes], tbls + return [(b["text"] + self._line_tag(b, zoomin), b.get("layoutno", "")) for b in self.boxes], tbls -def chunk(filename, binary=None, from_page=0, to_page=100000, - lang="Chinese", callback=None, **kwargs): +def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", callback=None, **kwargs): """ - Supported file formats are docx, pdf, txt. - Since a book is long and not all the parts are useful, if it's a PDF, - please set up the page ranges for every book in order eliminate negative effects and save elapsed computing time. + Supported file formats are docx, pdf, txt. + Since a book is long and not all the parts are useful, if it's a PDF, + please set up the page ranges for every book in order eliminate negative effects and save elapsed computing time. """ - parser_config = kwargs.get( - "parser_config", { - "chunk_token_num": 512, "delimiter": "\n!?。;!?", "layout_recognize": "DeepDOC"}) - doc = { - "docnm_kwd": filename, - "title_tks": rag_tokenizer.tokenize(re.sub(r"\.[a-zA-Z]+$", "", filename)) - } + parser_config = kwargs.get("parser_config", {"chunk_token_num": 512, "delimiter": "\n!?。;!?", "layout_recognize": "DeepDOC"}) + doc = {"docnm_kwd": filename, "title_tks": rag_tokenizer.tokenize(re.sub(r"\.[a-zA-Z]+$", "", filename))} doc["title_sm_tks"] = rag_tokenizer.fine_grained_tokenize(doc["title_tks"]) pdf_parser = None sections, tbls = [], [] @@ -87,28 +73,23 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, callback(0.1, "Start to parse.") doc_parser = naive.Docx() # TODO: table of contents need to be removed - main_sections = doc_parser( - filename, binary=binary, from_page=from_page, to_page=to_page) - + main_sections = doc_parser(filename, binary=binary, from_page=from_page, to_page=to_page) + sections = [] tbls = [] for text, image, html in main_sections: sections.append((text, image)) tbls.append(((None, html), "")) - - remove_contents_table(sections, eng=is_english( - random_choices([t for t, _ in sections], k=200))) + + remove_contents_table(sections, eng=is_english(random_choices([t for t, _ in sections], k=200))) tbls = vision_figure_parser_docx_wrapper(sections=sections, tbls=tbls, callback=callback, **kwargs) # tbls = [((None, lns), None) for lns in tbls] - sections = [(item[0], item[1] if item[1] is not None else "") for item in sections if - not isinstance(item[1], Image.Image)] + sections = [(item[0], item[1] if item[1] is not None else "") for item in sections if not isinstance(item[1], Image.Image)] callback(0.8, "Finish parsing.") elif re.search(r"\.pdf$", filename, re.IGNORECASE): - layout_recognizer, parser_model_name = normalize_layout_recognizer( - parser_config.get("layout_recognize", "DeepDOC") - ) + layout_recognizer, parser_model_name = normalize_layout_recognizer(parser_config.get("layout_recognize", "DeepDOC")) if isinstance(layout_recognizer, bool): layout_recognizer = "DeepDOC" if layout_recognizer else "Plain Text" @@ -127,13 +108,14 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, pdf_cls=Pdf, layout_recognizer=layout_recognizer, mineru_llm_name=parser_model_name, - **kwargs + paddleocr_llm_name=parser_model_name, + **kwargs, ) if not sections and not tables: return [] - if name in ["tcadp", "docling", "mineru"]: + if name in ["tcadp", "docling", "mineru", "paddleocr"]: parser_config["chunk_token_num"] = 0 callback(0.8, "Finish parsing.") @@ -142,16 +124,14 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, txt = get_text(filename, binary) sections = txt.split("\n") sections = [(line, "") for line in sections if line] - remove_contents_table(sections, eng=is_english( - random_choices([t for t, _ in sections], k=200))) + remove_contents_table(sections, eng=is_english(random_choices([t for t, _ in sections], k=200))) callback(0.8, "Finish parsing.") elif re.search(r"\.(htm|html)$", filename, re.IGNORECASE): callback(0.1, "Start to parse.") sections = HtmlParser()(filename, binary) sections = [(line, "") for line in sections if line] - remove_contents_table(sections, eng=is_english( - random_choices([t for t, _ in sections], k=200))) + remove_contents_table(sections, eng=is_english(random_choices([t for t, _ in sections], k=200))) callback(0.8, "Finish parsing.") elif re.search(r"\.doc$", filename, re.IGNORECASE): @@ -165,31 +145,23 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, binary = BytesIO(binary) doc_parsed = tika_parser.from_buffer(binary) - if doc_parsed.get('content', None) is not None: - sections = doc_parsed['content'].split('\n') + if doc_parsed.get("content", None) is not None: + sections = doc_parsed["content"].split("\n") sections = [(line, "") for line in sections if line] - remove_contents_table(sections, eng=is_english( - random_choices([t for t, _ in sections], k=200))) + remove_contents_table(sections, eng=is_english(random_choices([t for t, _ in sections], k=200))) callback(0.8, "Finish parsing.") else: - raise NotImplementedError( - "file type not supported yet(doc, docx, pdf, txt supported)") + raise NotImplementedError("file type not supported yet(doc, docx, pdf, txt supported)") make_colon_as_title(sections) - bull = bullets_category( - [t for t in random_choices([t for t, _ in sections], k=100)]) + bull = bullets_category([t for t in random_choices([t for t, _ in sections], k=100)]) if bull >= 0: - chunks = ["\n".join(ck) - for ck in hierarchical_merge(bull, sections, 5)] + chunks = ["\n".join(ck) for ck in hierarchical_merge(bull, sections, 5)] else: sections = [s.split("@") for s, _ in sections] - sections = [(pr[0], "@" + pr[1]) if len(pr) == 2 else (pr[0], '') for pr in sections] - chunks = naive_merge( - sections, - parser_config.get("chunk_token_num", 256), - parser_config.get("delimiter", "\n。;!?") - ) + sections = [(pr[0], "@" + pr[1]) if len(pr) == 2 else (pr[0], "") for pr in sections] + chunks = naive_merge(sections, parser_config.get("chunk_token_num", 256), parser_config.get("delimiter", "\n。;!?")) # is it English # is_english(random_choices([t for t, _ in sections], k=218)) @@ -208,9 +180,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, if __name__ == "__main__": import sys - def dummy(prog=None, msg=""): pass - chunk(sys.argv[1], from_page=1, to_page=10, callback=dummy) diff --git a/rag/app/laws.py b/rag/app/laws.py index 15c43e36873..eb26c154d8a 100644 --- a/rag/app/laws.py +++ b/rag/app/laws.py @@ -21,8 +21,7 @@ from common.constants import ParserType from deepdoc.parser.utils import get_text -from rag.nlp import bullets_category, remove_contents_table, \ - make_colon_as_title, tokenize_chunks, docx_question_level, tree_merge +from rag.nlp import bullets_category, remove_contents_table, make_colon_as_title, tokenize_chunks, docx_question_level, tree_merge from rag.nlp import rag_tokenizer, Node from deepdoc.parser import PdfParser, DocxParser, HtmlParser from rag.app.naive import by_plaintext, PARSERS @@ -38,8 +37,7 @@ def __clean(self, line): return line def old_call(self, filename, binary=None, from_page=0, to_page=100000): - self.doc = Document( - filename) if not binary else Document(BytesIO(binary)) + self.doc = Document(filename) if not binary else Document(BytesIO(binary)) pn = 0 lines = [] for p in self.doc.paragraphs: @@ -48,16 +46,15 @@ def old_call(self, filename, binary=None, from_page=0, to_page=100000): if from_page <= pn < to_page and p.text.strip(): lines.append(self.__clean(p.text)) for run in p.runs: - if 'lastRenderedPageBreak' in run._element.xml: + if "lastRenderedPageBreak" in run._element.xml: pn += 1 continue - if 'w:br' in run._element.xml and 'type="page"' in run._element.xml: + if "w:br" in run._element.xml and 'type="page"' in run._element.xml: pn += 1 return [line for line in lines if line] def __call__(self, filename, binary=None, from_page=0, to_page=100000): - self.doc = Document( - filename) if not binary else Document(BytesIO(binary)) + self.doc = Document(filename) if not binary else Document(BytesIO(binary)) pn = 0 lines = [] level_set = set() @@ -71,10 +68,10 @@ def __call__(self, filename, binary=None, from_page=0, to_page=100000): lines.append((question_level, p_text)) level_set.add(question_level) for run in p.runs: - if 'lastRenderedPageBreak' in run._element.xml: + if "lastRenderedPageBreak" in run._element.xml: pn += 1 continue - if 'w:br' in run._element.xml and 'type="page"' in run._element.xml: + if "w:br" in run._element.xml and 'type="page"' in run._element.xml: pn += 1 sorted_levels = sorted(level_set) @@ -88,12 +85,12 @@ def __call__(self, filename, binary=None, from_page=0, to_page=100000): return [element for element in root.get_tree() if element] def __str__(self) -> str: - return f''' + return f""" question:{self.question}, answer:{self.answer}, level:{self.level}, childs:{self.childs} - ''' + """ class Pdf(PdfParser): @@ -101,18 +98,12 @@ def __init__(self): self.model_speciess = ParserType.LAWS.value super().__init__() - def __call__(self, filename, binary=None, from_page=0, - to_page=100000, zoomin=3, callback=None): + def __call__(self, filename, binary=None, from_page=0, to_page=100000, zoomin=3, callback=None): from timeit import default_timer as timer + start = timer() callback(msg="OCR started") - self.__images__( - filename if not binary else binary, - zoomin, - from_page, - to_page, - callback - ) + self.__images__(filename if not binary else binary, zoomin, from_page, to_page, callback) callback(msg="OCR finished ({:.2f}s)".format(timer() - start)) start = timer() @@ -123,22 +114,15 @@ def __call__(self, filename, binary=None, from_page=0, callback(0.8, "Text extraction ({:.2f}s)".format(timer() - start)) - return [(b["text"], self._line_tag(b, zoomin)) - for b in self.boxes], None + return [(b["text"], self._line_tag(b, zoomin)) for b in self.boxes], None -def chunk(filename, binary=None, from_page=0, to_page=100000, - lang="Chinese", callback=None, **kwargs): +def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", callback=None, **kwargs): """ - Supported file formats are docx, pdf, txt. + Supported file formats are docx, pdf, txt. """ - parser_config = kwargs.get( - "parser_config", { - "chunk_token_num": 512, "delimiter": "\n!?。;!?", "layout_recognize": "DeepDOC"}) - doc = { - "docnm_kwd": filename, - "title_tks": rag_tokenizer.tokenize(re.sub(r"\.[a-zA-Z]+$", "", filename)) - } + parser_config = kwargs.get("parser_config", {"chunk_token_num": 512, "delimiter": "\n!?。;!?", "layout_recognize": "DeepDOC"}) + doc = {"docnm_kwd": filename, "title_tks": rag_tokenizer.tokenize(re.sub(r"\.[a-zA-Z]+$", "", filename))} doc["title_sm_tks"] = rag_tokenizer.fine_grained_tokenize(doc["title_tks"]) pdf_parser = None sections = [] @@ -152,9 +136,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, return tokenize_chunks(chunks, doc, eng, None) elif re.search(r"\.pdf$", filename, re.IGNORECASE): - layout_recognizer, parser_model_name = normalize_layout_recognizer( - parser_config.get("layout_recognize", "DeepDOC") - ) + layout_recognizer, parser_model_name = normalize_layout_recognizer(parser_config.get("layout_recognize", "DeepDOC")) if isinstance(layout_recognizer, bool): layout_recognizer = "DeepDOC" if layout_recognizer else "Plain Text" @@ -173,13 +155,14 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, pdf_cls=Pdf, layout_recognizer=layout_recognizer, mineru_llm_name=parser_model_name, - **kwargs + paddleocr_llm_name=parser_model_name, + **kwargs, ) if not raw_sections and not tables: return [] - if name in ["tcadp", "docling", "mineru"]: + if name in ["tcadp", "docling", "mineru", "paddleocr"]: parser_config["chunk_token_num"] = 0 for txt, poss in raw_sections: @@ -210,8 +193,8 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, binary = BytesIO(binary) doc_parsed = tika_parser.from_buffer(binary) - if doc_parsed.get('content', None) is not None: - sections = doc_parsed['content'].split('\n') + if doc_parsed.get("content", None) is not None: + sections = doc_parsed["content"].split("\n") sections = [s for s in sections if s] callback(0.8, "Finish parsing.") else: @@ -219,8 +202,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, logging.warning(f"tika.parser got empty content from {filename}.") return [] else: - raise NotImplementedError( - "file type not supported yet(doc, docx, pdf, txt supported)") + raise NotImplementedError("file type not supported yet(doc, docx, pdf, txt supported)") # Remove 'Contents' part remove_contents_table(sections, eng) @@ -241,9 +223,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, if __name__ == "__main__": import sys - def dummy(prog=None, msg=""): pass - chunk(sys.argv[1], callback=dummy) diff --git a/rag/app/manual.py b/rag/app/manual.py index 8a39bffecea..5f3b5879202 100644 --- a/rag/app/manual.py +++ b/rag/app/manual.py @@ -20,8 +20,7 @@ from common.constants import ParserType from io import BytesIO -from rag.nlp import rag_tokenizer, tokenize, tokenize_table, bullets_category, title_frequency, tokenize_chunks, \ - docx_question_level, attach_media_context +from rag.nlp import rag_tokenizer, tokenize, tokenize_table, bullets_category, title_frequency, tokenize_chunks, docx_question_level, attach_media_context from common.token_utils import num_tokens_from_string from deepdoc.parser import PdfParser, DocxParser from deepdoc.parser.figure_parser import vision_figure_parser_pdf_wrapper, vision_figure_parser_docx_wrapper @@ -36,18 +35,12 @@ def __init__(self): self.model_speciess = ParserType.MANUAL.value super().__init__() - def __call__(self, filename, binary=None, from_page=0, - to_page=100000, zoomin=3, callback=None): + def __call__(self, filename, binary=None, from_page=0, to_page=100000, zoomin=3, callback=None): from timeit import default_timer as timer + start = timer() callback(msg="OCR started") - self.__images__( - filename if not binary else binary, - zoomin, - from_page, - to_page, - callback - ) + self.__images__(filename if not binary else binary, zoomin, from_page, to_page, callback) callback(msg="OCR finished ({:.2f}s)".format(timer() - start)) logging.debug("OCR: {}".format(timer() - start)) @@ -71,8 +64,7 @@ def __call__(self, filename, binary=None, from_page=0, for b in self.boxes: b["text"] = re.sub(r"([\t  ]|\u3000){2,}", " ", b["text"].strip()) - return [(b["text"], b.get("layoutno", ""), self.get_position(b, zoomin)) - for i, b in enumerate(self.boxes)], tbls + return [(b["text"], b.get("layoutno", ""), self.get_position(b, zoomin)) for i, b in enumerate(self.boxes)], tbls class Docx(DocxParser): @@ -80,12 +72,12 @@ def __init__(self): pass def get_picture(self, document, paragraph): - img = paragraph._element.xpath('.//pic:pic') + img = paragraph._element.xpath(".//pic:pic") if not img: return None try: img = img[0] - embed = img.xpath('.//a:blip/@r:embed')[0] + embed = img.xpath(".//a:blip/@r:embed")[0] related_part = document.part.related_parts[embed] image = related_part.image if image is not None: @@ -111,7 +103,7 @@ def concat_img(self, img1, img2): new_width = max(width1, width2) new_height = height1 + height2 - new_image = Image.new('RGB', (new_width, new_height)) + new_image = Image.new("RGB", (new_width, new_height)) new_image.paste(img1, (0, 0)) new_image.paste(img2, (0, height1)) @@ -119,8 +111,7 @@ def concat_img(self, img1, img2): return new_image def __call__(self, filename, binary=None, from_page=0, to_page=100000, callback=None): - self.doc = Document( - filename) if not binary else Document(BytesIO(binary)) + self.doc = Document(filename) if not binary else Document(BytesIO(binary)) pn = 0 last_answer, last_image = "", None question_stack, level_stack = [], [] @@ -128,19 +119,19 @@ def __call__(self, filename, binary=None, from_page=0, to_page=100000, callback= for p in self.doc.paragraphs: if pn > to_page: break - question_level, p_text = 0, '' + question_level, p_text = 0, "" if from_page <= pn < to_page and p.text.strip(): question_level, p_text = docx_question_level(p) if not question_level or question_level > 6: # not a question - last_answer = f'{last_answer}\n{p_text}' + last_answer = f"{last_answer}\n{p_text}" current_image = self.get_picture(self.doc, p) last_image = self.concat_img(last_image, current_image) else: # is a question if last_answer or last_image: - sum_question = '\n'.join(question_stack) + sum_question = "\n".join(question_stack) if sum_question: - ti_list.append((f'{sum_question}\n{last_answer}', last_image)) - last_answer, last_image = '', None + ti_list.append((f"{sum_question}\n{last_answer}", last_image)) + last_answer, last_image = "", None i = question_level while question_stack and i <= level_stack[-1]: @@ -149,15 +140,15 @@ def __call__(self, filename, binary=None, from_page=0, to_page=100000, callback= question_stack.append(p_text) level_stack.append(question_level) for run in p.runs: - if 'lastRenderedPageBreak' in run._element.xml: + if "lastRenderedPageBreak" in run._element.xml: pn += 1 continue - if 'w:br' in run._element.xml and 'type="page"' in run._element.xml: + if "w:br" in run._element.xml and 'type="page"' in run._element.xml: pn += 1 if last_answer: - sum_question = '\n'.join(question_stack) + sum_question = "\n".join(question_stack) if sum_question: - ti_list.append((f'{sum_question}\n{last_answer}', last_image)) + ti_list.append((f"{sum_question}\n{last_answer}", last_image)) tbls = [] for tb in self.doc.tables: @@ -182,26 +173,19 @@ def __call__(self, filename, binary=None, from_page=0, to_page=100000, callback= return ti_list, tbls -def chunk(filename, binary=None, from_page=0, to_page=100000, - lang="Chinese", callback=None, **kwargs): +def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", callback=None, **kwargs): """ - Only pdf is supported. + Only pdf is supported. """ - parser_config = kwargs.get( - "parser_config", { - "chunk_token_num": 512, "delimiter": "\n!?。;!?", "layout_recognize": "DeepDOC"}) + parser_config = kwargs.get("parser_config", {"chunk_token_num": 512, "delimiter": "\n!?。;!?", "layout_recognize": "DeepDOC"}) pdf_parser = None - doc = { - "docnm_kwd": filename - } + doc = {"docnm_kwd": filename} doc["title_tks"] = rag_tokenizer.tokenize(re.sub(r"\.[a-zA-Z]+$", "", doc["docnm_kwd"])) doc["title_sm_tks"] = rag_tokenizer.fine_grained_tokenize(doc["title_tks"]) # is it English eng = lang.lower() == "english" # pdf_parser.is_english if re.search(r"\.pdf$", filename, re.IGNORECASE): - layout_recognizer, parser_model_name = normalize_layout_recognizer( - parser_config.get("layout_recognize", "DeepDOC") - ) + layout_recognizer, parser_model_name = normalize_layout_recognizer(parser_config.get("layout_recognize", "DeepDOC")) if isinstance(layout_recognizer, bool): layout_recognizer = "DeepDOC" if layout_recognizer else "Plain Text" @@ -222,8 +206,9 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, pdf_cls=Pdf, layout_recognizer=layout_recognizer, mineru_llm_name=parser_model_name, + paddleocr_llm_name=parser_model_name, parse_method="manual", - **kwargs + **kwargs, ) def _normalize_section(section): @@ -252,7 +237,7 @@ def _normalize_section(section): if not sections and not tbls: return [] - if name in ["tcadp", "docling", "mineru"]: + if name in ["tcadp", "docling", "mineru", "paddleocr"]: parser_config["chunk_token_num"] = 0 callback(0.8, "Finish parsing.") @@ -264,8 +249,7 @@ def _normalize_section(section): for txt, _, _ in sections: for t, lvl in pdf_parser.outlines: tks = set([t[i] + t[i + 1] for i in range(len(t) - 1)]) - tks_ = set([txt[i] + txt[i + 1] - for i in range(min(len(t), len(txt) - 1))]) + tks_ = set([txt[i] + txt[i + 1] for i in range(min(len(t), len(txt) - 1))]) if len(set(tks & tks_)) / max([len(tks), len(tks_), 1]) > 0.8: levels.append(lvl) break @@ -274,8 +258,7 @@ def _normalize_section(section): else: bull = bullets_category([txt for txt, _, _ in sections]) - most_level, levels = title_frequency( - bull, [(txt, lvl) for txt, lvl, _ in sections]) + most_level, levels = title_frequency(bull, [(txt, lvl) for txt, lvl, _ in sections]) assert len(sections) == len(levels) sec_ids = [] @@ -285,25 +268,21 @@ def _normalize_section(section): sid += 1 sec_ids.append(sid) - sections = [(txt, sec_ids[i], poss) - for i, (txt, _, poss) in enumerate(sections)] + sections = [(txt, sec_ids[i], poss) for i, (txt, _, poss) in enumerate(sections)] for (img, rows), poss in tbls: if not rows: continue - sections.append((rows if isinstance(rows, str) else rows[0], -1, - [(p[0] + 1 - from_page, p[1], p[2], p[3], p[4]) for p in poss])) + sections.append((rows if isinstance(rows, str) else rows[0], -1, [(p[0] + 1 - from_page, p[1], p[2], p[3], p[4]) for p in poss])) def tag(pn, left, right, top, bottom): if pn + left + right + top + bottom == 0: return "" - return "@@{}\t{:.1f}\t{:.1f}\t{:.1f}\t{:.1f}##" \ - .format(pn, left, right, top, bottom) + return "@@{}\t{:.1f}\t{:.1f}\t{:.1f}\t{:.1f}##".format(pn, left, right, top, bottom) chunks = [] last_sid = -2 tk_cnt = 0 - for txt, sec_id, poss in sorted(sections, key=lambda x: ( - x[-1][0][0], x[-1][0][3], x[-1][0][1])): + for txt, sec_id, poss in sorted(sections, key=lambda x: (x[-1][0][0], x[-1][0][3], x[-1][0][1])): poss = "\t".join([tag(*pos) for pos in poss]) if tk_cnt < 32 or (tk_cnt < 1024 and (sec_id == last_sid or sec_id == -1)): if chunks: @@ -330,14 +309,13 @@ def tag(pn, left, right, top, bottom): elif re.search(r"\.docx?$", filename, re.IGNORECASE): docx_parser = Docx() - ti_list, tbls = docx_parser(filename, binary, - from_page=0, to_page=10000, callback=callback) + ti_list, tbls = docx_parser(filename, binary, from_page=0, to_page=10000, callback=callback) tbls = vision_figure_parser_docx_wrapper(sections=ti_list, tbls=tbls, callback=callback, **kwargs) res = tokenize_table(tbls, doc, eng) for text, image in ti_list: d = copy.deepcopy(doc) if image: - d['image'] = image + d["image"] = image d["doc_type_kwd"] = "image" tokenize(d, text, eng) res.append(d) @@ -353,9 +331,7 @@ def tag(pn, left, right, top, bottom): if __name__ == "__main__": import sys - def dummy(prog=None, msg=""): pass - chunk(sys.argv[1], callback=dummy) diff --git a/rag/app/naive.py b/rag/app/naive.py index 05d673e4bc1..86ac85bc8ec 100644 --- a/rag/app/naive.py +++ b/rag/app/naive.py @@ -33,29 +33,32 @@ from common.constants import LLMType from api.db.services.llm_service import LLMBundle from rag.utils.file_utils import extract_embed_file, extract_links_from_pdf, extract_links_from_docx, extract_html -from deepdoc.parser import DocxParser, ExcelParser, HtmlParser, JsonParser, MarkdownElementExtractor, MarkdownParser, \ - PdfParser, TxtParser -from deepdoc.parser.figure_parser import VisionFigureParser, vision_figure_parser_docx_wrapper_naive, \ - vision_figure_parser_pdf_wrapper +from deepdoc.parser import DocxParser, ExcelParser, HtmlParser, JsonParser, MarkdownElementExtractor, MarkdownParser, PdfParser, TxtParser +from deepdoc.parser.figure_parser import VisionFigureParser, vision_figure_parser_docx_wrapper_naive, vision_figure_parser_pdf_wrapper from deepdoc.parser.pdf_parser import PlainParser, VisionParser from deepdoc.parser.docling_parser import DoclingParser from deepdoc.parser.tcadp_parser import TCADPParser from common.parser_config_utils import normalize_layout_recognizer -from rag.nlp import concat_img, find_codec, naive_merge, naive_merge_with_images, naive_merge_docx, rag_tokenizer, \ - tokenize_chunks, doc_tokenize_chunks_with_images, tokenize_table, append_context2table_image4pdf, tokenize_chunks_with_images, \ - attach_media_context # noqa: F401 - -def by_deepdoc(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", callback=None, pdf_cls=None, - **kwargs): +from rag.nlp import ( + concat_img, + find_codec, + naive_merge, + naive_merge_with_images, + naive_merge_docx, + rag_tokenizer, + tokenize_chunks, + doc_tokenize_chunks_with_images, + tokenize_table, + append_context2table_image4pdf, + tokenize_chunks_with_images, +) # noqa: F401 + + +def by_deepdoc(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", callback=None, pdf_cls=None, **kwargs): callback = callback binary = binary pdf_parser = pdf_cls() if pdf_cls else Pdf() - sections, tables = pdf_parser( - filename if not binary else binary, - from_page=from_page, - to_page=to_page, - callback=callback - ) + sections, tables = pdf_parser(filename if not binary else binary, from_page=from_page, to_page=to_page, callback=callback) tables = vision_figure_parser_pdf_wrapper( tbls=tables, @@ -67,17 +70,17 @@ def by_deepdoc(filename, binary=None, from_page=0, to_page=100000, lang="Chinese def by_mineru( - filename, - binary=None, - from_page=0, - to_page=100000, - lang="Chinese", - callback=None, - pdf_cls=None, - parse_method: str = "raw", - mineru_llm_name: str | None = None, - tenant_id: str | None = None, - **kwargs, + filename, + binary=None, + from_page=0, + to_page=100000, + lang="Chinese", + callback=None, + pdf_cls=None, + parse_method: str = "raw", + mineru_llm_name: str | None = None, + tenant_id: str | None = None, + **kwargs, ): pdf_parser = None if tenant_id: @@ -115,8 +118,7 @@ def by_mineru( return None, None, None -def by_docling(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", callback=None, pdf_cls=None, - **kwargs): +def by_docling(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", callback=None, pdf_cls=None, **kwargs): pdf_parser = DoclingParser() parse_method = kwargs.get("parse_method", "raw") @@ -130,7 +132,7 @@ def by_docling(filename, binary=None, from_page=0, to_page=100000, lang="Chinese callback=callback, output_dir=os.environ.get("MINERU_OUTPUT_DIR", ""), delete_output=bool(int(os.environ.get("MINERU_DELETE_OUTPUT", 1))), - parse_method=parse_method + parse_method=parse_method, ) return sections, tables, pdf_parser @@ -142,16 +144,60 @@ def by_tcadp(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", callback(-1, "TCADP parser not available. Please check Tencent Cloud API configuration.") return None, None, tcadp_parser - sections, tables = tcadp_parser.parse_pdf( - filepath=filename, - binary=binary, - callback=callback, - output_dir=os.environ.get("TCADP_OUTPUT_DIR", ""), - file_type="PDF" - ) + sections, tables = tcadp_parser.parse_pdf(filepath=filename, binary=binary, callback=callback, output_dir=os.environ.get("TCADP_OUTPUT_DIR", ""), file_type="PDF") return sections, tables, tcadp_parser +def by_paddleocr( + filename, + binary=None, + from_page=0, + to_page=100000, + lang="Chinese", + callback=None, + pdf_cls=None, + parse_method: str = "raw", + paddleocr_llm_name: str | None = None, + tenant_id: str | None = None, + **kwargs, +): + pdf_parser = None + if tenant_id: + if not paddleocr_llm_name: + try: + from api.db.services.tenant_llm_service import TenantLLMService + + env_name = TenantLLMService.ensure_paddleocr_from_env(tenant_id) + candidates = TenantLLMService.query(tenant_id=tenant_id, llm_factory="PaddleOCR", model_type=LLMType.OCR) + if candidates: + paddleocr_llm_name = candidates[0].llm_name + elif env_name: + paddleocr_llm_name = env_name + except Exception as e: # best-effort fallback + logging.warning(f"fallback to env paddleocr: {e}") + + if paddleocr_llm_name: + try: + ocr_model = LLMBundle(tenant_id=tenant_id, llm_type=LLMType.OCR, llm_name=paddleocr_llm_name, lang=lang) + pdf_parser = ocr_model.mdl + sections, tables = pdf_parser.parse_pdf( + filepath=filename, + binary=binary, + callback=callback, + parse_method=parse_method, + **kwargs, + ) + return sections, tables, pdf_parser + except Exception as e: + logging.error(f"Failed to parse pdf via LLMBundle PaddleOCR ({paddleocr_llm_name}): {e}") + + return None, None, None + + if callback: + callback(-1, "PaddleOCR not found.") + return None, None, None + + def by_plaintext(filename, binary=None, from_page=0, to_page=100000, callback=None, **kwargs): layout_recognizer = (kwargs.get("layout_recognizer") or "").strip() if (not layout_recognizer) or (layout_recognizer == "Plain Text"): @@ -168,12 +214,7 @@ def by_plaintext(filename, binary=None, from_page=0, to_page=100000, callback=No ) pdf_parser = VisionParser(vision_model=vision_model, **kwargs) - sections, tables = pdf_parser( - filename if not binary else binary, - from_page=from_page, - to_page=to_page, - callback=callback - ) + sections, tables = pdf_parser(filename if not binary else binary, from_page=from_page, to_page=to_page, callback=callback) return sections, tables, pdf_parser @@ -182,6 +223,7 @@ def by_plaintext(filename, binary=None, from_page=0, to_page=100000, callback=No "mineru": by_mineru, "docling": by_docling, "tcadp": by_tcadp, + "paddleocr": by_paddleocr, "plaintext": by_plaintext, # default } @@ -191,12 +233,12 @@ def __init__(self): pass def get_picture(self, document, paragraph): - imgs = paragraph._element.xpath('.//pic:pic') + imgs = paragraph._element.xpath(".//pic:pic") if not imgs: return None res_img = None for img in imgs: - embed = img.xpath('.//a:blip/@r:embed') + embed = img.xpath(".//a:blip/@r:embed") if not embed: continue embed = embed[0] @@ -219,7 +261,7 @@ def get_picture(self, document, paragraph): logging.warning(f"The recognized image stream appears to be corrupted. Skipping image, exception: {e}") continue try: - image = Image.open(BytesIO(image_blob)).convert('RGB') + image = Image.open(BytesIO(image_blob)).convert("RGB") if res_img is None: res_img = image else: @@ -251,11 +293,11 @@ def __get_nearest_title(self, table_index, filename): try: # Iterate through all paragraphs and tables in document order for i, block in enumerate(self.doc._element.body): - if block.tag.endswith('p'): # Paragraph + if block.tag.endswith("p"): # Paragraph p = Paragraph(block, self.doc) - blocks.append(('p', i, p)) - elif block.tag.endswith('tbl'): # Table - blocks.append(('t', i, None)) # Table object will be retrieved later + blocks.append(("p", i, p)) + elif block.tag.endswith("tbl"): # Table + blocks.append(("t", i, None)) # Table object will be retrieved later except Exception as e: logging.error(f"Error collecting blocks: {e}") return "" @@ -264,7 +306,7 @@ def __get_nearest_title(self, table_index, filename): target_table_pos = -1 table_count = 0 for i, (block_type, pos, _) in enumerate(blocks): - if block_type == 't': + if block_type == "t": if table_count == table_index: target_table_pos = pos break @@ -280,7 +322,7 @@ def __get_nearest_title(self, table_index, filename): if pos >= target_table_pos: # Skip blocks after the table continue - if block_type != 'p': + if block_type != "p": continue if block.style and block.style.name and re.search(r"Heading\s*(\d+)", block.style.name, re.I): @@ -309,7 +351,7 @@ def __get_nearest_title(self, table_index, filename): if pos >= target_table_pos: # Skip blocks after the table continue - if block_type != 'p': + if block_type != "p": continue if block.style and re.search(r"Heading\s*(\d+)", block.style.name, re.I): @@ -340,8 +382,7 @@ def __get_nearest_title(self, table_index, filename): return "" def __call__(self, filename, binary=None, from_page=0, to_page=100000): - self.doc = Document( - filename) if not binary else Document(BytesIO(binary)) + self.doc = Document(filename) if not binary else Document(BytesIO(binary)) pn = 0 lines = [] last_image = None @@ -357,7 +398,7 @@ def flush_last_image(): if pn > to_page: break - if block.tag.endswith('p'): + if block.tag.endswith("p"): p = Paragraph(block, self.doc) if from_page <= pn < to_page: @@ -417,7 +458,7 @@ def flush_last_image(): if "w:br" in xml and 'type="page"' in xml: pn += 1 - elif block.tag.endswith('tbl'): + elif block.tag.endswith("tbl"): if pn < from_page or pn > to_page: table_idx += 1 continue @@ -455,7 +496,6 @@ def flush_last_image(): return new_line - def to_markdown(self, filename=None, binary=None, inline_images: bool = True): """ This function uses mammoth, licensed under the BSD 2-Clause License. @@ -486,8 +526,7 @@ def _convert_image_to_base64(image): try: if inline_images: - result = mammoth.convert_to_html(docx_file, - convert_image=mammoth.images.img_element(_convert_image_to_base64)) + result = mammoth.convert_to_html(docx_file, convert_image=mammoth.images.img_element(_convert_image_to_base64)) else: result = mammoth.convert_to_html(docx_file) @@ -505,18 +544,11 @@ class Pdf(PdfParser): def __init__(self): super().__init__() - def __call__(self, filename, binary=None, from_page=0, - to_page=100000, zoomin=3, callback=None, separate_tables_figures=False): + def __call__(self, filename, binary=None, from_page=0, to_page=100000, zoomin=3, callback=None, separate_tables_figures=False): start = timer() first_start = start callback(msg="OCR started") - self.__images__( - filename if not binary else binary, - zoomin, - from_page, - to_page, - callback - ) + self.__images__(filename if not binary else binary, zoomin, from_page, to_page, callback) callback(msg="OCR finished ({:.2f}s)".format(timer() - start)) logging.info("OCR({}~{}): {:.2f}s".format(from_page, to_page, timer() - start)) @@ -559,13 +591,14 @@ def md_to_html(self, sections): return [] from bs4 import BeautifulSoup + html_content = markdown(text) - soup = BeautifulSoup(html_content, 'html.parser') + soup = BeautifulSoup(html_content, "html.parser") return soup def get_hyperlink_urls(self, soup): if soup: - return set([a.get('href') for a in soup.find_all('a') if a.get('href')]) + return set([a.get("href") for a in soup.find_all("a") if a.get("href")]) return [] def extract_image_urls_with_lines(self, text): @@ -588,10 +621,10 @@ def extract_image_urls_with_lines(self, text): try: from bs4 import BeautifulSoup - soup = BeautifulSoup(text, 'html.parser') + soup = BeautifulSoup(text, "html.parser") newline_offsets = [m.start() for m in re.finditer(r"\n", text)] + [len(text)] - for img_tag in soup.find_all('img'): - src = img_tag.get('src') + for img_tag in soup.find_all("img"): + src = img_tag.get("src") if not src: continue @@ -627,14 +660,14 @@ def load_images_from_urls(self, urls, cache=None): continue img_obj = None try: - if url.startswith(('http://', 'https://')): + if url.startswith(("http://", "https://")): response = requests.get(url, stream=True, timeout=30) - if response.status_code == 200 and response.headers.get('Content-Type', '').startswith('image/'): - img_obj = Image.open(BytesIO(response.content)).convert('RGB') + if response.status_code == 200 and response.headers.get("Content-Type", "").startswith("image/"): + img_obj = Image.open(BytesIO(response.content)).convert("RGB") else: local_path = Path(url) if local_path.exists(): - img_obj = Image.open(url).convert('RGB') + img_obj = Image.open(url).convert("RGB") else: logging.warning(f"Local image file not found: {url}") except Exception as e: @@ -652,7 +685,7 @@ def __call__(self, filename, binary=None, separate_tables=True, delimiter=None, with open(filename, "r") as f: txt = f.read() - remainder, tables = self.extract_tables_and_remainder(f'{txt}\n', separate_tables=separate_tables) + remainder, tables = self.extract_tables_and_remainder(f"{txt}\n", separate_tables=separate_tables) # To eliminate duplicate tables in chunking result, uncomment code below and set separate_tables to True in line 410. # extractor = MarkdownElementExtractor(remainder) extractor = MarkdownElementExtractor(txt) @@ -678,7 +711,7 @@ def __call__(self, filename, binary=None, separate_tables=True, delimiter=None, tbls = [] for table in tables: - tbls.append(((None, markdown(table, extensions=['markdown.extensions.tables'])), "")) + tbls.append(((None, markdown(table, extensions=["markdown.extensions.tables"])), "")) if return_section_images: return sections, tbls, section_images return sections, tbls @@ -694,7 +727,7 @@ def load_from_xml_v2(baseURI, rels_item_xml): if rels_item_xml is not None: rels_elm = parse_xml(rels_item_xml) for rel_elm in rels_elm.Relationship_lst: - if rel_elm.target_ref in ('../NULL', 'NULL'): + if rel_elm.target_ref in ("../NULL", "NULL"): continue srels._srels.append(_SerializedRelationship(baseURI, rel_elm)) return srels @@ -702,21 +735,18 @@ def load_from_xml_v2(baseURI, rels_item_xml): def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", callback=None, **kwargs): """ - Supported file formats are docx, pdf, excel, txt. - This method apply the naive ways to chunk files. - Successive text will be sliced into pieces using 'delimiter'. - Next, these successive pieces are merge into chunks whose token number is no more than 'Max token number'. + Supported file formats are docx, pdf, excel, txt. + This method apply the naive ways to chunk files. + Successive text will be sliced into pieces using 'delimiter'. + Next, these successive pieces are merge into chunks whose token number is no more than 'Max token number'. """ urls = set() url_res = [] is_english = lang.lower() == "english" # is_english(cks) - parser_config = kwargs.get( - "parser_config", { - "chunk_token_num": 512, "delimiter": "\n!?。;!?", "layout_recognize": "DeepDOC", "analyze_hyperlink": True}) + parser_config = kwargs.get("parser_config", {"chunk_token_num": 512, "delimiter": "\n!?。;!?", "layout_recognize": "DeepDOC", "analyze_hyperlink": True}) - child_deli = (parser_config.get("children_delimiter") or "").encode('utf-8').decode('unicode_escape').encode( - 'latin1').decode('utf-8') + child_deli = (parser_config.get("children_delimiter") or "").encode("utf-8").decode("unicode_escape").encode("latin1").decode("utf-8") cust_child_deli = re.findall(r"`([^`]+)`", child_deli) child_deli = "|".join(re.sub(r"`([^`]+)`", "", child_deli)) if cust_child_deli: @@ -728,10 +758,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca table_context_size = max(0, int(parser_config.get("table_context_size", 0) or 0)) image_context_size = max(0, int(parser_config.get("image_context_size", 0) or 0)) - doc = { - "docnm_kwd": filename, - "title_tks": rag_tokenizer.tokenize(re.sub(r"\.[a-zA-Z]+$", "", filename)) - } + doc = {"docnm_kwd": filename, "title_tks": rag_tokenizer.tokenize(re.sub(r"\.[a-zA-Z]+$", "", filename))} doc["title_sm_tks"] = rag_tokenizer.fine_grained_tokenize(doc["title_tks"]) res = [] pdf_parser = None @@ -750,8 +777,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca # Recursively chunk each embedded file and collect results for embed_filename, embed_bytes in embeds: try: - sub_res = chunk(embed_filename, binary=embed_bytes, lang=lang, callback=callback, is_root=False, - **kwargs) or [] + sub_res = chunk(embed_filename, binary=embed_bytes, lang=lang, callback=callback, is_root=False, **kwargs) or [] embed_res.extend(sub_res) except Exception as e: error_msg = f"Failed to chunk embed {embed_filename}: {e}" @@ -772,8 +798,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca sub_url_res = chunk(url, html_bytes, callback=callback, lang=lang, is_root=False, **kwargs) except Exception as e: logging.info(f"Failed to chunk url in registered file type {url}: {e}") - sub_url_res = chunk(f"{index}.html", html_bytes, callback=callback, lang=lang, is_root=False, - **kwargs) + sub_url_res = chunk(f"{index}.html", html_bytes, callback=callback, lang=lang, is_root=False, **kwargs) url_res.extend(sub_url_res) # fix "There is no item named 'word/NULL' in the archive", referring to https://github.com/python-openxml/python-docx/issues/1105#issuecomment-1298075246 @@ -784,11 +809,8 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca # chunks list[dict] # images list - index of image chunk in chunks - chunks, images = naive_merge_docx( - sections, int(parser_config.get( - "chunk_token_num", 128)), parser_config.get( - "delimiter", "\n!?。;!?"), table_context_size, image_context_size) - + chunks, images = naive_merge_docx(sections, int(parser_config.get("chunk_token_num", 128)), parser_config.get("delimiter", "\n!?。;!?"), table_context_size, image_context_size) + vision_figure_parser_docx_wrapper_naive(chunks=chunks, idx_lst=images, callback=callback, **kwargs) callback(0.8, "Finish parsing.") @@ -801,9 +823,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca return res elif re.search(r"\.pdf$", filename, re.IGNORECASE): - layout_recognizer, parser_model_name = normalize_layout_recognizer( - parser_config.get("layout_recognize", "DeepDOC") - ) + layout_recognizer, parser_model_name = normalize_layout_recognizer(parser_config.get("layout_recognize", "DeepDOC")) if parser_config.get("analyze_hyperlink", False) and is_root: urls = extract_links_from_pdf(binary) @@ -824,7 +844,8 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca callback=callback, layout_recognizer=layout_recognizer, mineru_llm_name=parser_model_name, - **kwargs + paddleocr_llm_name=parser_model_name, + **kwargs, ) if not sections and not tables: @@ -833,7 +854,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca if table_context_size or image_context_size: tables = append_context2table_image4pdf(sections, tables, image_context_size) - if name in ["tcadp", "docling", "mineru"]: + if name in ["tcadp", "docling", "mineru", "paddleocr"]: parser_config["chunk_token_num"] = 0 res = tokenize_table(tables, doc, is_english) @@ -847,10 +868,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca if layout_recognizer == "TCADP Parser": table_result_type = parser_config.get("table_result_type", "1") markdown_image_response_type = parser_config.get("markdown_image_response_type", "1") - tcadp_parser = TCADPParser( - table_result_type=table_result_type, - markdown_image_response_type=markdown_image_response_type - ) + tcadp_parser = TCADPParser(table_result_type=table_result_type, markdown_image_response_type=markdown_image_response_type) if not tcadp_parser.check_installation(): callback(-1, "TCADP parser not available. Please check Tencent Cloud API configuration.") return res @@ -858,13 +876,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca # Determine file type based on extension file_type = "XLSX" if re.search(r"\.xlsx?$", filename, re.IGNORECASE) else "CSV" - sections, tables = tcadp_parser.parse_pdf( - filepath=filename, - binary=binary, - callback=callback, - output_dir=os.environ.get("TCADP_OUTPUT_DIR", ""), - file_type=file_type - ) + sections, tables = tcadp_parser.parse_pdf(filepath=filename, binary=binary, callback=callback, output_dir=os.environ.get("TCADP_OUTPUT_DIR", ""), file_type=file_type) parser_config["chunk_token_num"] = 0 res = tokenize_table(tables, doc, is_english) callback(0.8, "Finish parsing.") @@ -879,9 +891,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca elif re.search(r"\.(txt|py|js|java|c|cpp|h|php|go|ts|sh|cs|kt|sql)$", filename, re.IGNORECASE): callback(0.1, "Start to parse.") - sections = TxtParser()(filename, binary, - parser_config.get("chunk_token_num", 128), - parser_config.get("delimiter", "\n!?;。;!?")) + sections = TxtParser()(filename, binary, parser_config.get("chunk_token_num", 128), parser_config.get("delimiter", "\n!?;。;!?")) callback(0.8, "Finish parsing.") elif re.search(r"\.(md|markdown|mdx)$", filename, re.IGNORECASE): @@ -919,11 +929,9 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca else: section_images = [None] * len(sections) section_images[idx] = combined_image - markdown_vision_parser = VisionFigureParser(vision_model=vision_model, figures_data=[ - ((combined_image, ["markdown image"]), [(0, 0, 0, 0, 0)])], **kwargs) + markdown_vision_parser = VisionFigureParser(vision_model=vision_model, figures_data=[((combined_image, ["markdown image"]), [(0, 0, 0, 0, 0)])], **kwargs) boosted_figures = markdown_vision_parser(callback=callback) - sections[idx] = (section_text + "\n\n" + "\n\n".join([fig[0][1] for fig in boosted_figures]), - sections[idx][1]) + sections[idx] = (section_text + "\n\n" + "\n\n".join([fig[0][1] for fig in boosted_figures]), sections[idx][1]) else: logging.warning("No visual model detected. Skipping figure parsing enhancement.") @@ -962,8 +970,8 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca binary = BytesIO(binary) doc_parsed = tika_parser.from_buffer(binary) - if doc_parsed.get('content', None) is not None: - sections = doc_parsed['content'].split('\n') + if doc_parsed.get("content", None) is not None: + sections = doc_parsed["content"].split("\n") sections = [(_, "") for _ in sections if _] callback(0.8, "Finish parsing.") else: @@ -972,8 +980,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca logging.warning(error_msg) return [] else: - raise NotImplementedError( - "file type not supported yet(pdf, xlsx, doc, docx, txt supported)") + raise NotImplementedError("file type not supported yet(pdf, xlsx, doc, docx, txt supported)") st = timer() if is_markdown: @@ -1021,8 +1028,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca has_images = merged_images and any(img is not None for img in merged_images) if has_images: - res.extend(tokenize_chunks_with_images(chunks, doc, is_english, merged_images, - child_delimiters_pattern=child_deli)) + res.extend(tokenize_chunks_with_images(chunks, doc, is_english, merged_images, child_delimiters_pattern=child_deli)) else: res.extend(tokenize_chunks(chunks, doc, is_english, pdf_parser, child_delimiters_pattern=child_deli)) else: @@ -1031,17 +1037,10 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca section_images = None if section_images: - chunks, images = naive_merge_with_images(sections, section_images, - int(parser_config.get( - "chunk_token_num", 128)), parser_config.get( - "delimiter", "\n!?。;!?")) - res.extend( - tokenize_chunks_with_images(chunks, doc, is_english, images, child_delimiters_pattern=child_deli)) + chunks, images = naive_merge_with_images(sections, section_images, int(parser_config.get("chunk_token_num", 128)), parser_config.get("delimiter", "\n!?。;!?")) + res.extend(tokenize_chunks_with_images(chunks, doc, is_english, images, child_delimiters_pattern=child_deli)) else: - chunks = naive_merge( - sections, int(parser_config.get( - "chunk_token_num", 128)), parser_config.get( - "delimiter", "\n!?。;!?")) + chunks = naive_merge(sections, int(parser_config.get("chunk_token_num", 128)), parser_config.get("delimiter", "\n!?。;!?")) res.extend(tokenize_chunks(chunks, doc, is_english, pdf_parser, child_delimiters_pattern=child_deli)) @@ -1071,9 +1070,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca if __name__ == "__main__": import sys - def dummy(prog=None, msg=""): pass - chunk(sys.argv[1], from_page=0, to_page=10, callback=dummy) diff --git a/rag/app/one.py b/rag/app/one.py index a53d00ea9c5..e445f881f1b 100644 --- a/rag/app/one.py +++ b/rag/app/one.py @@ -28,18 +28,12 @@ class Pdf(PdfParser): - def __call__(self, filename, binary=None, from_page=0, - to_page=100000, zoomin=3, callback=None): + def __call__(self, filename, binary=None, from_page=0, to_page=100000, zoomin=3, callback=None): from timeit import default_timer as timer + start = timer() callback(msg="OCR started") - self.__images__( - filename if not binary else binary, - zoomin, - from_page, - to_page, - callback - ) + self.__images__(filename if not binary else binary, zoomin, from_page, to_page, callback) callback(msg="OCR finished ({:.2f}s)".format(timer() - start)) start = timer() @@ -57,21 +51,16 @@ def __call__(self, filename, binary=None, from_page=0, tbls = self._extract_table_figure(True, zoomin, True, True) self._concat_downward() - sections = [(b["text"], self.get_position(b, zoomin)) - for i, b in enumerate(self.boxes)] - return [(txt, "") for txt, _ in sorted(sections, key=lambda x: ( - x[-1][0][0], x[-1][0][3], x[-1][0][1]))], tbls + sections = [(b["text"], self.get_position(b, zoomin)) for i, b in enumerate(self.boxes)] + return [(txt, "") for txt, _ in sorted(sections, key=lambda x: (x[-1][0][0], x[-1][0][3], x[-1][0][1]))], tbls -def chunk(filename, binary=None, from_page=0, to_page=100000, - lang="Chinese", callback=None, **kwargs): +def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", callback=None, **kwargs): """ - Supported file formats are docx, pdf, excel, txt. - One file forms a chunk which maintains original text order. + Supported file formats are docx, pdf, excel, txt. + One file forms a chunk which maintains original text order. """ - parser_config = kwargs.get( - "parser_config", { - "chunk_token_num": 512, "delimiter": "\n!?。;!?", "layout_recognize": "DeepDOC"}) + parser_config = kwargs.get("parser_config", {"chunk_token_num": 512, "delimiter": "\n!?。;!?", "layout_recognize": "DeepDOC"}) eng = lang.lower() == "english" # is_english(cks) if re.search(r"\.docx$", filename, re.IGNORECASE): @@ -99,9 +88,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, callback(0.8, "Finish parsing.") elif re.search(r"\.pdf$", filename, re.IGNORECASE): - layout_recognizer, parser_model_name = normalize_layout_recognizer( - parser_config.get("layout_recognize", "DeepDOC") - ) + layout_recognizer, parser_model_name = normalize_layout_recognizer(parser_config.get("layout_recognize", "DeepDOC")) if isinstance(layout_recognizer, bool): layout_recognizer = "DeepDOC" if layout_recognizer else "Plain Text" @@ -120,13 +107,14 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, pdf_cls=Pdf, layout_recognizer=layout_recognizer, mineru_llm_name=parser_model_name, - **kwargs + paddleocr_llm_name=parser_model_name, + **kwargs, ) if not sections and not tbls: return [] - if name in ["tcadp", "docling", "mineru"]: + if name in ["tcadp", "docling", "mineru", "paddleocr"]: parser_config["chunk_token_num"] = 0 callback(0.8, "Finish parsing.") @@ -134,8 +122,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, for (img, rows), poss in tbls: if not rows: continue - sections.append((rows if isinstance(rows, str) else rows[0], - [(p[0] + 1 - from_page, p[1], p[2], p[3], p[4]) for p in poss])) + sections.append((rows if isinstance(rows, str) else rows[0], [(p[0] + 1 - from_page, p[1], p[2], p[3], p[4]) for p in poss])) sections = [s for s, _ in sections if s] elif re.search(r"\.xlsx?$", filename, re.IGNORECASE): @@ -167,19 +154,15 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, binary = BytesIO(binary) doc_parsed = tika_parser.from_buffer(binary) - if doc_parsed.get('content', None) is not None: - sections = doc_parsed['content'].split('\n') + if doc_parsed.get("content", None) is not None: + sections = doc_parsed["content"].split("\n") sections = [s for s in sections if s] callback(0.8, "Finish parsing.") else: - raise NotImplementedError( - "file type not supported yet(doc, docx, pdf, txt supported)") + raise NotImplementedError("file type not supported yet(doc, docx, pdf, txt supported)") - doc = { - "docnm_kwd": filename, - "title_tks": rag_tokenizer.tokenize(re.sub(r"\.[a-zA-Z]+$", "", filename)) - } + doc = {"docnm_kwd": filename, "title_tks": rag_tokenizer.tokenize(re.sub(r"\.[a-zA-Z]+$", "", filename))} doc["title_sm_tks"] = rag_tokenizer.fine_grained_tokenize(doc["title_tks"]) tokenize(doc, "\n".join(sections), eng) return [doc] @@ -188,9 +171,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, if __name__ == "__main__": import sys - def dummy(prog=None, msg=""): pass - chunk(sys.argv[1], from_page=0, to_page=10, callback=dummy) diff --git a/rag/app/presentation.py b/rag/app/presentation.py index 26c08183e30..e4247e8cc82 100644 --- a/rag/app/presentation.py +++ b/rag/app/presentation.py @@ -36,22 +36,18 @@ def __call__(self, fnm, from_page, to_page, callback=None): callback(0.5, "Text extraction finished.") import aspose.slides as slides import aspose.pydrawing as drawing + imgs = [] with slides.Presentation(BytesIO(fnm)) as presentation: - for i, slide in enumerate(presentation.slides[from_page: to_page]): + for i, slide in enumerate(presentation.slides[from_page:to_page]): try: with BytesIO() as buffered: - slide.get_thumbnail( - 0.1, 0.1).save( - buffered, drawing.imaging.ImageFormat.jpeg) + slide.get_thumbnail(0.1, 0.1).save(buffered, drawing.imaging.ImageFormat.jpeg) buffered.seek(0) imgs.append(Image.open(buffered).copy()) except RuntimeError as e: - raise RuntimeError( - f'ppt parse error at page {i + 1}, original error: {str(e)}') from e - assert len(imgs) == len( - txts), "Slides text and image do not match: {} vs. {}".format( - len(imgs), len(txts)) + raise RuntimeError(f"ppt parse error at page {i + 1}, original error: {str(e)}") from e + assert len(imgs) == len(txts), "Slides text and image do not match: {} vs. {}".format(len(imgs), len(txts)) callback(0.9, "Image extraction finished") self.is_english = is_english(txts) return [(txts[i], imgs[i]) for i in range(len(txts))] @@ -61,12 +57,10 @@ class Pdf(PdfParser): def __init__(self): super().__init__() - def __call__(self, filename, binary=None, from_page=0, - to_page=100000, zoomin=3, callback=None, **kwargs): + def __call__(self, filename, binary=None, from_page=0, to_page=100000, zoomin=3, callback=None, **kwargs): # 1. OCR callback(msg="OCR started") - self.__images__(filename if not binary else binary, zoomin, from_page, - to_page, callback) + self.__images__(filename if not binary else binary, zoomin, from_page, to_page, callback) # 2. Layout Analysis callback(msg="Layout Analysis") @@ -91,12 +85,7 @@ def __call__(self, filename, binary=None, from_page=0, global_page_num = b["page_number"] + from_page if not (from_page < global_page_num <= to_page + from_page): continue - page_items[global_page_num].append({ - "top": b["top"], - "x0": b["x0"], - "text": b["text"], - "type": "text" - }) + page_items[global_page_num].append({"top": b["top"], "x0": b["x0"], "text": b["text"], "type": "text"}) # (B) Add table and figure for (img, content), positions in tbls: @@ -127,12 +116,7 @@ def __call__(self, filename, binary=None, from_page=0, top = positions[0][3] left = positions[0][1] - page_items[current_page_num].append({ - "top": top, - "x0": left, - "text": final_text, - "type": "table_or_figure" - }) + page_items[current_page_num].append({"top": top, "x0": left, "text": final_text, "type": "table_or_figure"}) # 7. Generate result res = [] @@ -153,18 +137,16 @@ def __call__(self, filename, binary=None, from_page=0, class PlainPdf(PlainParser): - def __call__(self, filename, binary=None, from_page=0, - to_page=100000, callback=None, **kwargs): + def __call__(self, filename, binary=None, from_page=0, to_page=100000, callback=None, **kwargs): self.pdf = pdf2_read(filename if not binary else BytesIO(binary)) page_txt = [] - for page in self.pdf.pages[from_page: to_page]: + for page in self.pdf.pages[from_page:to_page]: page_txt.append(page.extract_text()) callback(0.9, "Parsing finished") return [(txt, None) for txt in page_txt], [] -def chunk(filename, binary=None, from_page=0, to_page=100000, - lang="Chinese", callback=None, parser_config=None, **kwargs): +def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", callback=None, parser_config=None, **kwargs): """ The supported file formats are pdf, pptx. Every page will be treated as a chunk. And the thumbnail of every page will be stored. @@ -173,18 +155,12 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, if parser_config is None: parser_config = {} eng = lang.lower() == "english" - doc = { - "docnm_kwd": filename, - "title_tks": rag_tokenizer.tokenize( - re.sub(r"\.[a-zA-Z]+$", "", filename)) - } + doc = {"docnm_kwd": filename, "title_tks": rag_tokenizer.tokenize(re.sub(r"\.[a-zA-Z]+$", "", filename))} doc["title_sm_tks"] = rag_tokenizer.fine_grained_tokenize(doc["title_tks"]) res = [] if re.search(r"\.pptx?$", filename, re.IGNORECASE): ppt_parser = Ppt() - for pn, (txt, img) in enumerate(ppt_parser( - filename if not binary else binary, from_page, 1000000, - callback)): + for pn, (txt, img) in enumerate(ppt_parser(filename if not binary else binary, from_page, 1000000, callback)): d = copy.deepcopy(doc) pn += from_page d["image"] = img @@ -196,9 +172,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, res.append(d) return res elif re.search(r"\.pdf$", filename, re.IGNORECASE): - layout_recognizer, parser_model_name = normalize_layout_recognizer( - parser_config.get("layout_recognize", "DeepDOC") - ) + layout_recognizer, parser_model_name = normalize_layout_recognizer(parser_config.get("layout_recognize", "DeepDOC")) if isinstance(layout_recognizer, bool): layout_recognizer = "DeepDOC" if layout_recognizer else "Plain Text" @@ -217,13 +191,14 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, pdf_cls=Pdf, layout_recognizer=layout_recognizer, mineru_llm_name=parser_model_name, - **kwargs + paddleocr_llm_name=parser_model_name, + **kwargs, ) if not sections: return [] - if name in ["tcadp", "docling", "mineru"]: + if name in ["tcadp", "docling", "mineru", "paddleocr"]: parser_config["chunk_token_num"] = 0 callback(0.8, "Finish parsing.") @@ -236,22 +211,18 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, d["image"] = img d["page_num_int"] = [pn + 1] d["top_int"] = [0] - d["position_int"] = [(pn + 1, 0, img.size[0] if img else 0, 0, - img.size[1] if img else 0)] + d["position_int"] = [(pn + 1, 0, img.size[0] if img else 0, 0, img.size[1] if img else 0)] tokenize(d, txt, eng) res.append(d) return res - raise NotImplementedError( - "file type not supported yet(pptx, pdf supported)") + raise NotImplementedError("file type not supported yet(pptx, pdf supported)") if __name__ == "__main__": import sys - def dummy(a, b): pass - chunk(sys.argv[1], callback=dummy) diff --git a/rag/flow/parser/parser.py b/rag/flow/parser/parser.py index 1c715442432..2cc941b7270 100644 --- a/rag/flow/parser/parser.py +++ b/rag/flow/parser/parser.py @@ -166,7 +166,7 @@ def check(self): pdf_parse_method = pdf_config.get("parse_method", "") self.check_empty(pdf_parse_method, "Parse method abnormal.") - if pdf_parse_method.lower() not in ["deepdoc", "plain_text", "mineru", "tcadp parser"]: + if pdf_parse_method.lower() not in ["deepdoc", "plain_text", "mineru", "tcadp parser", "paddleocr"]: self.check_empty(pdf_config.get("lang", ""), "PDF VLM language") pdf_output_format = pdf_config.get("output_format", "") @@ -232,6 +232,9 @@ def _pdf(self, name, blob): if lowered.endswith("@mineru"): parser_model_name = raw_parse_method.rsplit("@", 1)[0] parse_method = "MinerU" + elif lowered.endswith("@paddleocr"): + parser_model_name = raw_parse_method.rsplit("@", 1)[0] + parse_method = "PaddleOCR" if parse_method.lower() == "deepdoc": bboxes = RAGFlowPdfParser().parse_into_bboxes(blob, callback=self.callback) @@ -239,6 +242,7 @@ def _pdf(self, name, blob): lines, _ = PlainParser()(blob) bboxes = [{"text": t} for t, _ in lines] elif parse_method.lower() == "mineru": + def resolve_mineru_llm_name(): configured = parser_model_name or conf.get("mineru_llm_name") if configured: @@ -320,6 +324,84 @@ def resolve_mineru_llm_name(): bboxes.append({"text": section}) else: bboxes.append({"text": section}) + elif parse_method.lower() == "paddleocr": + + def resolve_paddleocr_llm_name(): + configured = parser_model_name or conf.get("paddleocr_llm_name") + if configured: + return configured + + tenant_id = self._canvas._tenant_id + if not tenant_id: + return None + + from api.db.services.tenant_llm_service import TenantLLMService + + env_name = TenantLLMService.ensure_paddleocr_from_env(tenant_id) + candidates = TenantLLMService.query(tenant_id=tenant_id, llm_factory="PaddleOCR", model_type=LLMType.OCR.value) + if candidates: + return candidates[0].llm_name + return env_name + + parser_model_name = resolve_paddleocr_llm_name() + if not parser_model_name: + raise RuntimeError("PaddleOCR model not configured. Please add PaddleOCR in Model Providers or set PADDLEOCR_* env.") + + tenant_id = self._canvas._tenant_id + ocr_model = LLMBundle(tenant_id, LLMType.OCR, llm_name=parser_model_name) + pdf_parser = ocr_model.mdl + + lines, _ = pdf_parser.parse_pdf( + filepath=name, + binary=blob, + callback=self.callback, + parse_method=conf.get("paddleocr_parse_method", "raw"), + ) + bboxes = [] + for section in lines: + # PaddleOCRParser returns sections as tuple, different formats based on parse_method: + # - "raw": (text, position_tag) + # - "manual": (text, label, position_tag) + # - "paper": (text_with_tag, label) + text = section[0] + + # Parse position tag if exists + position_tag = "" + if len(section) > 1: + if len(section) == 2: # raw format: (text, tag) + position_tag = section[1] + elif len(section) == 3: # manual format: (text, label, tag) + position_tag = section[2] + elif "paper" in conf.get("paddleocr_parse_method", "") and len(section) == 2: + # paper format: text may contain tag + text_with_tag = text + import re + + tag_match = re.search(r"(@@[0-9-]+\t[0-9.\t]+##)", text_with_tag) + if tag_match: + position_tag = tag_match.group(1) + text = text_with_tag.replace(position_tag, "").strip() + + # Extract coordinate information from position tag + page_number, x0, x1, top, bottom = 1, 0, 0, 0, 0 + if position_tag: + import re + + tag_match = re.match(r"@@([0-9-]+)\t([0-9.]+)\t([0-9.]+)\t([0-9.]+)\t([0-9.]+)##", position_tag) + if tag_match: + pn, x0_str, x1_str, top_str, bottom_str = tag_match.groups() + page_number = int(pn.split("-")[0]) # Take first page number + x0, x1, top, bottom = float(x0_str), float(x1_str), float(top_str), float(bottom_str) + + box = { + "text": text, + "page_number": page_number, + "x0": x0, + "x1": x1, + "top": top, + "bottom": bottom, + } + bboxes.append(box) else: vision_model = LLMBundle(self._canvas._tenant_id, LLMType.IMAGE2TEXT, llm_name=conf.get("parse_method"), lang=self._param.setups["pdf"].get("lang")) lines, _ = VisionParser(vision_model=vision_model)(blob, callback=self.callback) @@ -802,7 +884,7 @@ async def _invoke(self, **kwargs): outs = self.output() tasks = [] for d in outs.get("json", []): - tasks.append(asyncio.create_task(image2id(d,partial(settings.STORAGE_IMPL.put, tenant_id=self._canvas._tenant_id),get_uuid()))) + tasks.append(asyncio.create_task(image2id(d, partial(settings.STORAGE_IMPL.put, tenant_id=self._canvas._tenant_id), get_uuid()))) try: await asyncio.gather(*tasks, return_exceptions=False) diff --git a/rag/llm/ocr_model.py b/rag/llm/ocr_model.py index 9b69eb5a58b..80093546714 100644 --- a/rag/llm/ocr_model.py +++ b/rag/llm/ocr_model.py @@ -19,6 +19,7 @@ from typing import Any, Optional from deepdoc.parser.mineru_parser import MinerUParser +from deepdoc.parser.paddleocr_parser import PaddleOCRParser class Base: @@ -60,16 +61,11 @@ def _resolve_config(key: str, env_key: str, default=""): # Redact sensitive config keys before logging redacted_config = {} for k, v in config.items(): - if any( - sensitive_word in k.lower() - for sensitive_word in ("key", "password", "token", "secret") - ): + if any(sensitive_word in k.lower() for sensitive_word in ("key", "password", "token", "secret")): redacted_config[k] = "[REDACTED]" else: redacted_config[k] = v - logging.info( - f"Parsed MinerU config (sensitive fields redacted): {redacted_config}" - ) + logging.info(f"Parsed MinerU config (sensitive fields redacted): {redacted_config}") MinerUParser.__init__(self, mineru_api=self.mineru_api, mineru_server_url=self.mineru_server_url) @@ -93,6 +89,60 @@ def parse_pdf(self, filepath: str, binary=None, callback=None, parse_method: str server_url=self.mineru_server_url, delete_output=self.mineru_delete_output, parse_method=parse_method, - **kwargs + **kwargs, + ) + return sections, tables + + +class PaddleOCROcrModel(Base, PaddleOCRParser): + _FACTORY_NAME = "PaddleOCR" + + def __init__(self, key: str | dict, model_name: str, **kwargs): + Base.__init__(self, key, model_name, **kwargs) + raw_config = {} + if key: + try: + raw_config = json.loads(key) + except Exception: + raw_config = {} + + # nested {"api_key": {...}} from UI + # flat {"PADDLEOCR_*": "..."} payload auto-provisioned from env vars + config = raw_config.get("api_key", raw_config) + if not isinstance(config, dict): + config = {} + + def _resolve_config(key: str, env_key: str, default=""): + # lower-case keys (UI), upper-case PADDLEOCR_* (env auto-provision), env vars + return config.get(key, config.get(env_key, os.environ.get(env_key, default))) + + self.paddleocr_api_url = _resolve_config("paddleocr_api_url", "PADDLEOCR_API_URL", "") + self.paddleocr_algorithm = _resolve_config("paddleocr_algorithm", "PADDLEOCR_ALGORITHM", "PaddleOCR-VL") + self.paddleocr_access_token = _resolve_config("paddleocr_access_token", "PADDLEOCR_ACCESS_TOKEN", None) + + # Redact sensitive config keys before logging + redacted_config = {} + for k, v in config.items(): + if any(sensitive_word in k.lower() for sensitive_word in ("key", "password", "token", "secret")): + redacted_config[k] = "[REDACTED]" + else: + redacted_config[k] = v + logging.info(f"Parsed PaddleOCR config (sensitive fields redacted): {redacted_config}") + + PaddleOCRParser.__init__( + self, + api_url=self.paddleocr_api_url, + access_token=self.paddleocr_access_token, + algorithm=self.paddleocr_algorithm, ) + + def check_available(self) -> tuple[bool, str]: + return self.check_installation() + + def parse_pdf(self, filepath: str, binary=None, callback=None, parse_method: str = "raw", **kwargs): + ok, reason = self.check_available() + if not ok: + raise RuntimeError(f"PaddleOCR server not accessible: {reason}") + + sections, tables = PaddleOCRParser.parse_pdf(self, filepath=filepath, binary=binary, callback=callback, parse_method=parse_method, **kwargs) return sections, tables diff --git a/web/src/assets/svg/llm/paddleocr.svg b/web/src/assets/svg/llm/paddleocr.svg new file mode 100644 index 00000000000..e2e3f13e77e --- /dev/null +++ b/web/src/assets/svg/llm/paddleocr.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/web/src/components/layout-recognize-form-field.tsx b/web/src/components/layout-recognize-form-field.tsx index 965eee83356..e122055e4c9 100644 --- a/web/src/components/layout-recognize-form-field.tsx +++ b/web/src/components/layout-recognize-form-field.tsx @@ -6,6 +6,7 @@ import { camelCase } from 'lodash'; import { ReactNode, useMemo } from 'react'; import { useFormContext } from 'react-hook-form'; import { MinerUOptionsFormField } from './mineru-options-form-field'; +import { PaddleOCROptionsFormField } from './paddleocr-options-form-field'; import { SelectWithSearch } from './originui/select-with-search'; import { FormControl, @@ -28,12 +29,14 @@ export function LayoutRecognizeFormField({ optionsWithoutLLM, label, showMineruOptions = true, + showPaddleocrOptions = true, }: { name?: string; horizontal?: boolean; optionsWithoutLLM?: { value: string; label: string }[]; label?: ReactNode; showMineruOptions?: boolean; + showPaddleocrOptions?: boolean; }) { const form = useFormContext(); @@ -113,6 +116,7 @@ export function LayoutRecognizeFormField({
{showMineruOptions && } + {showPaddleocrOptions && } ); }} diff --git a/web/src/components/paddleocr-options-form-field.tsx b/web/src/components/paddleocr-options-form-field.tsx new file mode 100644 index 00000000000..0d70519ebd7 --- /dev/null +++ b/web/src/components/paddleocr-options-form-field.tsx @@ -0,0 +1,95 @@ +import { RAGFlowFormItem } from '@/components/ragflow-form'; +import { Input } from '@/components/ui/input'; +import { RAGFlowSelect } from '@/components/ui/select'; +import { LLMFactory } from '@/constants/llm'; +import { buildOptions } from '@/utils/form'; +import { useFormContext, useWatch } from 'react-hook-form'; +import { useTranslation } from 'react-i18next'; + +const algorithmOptions = buildOptions(['PaddleOCR-VL']); + +export function PaddleOCROptionsFormField({ + namePrefix = 'parser_config', +}: { + namePrefix?: string; +}) { + const form = useFormContext(); + const { t } = useTranslation(); + const buildName = (field: string) => + namePrefix ? `${namePrefix}.${field}` : field; + + const layoutRecognize = useWatch({ + control: form.control, + name: 'parser_config.layout_recognize', + }); + + // Check if PaddleOCR is selected (the value contains 'PaddleOCR' or matches the factory name) + const isPaddleOCRSelected = + layoutRecognize?.includes(LLMFactory.PaddleOCR) || + layoutRecognize?.toLowerCase()?.includes('paddleocr'); + + if (!isPaddleOCRSelected) { + return null; + } + + return ( +
+
+ {t('knowledgeConfiguration.paddleocrOptions', 'PaddleOCR Options')} +
+ + + {(field) => ( + + )} + + + + {(field) => ( + + )} + + + + {(field) => ( + + )} + +
+ ); +} diff --git a/web/src/components/svg-icon.tsx b/web/src/components/svg-icon.tsx index b93d4a01bc6..8931a292fb6 100644 --- a/web/src/components/svg-icon.tsx +++ b/web/src/components/svg-icon.tsx @@ -105,6 +105,7 @@ export const LlmIcon = ({ LLMFactory.Gemini, LLMFactory.StepFun, LLMFactory.MinerU, + LLMFactory.PaddleOCR, // LLMFactory.DeerAPI, ]; if (svgIcons.includes(name as LLMFactory)) { diff --git a/web/src/constants/llm.ts b/web/src/constants/llm.ts index d603dbf4f94..5551ad3cee2 100644 --- a/web/src/constants/llm.ts +++ b/web/src/constants/llm.ts @@ -61,6 +61,7 @@ export enum LLMFactory { JiekouAI = 'Jiekou.AI', Builtin = 'Builtin', MinerU = 'MinerU', + PaddleOCR = 'PaddleOCR', } // Please lowercase the file name @@ -127,6 +128,7 @@ export const IconMap = { [LLMFactory.JiekouAI]: 'jiekouai', [LLMFactory.Builtin]: 'builtin', [LLMFactory.MinerU]: 'mineru', + [LLMFactory.PaddleOCR]: 'paddleocr', }; export const APIMapUrl = { @@ -178,4 +180,5 @@ export const APIMapUrl = { [LLMFactory.DeerAPI]: 'https://api.deerapi.com/token', [LLMFactory.TokenPony]: 'https://www.tokenpony.cn/#/user/keys', [LLMFactory.DeepInfra]: 'https://deepinfra.com/dash/api_keys', + [LLMFactory.PaddleOCR]: 'https://www.paddleocr.ai/latest/', }; diff --git a/web/src/locales/de.ts b/web/src/locales/de.ts index a3860f5abd0..a0bae495ba9 100644 --- a/web/src/locales/de.ts +++ b/web/src/locales/de.ts @@ -385,6 +385,17 @@ Prozedurales Gedächtnis: Erlernte Fähigkeiten, Gewohnheiten und automatisierte 'Formelerkennung aktivieren. Hinweis: Dies funktioniert möglicherweise nicht korrekt bei kyrillischen Dokumenten.', mineruTableEnable: 'Tabellenerkennung', mineruTableEnableTip: 'Tabellenerkennung und -extraktion aktivieren.', + paddleocrOptions: 'PaddleOCR-Optionen', + paddleocrApiUrl: 'PaddleOCR API-URL', + paddleocrApiUrlTip: 'API-Endpunkt-URL des PaddleOCR-Dienstes', + paddleocrApiUrlPlaceholder: 'Zum Beispiel: https://paddleocr-server.com/layout-parsing', + paddleocrAccessToken: 'AI Studio-Zugriffstoken', + paddleocrAccessTokenTip: 'Zugriffstoken für die PaddleOCR-API (optional)', + paddleocrAccessTokenPlaceholder: 'Ihr AI Studio-Token (optional)', + paddleocrAlgorithm: 'PaddleOCR-Algorithmus', + paddleocrAlgorithmTip: 'Algorithmus, der für die PaddleOCR-Verarbeitung verwendet wird', + paddleocrSelectAlgorithm: 'Algorithmus auswählen', + paddleocrModelNamePlaceholder: 'Zum Beispiel: paddleocr-umgebung-1', overlappedPercent: 'Überlappungsprozent(%)', generationScopeTip: 'Bestimmt, ob RAPTOR für den gesamten Datensatz oder für eine einzelne Datei generiert wird.', @@ -475,7 +486,7 @@ Prozedurales Gedächtnis: Erlernte Fähigkeiten, Gewohnheiten und automatisierte book: `

Unterstützte Dateiformate sind DOCX, PDF, TXT.

Für jedes Buch im PDF-Format stellen Sie bitte die Seitenbereiche ein, um unerwünschte Informationen zu entfernen und die Analysezeit zu reduzieren.

`, laws: `

Unterstützte Dateiformate sind DOCX, PDF, TXT.

- Rechtliche Dokumente folgen in der Regel einem strengen Schreibformat. Wir verwenden Textmerkmale, um Teilungspunkte zu identifizieren. + Rechtliche Dokumente folgen in der Regel einem strengen Schreibformat. Wir verwenden Textmerkmale, um Teilungspunkte zu identifizieren.

Der Chunk hat eine Granularität, die mit 'ARTIKEL' übereinstimmt, wobei sichergestellt wird, dass der gesamte übergeordnete Text im Chunk enthalten ist.

`, @@ -489,7 +500,7 @@ Prozedurales Gedächtnis: Erlernte Fähigkeiten, Gewohnheiten und automatisierte
  • Dann werden benachbarte Segmente kombiniert, bis die Token-Anzahl den durch 'Chunk-Token-Anzahl' festgelegten Schwellenwert überschreitet, woraufhin ein Chunk erstellt wird.
  • `, paper: `

    Nur PDF-Dateien werden unterstützt.

    Papers werden nach Abschnitten wie abstract, 1.1, 1.2 aufgeteilt.

    - Dieser Ansatz ermöglicht es dem LLM, das Paper effektiver zusammenzufassen und umfassendere, verständlichere Antworten zu liefern. + Dieser Ansatz ermöglicht es dem LLM, das Paper effektiver zusammenzufassen und umfassendere, verständlichere Antworten zu liefern. Es erhöht jedoch auch den Kontext für KI-Gespräche und die Rechenkosten für das LLM. Daher sollten Sie während eines Gesprächs erwägen, den Wert von 'topN' zu reduzieren.

    `, presentation: `

    Unterstützte Dateiformate sind PDF, PPTX.

    Jede Seite in den Folien wird als Chunk behandelt, wobei ihr Vorschaubild gespeichert wird.

    @@ -1108,6 +1119,17 @@ Beispiel: Virtual Hosted Style`, modelTypeMessage: 'Bitte geben Sie Ihren Modelltyp ein!', addLlmBaseUrl: 'Basis-URL', baseUrlNameMessage: 'Bitte geben Sie Ihre Basis-URL ein!', + paddleocr: { + apiUrl: 'PaddleOCR API-URL', + apiUrlPlaceholder: 'Zum Beispiel: https://paddleocr-server.com/layout-parsing', + accessToken: 'AI Studio-Zugriffstoken', + accessTokenPlaceholder: 'Ihr AI Studio-Token (optional)', + algorithm: 'PaddleOCR-Algorithmus', + selectAlgorithm: 'Algorithmus auswählen', + modelNamePlaceholder: 'Zum Beispiel: paddleocr-from-env-1', + modelNameRequired: 'Der Modellname ist ein Pflichtfeld', + apiUrlRequired: 'Die PaddleOCR API-URL ist ein Pflichtfeld' + }, vision: 'Unterstützt es Vision?', ollamaLink: 'Wie integriere ich {{name}}', FishAudioLink: 'Wie verwende ich FishAudio', diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index a15edf75da1..89416aea7f1 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -148,7 +148,7 @@ Procedural Memory: Learned skills, habits, and automated procedures.`, action: 'Action', }, config: { - memorySizeTooltip: `Accounts for each message's content + its embedding vector (≈ Content + Dimensions × 8 Bytes). + memorySizeTooltip: `Accounts for each message's content + its embedding vector (≈ Content + Dimensions × 8 Bytes). Example: A 1 KB message with 1024-dim embedding uses ~9 KB. The 5 MB default limit holds ~500 such messages.`, avatar: 'Avatar', description: 'Description', @@ -424,6 +424,17 @@ Example: A 1 KB message with 1024-dim embedding uses ~9 KB. The 5 MB default lim 'Enable formula recognition. Note: This may not work correctly for Cyrillic documents.', mineruTableEnable: 'Table recognition', mineruTableEnableTip: 'Enable table recognition and extraction.', + paddleocrOptions: 'PaddleOCR Options', + paddleocrApiUrl: 'PaddleOCR API URL', + paddleocrApiUrlTip: 'The API endpoint URL for PaddleOCR service', + paddleocrApiUrlPlaceholder: 'e.g. https://paddleocr-server.com/layout-parsing', + paddleocrAccessToken: 'AI Studio Access Token', + paddleocrAccessTokenTip: 'Access token for PaddleOCR API (optional)', + paddleocrAccessTokenPlaceholder: 'Your AI Studio token (optional)', + paddleocrAlgorithm: 'PaddleOCR Algorithm', + paddleocrAlgorithmTip: 'Algorithm to use for PaddleOCR parsing', + paddleocrSelectAlgorithm: 'Select Algorithm', + paddleocrModelNamePlaceholder: 'e.g. paddleocr-from-env-1', overlappedPercent: 'Overlapped percent(%)', generationScopeTip: 'Determines whether RAPTOR is generated for the entire dataset or for a single file.', @@ -1094,6 +1105,17 @@ Example: Virtual Hosted Style`, modelTypeMessage: 'Please input your model type!', addLlmBaseUrl: 'Base url', baseUrlNameMessage: 'Please input your base url!', + paddleocr: { + apiUrl: 'PaddleOCR API URL', + apiUrlPlaceholder: 'For example: https://paddleocr-server.com/layout-parsing', + accessToken: 'AI Studio Access Token', + accessTokenPlaceholder: 'Your AI Studio token (optional)', + algorithm: 'PaddleOCR Algorithm', + selectAlgorithm: 'Select Algorithm', + modelNamePlaceholder: 'For example: paddleocr-from-env-1', + modelNameRequired: 'Model name is required', + apiUrlRequired: 'PaddleOCR API URL is required' + }, vision: 'Does it support Vision?', ollamaLink: 'How to integrate {{name}}', FishAudioLink: 'How to use FishAudio', diff --git a/web/src/locales/es.ts b/web/src/locales/es.ts index a666adb595d..a94caea81ac 100644 --- a/web/src/locales/es.ts +++ b/web/src/locales/es.ts @@ -159,6 +159,20 @@ export default { html4excelTip: `Usar junto con el método de fragmentación General. Cuando está desactivado, los archivos de hoja de cálculo (XLSX, XLS (Excel 97-2003)) se analizan línea por línea como pares clave-valor. Cuando está activado, los archivos de hoja de cálculo se convierten en tablas HTML. Si la tabla original tiene más de 12 filas, el sistema la dividirá automáticamente en varias tablas HTML cada 12 filas. Para más información, consulte https://ragflow.io/docs/dev/enable_excel2html.`, }, + knowledgeConfiguration: { + paddleocrOptions: 'Opciones de PaddleOCR', + paddleocrApiUrl: 'URL de API de PaddleOCR', + paddleocrApiUrlTip: 'La URL del endpoint de la API para el servicio PaddleOCR', + paddleocrApiUrlPlaceholder: 'ej: https://servidor-paddleocr.com/api', + paddleocrAccessToken: 'Token de acceso de AI Studio', + paddleocrAccessTokenTip: 'Token de acceso para la API de PaddleOCR (opcional)', + paddleocrAccessTokenPlaceholder: 'Su token de AI Studio (opcional)', + paddleocrAlgorithm: 'Algoritmo de PaddleOCR', + paddleocrAlgorithmTip: 'Algoritmo a utilizar para el análisis de PaddleOCR', + paddleocrSelectAlgorithm: 'Seleccionar algoritmo', + paddleocrModelNamePlaceholder: 'ej: paddleocr-desde-env-1', + }, + // Otros bloques de traducción // Continua con la misma estructura chat: { @@ -379,6 +393,17 @@ export default { modelTypeMessage: '¡Por favor ingresa el tipo de tu modelo!', addLlmBaseUrl: 'URL base', baseUrlNameMessage: '¡Por favor ingresa tu URL base!', + paddleocr: { + apiUrl: 'URL de la API de PaddleOCR', + apiUrlPlaceholder: 'Por ejemplo: https://paddleocr-server.com/layout-parsing', + accessToken: 'Token de acceso de AI Studio', + accessTokenPlaceholder: 'Su token de AI Studio (opcional)', + algorithm: 'Algoritmo de PaddleOCR', + selectAlgorithm: 'Seleccionar algoritmo', + modelNamePlaceholder: 'Por ejemplo: paddleocr-from-env-1', + modelNameRequired: 'El nombre del modelo es obligatorio', + apiUrlRequired: 'La URL de la API de PaddleOCR es obligatoria' + }, vision: '¿Soporta visión?', ollamaLink: 'Cómo integrar {{name}}', FishAudioLink: 'Cómo usar FishAudio', diff --git a/web/src/locales/fr.ts b/web/src/locales/fr.ts index a664bc349d0..d89a69e4acb 100644 --- a/web/src/locales/fr.ts +++ b/web/src/locales/fr.ts @@ -293,6 +293,17 @@ export default { communityTip: `Un "community" est un groupe d’entités liées. Le LLM peut générer un résumé pour chaque groupe. Voir plus ici : https: //www.microsoft.com/en-us/research/blog/graphrag-improving-global-search-via-dynamic-community-selection/`, theDocumentBeingParsedCannotBeDeleted: 'Le document en cours d’analyse ne peut pas être supprimé', + paddleocrOptions: 'Options PaddleOCR', + paddleocrApiUrl: 'URL de l’API PaddleOCR', + paddleocrApiUrlTip: 'URL du point de terminaison de l’API du service PaddleOCR', + paddleocrApiUrlPlaceholder: 'Par exemple : https://paddleocr-server.com/layout-parsing', + paddleocrAccessToken: 'Jeton d’accès AI Studio', + paddleocrAccessTokenTip: 'Jeton d’accès à l’API PaddleOCR (optionnel)', + paddleocrAccessTokenPlaceholder: 'Votre jeton AI Studio (optionnel)', + paddleocrAlgorithm: 'Algorithme PaddleOCR', + paddleocrAlgorithmTip: 'Algorithme utilisé pour l’analyse PaddleOCR', + paddleocrSelectAlgorithm: 'Sélectionner un algorithme', + paddleocrModelNamePlaceholder: 'Par exemple : paddleocr-environnement-1', }, chunk: { chunk: 'Segment', @@ -566,6 +577,17 @@ export default { modelTypeMessage: 'Veuillez saisir le type de votre modèle !', addLlmBaseUrl: 'URL de base', baseUrlNameMessage: 'Veuillez saisir votre URL de base !', + paddleocr: { + apiUrl: 'URL de l’API PaddleOCR', + apiUrlPlaceholder: 'Par exemple : https://paddleocr-server.com/layout-parsing', + accessToken: 'Jeton d’accès AI Studio', + accessTokenPlaceholder: 'Votre jeton AI Studio (optionnel)', + algorithm: 'Algorithme PaddleOCR', + selectAlgorithm: 'Sélectionner un algorithme', + modelNamePlaceholder: 'Par exemple : paddleocr-from-env-1', + modelNameRequired: 'Le nom du modèle est obligatoire', + apiUrlRequired: 'L’URL de l’API PaddleOCR est obligatoire' + }, vision: 'Supporte-t-il la vision ?', ollamaLink: 'Comment intégrer {{name}}', FishAudioLink: 'Comment utiliser FishAudio', diff --git a/web/src/locales/id.ts b/web/src/locales/id.ts index 61a728b1b14..975760941b3 100644 --- a/web/src/locales/id.ts +++ b/web/src/locales/id.ts @@ -316,6 +316,17 @@ export default { randomSeed: 'Benih acak', randomSeedMessage: 'Benih acak diperlukan', entityTypes: 'Jenis entitas', + paddleocrOptions: 'Opsi PaddleOCR', + paddleocrApiUrl: 'URL API PaddleOCR', + paddleocrApiUrlTip: 'URL endpoint API layanan PaddleOCR', + paddleocrApiUrlPlaceholder: 'Contoh: https://paddleocr-server.com/layout-parsing', + paddleocrAccessToken: 'Token Akses AI Studio', + paddleocrAccessTokenTip: 'Token akses untuk API PaddleOCR (opsional)', + paddleocrAccessTokenPlaceholder: 'Token AI Studio Anda (opsional)', + paddleocrAlgorithm: 'Algoritma PaddleOCR', + paddleocrAlgorithmTip: 'Algoritma yang digunakan untuk pemrosesan PaddleOCR', + paddleocrSelectAlgorithm: 'Pilih algoritma', + paddleocrModelNamePlaceholder: 'Contoh: paddleocr-lingkungan-1', }, chunk: { chunk: 'Potongan', @@ -553,6 +564,17 @@ export default { modelTypeMessage: 'Silakan masukkan jenis model Anda!', addLlmBaseUrl: 'Base url', baseUrlNameMessage: 'Silakan masukkan base url Anda!', + paddleocr: { + apiUrl: 'URL API PaddleOCR', + apiUrlPlaceholder: 'Contoh: https://paddleocr-server.com/layout-parsing', + accessToken: 'Token Akses AI Studio', + accessTokenPlaceholder: 'Token AI Studio Anda (opsional)', + algorithm: 'Algoritma PaddleOCR', + selectAlgorithm: 'Pilih algoritma', + modelNamePlaceholder: 'Contoh: paddleocr-from-env-1', + modelNameRequired: 'Nama model wajib diisi', + apiUrlRequired: 'URL API PaddleOCR wajib diisi' + }, vision: 'Apakah mendukung Vision?', ollamaLink: 'Cara mengintegrasikan {{name}}', FishAudioLink: 'Cara menggunakan FishAudio', diff --git a/web/src/locales/it.ts b/web/src/locales/it.ts index cb44b07533c..b2c6f333020 100644 --- a/web/src/locales/it.ts +++ b/web/src/locales/it.ts @@ -488,6 +488,17 @@ Quanto sopra è il contenuto che devi riassumere.`, 'In un grafo della conoscenza, una comunità è un cluster di entità collegate da relazioni. Puoi far generare al LLM un abstract per ogni comunità, noto come report comunità.', theDocumentBeingParsedCannotBeDeleted: 'Il documento in fase di analisi non può essere eliminato', + paddleocrOptions: 'Opzioni PaddleOCR', + paddleocrApiUrl: 'URL API di PaddleOCR', + paddleocrApiUrlTip: 'URL dell’endpoint API del servizio PaddleOCR', + paddleocrApiUrlPlaceholder: 'Ad esempio: https://paddleocr-server.com/layout-parsing', + paddleocrAccessToken: 'Token di accesso AI Studio', + paddleocrAccessTokenTip: 'Token di accesso per l’API PaddleOCR (facoltativo)', + paddleocrAccessTokenPlaceholder: 'Il tuo token AI Studio (facoltativo)', + paddleocrAlgorithm: 'Algoritmo PaddleOCR', + paddleocrAlgorithmTip: 'Algoritmo utilizzato per l’elaborazione PaddleOCR', + paddleocrSelectAlgorithm: 'Seleziona algoritmo', + paddleocrModelNamePlaceholder: 'Ad esempio: paddleocr-ambiente-1', }, chunk: { chunk: 'Chunk', @@ -785,6 +796,17 @@ Quanto sopra è il contenuto che devi riassumere.`, modelTypeMessage: 'Inserisci il tuo tipo di modello!', addLlmBaseUrl: 'URL base', baseUrlNameMessage: 'Inserisci il tuo URL base!', + paddleocr: { + apiUrl: 'URL API di PaddleOCR', + apiUrlPlaceholder: 'Ad esempio: https://paddleocr-server.com/layout-parsing', + accessToken: 'Token di accesso AI Studio', + accessTokenPlaceholder: 'Il tuo token AI Studio (facoltativo)', + algorithm: 'Algoritmo PaddleOCR', + selectAlgorithm: 'Seleziona algoritmo', + modelNamePlaceholder: 'Ad esempio: paddleocr-from-env-1', + modelNameRequired: 'Il nome del modello è obbligatorio', + apiUrlRequired: 'L’URL API di PaddleOCR è obbligatorio' + }, vision: 'Supporta Vision?', ollamaLink: 'Come integrare {{name}}', FishAudioLink: 'Come usare FishAudio', diff --git a/web/src/locales/ja.ts b/web/src/locales/ja.ts index 9eda792e24b..5b10f3596d2 100644 --- a/web/src/locales/ja.ts +++ b/web/src/locales/ja.ts @@ -240,7 +240,7 @@ export default { XLSX形式のファイルには、ヘッダーのない2つの 列が必要です: 1つは質問の列でもう1つは回答の列です (質問列が先行)。複数のシートも可能です。 - +

  • CSV/TXT形式のファイルは、TABで区切られたUTF-8エンコードである必要があります。 @@ -285,7 +285,7 @@ export default { LLMがその量のコンテキスト長を処理できる場合に、ドキュメント全体を要約する必要があるときに適用されます。

    `, knowledgeGraph: `

    対応ファイル形式はDOCX, EXCEL, PPT, IMAGE, PDF, TXT, MD, JSON, EMLです。 - +

    このアプローチでは、ファイルを'ナイーブ'/'一般'メソッドを使用してチャンクに分割します。ドキュメントをセグメントに分割し、隣接するセグメントを結合してトークン数が'チャンクトークン数'で指定されたしきい値を超えるまで続け、その時点でチャンクが作成されます。

    その後、チャンクはLLMに入力され、ナレッジグラフとマインドマップのエンティティと関係を抽出します。

    エンティティタイプを設定することを忘れないでください。

    `, @@ -314,6 +314,17 @@ export default { entityTypes: 'エンティティタイプ', pageRank: 'ページランク', pageRankTip: `検索時に特定の知識ベースにより高いPageRankスコアを割り当てることができます。対応するスコアは、これらの知識ベースから取得されたチャンクのハイブリッド類似度スコアに加算され、ランキングが向上します。詳細については、https://ragflow.io/docs/dev/set_page_rank を参照してください。`, + paddleocrOptions: 'PaddleOCRオプション', + paddleocrApiUrl: 'PaddleOCR API URL', + paddleocrApiUrlTip: 'PaddleOCRサービスのAPIエンドポイントURL', + paddleocrApiUrlPlaceholder: '例: https://paddleocr-server.com/api', + paddleocrAccessToken: 'AI Studioアクセストークン', + paddleocrAccessTokenTip: 'PaddleOCR APIのアクセストークン(オプション)', + paddleocrAccessTokenPlaceholder: 'AI Studioトークン(オプション)', + paddleocrAlgorithm: 'PaddleOCRアルゴリズム', + paddleocrAlgorithmTip: 'PaddleOCR解析に使用するアルゴリズム', + paddleocrSelectAlgorithm: 'アルゴリズムを選択', + paddleocrModelNamePlaceholder: '例: paddleocr-from-env-1', }, chunk: { chunk: 'チャンク', @@ -596,6 +607,17 @@ export default { modelTypeMessage: 'モデルタイプを入力してください!', addLlmBaseUrl: 'ベースURL', baseUrlNameMessage: 'ベースURLを入力してください!', + paddleocr: { + apiUrl: 'PaddleOCR API URL', + apiUrlPlaceholder: '例:https://paddleocr-server.com/layout-parsing', + accessToken: 'AI Studio アクセストークン', + accessTokenPlaceholder: 'AI Studio のトークン(任意)', + algorithm: 'PaddleOCR アルゴリズム', + selectAlgorithm: 'アルゴリズムを選択', + modelNamePlaceholder: '例:paddleocr-from-env-1', + modelNameRequired: 'モデル名は必須です', + apiUrlRequired: 'PaddleOCR API URL は必須です' + }, vision: 'ビジョンをサポートしていますか?', ollamaLink: '{{name}}を統合する方法', FishAudioLink: 'FishAudioの使用方法', diff --git a/web/src/locales/pt-br.ts b/web/src/locales/pt-br.ts index 25bbab94f48..d5df6fd817b 100644 --- a/web/src/locales/pt-br.ts +++ b/web/src/locales/pt-br.ts @@ -310,6 +310,17 @@ export default { topnTags: 'Top-N Etiquetas', tags: 'Etiquetas', addTag: 'Adicionar etiqueta', + paddleocrOptions: 'Opções do PaddleOCR', + paddleocrApiUrl: 'URL da API do PaddleOCR', + paddleocrApiUrlTip: 'A URL do endpoint da API para o serviço PaddleOCR', + paddleocrApiUrlPlaceholder: 'ex: https://servidor-paddleocr.com/api', + paddleocrAccessToken: 'Token de Acesso do AI Studio', + paddleocrAccessTokenTip: 'Token de acesso para a API do PaddleOCR (opcional)', + paddleocrAccessTokenPlaceholder: 'Seu token do AI Studio (opcional)', + paddleocrAlgorithm: 'Algoritmo do PaddleOCR', + paddleocrAlgorithmTip: 'Algoritmo a ser usado para a análise do PaddleOCR', + paddleocrSelectAlgorithm: 'Selecionar algoritmo', + paddleocrModelNamePlaceholder: 'ex: paddleocr-do-ambiente-1', }, chunk: { chunk: 'Fragmento', @@ -546,6 +557,17 @@ export default { modelTypeMessage: 'Por favor, insira o tipo do seu modelo!', addLlmBaseUrl: 'URL base', baseUrlNameMessage: 'Por favor, insira sua URL base!', + paddleocr: { + apiUrl: 'URL da API do PaddleOCR', + apiUrlPlaceholder: 'Por exemplo: https://paddleocr-server.com/layout-parsing', + accessToken: 'Token de acesso do AI Studio', + accessTokenPlaceholder: 'Seu token do AI Studio (opcional)', + algorithm: 'Algoritmo do PaddleOCR', + selectAlgorithm: 'Selecionar algoritmo', + modelNamePlaceholder: 'Por exemplo: paddleocr-from-env-1', + modelNameRequired: 'O nome do modelo é obrigatório', + apiUrlRequired: 'A URL da API do PaddleOCR é obrigatória' + }, vision: 'Suporta visão?', ollamaLink: 'Como integrar {{name}}', FishAudioLink: 'Como usar FishAudio', diff --git a/web/src/locales/ru.ts b/web/src/locales/ru.ts index 404577a8591..4e676ddcef8 100644 --- a/web/src/locales/ru.ts +++ b/web/src/locales/ru.ts @@ -510,6 +510,17 @@ export default { 'В графе знаний сообщество - это кластер сущностей, связанных отношениями. Вы можете поручить LLM генерировать аннотацию для каждого сообщества, известную как отчет сообщества. Более подробная информация здесь: https://www.microsoft.com/en-us/research/blog/graphrag-improving-global-search-via-dynamic-community-selection/', theDocumentBeingParsedCannotBeDeleted: 'Документ, который в данный момент парсится, не может быть удален', + paddleocrOptions: 'Параметры PaddleOCR', + paddleocrApiUrl: 'URL API PaddleOCR', + paddleocrApiUrlTip: 'URL конечной точки API сервиса PaddleOCR', + paddleocrApiUrlPlaceholder: 'Например: https://paddleocr-server.com/layout-parsing', + paddleocrAccessToken: 'Токен доступа AI Studio', + paddleocrAccessTokenTip: 'Токен доступа к API PaddleOCR (необязательно)', + paddleocrAccessTokenPlaceholder: 'Ваш токен AI Studio (необязательно)', + paddleocrAlgorithm: 'Алгоритм PaddleOCR', + paddleocrAlgorithmTip: 'Алгоритм, используемый для обработки PaddleOCR', + paddleocrSelectAlgorithm: 'Выбрать алгоритм', + paddleocrModelNamePlaceholder: 'Например: paddleocr-среда-1', }, chunk: { chunk: 'Чанк', @@ -716,7 +727,7 @@ export default { 'Базовый URL вашего экземпляра Confluence (например, https://your-domain.atlassian.net/wiki)', confluenceSpaceKeyTip: 'Необязательно: Укажите ключ пространства для синхронизации только определенного пространства. Оставьте пустым для синхронизации всех доступных пространств. Для нескольких пространств разделите запятыми (например, DEV,DOCS,HR)', - s3PrefixTip: `Укажите путь к папке в вашем S3 бакете для получения файлов. + s3PrefixTip: `Укажите путь к папке в вашем S3 бакете для получения файлов. Пример: general/v2/`, S3CompatibleEndpointUrlTip: `Требуется для S3 совместимого Storage Box. Укажите URL конечной точки, совместимой с S3. Пример: https://fsn1.your-objectstorage.com`, @@ -1034,6 +1045,17 @@ export default { modelsToBeAddedTooltip: 'Если ваш провайдер моделей не указан, но заявляет о "совместимости с OpenAI-API", выберите карточку OpenAI-API-compatible, чтобы добавить соответствующие модели. ', mcp: 'MCP', + paddleocr: { + apiUrl: 'URL API PaddleOCR', + apiUrlPlaceholder: 'Например: https://paddleocr-server.com/layout-parsing', + accessToken: 'Токен доступа AI Studio', + accessTokenPlaceholder: 'Ваш токен AI Studio (необязательно)', + algorithm: 'Алгоритм PaddleOCR', + selectAlgorithm: 'Выбрать алгоритм', + modelNamePlaceholder: 'Например: paddleocr-from-env-1', + modelNameRequired: 'Имя модели является обязательным', + apiUrlRequired: 'URL API PaddleOCR является обязательным' + }, }, message: { registered: 'Зарегистрирован!', diff --git a/web/src/locales/vi.ts b/web/src/locales/vi.ts index b57dad6e7f6..1c831f57b19 100644 --- a/web/src/locales/vi.ts +++ b/web/src/locales/vi.ts @@ -354,6 +354,17 @@ export default { community: 'Xây dựng mối quan hệ cộng đồng', communityTip: 'Các liên kết được nhóm lại thành các cộng đồng phân cấp, với các thực thể và mối quan hệ kết nối từng phân đoạn lên các cấp độ trừu tượng cao hơn. Sau đó, chúng tôi sử dụng một LLM để tạo ra bản tóm tắt cho mỗi cộng đồng, được gọi là báo cáo cộng đồng. Xem thêm: https://www.microsoft.com/en-us/research/blog/graphrag-improving-global-search-via-dynamic-community-selection/', + paddleocrOptions: 'Tùy chọn PaddleOCR', + paddleocrApiUrl: 'URL API PaddleOCR', + paddleocrApiUrlTip: 'URL điểm cuối API của dịch vụ PaddleOCR', + paddleocrApiUrlPlaceholder: 'Ví dụ: https://paddleocr-server.com/layout-parsing', + paddleocrAccessToken: 'Token truy cập AI Studio', + paddleocrAccessTokenTip: 'Token truy cập cho API PaddleOCR (tùy chọn)', + paddleocrAccessTokenPlaceholder: 'Token AI Studio của bạn (tùy chọn)', + paddleocrAlgorithm: 'Thuật toán PaddleOCR', + paddleocrAlgorithmTip: 'Thuật toán được sử dụng để xử lý PaddleOCR', + paddleocrSelectAlgorithm: 'Chọn thuật toán', + paddleocrModelNamePlaceholder: 'Ví dụ: paddleocr-môi-trường-1', }, chunk: { chunk: 'Khối', @@ -595,6 +606,17 @@ export default { modelTypeMessage: 'Vui lòng nhập loại mô hình của bạn!', addLlmBaseUrl: 'URL cơ sở', baseUrlNameMessage: 'Vui lòng nhập URL cơ sở của bạn!', + paddleocr: { + apiUrl: 'URL API PaddleOCR', + apiUrlPlaceholder: 'Ví dụ: https://paddleocr-server.com/layout-parsing', + accessToken: 'Token truy cập AI Studio', + accessTokenPlaceholder: 'Token AI Studio của bạn (tùy chọn)', + algorithm: 'Thuật toán PaddleOCR', + selectAlgorithm: 'Chọn thuật toán', + modelNamePlaceholder: 'Ví dụ: paddleocr-from-env-1', + modelNameRequired: 'Tên mô hình là bắt buộc', + apiUrlRequired: 'URL API PaddleOCR là bắt buộc' + }, vision: 'Có hỗ trợ Tầm nhìn không?', ollamaLink: 'Cách tích hợp {{name}}', FishAudioLink: 'Cách sử dụng FishAudio', diff --git a/web/src/locales/zh-traditional.ts b/web/src/locales/zh-traditional.ts index 65bb4e08b8e..8113ca5496d 100644 --- a/web/src/locales/zh-traditional.ts +++ b/web/src/locales/zh-traditional.ts @@ -367,6 +367,17 @@ export default { `, tags: '標籤', addTag: '增加標籤', + paddleocrOptions: 'PaddleOCR 選項', + paddleocrApiUrl: 'PaddleOCR API URL', + paddleocrApiUrlTip: 'PaddleOCR 服務的 API 端點 URL', + paddleocrApiUrlPlaceholder: '例如:https://paddleocr-server.com/layout-parsing', + paddleocrAccessToken: 'AI Studio 訪問令牌', + paddleocrAccessTokenTip: 'PaddleOCR API 的訪問令牌(可選)', + paddleocrAccessTokenPlaceholder: '您的 AI Studio 令牌(可選)', + paddleocrAlgorithm: 'PaddleOCR 算法', + paddleocrAlgorithmTip: '用於 PaddleOCR 解析的算法', + paddleocrSelectAlgorithm: '選擇算法', + paddleocrModelNamePlaceholder: '例如:paddleocr-環境-1', useGraphRag: '提取知識圖譜', useGraphRagTip: '基於知識庫內所有切好的文本塊構建知識圖譜,用以提升多跳和複雜問題回答的正確率。請注意:構建知識圖譜將消耗大量 token 和時間。詳見 https://ragflow.io/docs/dev/construct_knowledge_graph。', @@ -644,6 +655,17 @@ export default { modelNameMessage: '請輸入模型名稱!', modelTypeMessage: '請輸入模型類型!', baseUrlNameMessage: '請輸入基礎 Url!', + paddleocr: { + apiUrl: 'PaddleOCR API URL', + apiUrlPlaceholder: '例如:https://paddleocr-server.com/layout-parsing', + accessToken: 'AI Studio 存取權杖', + accessTokenPlaceholder: '您的 AI Studio 權杖(選填)', + algorithm: 'PaddleOCR 演算法', + selectAlgorithm: '選擇演算法', + modelNamePlaceholder: '例如:paddleocr-from-env-1', + modelNameRequired: '模型名稱為必填項目', + apiUrlRequired: 'PaddleOCR API URL 為必填項目' + }, ollamaLink: '如何集成 {{name}}', FishAudioLink: '如何使用Fish Audio', TencentCloudLink: '如何使用騰訊雲語音識別', diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts index 8cbb409aad1..9abca9ded8f 100644 --- a/web/src/locales/zh.ts +++ b/web/src/locales/zh.ts @@ -390,6 +390,17 @@ export default { '启用公式识别。注意:对于西里尔文档可能无法正常工作。', mineruTableEnable: '表格识别', mineruTableEnableTip: '启用表格识别和提取。', + paddleocrOptions: 'PaddleOCR 选项', + paddleocrApiUrl: 'PaddleOCR API URL', + paddleocrApiUrlTip: 'PaddleOCR 服务的 API 端点 URL', + paddleocrApiUrlPlaceholder: '例如:https://paddleocr-server.com/layout-parsing', + paddleocrAccessToken: 'AI Studio 访问令牌', + paddleocrAccessTokenTip: 'PaddleOCR API 的访问令牌(可选)', + paddleocrAccessTokenPlaceholder: '您的 AI Studio 令牌(可选)', + paddleocrAlgorithm: 'PaddleOCR 算法', + paddleocrAlgorithmTip: '用于 PaddleOCR 解析的算法', + paddleocrSelectAlgorithm: '选择算法', + paddleocrModelNamePlaceholder: '例如:paddleocr-环境-1', generationScopeTip: '选择 RAPTOR 的生成范围:整个知识库或单个文件。', generationScope: '生成范围', scopeSingleFile: '单文件', @@ -1113,6 +1124,17 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于 vlmLmdeployEngine: '基于LMDeploy引擎的视觉语言模型(实验性)', }, }, + paddleocr: { + apiUrl: 'PaddleOCR API URL', + apiUrlPlaceholder: '例如:https://paddleocr-server.com/layout-parsing', + accessToken: 'AI Studio访问令牌', + accessTokenPlaceholder: '您的 AI Studio 令牌(可选)', + algorithm: 'PaddleOCR算法', + selectAlgorithm: '选择算法', + modelNamePlaceholder: '例如:paddleocr-from-env-1', + modelNameRequired: '模型名称为必填项', + apiUrlRequired: 'PaddleOCR API URL 为必填项' + }, }, message: { registered: '注册成功', diff --git a/web/src/pages/user-setting/setting-model/hooks.tsx b/web/src/pages/user-setting/setting-model/hooks.tsx index 237999fef90..68d73326acf 100644 --- a/web/src/pages/user-setting/setting-model/hooks.tsx +++ b/web/src/pages/user-setting/setting-model/hooks.tsx @@ -504,3 +504,43 @@ export const useSubmitMinerU = () => { mineruLoading: loading, }; }; + +export const useSubmitPaddleOCR = () => { + const { addLlm, loading } = useAddLlm(); + const { + visible: paddleocrVisible, + hideModal: hidePaddleOCRModal, + showModal: showPaddleOCRModal, + } = useSetModalState(); + + const onPaddleOCROk = useCallback( + async (payload: any) => { + const cfg: any = { + ...payload, + }; + const req: IAddLlmRequestBody = { + llm_factory: LLMFactory.PaddleOCR, + llm_name: payload.llm_name, + model_type: 'ocr', + api_key: cfg, + api_base: '', + max_tokens: 0, + }; + const ret = await addLlm(req); + if (ret === 0) { + hidePaddleOCRModal(); + return true; + } + return false; + }, + [addLlm, hidePaddleOCRModal], + ); + + return { + paddleocrVisible, + hidePaddleOCRModal, + showPaddleOCRModal, + onPaddleOCROk, + paddleocrLoading: loading, + }; +}; diff --git a/web/src/pages/user-setting/setting-model/index.tsx b/web/src/pages/user-setting/setting-model/index.tsx index 1b549496c63..41224a16aa8 100644 --- a/web/src/pages/user-setting/setting-model/index.tsx +++ b/web/src/pages/user-setting/setting-model/index.tsx @@ -15,6 +15,7 @@ import { useSubmitHunyuan, useSubmitMinerU, useSubmitOllama, + useSubmitPaddleOCR, useSubmitSpark, useSubmitSystemModelSetting, useSubmitTencentCloud, @@ -28,6 +29,7 @@ import FishAudioModal from './modal/fish-audio-modal'; import GoogleModal from './modal/google-modal'; import HunyuanModal from './modal/hunyuan-modal'; import MinerUModal from './modal/mineru-modal'; +import PaddleOCRModal from './modal/paddleocr-modal'; import TencentCloudModal from './modal/next-tencent-modal'; import OllamaModal from './modal/ollama-modal'; import SparkModal from './modal/spark-modal'; @@ -138,6 +140,14 @@ const ModelProviders = () => { mineruLoading, } = useSubmitMinerU(); + const { + paddleocrVisible, + hidePaddleOCRModal, + showPaddleOCRModal, + onPaddleOCROk, + paddleocrLoading, + } = useSubmitPaddleOCR(); + const ModalMap = useMemo( () => ({ [LLMFactory.Bedrock]: showBedrockAddingModal, @@ -150,6 +160,7 @@ const ModelProviders = () => { [LLMFactory.GoogleCloud]: showGoogleAddingModal, [LLMFactory.AzureOpenAI]: showAzureAddingModal, [LLMFactory.MinerU]: showMineruModal, + [LLMFactory.PaddleOCR]: showPaddleOCRModal, }), [ showBedrockAddingModal, @@ -162,6 +173,7 @@ const ModelProviders = () => { showGoogleAddingModal, showAzureAddingModal, showMineruModal, + showPaddleOCRModal, ], ); @@ -309,6 +321,12 @@ const ModelProviders = () => { onOk={onMineruOk} loading={mineruLoading} > +
  • ); }; diff --git a/web/src/pages/user-setting/setting-model/modal/paddleocr-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/paddleocr-modal/index.tsx new file mode 100644 index 00000000000..2df23c3de5a --- /dev/null +++ b/web/src/pages/user-setting/setting-model/modal/paddleocr-modal/index.tsx @@ -0,0 +1,135 @@ +import { useForm } from 'react-hook-form'; +import { useTranslation } from 'react-i18next'; +import { z } from 'zod'; +import { zodResolver } from '@hookform/resolvers/zod'; +import { t } from 'i18next'; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, +} from '@/components/ui/dialog'; +import { RAGFlowFormItem } from '@/components/ragflow-form'; +import { RAGFlowSelect, RAGFlowSelectOptionType } from '@/components/ui/select'; +import { Input } from '@/components/ui/input'; +import { Form } from '@/components/ui/form'; +import { LLMHeader } from '../../components/llm-header'; +import { LLMFactory } from '@/constants/llm'; + +const FormSchema = z.object({ + llm_name: z.string().min(1, { + message: t('setting.paddleocr.modelNameRequired'), + }), + paddleocr_api_url: z.string().min(1, { + message: t('setting.paddleocr.apiUrlRequired'), + }), + paddleocr_access_token: z.string().optional(), + paddleocr_algorithm: z.string().default('PaddleOCR-VL'), +}); + +export type PaddleOCRFormValues = z.infer; + +export interface IModalProps { + visible: boolean; + hideModal: () => void; + onOk?: (data: T) => Promise; + loading?: boolean; +} + +const algorithmOptions: RAGFlowSelectOptionType[] = [ + { label: 'PaddleOCR-VL', value: 'PaddleOCR-VL' }, +]; + +const PaddleOCRModal = ({ + visible, + hideModal, + onOk, + loading, +}: IModalProps) => { + const { t } = useTranslation(); + + const form = useForm({ + resolver: zodResolver(FormSchema), + defaultValues: { + paddleocr_algorithm: 'PaddleOCR-VL', + }, + }); + + const handleOk = async (values: PaddleOCRFormValues) => { + const ret = await onOk?.(values as any); + if (ret) { + hideModal?.(); + } + }; + + return ( + + + + + + + +
    + + + + + + + + + + + + {(field) => ( + + )} + +
    + + +
    +
    + +
    +
    + ); +}; + +export default PaddleOCRModal; From b226e06e2d36b8c7897e47f47158d9781ba4148d Mon Sep 17 00:00:00 2001 From: lys1313013 Date: Fri, 9 Jan 2026 19:23:50 +0800 Subject: [PATCH 079/335] refactor: remove debug print statements (#12534) ### What problem does this PR solve? refactor: remove debug print statements ### Type of change - [x] Refactoring --- deepdoc/parser/figure_parser.py | 5 ----- rag/app/one.py | 2 -- rag/nlp/__init__.py | 5 ----- 3 files changed, 12 deletions(-) diff --git a/deepdoc/parser/figure_parser.py b/deepdoc/parser/figure_parser.py index caf4f5b7b5d..ec5e333de28 100644 --- a/deepdoc/parser/figure_parser.py +++ b/deepdoc/parser/figure_parser.py @@ -124,18 +124,13 @@ def is_figure_item(item): def vision_figure_parser_docx_wrapper_naive(chunks, idx_lst, callback=None, **kwargs): - - print("\n\n hello here i am \n\n") - if not chunks: return [] try: vision_model = LLMBundle(kwargs["tenant_id"], LLMType.IMAGE2TEXT) callback(0.7, "Visual model detected. Attempting to enhance figure extraction...") - print(" \n\n Yes vision model \n\n") except Exception: vision_model = None - print(" \n\n No vision model \n\n") if vision_model: @timeout(30, 3) def worker(idx, ck): diff --git a/rag/app/one.py b/rag/app/one.py index e445f881f1b..d8bfdf58b8a 100644 --- a/rag/app/one.py +++ b/rag/app/one.py @@ -82,8 +82,6 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca cks.append({"text": text, "image": image, "ck_type": ck_type}) vision_figure_parser_docx_wrapper_naive(cks, image_idxs, callback, **kwargs) - for ck in cks: - print(ck) sections = [ck["text"] for ck in cks if ck.get("text")] callback(0.8, "Finish parsing.") diff --git a/rag/nlp/__init__.py b/rag/nlp/__init__.py index 1b0029d2c60..e4cefd993f6 100644 --- a/rag/nlp/__init__.py +++ b/rag/nlp/__init__.py @@ -815,11 +815,6 @@ def lower_context(page, i): if len(contexts) < len(res) + 1: contexts.append(("", "")) res.append(((img, tb), poss)) - - print("\n\n") - for c in contexts: - print(c) - print("\n\n") return contexts if return_context else res From 030d6ba00437598a807a2d29f429d707303e7bd5 Mon Sep 17 00:00:00 2001 From: Zhichang Yu Date: Sat, 10 Jan 2026 09:52:32 +0800 Subject: [PATCH 080/335] CI collect ragflow log (#12543) ### What problem does this PR solve? As title ### Type of change - [ ] Bug Fix (non-breaking change which fixes an issue) - [ ] New Feature (non-breaking change which adds functionality) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [x] Other (please describe): CI --- .github/workflows/tests.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 37c666173a4..0025295181b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -86,6 +86,9 @@ jobs: mkdir -p ${RUNNER_WORKSPACE_PREFIX}/artifacts/${GITHUB_REPOSITORY} echo "${PR_SHA} ${GITHUB_RUN_ID}" > ${PR_SHA_FP} fi + ARTIFACTS_DIR=${RUNNER_WORKSPACE_PREFIX}/artifacts/${GITHUB_REPOSITORY}/${GITHUB_RUN_ID} + echo "ARTIFACTS_DIR=${ARTIFACTS_DIR}" >> ${GITHUB_ENV} + rm -rf ${ARTIFACTS_DIR} && mkdir -p ${ARTIFACTS_DIR} # https://github.com/astral-sh/ruff-action - name: Static check with Ruff @@ -229,6 +232,13 @@ jobs: done source .venv/bin/activate && set -o pipefail; pytest -s --tb=short --level=${HTTP_API_TEST_LEVEL} test/testcases/test_http_api 2>&1 | tee es_http_api_test.log + - name: Collect ragflow log + if: ${{ !cancelled() }} + run: | + cp -r docker/ragflow-logs ${ARTIFACTS_DIR}/ragflow-logs-es + echo "ragflow log" && tail -n 200 docker/ragflow-logs/ragflow_server.log + sudo rm -rf docker/ragflow-logs + - name: Stop ragflow:nightly if: always() # always run this step even if previous steps failed run: | @@ -267,6 +277,12 @@ jobs: done source .venv/bin/activate && set -o pipefail; DOC_ENGINE=infinity pytest -s --tb=short --level=${HTTP_API_TEST_LEVEL} test/testcases/test_http_api 2>&1 | tee infinity_http_api_test.log + - name: Collect ragflow log + if: ${{ !cancelled() }} + run: | + cp -r docker/ragflow-logs ${ARTIFACTS_DIR}/ragflow-logs-infinity + echo "ragflow log" && tail -n 200 docker/ragflow-logs/ragflow_server.log + sudo rm -rf docker/ragflow-logs - name: Stop ragflow:nightly if: always() # always run this step even if previous steps failed run: | From ff11e3171eb0ca5383ad59b7b1bf5d4abef5772c Mon Sep 17 00:00:00 2001 From: Zhizhou Li <87249209@qq.com> Date: Mon, 12 Jan 2026 11:06:33 +0800 Subject: [PATCH 081/335] Feat: SandBox docker CLI error in ARM CPU #12433 (#12434) ### What problem does this PR solve? Add multi-architecture support for Sandbox Updated Dockerfile to support multiple architectures for Docker Sandbox installation. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- sandbox/executor_manager/Dockerfile | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/sandbox/executor_manager/Dockerfile b/sandbox/executor_manager/Dockerfile index c26919f348b..9444a848763 100644 --- a/sandbox/executor_manager/Dockerfile +++ b/sandbox/executor_manager/Dockerfile @@ -5,19 +5,33 @@ RUN grep -rl 'deb.debian.org' /etc/apt/ | xargs sed -i 's|http[s]*://deb.debian. apt-get install -y curl gcc && \ rm -rf /var/lib/apt/lists/* -RUN curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/static/stable/x86_64/docker-29.1.0.tgz -o docker.tgz && \ - tar -xzf docker.tgz && \ - mv docker/docker /usr/bin/docker && \ - rm -rf docker docker.tgz +ARG TARGETARCH +ARG TARGETVARIANT + +RUN set -eux; \ + case "${TARGETARCH}${TARGETVARIANT}" in \ + amd64) DOCKER_ARCH=x86_64 ;; \ + arm64) DOCKER_ARCH=aarch64 ;; \ + armv7) DOCKER_ARCH=armhf ;; \ + armv6) DOCKER_ARCH=armel ;; \ + arm64v8) DOCKER_ARCH=aarch64 ;; \ + arm64v7) DOCKER_ARCH=armhf ;; \ + arm*) DOCKER_ARCH=armhf ;; \ + ppc64le) DOCKER_ARCH=ppc64le ;; \ + s390x) DOCKER_ARCH=s390x ;; \ + *) echo "Unsupported architecture: ${TARGETARCH}${TARGETVARIANT}" && exit 1 ;; \ + esac; \ + echo "Downloading Docker for architecture: ${DOCKER_ARCH}"; \ + curl -fsSL "https://download.docker.com/linux/static/stable/${DOCKER_ARCH}/docker-29.1.0.tgz" | \ + tar xz -C /usr/local/bin --strip-components=1 docker/docker; \ + ln -sf /usr/local/bin/docker /usr/bin/docker COPY --from=ghcr.io/astral-sh/uv:0.7.5 /uv /uvx /bin/ ENV UV_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple - WORKDIR /app COPY . . RUN uv pip install --system -r requirements.txt CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "9385"] - From 638c5104685b4571d60e48cfbbe7e9f0db550316 Mon Sep 17 00:00:00 2001 From: Stephen Hu <812791840@qq.com> Date: Mon, 12 Jan 2026 11:07:11 +0800 Subject: [PATCH 082/335] refactor: introduce common normalize method in rerank base class (#12550) ### What problem does this PR solve? introduce common normalize method in rerank base class ### Type of change - [x] Refactoring --- rag/llm/rerank_model.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/rag/llm/rerank_model.py b/rag/llm/rerank_model.py index c876c051583..4dac44f2b3a 100644 --- a/rag/llm/rerank_model.py +++ b/rag/llm/rerank_model.py @@ -36,6 +36,22 @@ def __init__(self, key, model_name, **kwargs): def similarity(self, query: str, texts: list): raise NotImplementedError("Please implement encode method!") + @staticmethod + def _normalize_rank(rank: np.ndarray) -> np.ndarray: + """ + Normalize rank values to the range 0 to 1. + Avoids division by zero if all ranks are identical. + """ + min_rank = np.min(rank) + max_rank = np.max(rank) + + if not np.isclose(min_rank, max_rank, atol=1e-3): + rank = (rank - min_rank) / (max_rank - min_rank) + else: + rank = np.zeros_like(rank) + + return rank + class JinaRerank(Base): _FACTORY_NAME = "Jina" @@ -121,15 +137,7 @@ def similarity(self, query: str, texts: list): except Exception as _e: log_exception(_e, res) - # Normalize the rank values to the range 0 to 1 - min_rank = np.min(rank) - max_rank = np.max(rank) - - # Avoid division by zero if all ranks are identical - if not np.isclose(min_rank, max_rank, atol=1e-3): - rank = (rank - min_rank) / (max_rank - min_rank) - else: - rank = np.zeros_like(rank) + rank = Base._normalize_rank(rank) return rank, token_count @@ -215,15 +223,7 @@ def similarity(self, query: str, texts: list): except Exception as _e: log_exception(_e, res) - # Normalize the rank values to the range 0 to 1 - min_rank = np.min(rank) - max_rank = np.max(rank) - - # Avoid division by zero if all ranks are identical - if not np.isclose(min_rank, max_rank, atol=1e-3): - rank = (rank - min_rank) / (max_rank - min_rank) - else: - rank = np.zeros_like(rank) + rank = Base._normalize_rank(rank) return rank, token_count From a7dd3b7e9e66193ba1ece6ed1ed0b0cca561168c Mon Sep 17 00:00:00 2001 From: Jin Hai Date: Mon, 12 Jan 2026 12:48:23 +0800 Subject: [PATCH 083/335] Add time cost when start servers (#12552) ### What problem does this PR solve? - API server - Ingestion server - Data sync server - Admin server ### Type of change - [x] Refactoring Signed-off-by: Jin Hai --- admin/server/admin_server.py | 6 ++++-- api/ragflow_server.py | 8 +++++--- rag/svr/sync_data_source.py | 5 ++++- rag/svr/task_executor.py | 7 ++++++- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/admin/server/admin_server.py b/admin/server/admin_server.py index b8c96a62c45..2fbb4174c02 100644 --- a/admin/server/admin_server.py +++ b/admin/server/admin_server.py @@ -14,10 +14,12 @@ # limitations under the License. # +import time +start_ts = time.time() + import os import signal import logging -import time import threading import traceback import faulthandler @@ -66,7 +68,7 @@ SERVICE_CONFIGS.configs = load_configurations(SERVICE_CONF) try: - logging.info("RAGFlow Admin service start...") + logging.info(f"RAGFlow admin is ready after {time.time() - start_ts}s initialization.") run_simple( hostname="0.0.0.0", port=9381, diff --git a/api/ragflow_server.py b/api/ragflow_server.py index 26cd045c4de..193efff3b29 100644 --- a/api/ragflow_server.py +++ b/api/ragflow_server.py @@ -18,8 +18,8 @@ # from beartype.claw import beartype_all # <-- you didn't sign up for this # beartype_all(conf=BeartypeConf(violation_type=UserWarning)) # <-- emit warnings from all code -from common.log_utils import init_root_logger -from plugin import GlobalPluginManager +import time +start_ts = time.time() import logging import os @@ -40,6 +40,8 @@ from common.versions import get_ragflow_version from common.config_utils import show_configs from common.mcp_tool_call_conn import shutdown_all_mcp_sessions +from common.log_utils import init_root_logger +from plugin import GlobalPluginManager from rag.utils.redis_conn import RedisDistributedLock stop_event = threading.Event() @@ -145,7 +147,7 @@ def delayed_start_update_progress(): # start http server try: - logging.info("RAGFlow HTTP server start...") + logging.info(f"RAGFlow server is ready after {time.time() - start_ts}s initialization.") app.run(host=settings.HOST_IP, port=settings.HOST_PORT) except Exception: traceback.print_exc() diff --git a/rag/svr/sync_data_source.py b/rag/svr/sync_data_source.py index eb4445d8e0c..764bee83079 100644 --- a/rag/svr/sync_data_source.py +++ b/rag/svr/sync_data_source.py @@ -19,6 +19,9 @@ # beartype_all(conf=BeartypeConf(violation_type=UserWarning)) # <-- emit warnings from all code +import time +start_ts = time.time() + import asyncio import copy import faulthandler @@ -27,7 +30,6 @@ import signal import sys import threading -import time import traceback from datetime import datetime, timezone from typing import Any @@ -1266,6 +1268,7 @@ async def main(): signal.signal(signal.SIGINT, signal_handler) signal.signal(signal.SIGTERM, signal_handler) + logging.info(f"RAGFlow data sync is ready after {time.time() - start_ts}s initialization.") while not stop_event.is_set(): await dispatch_tasks() logging.error("BUG!!! You should not reach here!!!") diff --git a/rag/svr/task_executor.py b/rag/svr/task_executor.py index d397898410e..7e2352a9bd5 100644 --- a/rag/svr/task_executor.py +++ b/rag/svr/task_executor.py @@ -12,6 +12,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + +import time +start_ts = time.time() + import asyncio import socket import concurrent @@ -21,7 +25,6 @@ import random import sys import threading -import time from api.db import PIPELINE_SPECIAL_PROGRESS_FREEZE_TASK_TYPES from api.db.services.knowledgebase_service import KnowledgebaseService @@ -1322,6 +1325,8 @@ async def main(): report_task = asyncio.create_task(report_status()) tasks = [] + + logging.info(f"RAGFlow ingestion is ready after {time.time() - start_ts}s initialization.") try: while not stop_event.is_set(): await task_limiter.acquire() From d4f8c724ed5bb6cc51c21f76914aace031be1398 Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Mon, 12 Jan 2026 15:29:50 +0800 Subject: [PATCH 084/335] Fix:Automatically enable metadata and optimize parser dialog logic (#12553) ### What problem does this PR solve? Fix:Automatically enable metadata and optimize parser dialog logic ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/interfaces/database/knowledge.ts | 1 + .../metedata/hooks/use-manage-modal.ts | 1 + .../contexts/knowledge-base-context.tsx | 34 ++++++++++++ .../configuration/common-item.tsx | 1 + web/src/pages/dataset/dataset/index.tsx | 10 ++-- .../dataset/dataset/parsing-status-cell.tsx | 6 ++- .../pages/dataset/dataset/reparse-dialog.tsx | 15 ++++-- web/src/pages/dataset/index.tsx | 53 ++++++++++--------- 8 files changed, 88 insertions(+), 33 deletions(-) create mode 100644 web/src/pages/dataset/contexts/knowledge-base-context.tsx diff --git a/web/src/interfaces/database/knowledge.ts b/web/src/interfaces/database/knowledge.ts index 5c460389a80..502c63c1b74 100644 --- a/web/src/interfaces/database/knowledge.ts +++ b/web/src/interfaces/database/knowledge.ts @@ -67,6 +67,7 @@ export interface ParserConfig { tag_kb_ids?: string[]; topn_tags?: number; graphrag?: { use_graphrag?: boolean }; + enable_metadata?: boolean; } export interface IKnowledgeFileParserConfig { diff --git a/web/src/pages/dataset/components/metedata/hooks/use-manage-modal.ts b/web/src/pages/dataset/components/metedata/hooks/use-manage-modal.ts index 5993e5562e8..c9d54b1a570 100644 --- a/web/src/pages/dataset/components/metedata/hooks/use-manage-modal.ts +++ b/web/src/pages/dataset/components/metedata/hooks/use-manage-modal.ts @@ -389,6 +389,7 @@ export const useManageMetaDataModal = ( const { data: res } = await kbService.kbUpdateMetaData({ kb_id: id, metadata: data, + enable_metadata: true, }); if (res.code === 0) { message.success(t('message.operated')); diff --git a/web/src/pages/dataset/contexts/knowledge-base-context.tsx b/web/src/pages/dataset/contexts/knowledge-base-context.tsx new file mode 100644 index 00000000000..09fff048d98 --- /dev/null +++ b/web/src/pages/dataset/contexts/knowledge-base-context.tsx @@ -0,0 +1,34 @@ +import { IKnowledge } from '@/interfaces/database/knowledge'; +import React, { createContext, ReactNode, useContext } from 'react'; + +interface KnowledgeBaseContextType { + knowledgeBase: IKnowledge | null; + loading: boolean; +} + +const KnowledgeBaseContext = createContext< + KnowledgeBaseContextType | undefined +>(undefined); + +export const KnowledgeBaseProvider: React.FC<{ + children: ReactNode; + knowledgeBase: IKnowledge | null; + loading: boolean; +}> = ({ children, knowledgeBase, loading }) => { + return ( + + {children} + + ); +}; + +// eslint-disable-next-line react-refresh/only-export-components +export const useKnowledgeBaseContext = (): KnowledgeBaseContextType => { + const context = useContext(KnowledgeBaseContext); + if (context === undefined) { + throw new Error( + 'useKnowledgeBaseContext must be used within a KnowledgeBaseProvider', + ); + } + return context; +}; diff --git a/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx b/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx index 8a8d6e1a8d5..39fef6c45d2 100644 --- a/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx +++ b/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx @@ -431,6 +431,7 @@ export function AutoMetadata({ const handleSaveMetadata = (data?: IMetaDataReturnJSONSettings) => { form.setValue('parser_config.metadata', data || []); + form.setValue('parser_config.enable_metadata', true); }; return ( <> diff --git a/web/src/pages/dataset/dataset/index.tsx b/web/src/pages/dataset/dataset/index.tsx index 1bebdcdad6c..e023d1696cb 100644 --- a/web/src/pages/dataset/dataset/index.tsx +++ b/web/src/pages/dataset/dataset/index.tsx @@ -21,6 +21,7 @@ import { useManageMetadata, } from '../components/metedata/hooks/use-manage-modal'; import { ManageMetadataModal } from '../components/metedata/manage-modal'; +import { useKnowledgeBaseContext } from '../contexts/knowledge-base-context'; import { DatasetTable } from './dataset-table'; import Generate from './generate-button/generate'; import { ReparseDialog } from './reparse-dialog'; @@ -38,7 +39,7 @@ export default function Dataset() { onDocumentUploadOk, documentUploadLoading, } = useHandleUploadDocument(); - + const { knowledgeBase } = useKnowledgeBaseContext(); const { searchString, documents, @@ -221,8 +222,11 @@ export default function Dataset() { )} {reparseDialogVisible && (
    ), }; - if (chunk_num > 0) { + if (chunk_num > 0 && enable_metadata) { setFields([deleteField, applyKBField]); - } - if (chunk_num <= 0) { + } else if (chunk_num > 0 && !enable_metadata) { + setFields([deleteField]); + } else if (chunk_num <= 0 && enable_metadata) { setFields([applyKBField]); + } else { + setFields([]); } - }, [chunk_num, t]); + }, [chunk_num, t, enable_metadata]); const formCallbackRef = useRef(null); @@ -167,3 +172,5 @@ export const ReparseDialog = memo( ); }, ); + +ReparseDialog.displayName = 'ReparseDialog'; diff --git a/web/src/pages/dataset/index.tsx b/web/src/pages/dataset/index.tsx index 5c83a9cedb2..337a4268362 100644 --- a/web/src/pages/dataset/index.tsx +++ b/web/src/pages/dataset/index.tsx @@ -9,6 +9,7 @@ import { } from '@/components/ui/breadcrumb'; import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks'; import { useFetchKnowledgeBaseConfiguration } from '@/hooks/use-knowledge-request'; +import { KnowledgeBaseProvider } from '@/pages/dataset/contexts/knowledge-base-context'; import { useTranslation } from 'react-i18next'; import { Outlet } from 'react-router'; import { SideBar } from './sidebar'; @@ -16,33 +17,35 @@ import { SideBar } from './sidebar'; export default function DatasetWrapper() { const { navigateToDatasetList } = useNavigatePage(); const { t } = useTranslation(); - const { data } = useFetchKnowledgeBaseConfiguration(); + const { data, loading } = useFetchKnowledgeBaseConfiguration(); return ( -
    - - - - - - {t('knowledgeDetails.dataset')} - - - - - - {data.name} - - - - - -
    - -
    - + +
    + + + + + + {t('knowledgeDetails.dataset')} + + + + + + {data.name} + + + + + +
    + +
    + +
    -
    -
    + + ); } From 653001b14fb35586677e367d7c5e4b9ab3196ba3 Mon Sep 17 00:00:00 2001 From: Lynn Date: Mon, 12 Jan 2026 15:31:02 +0800 Subject: [PATCH 085/335] Doc: python sdk document (#12554) ### What problem does this PR solve? Add python sdk document for memory api. ### Type of change - [x] Documentation Update --- docs/references/http_api_reference.md | 15 +- docs/references/python_api_reference.md | 635 ++++++++++++++++++++++++ 2 files changed, 646 insertions(+), 4 deletions(-) diff --git a/docs/references/http_api_reference.md b/docs/references/http_api_reference.md index f12b93a5213..dbfe8b66cb6 100644 --- a/docs/references/http_api_reference.md +++ b/docs/references/http_api_reference.md @@ -5062,6 +5062,7 @@ curl --location --request PUT 'http://{address}/api/v1/memories/d6775d4eeada11f0 - Maximum 128 characters, *Optional* - `avatar`: (*Body parameter*), `string`, *Optional* + The updated base64 encoding of the avatar. - Maximum 65535 characters @@ -5184,10 +5185,12 @@ curl --location 'http://{address}/api/v1/memories?keywords=&page_size=50&page=1& The name of memory to retrieve, supports fuzzy search. - `page`: (*Filter parameter*), `int`, *Optional* - Specifies the page on which the datasets will be displayed. Defaults to `1`. + + Specifies the page on which the memories will be displayed. Defaults to `1`. - `page_size`: (*Filter parameter*), `int`, *Optional* - The number of datasets on each page. Defaults to `50`. + + The number of memories on each page. Defaults to `50`. #### Response @@ -5314,6 +5317,8 @@ Failure **DELETE** `/api/v1/memories/{memory_id}` +Delete a specified memory. + #### Request - Method: DELETE @@ -5396,10 +5401,12 @@ curl --location 'http://{address}/api/v1/memories/6c8983badede11f083f184ba59bc53 Filters messages by their session ID. This field supports fuzzy search. - `page`: (*Filter parameter*), `int`, *Optional* - Specifies the page on which the datasets will be displayed. Defaults to `1`. + + Specifies the page on which the messages will be displayed. Defaults to `1`. - `page_size`: (*Filter parameter*), `int`, *Optional* - The number of datasets on each page. Defaults to `50`. + + The number of messages on each page. Defaults to `50`. #### Response diff --git a/docs/references/python_api_reference.md b/docs/references/python_api_reference.md index 089dd981972..4d60d8459de 100644 --- a/docs/references/python_api_reference.md +++ b/docs/references/python_api_reference.md @@ -1963,3 +1963,638 @@ rag_object.delete_agent("58af890a2a8911f0a71a11b922ed82d6") ``` --- + + + +## Memory Management + +### Create Memory + +```python +Ragflow.create_memory( + name: str, + memory_type: list[str], + embd_id: str, + llm_id: str +) -> Memory +``` + +Create a new memory. + +#### Parameters + +##### name: `str`, *Required* + +The unique name of the memory to create. It must adhere to the following requirements: + +- Basic Multilingual Plane (BMP) only +- Maximum 128 characters + +##### memory_type: `list[str]`, *Required* + +Specifies the types of memory to extract. Available options: + +- `raw`: The raw dialogue content between the user and the agent . *Required by default*. +- `semantic`: General knowledge and facts about the user and world. +- `episodic`: Time-stamped records of specific events and experiences. +- `procedural`: Learned skills, habits, and automated procedures. + +##### embd_id: `str`, *Required* + +The name of the embedding model to use. For example: `"BAAI/bge-large-zh-v1.5@BAAI"` + +- Maximum 255 characters +- Must follow `model_name@model_factory` format + +##### llm_id: `str`, *Required* + +The name of the chat model to use. For example: `"glm-4-flash@ZHIPU-AI"` + +- Maximum 255 characters +- Must follow `model_name@model_factory` format + +#### Returns + +- Success: A `memory` object. + +- Failure: `Exception` + +#### Examples + +```python +from ragflow_sdk import RAGFlow +rag_object = RAGFlow(api_key="", base_url="http://:9380") +memory = rag_obj.create_memory("name", ["raw"], "BAAI/bge-large-zh-v1.5@SILICONFLOW", "glm-4-flash@ZHIPU-AI") +``` + +--- + + + +### Update Memory + +```python +Memory.update( + update_dict: dict +) -> Memory +``` + +Updates configurations for a specified memory. + +#### Parameters + +##### update_dict: `dict`, *Required* + +Configurations to update. Available configurations: + +- `name`: `string`, *Optional* + + The revised name of the memory. + + - Basic Multilingual Plane (BMP) only + - Maximum 128 characters, *Optional* + +- `avatar`: `string`, *Optional* + + The updated base64 encoding of the avatar. + + - Maximum 65535 characters + +- `permission`: `enum`, *Optional* + + The updated memory permission. Available options: + + - `"me"`: (Default) Only you can manage the memory. + - `"team"`: All team members can manage the memory. + +- `llm_id`: `string`, *Optional* + + The name of the chat model to use. For example: `"glm-4-flash@ZHIPU-AI"` + + - Maximum 255 characters + - Must follow `model_name@model_factory` format + +- `description`: `string`, *Optional* + + The description of the memory. Defaults to `None`. + +- `memory_size`: `int`, *Optional* + + Defaults to `5*1024*1024` Bytes. Accounts for each message's content + its embedding vector (≈ Content + Dimensions × 8 Bytes). Example: A 1 KB message with 1024-dim embedding uses ~9 KB. The 5 MB default limit holds ~500 such messages. + + - Maximum 10 * 1024 * 1024 Bytes + +- `forgetting_policy`: `enum`, *Optional* + + Evicts existing data based on the chosen policy when the size limit is reached, freeing up space for new messages. Available options: + + - `"FIFO"`: (Default) Prioritize messages with the earliest `forget_at` time for removal. When the pool of messages that have `forget_at` set is insufficient, it falls back to selecting messages in ascending order of their `valid_at` (oldest first). + +- `temperature`: (*Body parameter*), `float`, *Optional* + + Adjusts output randomness. Lower = more deterministic; higher = more creative. + + - Range [0, 1] + +- `system_prompt`: (*Body parameter*), `string`, *Optional* + + Defines the system-level instructions and role for the AI assistant. It is automatically assembled based on the selected `memory_type` by `PromptAssembler` in `memory/utils/prompt_util.py`. This prompt sets the foundational behavior and context for the entire conversation. + + - Keep the `OUTPUT REQUIREMENTS` and `OUTPUT FORMAT` parts unchanged. + +- `user_prompt`: (*Body parameter*), `string`, *Optional* + + Represents the user's custom setting, which is the specific question or instruction the AI needs to respond to directly. Defaults to `None`. + +#### Returns + +- Success: A `memory` object. + +- Failure: `Exception` + +#### Examples + +```python +from ragflow_sdk import Ragflow, Memory +rag_object = RAGFlow(api_key="", base_url="http://:9380") +memory_obejct = Memory(rag_object, {"id": "your memory_id"}) +memory_object.update({"name": "New_name"}) +``` + +--- + + + +### List Memory + +```python +Ragflow.list_memory( + page: int = 1, + page_size: int = 50, + tenant_id: str | list[str] = None, + memory_type: str | list[str] = None, + storage_type: str = None, + keywords: str = None) -> dict +``` + +List memories. + +#### Parameters + +##### page: `int`, *Optional* + +Specifies the page on which the datasets will be displayed. Defaults to `1` + +##### page_size: `int`, *Optional* + +The number of memories on each page. Defaults to `50`. + +##### tenant_id: `str` or `list[str]`, *Optional* + +The owner's ID, supports search multiple IDs. + +##### memory_type: `str` or `list[str]`, *Optional* + +The type of memory (as set during creation). A memory matches if its type is **included in** the provided value(s). Available options: + +- `raw` +- `semantic` +- `episodic` +- `procedural` + +##### storage_type: `str`, *Optional* + +The storage format of messages. Available options: + +- `table`: (Default) + +##### keywords: `str`, *Optional* + +The name of memory to retrieve, supports fuzzy search. + +#### Returns + +Success: A dict of `Memory` object list and total count. + +```json +{"memory_list": list[Memory], "total_count": int} +``` + +Failure: `Exception` + +#### Examples + +``` +from ragflow_sdk import Ragflow, Memory +rag_object = RAGFlow(api_key="", base_url="http://:9380") +rag_obejct.list_memory() +``` + +--- + + + +### Get Memory Config + +```python +Memory.get_config() +``` + +Get the configuration of a specified memory. + +#### Parameters + +None + +#### Returns + +Success: A `Memory` object. + +Failure: `Exception` + +#### Examples + +```python +from ragflow_sdk import Ragflow, Memory +rag_object = RAGFlow(api_key="", base_url="http://:9380") +memory_obejct = Memory(rag_object, {"id": "your memory_id"}) +memory_obejct.get_config() +``` + +--- + + + +### Delete Memory + +```python +Ragflow.delete_memory( + memory_id: str +) -> None +``` + +Delete a specified memory. + +#### Parameters + +##### memory_id: `str`, *Required* + +The ID of the memory. + +#### Returns + +Success: Nothing + +Failure: `Exception` + +#### Examples + +```python +from ragflow_sdk import Ragflow, Memory +rag_object = RAGFlow(api_key="", base_url="http://:9380") +rag_object.delete_memory("your memory_id") +``` + +--- + + + +### List messages of a memory + +```python +Memory.list_memory_messages( + agent_id: str | list[str]=None, + keywords: str=None, + page: int=1, + page_size: int=50 +) -> dict +``` + +List the messages of a specified memory. + +#### Parameters + +##### agent_id: `str` or `list[str]`, *Optional* + +Filters messages by the ID of their source agent. Supports multiple values. + +##### keywords: `str`, *Optional* + +Filters messages by their session ID. This field supports fuzzy search. + +##### page: `int`, *Optional* + +Specifies the page on which the messages will be displayed. Defaults to `1`. + +##### page_size: `int`, *Optional* + +The number of messages on each page. Defaults to `50`. + +#### Returns + +Success: a dict of messages and meta info. + +```json +{"messages": {"message_list": [{message dict}], "total_count": int}, "storage_type": "table"} +``` + +Failure: `Exception` + +#### Examples + +```python +from ragflow_sdk import Ragflow, Memory +rag_object = RAGFlow(api_key="", base_url="http://:9380") +memory_obejct = Memory(rag_object, {"id": "your memory_id"}) +memory_obejct.list_memory_messages() +``` + +--- + + + +### Add Message + +```python +Ragflow.add_message( + memory_id: list[str], + agent_id: str, + session_id: str, + user_input: str, + agent_response: str, + user_id: str = "" +) -> str +``` + +Add a message to specified memories. + +#### Parameters + +##### memory_id: `list[str]`, *Required* + +The IDs of the memories to save messages. + +##### agent_id: `str`, *Required* + +The ID of the message's source agent. + +##### session_id: `str`, *Required* + +The ID of the message's session. + +##### user_input: `str`, *Required* + +The text input provided by the user. + +##### agent_response: `str`, *Required* + +The text response generated by the AI agent. + +##### user_id: `str`, *Optional* + +The user participating in the conversation with the agent. Defaults to `""`. + +#### Returns + +Success: A text `"All add to task."` + +Failure: `Exception` + +#### Examples + +```python +from ragflow_sdk import Ragflow, Memory +rag_object = RAGFlow(api_key="", base_url="http://:9380") +message_payload = { + "memory_id": memory_ids, + "agent_id": agent_id, + "session_id": session_id, + "user_id": "", + "user_input": "Your question here", + "agent_response": """ +Your agent response here +""" +} +client.add_message(**message_payload) +``` + +--- + + + +### Forget Message + +```python +Memory.forget_message(message_id: int) -> bool +``` + +Forget a specified message. After forgetting, this message will not be retrieved by agents, and it will also be prioritized for cleanup by the forgetting policy. + +#### Parameters + +##### message_id: `int`, *Required* + +The ID of the message to forget. + +#### Returns + +Success: True + +Failure: `Exception` + +#### Examples + +```python +from ragflow_sdk import Ragflow, Memory +rag_object = RAGFlow(api_key="", base_url="http://:9380") +memory_object = Memory(rag_object, {"id": "your memory_id"}) +memory_object.forget_message(message_id) +``` + +--- + + + +### Update message status + +```python +Memory.update_message_status(message_id: int, status: bool) -> bool +``` + +Update message status, enable or disable a message. Once a message is disabled, it will not be retrieved by agents. + +#### Parameters + +##### message_id: `int`, *Required* + +The ID of the message to enable or disable. + +##### status: `bool`, *Required* + +The status of message. `True` = `enabled`, `False` = `disabled`. + +#### Returns + +Success: `True` + +Failure: `Exception` + +#### Examples + +```python +from ragflow_sdk import Ragflow, Memory +rag_object = RAGFlow(api_key="", base_url="http://:9380") +memory_object = Memory(rag_object, {"id": "your memory_id"}) +memory_object.update_message_status(message_id, True) +``` + +--- + + + +### Search message + +```python +Ragflow.search_message( + query: str, + memory_id: list[str], + agent_id: str=None, + session_id: str=None, + similarity_threshold: float=0.2, + keywords_similarity_weight: float=0.7, + top_n: int=10 +) -> list[dict] +``` + +Searches and retrieves messages from memory based on the provided `query` and other configuration parameters. + +#### Parameters + +##### query: `str`, *Required* + +The search term or natural language question used to find relevant messages. + +##### memory_id: `list[str]`, *Required* + +The IDs of the memories to search. Supports multiple values. + +##### agent_id: `str`, *Optional* + +The ID of the message's source agent. Defaults to `None`. + +##### session_id: `str`, *Optional* + +The ID of the message's session. Defaults to `None`. + +##### similarity_threshold: `float`, *Optional* + +The minimum cosine similarity score required for a message to be considered a match. A higher value yields more precise but fewer results. Defaults to `0.2`. + +- Range [0.0, 1.0] + +##### keywords_similarity_weight: `float`, *Optional* + +Controls the influence of keyword matching versus semantic (embedding-based) matching in the final relevance score. A value of 0.5 gives them equal weight. Defaults to `0.7`. + +- Range [0.0, 1.0] + +##### top_n: `int`, *Optional* + +The maximum number of most relevant messages to return. This limits the result set size for efficiency. Defaults to `10`. + +#### Returns + +Success: A list of `message` dict. + +Failure: `Exception` + +#### Examples + +```python +from ragflow_sdk import Ragflow +rag_object = RAGFlow(api_key="", base_url="http://:9380") +rag_object.search_message("your question", ["your memory_id"]) +``` + +--- + + + +### Get Recent Messages + +```python +Ragflow.get_recent_messages( + memory_id: list[str], + agent_id: str=None, + session_id: str=None, + limit: int=10 +) -> list[dict] +``` + +Retrieves the most recent messages from specified memories. Typically accepts a `limit` parameter to control the number of messages returned. + +#### Parameters + +##### memory_id: `list[str]`, *Required* + +The IDs of the memories to search. Supports multiple values. + +##### agent_id: `str`, *Optional* + +The ID of the message's source agent. Defaults to `None`. + +##### session_id: `str`, *Optional* + +The ID of the message's session. Defaults to `None`. + +##### limit: `int`, *Optional* + +Control the number of messages returned. Defaults to `10`. + +#### Returns + +Success: A list of `message` dict. + +Failure: `Exception` + +#### Examples + +```python +from ragflow_sdk import Ragflow +rag_object = RAGFlow(api_key="", base_url="http://:9380") +rag_object.get_recent_messages(["your memory_id"]) +``` + +--- + + + +### Get Message Content + +```python +Memory.get_message_content(message_id: int) +``` + +Retrieves the full content and embed vector of a specific message using its unique message ID. + +#### Parameters + +##### message_id: `int`, *Required* + +#### Returns + +Success: A `message` dict. + +Failure: `Exception` + +#### Examples + +```python +from ragflow_sdk import Ragflow +rag_object = RAGFlow(api_key="", base_url="http://:9380") +memory_object = Memory(rag_object, {"id": "your memory_id"}) +memory_object.get_message_content(message_id) +``` + +--- + From fd0a1fde6b88108e6b4f96e0e5f096c85fe4ac1e Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Mon, 12 Jan 2026 19:05:33 +0800 Subject: [PATCH 086/335] Feat: Enhanced metadata functionality (#12560) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What problem does this PR solve? Feat: Enhanced metadata functionality - Metadata filtering supports searching. - Values ​​can be directly modified. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- .../list-filter-bar/filter-field.tsx | 7 +- .../list-filter-bar/filter-popover.tsx | 159 ++++++++++--- web/src/components/list-filter-bar/index.tsx | 1 + .../components/list-filter-bar/interface.ts | 5 +- .../components/metedata/manage-modal.tsx | 214 +++++++++++++----- web/src/pages/dataset/dataset/index.tsx | 1 + .../dataset/dataset/parsing-status-cell.tsx | 13 +- .../dataset/use-dataset-table-columns.tsx | 38 +++- .../dataset/dataset/use-select-filters.ts | 7 +- 9 files changed, 322 insertions(+), 123 deletions(-) diff --git a/web/src/components/list-filter-bar/filter-field.tsx b/web/src/components/list-filter-bar/filter-field.tsx index 8fd4e3bd53f..8a66e33d99e 100644 --- a/web/src/components/list-filter-bar/filter-field.tsx +++ b/web/src/components/list-filter-bar/filter-field.tsx @@ -80,7 +80,7 @@ const FilterItem = memo( } // className="hidden group-hover:block" /> - handleCheckChange({ checked: !field.value?.includes(item.id.toString()), @@ -88,9 +88,10 @@ const FilterItem = memo( item, }) } + className="truncate w-[200px] text-sm font-normal leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 text-text-secondary" > {item.label} - +
    @@ -101,7 +102,7 @@ const FilterItem = memo( ); }, ); - +FilterItem.displayName = 'FilterItem'; export const FilterField = memo( ({ item, diff --git a/web/src/components/list-filter-bar/filter-popover.tsx b/web/src/components/list-filter-bar/filter-popover.tsx index 6b787d1711e..45657a81dfb 100644 --- a/web/src/components/list-filter-bar/filter-popover.tsx +++ b/web/src/components/list-filter-bar/filter-popover.tsx @@ -15,11 +15,17 @@ import { useForm } from 'react-hook-form'; import { z, ZodArray, ZodString } from 'zod'; import { Button } from '@/components/ui/button'; +import { Input } from '@/components/ui/input'; import { Form, FormItem, FormLabel, FormMessage } from '@/components/ui/form'; import { t } from 'i18next'; import { FilterField } from './filter-field'; -import { FilterChange, FilterCollection, FilterValue } from './interface'; +import { + FilterChange, + FilterCollection, + FilterType, + FilterValue, +} from './interface'; export type CheckboxFormMultipleProps = { filters?: FilterCollection[]; @@ -30,6 +36,41 @@ export type CheckboxFormMultipleProps = { filterGroup?: Record; }; +const filterNestedList = ( + list: FilterType[], + searchTerm: string, +): FilterType[] => { + if (!searchTerm) return list; + + const term = searchTerm.toLowerCase(); + + return list + .filter((item) => { + if ( + item.label.toString().toLowerCase().includes(term) || + item.id.toLowerCase().includes(term) + ) { + return true; + } + + if (item.list && item.list.length > 0) { + const filteredSubList = filterNestedList(item.list, searchTerm); + return filteredSubList.length > 0; + } + + return false; + }) + .map((item) => { + if (item.list && item.list.length > 0) { + return { + ...item, + list: filterNestedList(item.list, searchTerm), + }; + } + return item; + }); +}; + function CheckboxFormMultiple({ filters = [], value, @@ -37,21 +78,22 @@ function CheckboxFormMultiple({ setOpen, filterGroup, }: CheckboxFormMultipleProps) { - const [resolvedFilters, setResolvedFilters] = - useState(filters); + // const [resolvedFilters, setResolvedFilters] = + // useState(filters); + const [searchTerms, setSearchTerms] = useState>({}); - useEffect(() => { - if (filters && filters.length > 0) { - setResolvedFilters(filters); - } - }, [filters]); + // useEffect(() => { + // if (filters && filters.length > 0) { + // setResolvedFilters(filters); + // } + // }, [filters]); const fieldsDict = useMemo(() => { - if (resolvedFilters.length === 0) { + if (filters.length === 0) { return {}; } - return resolvedFilters.reduce>((pre, cur) => { + return filters.reduce>((pre, cur) => { const hasNested = cur.list?.some( (item) => item.list && item.list.length > 0, ); @@ -63,14 +105,14 @@ function CheckboxFormMultiple({ } return pre; }, {}); - }, [resolvedFilters]); + }, [filters]); const FormSchema = useMemo(() => { - if (resolvedFilters.length === 0) { + if (filters.length === 0) { return z.object({}); } return z.object( - resolvedFilters.reduce< + filters.reduce< Record< string, ZodArray | z.ZodObject | z.ZodOptional @@ -90,13 +132,10 @@ function CheckboxFormMultiple({ return pre; }, {}), ); - }, [resolvedFilters]); - // const FormSchema = useMemo(() => { - // return z.object({}); - // }, []); + }, [filters]); const form = useForm>({ - resolver: resolvedFilters.length > 0 ? zodResolver(FormSchema) : undefined, + resolver: filters.length > 0 ? zodResolver(FormSchema) : undefined, defaultValues: fieldsDict, }); @@ -112,10 +151,10 @@ function CheckboxFormMultiple({ }, [fieldsDict, onChange, setOpen]); useEffect(() => { - if (resolvedFilters.length > 0) { + if (filters.length > 0) { form.reset(value || fieldsDict); } - }, [form, value, resolvedFilters, fieldsDict]); + }, [form, value, filters, fieldsDict]); const filterList = useMemo(() => { const filterSet = filterGroup @@ -131,6 +170,26 @@ function CheckboxFormMultiple({ return filters.filter((x) => !filterList.includes(x.field)); }, [filterList, filters]); + const handleSearchChange = (field: string, value: string) => { + setSearchTerms((prev) => ({ + ...prev, + [field]: value, + })); + }; + + const getFilteredFilters = (originalFilters: FilterCollection[]) => { + return originalFilters.map((filter) => { + if (filter.canSearch && searchTerms[filter.field]) { + const filteredList = filterNestedList( + filter.list, + searchTerms[filter.field], + ); + return { ...filter, list: filteredList }; + } + return filter; + }); + }; + return (
    { const filterKeys = filterGroup[key]; - const thisFilters = filters.filter((x) => + const originalFilters = filters.filter((x) => filterKeys.includes(x.field), ); + const thisFilters = getFilteredFilters(originalFilters); + return (
    {key}
    {thisFilters.map((x) => ( - +
    + {x.canSearch && ( +
    + + handleSearchChange(x.field, e.target.value) + } + className="h-8" + /> +
    + )} + +
    ))}
    @@ -169,15 +244,29 @@ function CheckboxFormMultiple({ })} {notInfilterGroup && notInfilterGroup.map((x) => { + const filteredItem = getFilteredFilters([x])[0]; + return (
    - - {x.label} - +
    + + {x.label} + + {x.canSearch && ( + + handleSearchChange(x.field, e.target.value) + } + className="h-8 w-32 ml-2" + /> + )} +
    - {x.list?.length && - x.list.map((item) => { + {!!filteredItem.list?.length && + filteredItem.list.map((item) => { return ( | Record> >; - export type FilterChange = (value: FilterValue) => void; diff --git a/web/src/pages/dataset/components/metedata/manage-modal.tsx b/web/src/pages/dataset/components/metedata/manage-modal.tsx index ddecdd68564..790b2f1ea95 100644 --- a/web/src/pages/dataset/components/metedata/manage-modal.tsx +++ b/web/src/pages/dataset/components/metedata/manage-modal.tsx @@ -5,6 +5,7 @@ import { import { EmptyType } from '@/components/empty/constant'; import Empty from '@/components/empty/empty'; import { Button } from '@/components/ui/button'; +import { Input } from '@/components/ui/input'; import { Modal } from '@/components/ui/modal/modal'; import { Table, @@ -25,7 +26,13 @@ import { getSortedRowModel, useReactTable, } from '@tanstack/react-table'; -import { Plus, Settings, Trash2 } from 'lucide-react'; +import { + ListChevronsDownUp, + ListChevronsUpDown, + Plus, + Settings, + Trash2, +} from 'lucide-react'; import { useCallback, useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useHandleMenuClick } from '../../sidebar/hooks'; @@ -61,6 +68,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => { values: [], }); + const [expanded, setExpanded] = useState(true); const [currentValueIndex, setCurrentValueIndex] = useState(0); const [deleteDialogContent, setDeleteDialogContent] = useState({ visible: false, @@ -70,6 +78,11 @@ export const ManageMetadataModal = (props: IManageModalProps) => { onOk: () => {}, onCancel: () => {}, }); + const [editingValue, setEditingValue] = useState<{ + field: string; + value: string; + newValue: string; + } | null>(null); const { tableData, @@ -81,6 +94,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => { addDeleteValue, } = useManageMetaDataModal(originalTableData, metadataType, otherData); const { handleMenuClick } = useHandleMenuClick(); + const [shouldSave, setShouldSave] = useState(false); const { visible: manageValuesVisible, showModal: showManageValuesModal, @@ -96,6 +110,32 @@ export const ManageMetadataModal = (props: IManageModalProps) => { onCancel: () => {}, }); }; + + const handleEditValue = (field: string, value: string) => { + setEditingValue({ field, value, newValue: value }); + }; + + const saveEditedValue = useCallback(() => { + if (editingValue) { + setTableData((prev) => { + return prev.map((row) => { + if (row.field === editingValue.field) { + const updatedValues = row.values.map((v) => + v === editingValue.value ? editingValue.newValue : v, + ); + return { ...row, values: updatedValues }; + } + return row; + }); + }); + setEditingValue(null); + setShouldSave(true); + } + }, [editingValue, setTableData]); + + const cancelEditValue = () => { + setEditingValue(null); + }; const handAddValueRow = () => { setValueData({ field: '', @@ -136,66 +176,119 @@ export const ManageMetadataModal = (props: IManageModalProps) => { }, { accessorKey: 'values', - header: () => {t('knowledgeDetails.metadata.values')}, + header: () => ( +
    + {t('knowledgeDetails.metadata.values')} +
    { + setExpanded(!expanded); + }} + > + {expanded ? ( + + ) : ( + + )} + {expanded} +
    +
    + ), cell: ({ row }) => { const values = row.getValue('values') as Array; + + if (!Array.isArray(values) || values.length === 0) { + return
    ; + } + + const displayedValues = expanded ? values : values.slice(0, 2); + const hasMore = Array.isArray(values) && values.length > 2; + return ( -
    - {Array.isArray(values) && - values.length > 0 && - values - .filter((value: string, index: number) => index < 2) - ?.map((value: string) => { - return ( - - )} -
    - - ); - })} - {Array.isArray(values) && values.length > 2 && ( -
    ...
    - )} +
    +
    + {displayedValues?.map((value: string) => { + const isEditing = + editingValue && + editingValue.field === row.getValue('field') && + editingValue.value === value; + + return isEditing ? ( +
    + + setEditingValue({ + ...editingValue, + newValue: e.target.value, + }) + } + onBlur={saveEditedValue} + onKeyDown={(e) => { + if (e.key === 'Enter') { + saveEditedValue(); + } else if (e.key === 'Escape') { + cancelEditValue(); + } + }} + autoFocus + // className="text-sm min-w-20 max-w-32 outline-none bg-transparent px-1 py-0.5" + /> +
    + ) : ( + + )} +
    + + ); + })} + {hasMore && !expanded && ( +
    ...
    + )} +
    ); }, @@ -260,6 +353,9 @@ export const ManageMetadataModal = (props: IManageModalProps) => { isDeleteSingleValue, handleEditValueRow, metadataType, + expanded, + editingValue, + saveEditedValue, ]); const table = useReactTable({ @@ -271,7 +367,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => { getFilteredRowModel: getFilteredRowModel(), manualPagination: true, }); - const [shouldSave, setShouldSave] = useState(false); + const handleSaveValues = (data: IMetaDataTableData) => { setTableData((prev) => { let newData; diff --git a/web/src/pages/dataset/dataset/index.tsx b/web/src/pages/dataset/dataset/index.tsx index e023d1696cb..6853c6c7239 100644 --- a/web/src/pages/dataset/dataset/index.tsx +++ b/web/src/pages/dataset/dataset/index.tsx @@ -127,6 +127,7 @@ export default function Dataset() { type: MetadataType.Manage, isCanAdd: false, isEditField: true, + isDeleteSingleValue: true, title: (
    diff --git a/web/src/pages/dataset/dataset/parsing-status-cell.tsx b/web/src/pages/dataset/dataset/parsing-status-cell.tsx index d6a9deb8f6e..9ac7fc82de4 100644 --- a/web/src/pages/dataset/dataset/parsing-status-cell.tsx +++ b/web/src/pages/dataset/dataset/parsing-status-cell.tsx @@ -21,7 +21,6 @@ import { ParsingCard } from './parsing-card'; import { ReparseDialog } from './reparse-dialog'; import { UseChangeDocumentParserShowType } from './use-change-document-parser'; import { useHandleRunDocumentByIds } from './use-run-document'; -import { UseSaveMetaShowType } from './use-save-meta'; import { isParserRunning } from './utils'; const IconMap = { [RunningStatus.UNSTART]: ( @@ -44,13 +43,12 @@ const IconMap = { export function ParsingStatusCell({ record, showChangeParserModal, - showSetMetaModal, + // showSetMetaModal, showLog, }: { record: IDocumentInfo; showLog: (record: IDocumentInfo) => void; -} & UseChangeDocumentParserShowType & - UseSaveMetaShowType) { +} & UseChangeDocumentParserShowType) { const { t } = useTranslation(); const { run, @@ -83,10 +81,6 @@ export function ParsingStatusCell({ showChangeParserModal(record); }, [record, showChangeParserModal]); - const handleShowSetMetaModal = useCallback(() => { - showSetMetaModal(record); - }, [record, showSetMetaModal]); - const showParse = useMemo(() => { return record.type !== DocumentType.Virtual; }, [record]); @@ -124,9 +118,6 @@ export function ParsingStatusCell({ {t('knowledgeDetails.dataPipeline')} - - {t('knowledgeDetails.setMetaData')} -
    diff --git a/web/src/pages/dataset/dataset/use-dataset-table-columns.tsx b/web/src/pages/dataset/dataset/use-dataset-table-columns.tsx index ce877ed1fe5..c3e1e4aa870 100644 --- a/web/src/pages/dataset/dataset/use-dataset-table-columns.tsx +++ b/web/src/pages/dataset/dataset/use-dataset-table-columns.tsx @@ -172,17 +172,18 @@ export function useDatasetTableColumns({ ), }, { - accessorKey: 'run', - header: t('Parse'), - // meta: { cellClassName: 'min-w-[20vw]' }, + accessorKey: 'meta_fields', + header: t('metadata.metadata'), cell: ({ row }) => { + const length = Object.keys(row.getValue('meta_fields') || {}).length; return ( - +
    { showManageMetadataModal({ - metadata: util.JSONToMetaDataTableData(row.meta_fields || {}), + metadata: util.JSONToMetaDataTableData( + row.original.meta_fields || {}, + ), isCanAdd: true, type: MetadataType.UpdateSingle, record: row, @@ -193,13 +194,28 @@ export function useDatasetTableColumns({
    {t('metadata.editMetadataForDataset')} - {row.name} + {row.original.name}
    ), isDeleteSingleValue: true, - }) - } + }); + }} + > + {length + ' fields'} + + ); + }, + }, + { + accessorKey: 'run', + header: t('Parse'), + // meta: { cellClassName: 'min-w-[20vw]' }, + cell: ({ row }) => { + return ( + ); diff --git a/web/src/pages/dataset/dataset/use-select-filters.ts b/web/src/pages/dataset/dataset/use-select-filters.ts index e5497182c70..2c759676987 100644 --- a/web/src/pages/dataset/dataset/use-select-filters.ts +++ b/web/src/pages/dataset/dataset/use-select-filters.ts @@ -72,7 +72,12 @@ export function useSelectDatasetFilters() { return [ { field: 'type', label: 'File Type', list: fileTypes }, { field: 'run', label: 'Status', list: fileStatus }, - { field: 'metadata', label: 'Metadata field', list: metaDataList }, + { + field: 'metadata', + label: 'Metadata field', + canSearch: true, + list: metaDataList, + }, ] as FilterCollection[]; }, [fileStatus, fileTypes, metaDataList]); From 867ec942586103899cae42250e5ce1458056c395 Mon Sep 17 00:00:00 2001 From: Jimmy Ben Klieve Date: Tue, 13 Jan 2026 09:41:02 +0800 Subject: [PATCH 087/335] revert white-space changes in docs (#12557) ### What problem does this PR solve? Trailing white-spaces in commit 6814ace1aa1d449b792f2a87d5ee5686e41b3081 got automatically trimmed by code editor may causes documentation typesetting broken. Mostly for double spaces for soft line breaks. ### Type of change - [x] Documentation Update --- docs/basics/rag.md | 12 +- docs/configurations.md | 1 - docs/contribution/contributing.md | 3 +- docs/develop/acquire_ragflow_api_key.md | 1 - docs/develop/build_docker_image.mdx | 1 - docs/develop/launch_ragflow_from_source.md | 11 +- docs/develop/mcp/launch_mcp_server.md | 61 +- docs/develop/mcp/mcp_client_example.md | 5 +- docs/develop/mcp/mcp_tools.md | 1 - docs/develop/switch_doc_engine.md | 1 - docs/faq.mdx | 27 +- docs/guides/admin/admin_cli.md | 5 +- docs/guides/admin/admin_service.md | 4 +- docs/guides/admin/admin_ui.md | 1 - .../agent/agent_component_reference/agent.mdx | 29 +- .../await_response.mdx | 11 +- .../agent/agent_component_reference/begin.mdx | 9 +- .../agent_component_reference/categorize.mdx | 27 +- .../chunker_title.md | 3 +- .../chunker_token.md | 1 - .../agent/agent_component_reference/code.mdx | 23 +- .../agent_component_reference/execute_sql.md | 3 +- .../agent/agent_component_reference/http.md | 3 +- .../agent_component_reference/indexer.md | 1 - .../agent_component_reference/iteration.mdx | 11 +- .../agent_component_reference/message.mdx | 1 - .../agent/agent_component_reference/parser.md | 5 +- .../agent_component_reference/retrieval.mdx | 9 +- .../agent_component_reference/switch.mdx | 11 +- .../text_processing.mdx | 3 +- .../agent_component_reference/transformer.md | 19 +- docs/guides/agent/agent_introduction.md | 5 +- docs/guides/agent/embed_agent_into_webpage.md | 1 - docs/guides/agent/sandbox_quickstart.md | 5 +- docs/guides/ai_search.md | 3 +- docs/guides/chat/implement_deep_research.md | 1 - docs/guides/chat/set_chat_variables.md | 7 +- docs/guides/chat/start_chat.md | 15 +- .../add_data_source/add_google_drive.md | 15 +- docs/guides/dataset/auto_metadata.md | 1 - .../dataset/autokeyword_autoquestion.mdx | 17 +- .../configure_child_chunking_strategy.md | 1 - .../dataset/configure_knowledge_base.md | 25 +- .../dataset/construct_knowledge_graph.md | 9 +- docs/guides/dataset/enable_excel2html.md | 1 - docs/guides/dataset/enable_raptor.md | 7 +- .../dataset/extract_table_of_contents.md | 3 +- docs/guides/dataset/manage_metadata.md | 3 +- docs/guides/dataset/run_retrieval_test.md | 7 +- docs/guides/dataset/select_pdf_parser.md | 5 +- docs/guides/dataset/set_context_window.md | 1 - docs/guides/dataset/set_metadata.md | 1 - docs/guides/dataset/set_page_rank.md | 1 - docs/guides/dataset/use_tag_sets.md | 11 +- docs/guides/manage_files.md | 15 +- docs/guides/models/deploy_local_llm.mdx | 31 +- docs/guides/models/llm_api_key_setup.md | 3 +- docs/guides/team/join_or_leave_team.md | 1 - docs/guides/team/manage_team_members.md | 1 - docs/guides/team/share_agents.md | 3 +- docs/guides/team/share_chat_assistant.md | 1 - docs/guides/team/share_knowledge_bases.md | 1 - docs/guides/team/share_model.md | 1 - docs/guides/tracing.mdx | 27 +- docs/guides/upgrade_ragflow.mdx | 1 - docs/quickstart.mdx | 41 +- docs/references/glossary.mdx | 1 - docs/references/http_api_reference.md | 577 +++++++++--------- docs/references/python_api_reference.md | 219 ++++--- docs/references/supported_models.mdx | 1 - docs/release_notes.md | 19 +- 71 files changed, 660 insertions(+), 731 deletions(-) diff --git a/docs/basics/rag.md b/docs/basics/rag.md index fc7025a3806..eac65702a47 100644 --- a/docs/basics/rag.md +++ b/docs/basics/rag.md @@ -86,22 +86,22 @@ They are highly consistent at the technical base (e.g., vector retrieval, keywor RAG has demonstrated clear value in several typical scenarios: -1. Enterprise Knowledge Q&A and Internal Search +1. Enterprise Knowledge Q&A and Internal Search By vectorizing corporate private data and combining it with an LLM, RAG can directly return natural language answers based on authoritative sources, rather than document lists. While meeting intelligent Q&A needs, it inherently aligns with corporate requirements for data security, access control, and compliance. -2. Complex Document Understanding and Professional Q&A +2. Complex Document Understanding and Professional Q&A For structurally complex documents like contracts and regulations, the value of RAG lies in its ability to generate accurate, verifiable answers while maintaining context integrity. Its system accuracy largely depends on text chunking and semantic understanding strategies. -3. Dynamic Knowledge Fusion and Decision Support +3. Dynamic Knowledge Fusion and Decision Support In business scenarios requiring the synthesis of information from multiple sources, RAG evolves into a knowledge orchestration and reasoning support system for business decisions. Through a multi-path recall mechanism, it fuses knowledge from different systems and formats, maintaining factual consistency and logical controllability during the generation phase. ## The future of RAG The evolution of RAG is unfolding along several clear paths: -1. RAG as the data foundation for Agents +1. RAG as the data foundation for Agents RAG and agents have an architecture vs. scenario relationship. For agents to achieve autonomous and reliable decision-making and execution, they must rely on accurate and timely knowledge. RAG provides them with a standardized capability to access private domain knowledge and is an inevitable choice for building knowledge-aware agents. -2. Advanced RAG: Using LLMs to optimize retrieval itself +2. Advanced RAG: Using LLMs to optimize retrieval itself The core feature of next-generation RAG is fully utilizing the reasoning capabilities of LLMs to optimize the retrieval process, such as rewriting queries, summarizing or fusing results, or implementing intelligent routing. Empowering every aspect of retrieval with LLMs is key to breaking through current performance bottlenecks. -3. Towards context engineering 2.0 +3. Towards context engineering 2.0 Current RAG can be viewed as Context Engineering 1.0, whose core is assembling static knowledge context for single Q&A tasks. The forthcoming Context Engineering 2.0 will extend with RAG technology at its core, becoming a system that automatically and dynamically assembles comprehensive context for agents. The context fused by this system will come not only from documents but also include interaction memory, available tools/skills, and real-time environmental information. This marks the transition of agent development from a "handicraft workshop" model to the industrial starting point of automated context engineering. The essence of RAG is to build a dedicated, efficient, and trustworthy external data interface for large language models; its core is Retrieval, not Generation. Starting from the practical need to solve private data access, its technical depth is reflected in the optimization of retrieval for complex unstructured data. With its deep integration into agent architectures and its development towards automated context engineering, RAG is evolving from a technology that improves Q&A quality into the core infrastructure for building the next generation of trustworthy, controllable, and scalable intelligent applications. diff --git a/docs/configurations.md b/docs/configurations.md index 565354d6cf7..a993061e3ef 100644 --- a/docs/configurations.md +++ b/docs/configurations.md @@ -5,7 +5,6 @@ sidebar_custom_props: { sidebarIcon: LucideCog } --- - # Configuration Configurations for deploying RAGFlow via Docker. diff --git a/docs/contribution/contributing.md b/docs/contribution/contributing.md index 53d5d08394a..39b5e1a5503 100644 --- a/docs/contribution/contributing.md +++ b/docs/contribution/contributing.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideBookA } --- - # Contribution guidelines General guidelines for RAGFlow's community contributors. @@ -35,7 +34,7 @@ The list below mentions some contributions you can make, but it is not a complet 1. Fork our GitHub repository. 2. Clone your fork to your local machine: `git clone git@github.com:/ragflow.git` -3. Create a local branch: +3. Create a local branch: `git checkout -b my-branch` 4. Provide sufficient information in your commit message `git commit -m 'Provide sufficient info in your commit message'` diff --git a/docs/develop/acquire_ragflow_api_key.md b/docs/develop/acquire_ragflow_api_key.md index fec9f6da388..c01b86bf70b 100644 --- a/docs/develop/acquire_ragflow_api_key.md +++ b/docs/develop/acquire_ragflow_api_key.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideKey } --- - # Acquire RAGFlow API key An API key is required for the RAGFlow server to authenticate your HTTP/Python or MCP requests. This documents provides instructions on obtaining a RAGFlow API key. diff --git a/docs/develop/build_docker_image.mdx b/docs/develop/build_docker_image.mdx index 3a1ef350617..db70dec216a 100644 --- a/docs/develop/build_docker_image.mdx +++ b/docs/develop/build_docker_image.mdx @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucidePackage } --- - # Build RAGFlow Docker image import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; diff --git a/docs/develop/launch_ragflow_from_source.md b/docs/develop/launch_ragflow_from_source.md index 11510f71767..095d493edf8 100644 --- a/docs/develop/launch_ragflow_from_source.md +++ b/docs/develop/launch_ragflow_from_source.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideMonitorPlay } --- - # Launch service from source A guide explaining how to set up a RAGFlow service from its source code. By following this guide, you'll be able to debug using the source code. @@ -39,7 +38,7 @@ cd ragflow/ ### Install Python dependencies 1. Install uv: - + ```bash pipx install uv ``` @@ -91,13 +90,13 @@ docker compose -f docker/docker-compose-base.yml up -d ``` 3. **Optional:** If you cannot access HuggingFace, set the HF_ENDPOINT environment variable to use a mirror site: - + ```bash export HF_ENDPOINT=https://hf-mirror.com ``` 4. Check the configuration in **conf/service_conf.yaml**, ensuring all hosts and ports are correctly set. - + 5. Run the **entrypoint.sh** script to launch the backend service: ```shell @@ -126,10 +125,10 @@ docker compose -f docker/docker-compose-base.yml up -d 3. Start up the RAGFlow frontend service: ```bash - npm run dev + npm run dev ``` - *The following message appears, showing the IP address and port number of your frontend service:* + *The following message appears, showing the IP address and port number of your frontend service:* ![](https://github.com/user-attachments/assets/0daf462c-a24d-4496-a66f-92533534e187) diff --git a/docs/develop/mcp/launch_mcp_server.md b/docs/develop/mcp/launch_mcp_server.md index e3a27e07146..72a23aca19e 100644 --- a/docs/develop/mcp/launch_mcp_server.md +++ b/docs/develop/mcp/launch_mcp_server.md @@ -5,20 +5,19 @@ sidebar_custom_props: { categoryIcon: LucideTvMinimalPlay } --- - # Launch RAGFlow MCP server Launch an MCP server from source or via Docker. --- -A RAGFlow Model Context Protocol (MCP) server is designed as an independent component to complement the RAGFlow server. Note that an MCP server must operate alongside a properly functioning RAGFlow server. +A RAGFlow Model Context Protocol (MCP) server is designed as an independent component to complement the RAGFlow server. Note that an MCP server must operate alongside a properly functioning RAGFlow server. -An MCP server can start up in either self-host mode (default) or host mode: +An MCP server can start up in either self-host mode (default) or host mode: -- **Self-host mode**: +- **Self-host mode**: When launching an MCP server in self-host mode, you must provide an API key to authenticate the MCP server with the RAGFlow server. In this mode, the MCP server can access *only* the datasets of a specified tenant on the RAGFlow server. -- **Host mode**: +- **Host mode**: In host mode, each MCP client can access their own datasets on the RAGFlow server. However, each client request must include a valid API key to authenticate the client with the RAGFlow server. Once a connection is established, an MCP server communicates with its client in MCP HTTP+SSE (Server-Sent Events) mode, unidirectionally pushing responses from the RAGFlow server to its client in real time. @@ -32,9 +31,9 @@ Once a connection is established, an MCP server communicates with its client in If you wish to try out our MCP server without upgrading RAGFlow, community contributor [yiminghub2024](https://github.com/yiminghub2024) 👏 shares their recommended steps [here](#launch-an-mcp-server-without-upgrading-ragflow). ::: -## Launch an MCP server +## Launch an MCP server -You can start an MCP server either from source code or via Docker. +You can start an MCP server either from source code or via Docker. ### Launch from source code @@ -51,7 +50,7 @@ uv run mcp/server/server.py --host=127.0.0.1 --port=9382 --base-url=http://127.0 # uv run mcp/server/server.py --host=127.0.0.1 --port=9382 --base-url=http://127.0.0.1:9380 --mode=host ``` -Where: +Where: - `host`: The MCP server's host address. - `port`: The MCP server's listening port. @@ -97,7 +96,7 @@ The MCP server is designed as an optional component that complements the RAGFlow # - --no-json-response # Disables JSON responses for the streamable-HTTP transport ``` -Where: +Where: - `mcp-host`: The MCP server's host address. - `mcp-port`: The MCP server's listening port. @@ -122,13 +121,13 @@ Run `docker compose -f docker-compose.yml up` to launch the RAGFlow server toget docker-ragflow-cpu-1 | Starting MCP Server on 0.0.0.0:9382 with base URL http://127.0.0.1:9380... docker-ragflow-cpu-1 | Starting 1 task executor(s) on host 'dd0b5e07e76f'... docker-ragflow-cpu-1 | 2025-04-18 15:41:18,816 INFO 27 ragflow_server log path: /ragflow/logs/ragflow_server.log, log levels: {'peewee': 'WARNING', 'pdfminer': 'WARNING', 'root': 'INFO'} - docker-ragflow-cpu-1 | + docker-ragflow-cpu-1 | docker-ragflow-cpu-1 | __ __ ____ ____ ____ _____ ______ _______ ____ docker-ragflow-cpu-1 | | \/ |/ ___| _ \ / ___|| ____| _ \ \ / / ____| _ \ docker-ragflow-cpu-1 | | |\/| | | | |_) | \___ \| _| | |_) \ \ / /| _| | |_) | docker-ragflow-cpu-1 | | | | | |___| __/ ___) | |___| _ < \ V / | |___| _ < docker-ragflow-cpu-1 | |_| |_|\____|_| |____/|_____|_| \_\ \_/ |_____|_| \_\ - docker-ragflow-cpu-1 | + docker-ragflow-cpu-1 | docker-ragflow-cpu-1 | MCP launch mode: self-host docker-ragflow-cpu-1 | MCP host: 0.0.0.0 docker-ragflow-cpu-1 | MCP port: 9382 @@ -141,13 +140,13 @@ Run `docker compose -f docker-compose.yml up` to launch the RAGFlow server toget docker-ragflow-cpu-1 | 2025-04-18 15:41:23,263 INFO 27 init database on cluster mode successfully docker-ragflow-cpu-1 | 2025-04-18 15:41:25,318 INFO 27 load_model /ragflow/rag/res/deepdoc/det.onnx uses CPU docker-ragflow-cpu-1 | 2025-04-18 15:41:25,367 INFO 27 load_model /ragflow/rag/res/deepdoc/rec.onnx uses CPU - docker-ragflow-cpu-1 | ____ ___ ______ ______ __ + docker-ragflow-cpu-1 | ____ ___ ______ ______ __ docker-ragflow-cpu-1 | / __ \ / | / ____// ____// /____ _ __ docker-ragflow-cpu-1 | / /_/ // /| | / / __ / /_ / // __ \| | /| / / - docker-ragflow-cpu-1 | / _, _// ___ |/ /_/ // __/ / // /_/ /| |/ |/ / - docker-ragflow-cpu-1 | /_/ |_|/_/ |_|\____//_/ /_/ \____/ |__/|__/ - docker-ragflow-cpu-1 | - docker-ragflow-cpu-1 | + docker-ragflow-cpu-1 | / _, _// ___ |/ /_/ // __/ / // /_/ /| |/ |/ / + docker-ragflow-cpu-1 | /_/ |_|/_/ |_|\____//_/ /_/ \____/ |__/|__/ + docker-ragflow-cpu-1 | + docker-ragflow-cpu-1 | docker-ragflow-cpu-1 | 2025-04-18 15:41:29,088 INFO 27 RAGFlow version: v0.18.0-285-gb2c299fa full docker-ragflow-cpu-1 | 2025-04-18 15:41:29,088 INFO 27 project base: /ragflow docker-ragflow-cpu-1 | 2025-04-18 15:41:29,088 INFO 27 Current configs, from /ragflow/conf/service_conf.yaml: @@ -156,12 +155,12 @@ Run `docker compose -f docker-compose.yml up` to launch the RAGFlow server toget docker-ragflow-cpu-1 | * Running on all addresses (0.0.0.0) docker-ragflow-cpu-1 | * Running on http://127.0.0.1:9380 docker-ragflow-cpu-1 | * Running on http://172.19.0.6:9380 - docker-ragflow-cpu-1 | ______ __ ______ __ + docker-ragflow-cpu-1 | ______ __ ______ __ docker-ragflow-cpu-1 | /_ __/___ ______/ /__ / ____/ _____ _______ __/ /_____ _____ docker-ragflow-cpu-1 | / / / __ `/ ___/ //_/ / __/ | |/_/ _ \/ ___/ / / / __/ __ \/ ___/ - docker-ragflow-cpu-1 | / / / /_/ (__ ) ,< / /____> 9200/tcp, :::9200->9200/tcp ragflow-es-01 @@ -371,7 +370,7 @@ Yes, we do. See the Python files under the **rag/app** folder. $ docker ps ``` - *The status of a healthy Elasticsearch component should look as follows:* + *The status of a healthy Elasticsearch component should look as follows:* ```bash cd29bcb254bc quay.io/minio/minio:RELEASE.2023-12-20T01-00-02Z "/usr/bin/docker-ent…" 2 weeks ago Up 11 hours 0.0.0.0:9001->9001/tcp, :::9001->9001/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp ragflow-minio @@ -454,7 +453,7 @@ See [Upgrade RAGFlow](./guides/upgrade_ragflow.mdx) for more information. To switch your document engine from Elasticsearch to [Infinity](https://github.com/infiniflow/infinity): -1. Stop all running containers: +1. Stop all running containers: ```bash $ docker compose -f docker/docker-compose.yml down -v @@ -464,7 +463,7 @@ To switch your document engine from Elasticsearch to [Infinity](https://github.c ::: 2. In **docker/.env**, set `DOC_ENGINE=${DOC_ENGINE:-infinity}` -3. Restart your Docker image: +3. Restart your Docker image: ```bash $ docker compose -f docker-compose.yml up -d @@ -509,12 +508,12 @@ From v0.22.0 onwards, RAGFlow includes MinerU (≥ 2.6.3) as an optional PDF pa - `"vlm-mlx-engine"` - `"vlm-vllm-async-engine"` - `"vlm-lmdeploy-engine"`. - - `MINERU_SERVER_URL`: (optional) The downstream vLLM HTTP server (e.g., `http://vllm-host:30000`). Applicable when `MINERU_BACKEND` is set to `"vlm-http-client"`. + - `MINERU_SERVER_URL`: (optional) The downstream vLLM HTTP server (e.g., `http://vllm-host:30000`). Applicable when `MINERU_BACKEND` is set to `"vlm-http-client"`. - `MINERU_OUTPUT_DIR`: (optional) The local directory for holding the outputs of the MinerU API service (zip/JSON) before ingestion. - `MINERU_DELETE_OUTPUT`: Whether to delete temporary output when a temporary directory is used: - `1`: Delete. - `0`: Retain. -3. In the web UI, navigate to your dataset's **Configuration** page and find the **Ingestion pipeline** section: +3. In the web UI, navigate to your dataset's **Configuration** page and find the **Ingestion pipeline** section: - If you decide to use a chunking method from the **Built-in** dropdown, ensure it supports PDF parsing, then select **MinerU** from the **PDF parser** dropdown. - If you use a custom ingestion pipeline instead, select **MinerU** in the **PDF parser** section of the **Parser** component. diff --git a/docs/guides/admin/admin_cli.md b/docs/guides/admin/admin_cli.md index d03afc6f212..a8a7f0983d6 100644 --- a/docs/guides/admin/admin_cli.md +++ b/docs/guides/admin/admin_cli.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideSquareTerminal } --- - # Admin CLI The RAGFlow Admin CLI is a command-line-based system administration tool that offers administrators an efficient and flexible method for system interaction and control. Operating on a client-server architecture, it communicates in real-time with the Admin Service, receiving administrator commands and dynamically returning execution results. @@ -30,9 +29,9 @@ The RAGFlow Admin CLI is a command-line-based system administration tool that of The default password is admin. **Parameters:** - + - -h: RAGFlow admin server host address - + - -p: RAGFlow admin server port ## Default administrative account diff --git a/docs/guides/admin/admin_service.md b/docs/guides/admin/admin_service.md index 52162a5b11b..35ecabae938 100644 --- a/docs/guides/admin/admin_service.md +++ b/docs/guides/admin/admin_service.md @@ -5,8 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideActivity } --- - - # Admin Service The Admin Service is the core backend management service of the RAGFlow system, providing comprehensive system administration capabilities through centralized API interfaces for managing and controlling the entire platform. Adopting a client-server architecture, it supports access and operations via both a Web UI and an Admin CLI, ensuring flexible and efficient execution of administrative tasks. @@ -27,7 +25,7 @@ With its unified interface design, the Admin Service combines the convenience of python admin/server/admin_server.py ``` - The service will start and listen for incoming connections from the CLI on the configured port. + The service will start and listen for incoming connections from the CLI on the configured port. ### Using docker image diff --git a/docs/guides/admin/admin_ui.md b/docs/guides/admin/admin_ui.md index 67786421e1f..9584bb8cfc7 100644 --- a/docs/guides/admin/admin_ui.md +++ b/docs/guides/admin/admin_ui.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucidePalette } --- - # Admin UI The RAGFlow Admin UI is a web-based interface that provides comprehensive system status monitoring and user management capabilities. diff --git a/docs/guides/agent/agent_component_reference/agent.mdx b/docs/guides/agent/agent_component_reference/agent.mdx index 29b0e0d697c..7a220739376 100644 --- a/docs/guides/agent/agent_component_reference/agent.mdx +++ b/docs/guides/agent/agent_component_reference/agent.mdx @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: RagAiAgent } --- - # Agent component The component equipped with reasoning, tool usage, and multi-agent collaboration capabilities. @@ -19,7 +18,7 @@ An **Agent** component fine-tunes the LLM and sets its prompt. From v0.20.5 onwa ## Scenarios -An **Agent** component is essential when you need the LLM to assist with summarizing, translating, or controlling various tasks. +An **Agent** component is essential when you need the LLM to assist with summarizing, translating, or controlling various tasks. ## Prerequisites @@ -31,13 +30,13 @@ An **Agent** component is essential when you need the LLM to assist with summari ## Quickstart -### 1. Click on an **Agent** component to show its configuration panel +### 1. Click on an **Agent** component to show its configuration panel The corresponding configuration panel appears to the right of the canvas. Use this panel to define and fine-tune the **Agent** component's behavior. ### 2. Select your model -Click **Model**, and select a chat model from the dropdown menu. +Click **Model**, and select a chat model from the dropdown menu. :::tip NOTE If no model appears, check if your have added a chat model on the **Model providers** page. @@ -58,7 +57,7 @@ In this quickstart, we assume your **Agent** component is used standalone (witho ### 5. Skip Tools and Agent -The **+ Add tools** and **+ Add agent** sections are used *only* when you need to configure your **Agent** component as a planner (with tools or sub-Agents beneath). In this quickstart, we assume your **Agent** component is used standalone (without tools or sub-Agents beneath). +The **+ Add tools** and **+ Add agent** sections are used *only* when you need to configure your **Agent** component as a planner (with tools or sub-Agents beneath). In this quickstart, we assume your **Agent** component is used standalone (without tools or sub-Agents beneath). ### 6. Choose the next component @@ -74,7 +73,7 @@ In this section, we assume your **Agent** will be configured as a planner, with ![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/mcp_page.jpg) -### 2. Configure your Tavily MCP server +### 2. Configure your Tavily MCP server Update your MCP server's name, URL (including the API key), server type, and other necessary settings. When configured correctly, the available tools will be displayed. @@ -113,7 +112,7 @@ On the canvas, click the newly-populated Tavily server to view and select its av Click the dropdown menu of **Model** to show the model configuration window. -- **Model**: The chat model to use. +- **Model**: The chat model to use. - Ensure you set the chat model correctly on the **Model providers** page. - You can use different models for different components to increase flexibility or improve overall performance. - **Creativity**: A shortcut to **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty** settings, indicating the freedom level of the model. From **Improvise**, **Precise**, to **Balance**, each preset configuration corresponds to a unique combination of **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty**. @@ -121,21 +120,21 @@ Click the dropdown menu of **Model** to show the model configuration window. - **Improvise**: Produces more creative responses. - **Precise**: (Default) Produces more conservative responses. - **Balance**: A middle ground between **Improvise** and **Precise**. -- **Temperature**: The randomness level of the model's output. +- **Temperature**: The randomness level of the model's output. Defaults to 0.1. - Lower values lead to more deterministic and predictable outputs. - Higher values lead to more creative and varied outputs. - A temperature of zero results in the same output for the same prompt. -- **Top P**: Nucleus sampling. +- **Top P**: Nucleus sampling. - Reduces the likelihood of generating repetitive or unnatural text by setting a threshold *P* and restricting the sampling to tokens with a cumulative probability exceeding *P*. - Defaults to 0.3. -- **Presence penalty**: Encourages the model to include a more diverse range of tokens in the response. +- **Presence penalty**: Encourages the model to include a more diverse range of tokens in the response. - A higher **presence penalty** value results in the model being more likely to generate tokens not yet been included in the generated text. - Defaults to 0.4. -- **Frequency penalty**: Discourages the model from repeating the same words or phrases too frequently in the generated text. +- **Frequency penalty**: Discourages the model from repeating the same words or phrases too frequently in the generated text. - A higher **frequency penalty** value results in the model being more conservative in its use of repeated tokens. - Defaults to 0.7. -- **Max tokens**: +- **Max tokens**: This sets the maximum length of the model's output, measured in the number of tokens (words or pieces of words). It is disabled by default, allowing the model to determine the number of tokens in its responses. :::tip NOTE @@ -145,7 +144,7 @@ Click the dropdown menu of **Model** to show the model configuration window. ### System prompt -Typically, you use the system prompt to describe the task for the LLM, specify how it should respond, and outline other miscellaneous requirements. We do not plan to elaborate on this topic, as it can be as extensive as prompt engineering. However, please be aware that the system prompt is often used in conjunction with keys (variables), which serve as various data inputs for the LLM. +Typically, you use the system prompt to describe the task for the LLM, specify how it should respond, and outline other miscellaneous requirements. We do not plan to elaborate on this topic, as it can be as extensive as prompt engineering. However, please be aware that the system prompt is often used in conjunction with keys (variables), which serve as various data inputs for the LLM. An **Agent** component relies on keys (variables) to specify its data inputs. Its immediate upstream component is *not* necessarily its data input, and the arrows in the workflow indicate *only* the processing sequence. Keys in a **Agent** component are used in conjunction with the system prompt to specify data inputs for the LLM. Use a forward slash `/` or the **(x)** button to show the keys to use. @@ -193,11 +192,11 @@ From v0.20.5 onwards, four framework-level prompt blocks are available in the ** The user-defined prompt. Defaults to `sys.query`, the user query. As a general rule, when using the **Agent** component as a standalone module (not as a planner), you usually need to specify the corresponding **Retrieval** component’s output variable (`formalized_content`) here as part of the input to the LLM. -### Tools +### Tools You can use an **Agent** component as a collaborator that reasons and reflects with the aid of other tools; for instance, **Retrieval** can serve as one such tool for an **Agent**. -### Agent +### Agent You use an **Agent** component as a collaborator that reasons and reflects with the aid of subagents or other tools, forming a multi-agent system. diff --git a/docs/guides/agent/agent_component_reference/await_response.mdx b/docs/guides/agent/agent_component_reference/await_response.mdx index 4f30c38d09f..f47da3cbd3c 100644 --- a/docs/guides/agent/agent_component_reference/await_response.mdx +++ b/docs/guides/agent/agent_component_reference/await_response.mdx @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideMessageSquareDot } --- - # Await response component A component that halts the workflow and awaits user input. @@ -26,7 +25,7 @@ Whether to show the message defined in the **Message** field. ### Message -The static message to send out. +The static message to send out. Click **+ Add message** to add message options. When multiple messages are supplied, the **Message** component randomly selects one to send. @@ -34,9 +33,9 @@ Click **+ Add message** to add message options. When multiple messages are suppl You can define global variables within the **Await response** component, which can be either mandatory or optional. Once set, users will need to provide values for these variables when engaging with the agent. Click **+** to add a global variable, each with the following attributes: -- **Name**: _Required_ - A descriptive name providing additional details about the variable. -- **Type**: _Required_ +- **Name**: _Required_ + A descriptive name providing additional details about the variable. +- **Type**: _Required_ The type of the variable: - **Single-line text**: Accepts a single line of text without line breaks. - **Paragraph text**: Accepts multiple lines of text, including line breaks. @@ -44,7 +43,7 @@ You can define global variables within the **Await response** component, which c - **file upload**: Requires the user to upload one or multiple files. - **Number**: Accepts a number as input. - **Boolean**: Requires the user to toggle between on and off. -- **Key**: _Required_ +- **Key**: _Required_ The unique variable name. - **Optional**: A toggle indicating whether the variable is optional. diff --git a/docs/guides/agent/agent_component_reference/begin.mdx b/docs/guides/agent/agent_component_reference/begin.mdx index 921ed898b9d..daa50b711a9 100644 --- a/docs/guides/agent/agent_component_reference/begin.mdx +++ b/docs/guides/agent/agent_component_reference/begin.mdx @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideHome } --- - # Begin component The starting component in a workflow. @@ -39,9 +38,9 @@ An agent in conversational mode begins with an opening greeting. It is the agent You can define global variables within the **Begin** component, which can be either mandatory or optional. Once set, users will need to provide values for these variables when engaging with the agent. Click **+ Add variable** to add a global variable, each with the following attributes: -- **Name**: _Required_ - A descriptive name providing additional details about the variable. -- **Type**: _Required_ +- **Name**: _Required_ + A descriptive name providing additional details about the variable. +- **Type**: _Required_ The type of the variable: - **Single-line text**: Accepts a single line of text without line breaks. - **Paragraph text**: Accepts multiple lines of text, including line breaks. @@ -49,7 +48,7 @@ You can define global variables within the **Begin** component, which can be eit - **file upload**: Requires the user to upload one or multiple files. - **Number**: Accepts a number as input. - **Boolean**: Requires the user to toggle between on and off. -- **Key**: _Required_ +- **Key**: _Required_ The unique variable name. - **Optional**: A toggle indicating whether the variable is optional. diff --git a/docs/guides/agent/agent_component_reference/categorize.mdx b/docs/guides/agent/agent_component_reference/categorize.mdx index 9c710318e05..57cd14ea7bc 100644 --- a/docs/guides/agent/agent_component_reference/categorize.mdx +++ b/docs/guides/agent/agent_component_reference/categorize.mdx @@ -5,10 +5,9 @@ sidebar_custom_props: { categoryIcon: LucideSwatchBook } --- - # Categorize component -A component that classifies user inputs and applies strategies accordingly. +A component that classifies user inputs and applies strategies accordingly. --- @@ -26,7 +25,7 @@ A **Categorize** component is essential when you need the LLM to help you identi Select the source for categorization. -The **Categorize** component relies on query variables to specify its data inputs (queries). All global variables defined before the **Categorize** component are available in the dropdown list. +The **Categorize** component relies on query variables to specify its data inputs (queries). All global variables defined before the **Categorize** component are available in the dropdown list. ### Input @@ -34,7 +33,7 @@ The **Categorize** component relies on query variables to specify its data input The **Categorize** component relies on input variables to specify its data inputs (queries). Click **+ Add variable** in the **Input** section to add the desired input variables. There are two types of input variables: **Reference** and **Text**. - **Reference**: Uses a component's output or a user input as the data source. You are required to select from the dropdown menu: - - A component ID under **Component Output**, or + - A component ID under **Component Output**, or - A global variable under **Begin input**, which is defined in the **Begin** component. - **Text**: Uses fixed text as the query. You are required to enter static text. @@ -42,29 +41,29 @@ The **Categorize** component relies on input variables to specify its data input Click the dropdown menu of **Model** to show the model configuration window. -- **Model**: The chat model to use. +- **Model**: The chat model to use. - Ensure you set the chat model correctly on the **Model providers** page. - You can use different models for different components to increase flexibility or improve overall performance. - **Creativity**: A shortcut to **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty** settings, indicating the freedom level of the model. From **Improvise**, **Precise**, to **Balance**, each preset configuration corresponds to a unique combination of **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty**. - This parameter has three options: + This parameter has three options: - **Improvise**: Produces more creative responses. - **Precise**: (Default) Produces more conservative responses. - **Balance**: A middle ground between **Improvise** and **Precise**. -- **Temperature**: The randomness level of the model's output. - Defaults to 0.1. +- **Temperature**: The randomness level of the model's output. + Defaults to 0.1. - Lower values lead to more deterministic and predictable outputs. - Higher values lead to more creative and varied outputs. - A temperature of zero results in the same output for the same prompt. -- **Top P**: Nucleus sampling. +- **Top P**: Nucleus sampling. - Reduces the likelihood of generating repetitive or unnatural text by setting a threshold *P* and restricting the sampling to tokens with a cumulative probability exceeding *P*. - Defaults to 0.3. -- **Presence penalty**: Encourages the model to include a more diverse range of tokens in the response. +- **Presence penalty**: Encourages the model to include a more diverse range of tokens in the response. - A higher **presence penalty** value results in the model being more likely to generate tokens not yet been included in the generated text. - Defaults to 0.4. -- **Frequency penalty**: Discourages the model from repeating the same words or phrases too frequently in the generated text. +- **Frequency penalty**: Discourages the model from repeating the same words or phrases too frequently in the generated text. - A higher **frequency penalty** value results in the model being more conservative in its use of repeated tokens. - Defaults to 0.7. -- **Max tokens**: +- **Max tokens**: This sets the maximum length of the model's output, measured in the number of tokens (words or pieces of words). It is disabled by default, allowing the model to determine the number of tokens in its responses. :::tip NOTE @@ -84,7 +83,7 @@ This feature is used for multi-turn dialogue *only*. If your **Categorize** comp ### Category name -A **Categorize** component must have at least two categories. This field sets the name of the category. Click **+ Add Item** to include the intended categories. +A **Categorize** component must have at least two categories. This field sets the name of the category. Click **+ Add Item** to include the intended categories. :::tip NOTE You will notice that the category name is auto-populated. No worries. Each category is assigned a random name upon creation. Feel free to change it to a name that is understandable to the LLM. @@ -92,7 +91,7 @@ You will notice that the category name is auto-populated. No worries. Each categ #### Description -Description of this category. +Description of this category. You can input criteria, situation, or information that may help the LLM determine which inputs belong in this category. diff --git a/docs/guides/agent/agent_component_reference/chunker_title.md b/docs/guides/agent/agent_component_reference/chunker_title.md index f75d8796efc..787f6602806 100644 --- a/docs/guides/agent/agent_component_reference/chunker_title.md +++ b/docs/guides/agent/agent_component_reference/chunker_title.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideBlocks } --- - # Title chunker component A component that splits texts into chunks by heading level. @@ -26,7 +25,7 @@ Placing a **Title chunker** after a **Token chunker** is invalid and will cause ### Hierarchy -Specifies the heading level to define chunk boundaries: +Specifies the heading level to define chunk boundaries: - H1 - H2 diff --git a/docs/guides/agent/agent_component_reference/chunker_token.md b/docs/guides/agent/agent_component_reference/chunker_token.md index 8f96230151b..ee0c1e79a0f 100644 --- a/docs/guides/agent/agent_component_reference/chunker_token.md +++ b/docs/guides/agent/agent_component_reference/chunker_token.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideBlocks } --- - # Token chunker component A component that splits texts into chunks, respecting a maximum token limit and using delimiters to find optimal breakpoints. diff --git a/docs/guides/agent/agent_component_reference/code.mdx b/docs/guides/agent/agent_component_reference/code.mdx index a9b9c82b8be..a9472ca5e03 100644 --- a/docs/guides/agent/agent_component_reference/code.mdx +++ b/docs/guides/agent/agent_component_reference/code.mdx @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideCodeXml } --- - # Code component A component that enables users to integrate Python or JavaScript codes into their Agent for dynamic data processing. @@ -36,7 +35,7 @@ If your RAGFlow Sandbox is not working, please be sure to consult the [Troublesh ### 3. (Optional) Install necessary dependencies -If you need to import your own Python or JavaScript packages into Sandbox, please follow the commands provided in the [How to import my own Python or JavaScript packages into Sandbox?](#how-to-import-my-own-python-or-javascript-packages-into-sandbox) section to install the additional dependencies. +If you need to import your own Python or JavaScript packages into Sandbox, please follow the commands provided in the [How to import my own Python or JavaScript packages into Sandbox?](#how-to-import-my-own-python-or-javascript-packages-into-sandbox) section to install the additional dependencies. ### 4. Enable Sandbox-specific settings in RAGFlow @@ -46,11 +45,11 @@ Ensure all Sandbox-specific settings are enabled in **ragflow/docker/.env**. Any changes to the configuration or environment *require* a full service restart to take effect. -## Configurations +## Configurations ### Input -You can specify multiple input sources for the **Code** component. Click **+ Add variable** in the **Input variables** section to include the desired input variables. +You can specify multiple input sources for the **Code** component. Click **+ Add variable** in the **Input variables** section to include the desired input variables. ### Code @@ -62,7 +61,7 @@ If your code implementation includes defined variables, whether input or output #### A Python code example -```Python +```Python def main(arg1: str, arg2: str) -> dict: return { "result": arg1 + arg2, @@ -105,7 +104,7 @@ The defined output variable(s) will be auto-populated here. ### `HTTPConnectionPool(host='sandbox-executor-manager', port=9385): Read timed out.` -**Root cause** +**Root cause** - You did not properly install gVisor and `runsc` was not recognized as a valid Docker runtime. - You did not pull the required base images for the runners and no runner was started. @@ -147,11 +146,11 @@ docker build -t sandbox-executor-manager:latest ./sandbox/executor_manager ### `HTTPConnectionPool(host='none', port=9385): Max retries exceeded.` -**Root cause** +**Root cause** `sandbox-executor-manager` is not mapped in `/etc/hosts`. -**Solution** +**Solution** Add a new entry to `/etc/hosts`: @@ -159,11 +158,11 @@ Add a new entry to `/etc/hosts`: ### `Container pool is busy` -**Root cause** +**Root cause** -All runners are currently in use, executing tasks. +All runners are currently in use, executing tasks. -**Solution** +**Solution** Please try again shortly or increase the pool size in the configuration to improve availability and reduce waiting times. @@ -208,7 +207,7 @@ To import your JavaScript packages, navigate to `sandbox_base_image/nodejs` and (ragflow) ➜ ragflow/sandbox main ✓ cd sandbox_base_image/nodejs -(ragflow) ➜ ragflow/sandbox/sandbox_base_image/nodejs main ✓ npm install lodash +(ragflow) ➜ ragflow/sandbox/sandbox_base_image/nodejs main ✓ npm install lodash (ragflow) ➜ ragflow/sandbox/sandbox_base_image/nodejs main ✓ cd ../.. # go back to sandbox root directory diff --git a/docs/guides/agent/agent_component_reference/execute_sql.md b/docs/guides/agent/agent_component_reference/execute_sql.md index 23786df6d7b..30c9c9912fa 100644 --- a/docs/guides/agent/agent_component_reference/execute_sql.md +++ b/docs/guides/agent/agent_component_reference/execute_sql.md @@ -5,14 +5,13 @@ sidebar_custom_props: { categoryIcon: RagSql } --- - # Execute SQL tool A tool that execute SQL queries on a specified relational database. --- -The **Execute SQL** tool enables you to connect to a relational database and run SQL queries, whether entered directly or generated by the system’s Text2SQL capability via an **Agent** component. +The **Execute SQL** tool enables you to connect to a relational database and run SQL queries, whether entered directly or generated by the system’s Text2SQL capability via an **Agent** component. ## Prerequisites diff --git a/docs/guides/agent/agent_component_reference/http.md b/docs/guides/agent/agent_component_reference/http.md index 6de2f0e45a3..66ee8067abd 100644 --- a/docs/guides/agent/agent_component_reference/http.md +++ b/docs/guides/agent/agent_component_reference/http.md @@ -5,10 +5,9 @@ sidebar_custom_props: { categoryIcon: RagHTTP } --- - # HTTP request component -A component that calls remote services. +A component that calls remote services. --- diff --git a/docs/guides/agent/agent_component_reference/indexer.md b/docs/guides/agent/agent_component_reference/indexer.md index 236ab6e688b..22596773b19 100644 --- a/docs/guides/agent/agent_component_reference/indexer.md +++ b/docs/guides/agent/agent_component_reference/indexer.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideListPlus } --- - # Indexer component A component that defines how chunks are indexed. diff --git a/docs/guides/agent/agent_component_reference/iteration.mdx b/docs/guides/agent/agent_component_reference/iteration.mdx index 3ec4998e792..051b923eefb 100644 --- a/docs/guides/agent/agent_component_reference/iteration.mdx +++ b/docs/guides/agent/agent_component_reference/iteration.mdx @@ -5,19 +5,18 @@ sidebar_custom_props: { categoryIcon: LucideRepeat2 } --- - # Iteration component A component that splits text input into text segments and iterates a predefined workflow for each one. --- -An **Interaction** component can divide text input into text segments and apply its built-in component workflow to each segment. +An **Interaction** component can divide text input into text segments and apply its built-in component workflow to each segment. ## Scenario -An **Iteration** component is essential when a workflow loop is required and the loop count is *not* fixed but depends on number of segments created from the output of specific agent components. +An **Iteration** component is essential when a workflow loop is required and the loop count is *not* fixed but depends on number of segments created from the output of specific agent components. - If, for instance, you plan to feed several paragraphs into an LLM for content generation, each with its own focus, and feeding them to the LLM all at once could create confusion or contradictions, then you can use an **Iteration** component, which encapsulates a **Generate** component, to repeat the content generation process for each paragraph. - Another example: If you wish to use the LLM to translate a lengthy paper into a target language without exceeding its token limit, consider using an **Iteration** component, which encapsulates a **Generate** component, to break the paper into smaller pieces and repeat the translation process for each one. @@ -32,12 +31,12 @@ Each **Iteration** component includes an internal **IterationItem** component. T The **IterationItem** component is visible *only* to the components encapsulated by the current **Iteration** components. ::: -### Build an internal workflow +### Build an internal workflow You are allowed to pull other components into the **Iteration** component to build an internal workflow, and these "added internal components" are no longer visible to components outside of the current **Iteration** component. :::danger IMPORTANT -To reference the created text segments from an added internal component, simply add a **Reference** variable that equals **IterationItem** within the **Input** section of that internal component. There is no need to reference the corresponding external component, as the **IterationItem** component manages the loop of the workflow for all created text segments. +To reference the created text segments from an added internal component, simply add a **Reference** variable that equals **IterationItem** within the **Input** section of that internal component. There is no need to reference the corresponding external component, as the **IterationItem** component manages the loop of the workflow for all created text segments. ::: :::tip NOTE @@ -51,7 +50,7 @@ An added internal component can reference an external component when necessary. The **Iteration** component uses input variables to specify its data inputs, namely the texts to be segmented. You are allowed to specify multiple input sources for the **Iteration** component. Click **+ Add variable** in the **Input** section to include the desired input variables. There are two types of input variables: **Reference** and **Text**. - **Reference**: Uses a component's output or a user input as the data source. You are required to select from the dropdown menu: - - A component ID under **Component Output**, or + - A component ID under **Component Output**, or - A global variable under **Begin input**, which is defined in the **Begin** component. - **Text**: Uses fixed text as the query. You are required to enter static text. diff --git a/docs/guides/agent/agent_component_reference/message.mdx b/docs/guides/agent/agent_component_reference/message.mdx index a049e3a895d..295bd72cc84 100644 --- a/docs/guides/agent/agent_component_reference/message.mdx +++ b/docs/guides/agent/agent_component_reference/message.mdx @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideMessageSquareReply } --- - # Message component A component that sends out a static or dynamic message. diff --git a/docs/guides/agent/agent_component_reference/parser.md b/docs/guides/agent/agent_component_reference/parser.md index 8dcb702cf66..cdc0a9e1750 100644 --- a/docs/guides/agent/agent_component_reference/parser.md +++ b/docs/guides/agent/agent_component_reference/parser.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideFilePlay } --- - # Parser component A component that sets the parsing rules for your dataset. @@ -57,12 +56,12 @@ Starting from v0.22.0, RAGFlow includes MinerU (≥ 2.6.3) as an optional PDF p - `"vlm-mlx-engine"` - `"vlm-vllm-async-engine"` - `"vlm-lmdeploy-engine"`. - - `MINERU_SERVER_URL`: (optional) The downstream vLLM HTTP server (e.g., `http://vllm-host:30000`). Applicable when `MINERU_BACKEND` is set to `"vlm-http-client"`. + - `MINERU_SERVER_URL`: (optional) The downstream vLLM HTTP server (e.g., `http://vllm-host:30000`). Applicable when `MINERU_BACKEND` is set to `"vlm-http-client"`. - `MINERU_OUTPUT_DIR`: (optional) The local directory for holding the outputs of the MinerU API service (zip/JSON) before ingestion. - `MINERU_DELETE_OUTPUT`: Whether to delete temporary output when a temporary directory is used: - `1`: Delete. - `0`: Retain. -3. In the web UI, navigate to your dataset's **Configuration** page and find the **Ingestion pipeline** section: +3. In the web UI, navigate to your dataset's **Configuration** page and find the **Ingestion pipeline** section: - If you decide to use a chunking method from the **Built-in** dropdown, ensure it supports PDF parsing, then select **MinerU** from the **PDF parser** dropdown. - If you use a custom ingestion pipeline instead, select **MinerU** in the **PDF parser** section of the **Parser** component. diff --git a/docs/guides/agent/agent_component_reference/retrieval.mdx b/docs/guides/agent/agent_component_reference/retrieval.mdx index 3adc2ab932e..0c6728d99f8 100644 --- a/docs/guides/agent/agent_component_reference/retrieval.mdx +++ b/docs/guides/agent/agent_component_reference/retrieval.mdx @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideFolderSearch } --- - # Retrieval component A component that retrieves information from specified datasets. @@ -24,13 +23,13 @@ Ensure you [have properly configured your target dataset(s)](../../dataset/confi ## Quickstart -### 1. Click on a **Retrieval** component to show its configuration panel +### 1. Click on a **Retrieval** component to show its configuration panel The corresponding configuration panel appears to the right of the canvas. Use this panel to define and fine-tune the **Retrieval** component's search behavior. ### 2. Input query variable(s) -The **Retrieval** component depends on query variables to specify its queries. +The **Retrieval** component depends on query variables to specify its queries. :::caution IMPORTANT - If you use the **Retrieval** component as a standalone workflow module, input query variables in the **Input Variables** text box. @@ -77,7 +76,7 @@ Select the query source for retrieval. Defaults to `sys.query`, which is the def The **Retrieval** component relies on query variables to specify its queries. All global variables defined before the **Retrieval** component can also be used as queries. Use the `(x)` button or type `/` to show all the available query variables. -### Knowledge bases +### Knowledge bases Select the dataset(s) to retrieve data from. @@ -113,7 +112,7 @@ Using a rerank model will *significantly* increase the system's response time. ### Empty response -- Set this as a response if no results are retrieved from the dataset(s) for your query, or +- Set this as a response if no results are retrieved from the dataset(s) for your query, or - Leave this field blank to allow the chat model to improvise when nothing is found. :::caution WARNING diff --git a/docs/guides/agent/agent_component_reference/switch.mdx b/docs/guides/agent/agent_component_reference/switch.mdx index fe90923302e..d98ca82c007 100644 --- a/docs/guides/agent/agent_component_reference/switch.mdx +++ b/docs/guides/agent/agent_component_reference/switch.mdx @@ -5,10 +5,9 @@ sidebar_custom_props: { categoryIcon: LucideSplit } --- - # Switch component -A component that evaluates whether specified conditions are met and directs the follow of execution accordingly. +A component that evaluates whether specified conditions are met and directs the follow of execution accordingly. --- @@ -16,7 +15,7 @@ A **Switch** component evaluates conditions based on the output of specific comp ## Scenarios -A **Switch** component is essential for condition-based direction of execution flow. While it shares similarities with the [Categorize](./categorize.mdx) component, which is also used in multi-pronged strategies, the key distinction lies in their approach: the evaluation of the **Switch** component is rule-based, whereas the **Categorize** component involves AI and uses an LLM for decision-making. +A **Switch** component is essential for condition-based direction of execution flow. While it shares similarities with the [Categorize](./categorize.mdx) component, which is also used in multi-pronged strategies, the key distinction lies in their approach: the evaluation of the **Switch** component is rule-based, whereas the **Categorize** component involves AI and uses an LLM for decision-making. ## Configurations @@ -42,12 +41,12 @@ When you have added multiple conditions for a specific case, a **Logical operato - Greater equal - Less than - Less equal - - Contains - - Not contains + - Contains + - Not contains - Starts with - Ends with - Is empty - Not empty -- **Value**: A single value, which can be an integer, float, or string. +- **Value**: A single value, which can be an integer, float, or string. - Delimiters, multiple values, or expressions are *not* supported. diff --git a/docs/guides/agent/agent_component_reference/text_processing.mdx b/docs/guides/agent/agent_component_reference/text_processing.mdx index bfc0d9dd422..7ecfa19e14d 100644 --- a/docs/guides/agent/agent_component_reference/text_processing.mdx +++ b/docs/guides/agent/agent_component_reference/text_processing.mdx @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideType } --- - # Text processing component A component that merges or splits texts. @@ -27,7 +26,7 @@ Appears only when you select **Split** as method. The variable to be split. Type `/` to quickly insert variables. -### Script +### Script Template for the merge. Appears only when you select **Merge** as method. Type `/` to quickly insert variables. diff --git a/docs/guides/agent/agent_component_reference/transformer.md b/docs/guides/agent/agent_component_reference/transformer.md index 7afcf4de8aa..50e4eeee562 100644 --- a/docs/guides/agent/agent_component_reference/transformer.md +++ b/docs/guides/agent/agent_component_reference/transformer.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideFileStack } --- - # Transformer component A component that uses an LLM to extract insights from the chunks. @@ -16,7 +15,7 @@ A **Transformer** component indexes chunks and configures their storage formats ## Scenario -A **Transformer** component is essential when you need the LLM to extract new information, such as keywords, questions, metadata, and summaries, from the original chunks. +A **Transformer** component is essential when you need the LLM to extract new information, such as keywords, questions, metadata, and summaries, from the original chunks. ## Configurations @@ -24,29 +23,29 @@ A **Transformer** component is essential when you need the LLM to extract new in Click the dropdown menu of **Model** to show the model configuration window. -- **Model**: The chat model to use. +- **Model**: The chat model to use. - Ensure you set the chat model correctly on the **Model providers** page. - You can use different models for different components to increase flexibility or improve overall performance. -- **Creativity**: A shortcut to **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty** settings, indicating the freedom level of the model. From **Improvise**, **Precise**, to **Balance**, each preset configuration corresponds to a unique combination of **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty**. +- **Creativity**: A shortcut to **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty** settings, indicating the freedom level of the model. From **Improvise**, **Precise**, to **Balance**, each preset configuration corresponds to a unique combination of **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty**. This parameter has three options: - **Improvise**: Produces more creative responses. - **Precise**: (Default) Produces more conservative responses. - **Balance**: A middle ground between **Improvise** and **Precise**. -- **Temperature**: The randomness level of the model's output. +- **Temperature**: The randomness level of the model's output. Defaults to 0.1. - Lower values lead to more deterministic and predictable outputs. - Higher values lead to more creative and varied outputs. - A temperature of zero results in the same output for the same prompt. -- **Top P**: Nucleus sampling. +- **Top P**: Nucleus sampling. - Reduces the likelihood of generating repetitive or unnatural text by setting a threshold *P* and restricting the sampling to tokens with a cumulative probability exceeding *P*. - Defaults to 0.3. -- **Presence penalty**: Encourages the model to include a more diverse range of tokens in the response. +- **Presence penalty**: Encourages the model to include a more diverse range of tokens in the response. - A higher **presence penalty** value results in the model being more likely to generate tokens not yet been included in the generated text. - Defaults to 0.4. -- **Frequency penalty**: Discourages the model from repeating the same words or phrases too frequently in the generated text. +- **Frequency penalty**: Discourages the model from repeating the same words or phrases too frequently in the generated text. - A higher **frequency penalty** value results in the model being more conservative in its use of repeated tokens. - Defaults to 0.7. -- **Max tokens**: +- **Max tokens**: This sets the maximum length of the model's output, measured in the number of tokens (words or pieces of words). It is disabled by default, allowing the model to determine the number of tokens in its responses. :::tip NOTE @@ -65,7 +64,7 @@ Select the type of output to be generated by the LLM: ### System prompt -Typically, you use the system prompt to describe the task for the LLM, specify how it should respond, and outline other miscellaneous requirements. We do not plan to elaborate on this topic, as it can be as extensive as prompt engineering. +Typically, you use the system prompt to describe the task for the LLM, specify how it should respond, and outline other miscellaneous requirements. We do not plan to elaborate on this topic, as it can be as extensive as prompt engineering. :::tip NOTE The system prompt here automatically updates to match your selected **Result destination**. diff --git a/docs/guides/agent/agent_introduction.md b/docs/guides/agent/agent_introduction.md index 87d35dbc51c..72996bcc544 100644 --- a/docs/guides/agent/agent_introduction.md +++ b/docs/guides/agent/agent_introduction.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideBookOpenText } --- - # Introduction to agents Key concepts, basic operations, a quick view of the agent editor. @@ -27,7 +26,7 @@ Agents and RAG are complementary techniques, each enhancing the other’s capabi :::tip NOTE -Before proceeding, ensure that: +Before proceeding, ensure that: 1. You have properly set the LLM to use. See the guides on [Configure your API key](../models/llm_api_key_setup.md) or [Deploy a local LLM](../models/deploy_local_llm.mdx) for more information. 2. You have a dataset configured and the corresponding files properly parsed. See the guide on [Configure a dataset](../dataset/configure_knowledge_base.md) for more information. @@ -44,7 +43,7 @@ We also provide templates catered to different business scenarios. You can eithe ![agent_template](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/agent_template_list.jpg) -2. To create an agent from scratch, click **Create Agent**. Alternatively, to create an agent from one of our templates, click the desired card, such as **Deep Research**, name your agent in the pop-up dialogue, and click **OK** to confirm. +2. To create an agent from scratch, click **Create Agent**. Alternatively, to create an agent from one of our templates, click the desired card, such as **Deep Research**, name your agent in the pop-up dialogue, and click **OK** to confirm. *You are now taken to the **no-code workflow editor** page.* diff --git a/docs/guides/agent/embed_agent_into_webpage.md b/docs/guides/agent/embed_agent_into_webpage.md index 5b4644c3444..81c12a0d8a0 100644 --- a/docs/guides/agent/embed_agent_into_webpage.md +++ b/docs/guides/agent/embed_agent_into_webpage.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideMonitorDot } --- - # Embed agent into webpage You can use iframe to embed an agent into a third-party webpage. diff --git a/docs/guides/agent/sandbox_quickstart.md b/docs/guides/agent/sandbox_quickstart.md index 2ea3ed0fbdf..115ffe88823 100644 --- a/docs/guides/agent/sandbox_quickstart.md +++ b/docs/guides/agent/sandbox_quickstart.md @@ -5,12 +5,11 @@ sidebar_custom_props: { categoryIcon: LucideCodesandbox } --- - # Sandbox quickstart A secure, pluggable code execution backend designed for RAGFlow and other applications requiring isolated code execution environments. -## Features: +## Features: - Seamless RAGFlow Integration — Works out-of-the-box with the code component of RAGFlow. - High Security — Uses gVisor for syscall-level sandboxing to isolate execution. @@ -58,7 +57,7 @@ Next, build the executor manager image: docker build -t sandbox-executor-manager:latest ./executor_manager ``` -## Running with RAGFlow +## Running with RAGFlow 1. Verify that gVisor is properly installed and operational. diff --git a/docs/guides/ai_search.md b/docs/guides/ai_search.md index 609192a21dc..1f257d29110 100644 --- a/docs/guides/ai_search.md +++ b/docs/guides/ai_search.md @@ -5,14 +5,13 @@ sidebar_custom_props: { categoryIcon: LucideSearch } --- - # Search Conduct an AI search. --- -An AI search is a single-turn AI conversation using a predefined retrieval strategy (a hybrid search of weighted keyword similarity and weighted vector similarity) and the system's default chat model. It does not involve advanced RAG strategies like knowledge graph, auto-keyword, or auto-question. The related chunks are listed below the chat model's response in descending order based on their similarity scores. +An AI search is a single-turn AI conversation using a predefined retrieval strategy (a hybrid search of weighted keyword similarity and weighted vector similarity) and the system's default chat model. It does not involve advanced RAG strategies like knowledge graph, auto-keyword, or auto-question. The related chunks are listed below the chat model's response in descending order based on their similarity scores. ![Create search app](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/create_search_app.jpg) diff --git a/docs/guides/chat/implement_deep_research.md b/docs/guides/chat/implement_deep_research.md index ec6d8ee8d7d..2b07a4116e6 100644 --- a/docs/guides/chat/implement_deep_research.md +++ b/docs/guides/chat/implement_deep_research.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideScanSearch } --- - # Implement deep research Implements deep research for agentic reasoning. diff --git a/docs/guides/chat/set_chat_variables.md b/docs/guides/chat/set_chat_variables.md index a6507a8a7e9..ac5559d605a 100644 --- a/docs/guides/chat/set_chat_variables.md +++ b/docs/guides/chat/set_chat_variables.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideVariable } --- - # Set variables Set variables to be used together with the system prompt for your LLM. @@ -94,7 +93,7 @@ from ragflow_sdk import RAGFlow rag_object = RAGFlow(api_key="", base_url="http://:9380") assistant = rag_object.list_chats(name="Miss R") assistant = assistant[0] -session = assistant.create_session() +session = assistant.create_session() print("\n==================== Miss R =====================\n") print("Hello. What can I do for you?") @@ -102,9 +101,9 @@ print("Hello. What can I do for you?") while True: question = input("\n==================== User =====================\n> ") style = input("Please enter your preferred style (e.g., formal, informal, hilarious): ") - + print("\n==================== Miss R =====================\n") - + cont = "" for ans in session.ask(question, stream=True, style=style): print(ans.content[len(cont):], end='', flush=True) diff --git a/docs/guides/chat/start_chat.md b/docs/guides/chat/start_chat.md index 279ea62304f..e5066a8b297 100644 --- a/docs/guides/chat/start_chat.md +++ b/docs/guides/chat/start_chat.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideBot } --- - # Start AI chat Initiate an AI-powered chat with a configured chat assistant. @@ -45,8 +44,8 @@ You start an AI conversation by creating an assistant. - **Rerank model** sets the reranker model to use. It is left empty by default. - If **Rerank model** is left empty, the hybrid score system uses keyword similarity and vector similarity, and the default weight assigned to the vector similarity component is 1-0.7=0.3. - If **Rerank model** is selected, the hybrid score system uses keyword similarity and reranker score, and the default weight assigned to the reranker score is 1-0.7=0.3. - - [Cross-language search](../../references/glossary.mdx#cross-language-search): Optional - Select one or more target languages from the dropdown menu. The system’s default chat model will then translate your query into the selected target language(s). This translation ensures accurate semantic matching across languages, allowing you to retrieve relevant results regardless of language differences. + - [Cross-language search](../../references/glossary.mdx#cross-language-search): Optional + Select one or more target languages from the dropdown menu. The system’s default chat model will then translate your query into the selected target language(s). This translation ensures accurate semantic matching across languages, allowing you to retrieve relevant results regardless of language differences. - When selecting target languages, please ensure that these languages are present in the dataset to guarantee an effective search. - If no target language is selected, the system will search only in the language of your query, which may cause relevant information in other languages to be missed. - **Variable** refers to the variables (keys) to be used in the system prompt. `{knowledge}` is a reserved variable. Click **Add** to add more variables for the system prompt. @@ -58,23 +57,23 @@ You start an AI conversation by creating an assistant. 4. Update Model-specific Settings: - In **Model**: you select the chat model. Though you have selected the default chat model in **System Model Settings**, RAGFlow allows you to choose an alternative chat model for your dialogue. - - **Creativity**: A shortcut to **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty** settings, indicating the freedom level of the model. From **Improvise**, **Precise**, to **Balance**, each preset configuration corresponds to a unique combination of **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty**. + - **Creativity**: A shortcut to **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty** settings, indicating the freedom level of the model. From **Improvise**, **Precise**, to **Balance**, each preset configuration corresponds to a unique combination of **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty**. This parameter has three options: - **Improvise**: Produces more creative responses. - **Precise**: (Default) Produces more conservative responses. - **Balance**: A middle ground between **Improvise** and **Precise**. - - **Temperature**: The randomness level of the model's output. + - **Temperature**: The randomness level of the model's output. Defaults to 0.1. - Lower values lead to more deterministic and predictable outputs. - Higher values lead to more creative and varied outputs. - A temperature of zero results in the same output for the same prompt. - - **Top P**: Nucleus sampling. + - **Top P**: Nucleus sampling. - Reduces the likelihood of generating repetitive or unnatural text by setting a threshold *P* and restricting the sampling to tokens with a cumulative probability exceeding *P*. - Defaults to 0.3. - - **Presence penalty**: Encourages the model to include a more diverse range of tokens in the response. + - **Presence penalty**: Encourages the model to include a more diverse range of tokens in the response. - A higher **presence penalty** value results in the model being more likely to generate tokens not yet been included in the generated text. - Defaults to 0.4. - - **Frequency penalty**: Discourages the model from repeating the same words or phrases too frequently in the generated text. + - **Frequency penalty**: Discourages the model from repeating the same words or phrases too frequently in the generated text. - A higher **frequency penalty** value results in the model being more conservative in its use of repeated tokens. - Defaults to 0.7. diff --git a/docs/guides/dataset/add_data_source/add_google_drive.md b/docs/guides/dataset/add_data_source/add_google_drive.md index d4ee70a875b..57263094845 100644 --- a/docs/guides/dataset/add_data_source/add_google_drive.md +++ b/docs/guides/dataset/add_data_source/add_google_drive.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: SiGoogledrive } --- - # Add Google Drive ## 1. Create a Google Cloud Project @@ -13,9 +12,9 @@ sidebar_custom_props: { You can either create a dedicated project for RAGFlow or use an existing Google Cloud external project. -**Steps:** +**Steps:** 1. Open the project creation page\ -`https://console.cloud.google.com/projectcreate` +`https://console.cloud.google.com/projectcreate` ![placeholder-image](https://github.com/infiniflow/ragflow-docs/blob/040e4acd4c1eac6dc73dc44e934a6518de78d097/images/google_drive/image1.jpeg?raw=true) 2. Select **External** as the Audience ![placeholder-image](https://github.com/infiniflow/ragflow-docs/blob/040e4acd4c1eac6dc73dc44e934a6518de78d097/images/google_drive/image2.png?raw=true) @@ -99,11 +98,11 @@ Navigate to the Google API Library:\ Enable the following APIs: -- Google Drive API -- Admin SDK API -- Google Sheets API +- Google Drive API +- Admin SDK API +- Google Sheets API - Google Docs API - + ![placeholder-image](https://github.com/infiniflow/ragflow-docs/blob/040e4acd4c1eac6dc73dc44e934a6518de78d097/images/google_drive/image15.png?raw=true) @@ -129,7 +128,7 @@ Enable the following APIs: ![placeholder-image](https://github.com/infiniflow/ragflow-docs/blob/040e4acd4c1eac6dc73dc44e934a6518de78d097/images/google_drive/image23.png?raw=true) 5. Click **Authorize with Google** -A browser window will appear. +A browser window will appear. ![placeholder-image](https://github.com/infiniflow/ragflow-docs/blob/040e4acd4c1eac6dc73dc44e934a6518de78d097/images/google_drive/image25.jpeg?raw=true) Click: - **Continue** - **Select All → Continue** - Authorization should succeed - Select **OK** to add the data source diff --git a/docs/guides/dataset/auto_metadata.md b/docs/guides/dataset/auto_metadata.md index 2cbf854291a..7a7b086361b 100644 --- a/docs/guides/dataset/auto_metadata.md +++ b/docs/guides/dataset/auto_metadata.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideFileCodeCorner } --- - # Auto-extract metadata Automatically extract metadata from uploaded files. diff --git a/docs/guides/dataset/autokeyword_autoquestion.mdx b/docs/guides/dataset/autokeyword_autoquestion.mdx index 937394e4ee0..3165a6a6b14 100644 --- a/docs/guides/dataset/autokeyword_autoquestion.mdx +++ b/docs/guides/dataset/autokeyword_autoquestion.mdx @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideSlidersHorizontal } --- - # Auto-keyword Auto-question import APITable from '@site/src/components/APITable'; @@ -23,14 +22,14 @@ Enabling this feature increases document indexing time and uses extra tokens, as Auto-keyword refers to the auto-keyword generation feature of RAGFlow. It uses a chat model to generate a set of keywords or synonyms from each chunk to correct errors and enhance retrieval accuracy. This feature is implemented as a slider under **Page rank** on the **Configuration** page of your dataset. -**Values**: +**Values**: -- 0: (Default) Disabled. -- Between 3 and 5 (inclusive): Recommended if you have chunks of approximately 1,000 characters. -- 30 (maximum) +- 0: (Default) Disabled. +- Between 3 and 5 (inclusive): Recommended if you have chunks of approximately 1,000 characters. +- 30 (maximum) :::tip NOTE -- If your chunk size increases, you can increase the value accordingly. Please note, as the value increases, the marginal benefit decreases. +- If your chunk size increases, you can increase the value accordingly. Please note, as the value increases, the marginal benefit decreases. - An Auto-keyword value must be an integer. If you set it to a non-integer, say 1.7, it will be rounded down to the nearest integer, which in this case is 1. ::: @@ -40,12 +39,12 @@ Auto-question is a feature of RAGFlow that automatically generates questions fro **Values**: -- 0: (Default) Disabled. -- 1 or 2: Recommended if you have chunks of approximately 1,000 characters. +- 0: (Default) Disabled. +- 1 or 2: Recommended if you have chunks of approximately 1,000 characters. - 10 (maximum) :::tip NOTE -- If your chunk size increases, you can increase the value accordingly. Please note, as the value increases, the marginal benefit decreases. +- If your chunk size increases, you can increase the value accordingly. Please note, as the value increases, the marginal benefit decreases. - An Auto-question value must be an integer. If you set it to a non-integer, say 1.7, it will be rounded down to the nearest integer, which in this case is 1. ::: diff --git a/docs/guides/dataset/configure_child_chunking_strategy.md b/docs/guides/dataset/configure_child_chunking_strategy.md index 267b4b070b7..32a61408ee8 100644 --- a/docs/guides/dataset/configure_child_chunking_strategy.md +++ b/docs/guides/dataset/configure_child_chunking_strategy.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideGroup } --- - # Configure child chunking strategy Set parent-child chunking strategy to improve retrieval. diff --git a/docs/guides/dataset/configure_knowledge_base.md b/docs/guides/dataset/configure_knowledge_base.md index 85f00180dcc..8c7c9db6246 100644 --- a/docs/guides/dataset/configure_knowledge_base.md +++ b/docs/guides/dataset/configure_knowledge_base.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideCog } --- - # Configure dataset Most of RAGFlow's chat assistants and Agents are based on datasets. Each of RAGFlow's datasets serves as a knowledge source, *parsing* files uploaded from your local machine and file references generated in RAGFlow's File system into the real 'knowledge' for future AI chats. This guide demonstrates some basic usages of the dataset feature, covering the following topics: @@ -25,7 +24,7 @@ _Each time a dataset is created, a folder with the same name is generated in the ## Configure dataset -The following screenshot shows the configuration page of a dataset. A proper configuration of your dataset is crucial for future AI chats. For example, choosing the wrong embedding model or chunking method would cause unexpected semantic loss or mismatched answers in chats. +The following screenshot shows the configuration page of a dataset. A proper configuration of your dataset is crucial for future AI chats. For example, choosing the wrong embedding model or chunking method would cause unexpected semantic loss or mismatched answers in chats. ![dataset configuration](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/configure_knowledge_base.jpg) @@ -63,14 +62,14 @@ You can also change a file's chunking method on the **Files** page.
    From v0.21.0 onward, RAGFlow supports ingestion pipeline for customized data ingestion and cleansing workflows. - + To use a customized data pipeline: 1. On the **Agent** page, click **+ Create agent** > **Create from blank**. 2. Select **Ingestion pipeline** and name your data pipeline in the popup, then click **Save** to show the data pipeline canvas. 3. After updating your data pipeline, click **Save** on the top right of the canvas. 4. Navigate to the **Configuration** page of your dataset, select **Choose pipeline** in **Ingestion pipeline**. - + *Your saved data pipeline will appear in the dropdown menu below.*
    @@ -86,9 +85,9 @@ Some embedding models are optimized for specific languages, so performance may b ### Upload file - RAGFlow's File system allows you to link a file to multiple datasets, in which case each target dataset holds a reference to the file. -- In **Knowledge Base**, you are also given the option of uploading a single file or a folder of files (bulk upload) from your local machine to a dataset, in which case the dataset holds file copies. +- In **Knowledge Base**, you are also given the option of uploading a single file or a folder of files (bulk upload) from your local machine to a dataset, in which case the dataset holds file copies. -While uploading files directly to a dataset seems more convenient, we *highly* recommend uploading files to RAGFlow's File system and then linking them to the target datasets. This way, you can avoid permanently deleting files uploaded to the dataset. +While uploading files directly to a dataset seems more convenient, we *highly* recommend uploading files to RAGFlow's File system and then linking them to the target datasets. This way, you can avoid permanently deleting files uploaded to the dataset. ### Parse file @@ -96,14 +95,14 @@ File parsing is a crucial topic in dataset configuration. The meaning of file pa ![parse file](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/parse_file.jpg) -- As shown above, RAGFlow allows you to use a different chunking method for a particular file, offering flexibility beyond the default method. -- As shown above, RAGFlow allows you to enable or disable individual files, offering finer control over dataset-based AI chats. +- As shown above, RAGFlow allows you to use a different chunking method for a particular file, offering flexibility beyond the default method. +- As shown above, RAGFlow allows you to enable or disable individual files, offering finer control over dataset-based AI chats. ### Intervene with file parsing results -RAGFlow features visibility and explainability, allowing you to view the chunking results and intervene where necessary. To do so: +RAGFlow features visibility and explainability, allowing you to view the chunking results and intervene where necessary. To do so: -1. Click on the file that completes file parsing to view the chunking results: +1. Click on the file that completes file parsing to view the chunking results: _You are taken to the **Chunk** page:_ @@ -116,7 +115,7 @@ RAGFlow features visibility and explainability, allowing you to view the chunkin ![update chunk](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/add_keyword_question.jpg) :::caution NOTE -You can add keywords to a file chunk to increase its ranking for queries containing those keywords. This action increases its keyword weight and can improve its position in search list. +You can add keywords to a file chunk to increase its ranking for queries containing those keywords. This action increases its keyword weight and can improve its position in search list. ::: 4. In Retrieval testing, ask a quick question in **Test text** to double-check if your configurations work: @@ -144,7 +143,7 @@ As of RAGFlow v0.23.1, the search feature is still in a rudimentary form, suppor You are allowed to delete a dataset. Hover your mouse over the three dot of the intended dataset card and the **Delete** option appears. Once you delete a dataset, the associated folder under **root/.knowledge** directory is AUTOMATICALLY REMOVED. The consequence is: -- The files uploaded directly to the dataset are gone; -- The file references, which you created from within RAGFlow's File system, are gone, but the associated files still exist. +- The files uploaded directly to the dataset are gone; +- The file references, which you created from within RAGFlow's File system, are gone, but the associated files still exist. ![delete dataset](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/delete_datasets.jpg) diff --git a/docs/guides/dataset/construct_knowledge_graph.md b/docs/guides/dataset/construct_knowledge_graph.md index 4c4b5674012..b4eba1fd6b0 100644 --- a/docs/guides/dataset/construct_knowledge_graph.md +++ b/docs/guides/dataset/construct_knowledge_graph.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideWandSparkles } --- - # Construct knowledge graph Generate a knowledge graph for your dataset. @@ -66,7 +65,7 @@ In a knowledge graph, a community is a cluster of entities linked by relationshi ## Quickstart 1. Navigate to the **Configuration** page of your dataset and update: - + - Entity types: *Required* - Specifies the entity types in the knowledge graph to generate. You don't have to stick with the default, but you need to customize them for your documents. - Method: *Optional* - Entity resolution: *Optional* @@ -77,12 +76,12 @@ In a knowledge graph, a community is a cluster of entities linked by relationshi *You can click the pause button in the dropdown to halt the build process when necessary.* -3. Go back to the **Configuration** page: - +3. Go back to the **Configuration** page: + *Once a knowledge graph is generated, the **Knowledge graph** field changes from `Not generated` to `Generated at a specific timestamp`. You can delete it by clicking the recycle bin button to the right of the field.* 4. To use the created knowledge graph, do either of the following: - + - In the **Chat setting** panel of your chat app, switch on the **Use knowledge graph** toggle. - If you are using an agent, click the **Retrieval** agent component to specify the dataset(s) and switch on the **Use knowledge graph** toggle. diff --git a/docs/guides/dataset/enable_excel2html.md b/docs/guides/dataset/enable_excel2html.md index 7449ee59bd2..9f4f20bec02 100644 --- a/docs/guides/dataset/enable_excel2html.md +++ b/docs/guides/dataset/enable_excel2html.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideToggleRight } --- - # Enable Excel2HTML Convert complex Excel spreadsheets into HTML tables. diff --git a/docs/guides/dataset/enable_raptor.md b/docs/guides/dataset/enable_raptor.md index abe6f6a8cad..54e36d2bf22 100644 --- a/docs/guides/dataset/enable_raptor.md +++ b/docs/guides/dataset/enable_raptor.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideNetwork } --- - # Enable RAPTOR A recursive abstractive method used in long-context knowledge retrieval and summarization, balancing broad semantic understanding with fine details. @@ -79,7 +78,7 @@ A random seed. Click **+** to change the seed value. ## Quickstart 1. Navigate to the **Configuration** page of your dataset and update: - + - Prompt: *Optional* - We recommend that you keep it as-is until you understand the mechanism behind. - Max token: *Optional* - Threshold: *Optional* @@ -89,8 +88,8 @@ A random seed. Click **+** to change the seed value. *You can click the pause button in the dropdown to halt the build process when necessary.* -3. Go back to the **Configuration** page: - +3. Go back to the **Configuration** page: + *The **RAPTOR** field changes from `Not generated` to `Generated at a specific timestamp` when a RAPTOR hierarchical tree structure is generated. You can delete it by clicking the recycle bin button to the right of the field.* 4. Once a RAPTOR hierarchical tree structure is generated, your chat assistant and **Retrieval** agent component will use it for retrieval as a default. diff --git a/docs/guides/dataset/extract_table_of_contents.md b/docs/guides/dataset/extract_table_of_contents.md index 4e67ecae41f..c642f89924c 100644 --- a/docs/guides/dataset/extract_table_of_contents.md +++ b/docs/guides/dataset/extract_table_of_contents.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideTableOfContents } --- - # Extract table of contents Extract table of contents (TOC) from documents to provide long context RAG and improve retrieval. @@ -31,7 +30,7 @@ The system's default chat model is used to summarize clustered content. Before p 2. Enable **TOC Enhance**. 3. To use this technique during retrieval, do either of the following: - + - In the **Chat setting** panel of your chat app, switch on the **TOC Enhance** toggle. - If you are using an agent, click the **Retrieval** agent component to specify the dataset(s) and switch on the **TOC Enhance** toggle. diff --git a/docs/guides/dataset/manage_metadata.md b/docs/guides/dataset/manage_metadata.md index 1f6439f5199..79b42a47621 100644 --- a/docs/guides/dataset/manage_metadata.md +++ b/docs/guides/dataset/manage_metadata.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideCode } --- - # Manage metadata Manage metadata for your dataset and for your individual documents. @@ -22,7 +21,7 @@ From v0.23.0 onwards, RAGFlow allows you to manage metadata both at the dataset ![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/click_metadata.png) -2. On the **Manage Metadata** page, you can do either of the following: +2. On the **Manage Metadata** page, you can do either of the following: - Edit Values: You can modify existing values. If you rename two values to be identical, they will be automatically merged. - Delete: You can delete specific values or entire fields. These changes will apply to all associated files. diff --git a/docs/guides/dataset/run_retrieval_test.md b/docs/guides/dataset/run_retrieval_test.md index 0291043c2c4..973a2f2ed56 100644 --- a/docs/guides/dataset/run_retrieval_test.md +++ b/docs/guides/dataset/run_retrieval_test.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideTextSearch } --- - # Run retrieval test Conduct a retrieval test on your dataset to check whether the intended chunks can be retrieved. @@ -56,7 +55,7 @@ The switch is disabled by default. When enabled, RAGFlow performs the following 3. Find similar entities and their N-hop relationships from the graph using the embeddings of the extracted query entities. 4. Retrieve similar relationships from the graph using the query embedding. 5. Rank these retrieved entities and relationships by multiplying each one's PageRank value with its similarity score to the query, returning the top n as the final retrieval. -6. Retrieve the report for the community involving the most entities in the final retrieval. +6. Retrieve the report for the community involving the most entities in the final retrieval. *The retrieved entity descriptions, relationship descriptions, and the top 1 community report are sent to the LLM for content generation.* :::danger IMPORTANT @@ -81,10 +80,10 @@ This field is where you put in your testing query. 1. Navigate to the **Retrieval testing** page of your dataset, enter your query in **Test text**, and click **Testing** to run the test. 2. If the results are unsatisfactory, tune the options listed in the Configuration section and rerun the test. - *The following is a screenshot of a retrieval test conducted without using knowledge graph. It demonstrates a hybrid search combining weighted keyword similarity and weighted vector cosine similarity. The overall hybrid similarity score is 28.56, calculated as 25.17 (term similarity score) x 0.7 + 36.49 (vector similarity score) x 0.3:* + *The following is a screenshot of a retrieval test conducted without using knowledge graph. It demonstrates a hybrid search combining weighted keyword similarity and weighted vector cosine similarity. The overall hybrid similarity score is 28.56, calculated as 25.17 (term similarity score) x 0.7 + 36.49 (vector similarity score) x 0.3:* ![Image](https://github.com/user-attachments/assets/541554d4-3f3e-44e1-954b-0ae77d7372c6) - *The following is a screenshot of a retrieval test conducted using a knowledge graph. It shows that only vector similarity is used for knowledge graph-generated chunks:* + *The following is a screenshot of a retrieval test conducted using a knowledge graph. It shows that only vector similarity is used for knowledge graph-generated chunks:* ![Image](https://github.com/user-attachments/assets/30a03091-0f7b-4058-901a-f4dc5ca5aa6b) :::caution WARNING diff --git a/docs/guides/dataset/select_pdf_parser.md b/docs/guides/dataset/select_pdf_parser.md index 95e0305f6f7..fa2d068cb42 100644 --- a/docs/guides/dataset/select_pdf_parser.md +++ b/docs/guides/dataset/select_pdf_parser.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideFileText } --- - # Select PDF parser Select a visual model for parsing your PDFs. @@ -57,12 +56,12 @@ Starting from v0.22.0, RAGFlow includes MinerU (≥ 2.6.3) as an optional PDF p - `"vlm-mlx-engine"` - `"vlm-vllm-async-engine"` - `"vlm-lmdeploy-engine"`. - - `MINERU_SERVER_URL`: (optional) The downstream vLLM HTTP server (e.g., `http://vllm-host:30000`). Applicable when `MINERU_BACKEND` is set to `"vlm-http-client"`. + - `MINERU_SERVER_URL`: (optional) The downstream vLLM HTTP server (e.g., `http://vllm-host:30000`). Applicable when `MINERU_BACKEND` is set to `"vlm-http-client"`. - `MINERU_OUTPUT_DIR`: (optional) The local directory for holding the outputs of the MinerU API service (zip/JSON) before ingestion. - `MINERU_DELETE_OUTPUT`: Whether to delete temporary output when a temporary directory is used: - `1`: Delete. - `0`: Retain. -3. In the web UI, navigate to your dataset's **Configuration** page and find the **Ingestion pipeline** section: +3. In the web UI, navigate to your dataset's **Configuration** page and find the **Ingestion pipeline** section: - If you decide to use a chunking method from the **Built-in** dropdown, ensure it supports PDF parsing, then select **MinerU** from the **PDF parser** dropdown. - If you use a custom ingestion pipeline instead, select **MinerU** in the **PDF parser** section of the **Parser** component. diff --git a/docs/guides/dataset/set_context_window.md b/docs/guides/dataset/set_context_window.md index e3f84262a28..20d9cb597e7 100644 --- a/docs/guides/dataset/set_context_window.md +++ b/docs/guides/dataset/set_context_window.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideListChevronsUpDown } --- - # Set context window size Set context window size for images and tables to improve long-context RAG performances. diff --git a/docs/guides/dataset/set_metadata.md b/docs/guides/dataset/set_metadata.md index 5af503400bd..082fc70b540 100644 --- a/docs/guides/dataset/set_metadata.md +++ b/docs/guides/dataset/set_metadata.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideCode } --- - # Set metadata Manually add metadata to an uploaded file diff --git a/docs/guides/dataset/set_page_rank.md b/docs/guides/dataset/set_page_rank.md index d18b6271b78..de22072ca67 100644 --- a/docs/guides/dataset/set_page_rank.md +++ b/docs/guides/dataset/set_page_rank.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideStickyNote } --- - # Set page rank Create a step-retrieval strategy using page rank. diff --git a/docs/guides/dataset/use_tag_sets.md b/docs/guides/dataset/use_tag_sets.md index 29b005d872f..af9134b2015 100644 --- a/docs/guides/dataset/use_tag_sets.md +++ b/docs/guides/dataset/use_tag_sets.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideTags } --- - # Use tag set Use a tag set to auto-tag chunks in your datasets. @@ -46,10 +45,10 @@ A tag set is *not* involved in document indexing or retrieval. Do not specify a 1. Click **+ Create dataset** to create a dataset. 2. Navigate to the **Configuration** page of the created dataset, select **Built-in** in **Ingestion pipeline**, then choose **Tag** as the default chunking method from the **Built-in** drop-down menu. -3. Go back to the **Files** page and upload and parse your table file in XLSX, CSV, or TXT formats. - _A tag cloud appears under the **Tag view** section, indicating the tag set is created:_ +3. Go back to the **Files** page and upload and parse your table file in XLSX, CSV, or TXT formats. + _A tag cloud appears under the **Tag view** section, indicating the tag set is created:_ ![Image](https://github.com/user-attachments/assets/abefbcbf-c130-4abe-95e1-267b0d2a0505) -4. Click the **Table** tab to view the tag frequency table: +4. Click the **Table** tab to view the tag frequency table: ![Image](https://github.com/user-attachments/assets/af91d10c-5ea5-491f-ab21-3803d5ebf59f) ## 2. Tag chunks @@ -63,12 +62,12 @@ Once a tag set is created, you can apply it to your dataset: If the tag set is missing from the dropdown, check that it has been created or configured correctly. ::: -3. Re-parse your documents to start the auto-tagging process. +3. Re-parse your documents to start the auto-tagging process. _In an AI chat scenario using auto-tagged datasets, each query will be tagged using the corresponding tag set(s) and chunks with these tags will have a higher chance to be retrieved._ ## 3. Update tag set -Creating a tag set is *not* for once and for all. Oftentimes, you may find it necessary to update or delete existing tags or add new entries. +Creating a tag set is *not* for once and for all. Oftentimes, you may find it necessary to update or delete existing tags or add new entries. - You can update the existing tag set in the tag frequency table. - To add new entries, you can add and parse new table files in XLSX, CSV, or TXT formats. diff --git a/docs/guides/manage_files.md b/docs/guides/manage_files.md index 2d60c485d62..33b843d2e43 100644 --- a/docs/guides/manage_files.md +++ b/docs/guides/manage_files.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideFolderDot } --- - # Files RAGFlow's file management allows you to upload files individually or in bulk. You can then link an uploaded file to multiple target datasets. This guide showcases some basic usages of the file management feature. @@ -16,7 +15,7 @@ Compared to uploading files directly to various datasets, uploading them to RAGF ## Create folder -RAGFlow's file management allows you to establish your file system with nested folder structures. To create a folder in the root directory of RAGFlow: +RAGFlow's file management allows you to establish your file system with nested folder structures. To create a folder in the root directory of RAGFlow: ![create new folder](https://github.com/infiniflow/ragflow/assets/93570324/3a37a5f4-43a6-426d-a62a-e5cd2ff7a533) @@ -26,7 +25,7 @@ Each dataset in RAGFlow has a corresponding folder under the **root/.knowledgeba ## Upload file -RAGFlow's file management supports file uploads from your local machine, allowing both individual and bulk uploads: +RAGFlow's file management supports file uploads from your local machine, allowing both individual and bulk uploads: ![upload file](https://github.com/infiniflow/ragflow/assets/93570324/5d7ded14-ce2b-4703-8567-9356a978f45c) @@ -48,7 +47,7 @@ RAGFlow's file management allows you to *link* an uploaded file to multiple data ![link knowledgebase](https://github.com/infiniflow/ragflow/assets/93570324/6c6b8db4-3269-4e35-9434-6089887e3e3f) -You can link your file to one dataset or multiple datasets at one time: +You can link your file to one dataset or multiple datasets at one time: ![link multiple kb](https://github.com/infiniflow/ragflow/assets/93570324/6c508803-fb1f-435d-b688-683066fd7fff) @@ -71,9 +70,9 @@ RAGFlow's file management allows you to rename a file or folder: ## Delete files or folders -RAGFlow's file management allows you to delete files or folders individually or in bulk. +RAGFlow's file management allows you to delete files or folders individually or in bulk. -To delete a file or folder: +To delete a file or folder: ![delete file](https://github.com/infiniflow/ragflow/assets/93570324/85872728-125d-45e9-a0ee-21e9d4cedb8b) @@ -81,7 +80,7 @@ To bulk delete files or folders: ![bulk delete](https://github.com/infiniflow/ragflow/assets/93570324/519b99ab-ec7f-4c8a-8cea-e0b6dcb3cb46) -> - You are not allowed to delete the **root/.knowledgebase** folder. +> - You are not allowed to delete the **root/.knowledgebase** folder. > - Deleting files that have been linked to datasets will **AUTOMATICALLY REMOVE** all associated file references across the datasets. ## Download uploaded file @@ -90,4 +89,4 @@ RAGFlow's file management allows you to download an uploaded file: ![download_file](https://github.com/infiniflow/ragflow/assets/93570324/cf3b297f-7d9b-4522-bf5f-4f45743e4ed5) -> As of RAGFlow v0.23.1, bulk download is not supported, nor can you download an entire folder. +> As of RAGFlow v0.23.1, bulk download is not supported, nor can you download an entire folder. diff --git a/docs/guides/models/deploy_local_llm.mdx b/docs/guides/models/deploy_local_llm.mdx index 2e141a79ea6..e7e3fbeaee3 100644 --- a/docs/guides/models/deploy_local_llm.mdx +++ b/docs/guides/models/deploy_local_llm.mdx @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideMonitorCog } --- - # Deploy local models import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; @@ -56,9 +55,9 @@ $ sudo docker exec ollama ollama pull llama3.2 ``` ```bash -$ sudo docker exec ollama ollama pull bge-m3 -> pulling daec91ffb5dd... 100% ▕████████████████▏ 1.2 GB -> success +$ sudo docker exec ollama ollama pull bge-m3 +> pulling daec91ffb5dd... 100% ▕████████████████▏ 1.2 GB +> success ``` ### 2. Find Ollama URL and ensure it is accessible @@ -108,7 +107,7 @@ Max retries exceeded with url: /api/chat (Caused by NewConnectionError('** **Model providers** **>** **System Model Settings** to update your model: - + - *You should now be able to find **llama3.2** from the dropdown list under **Chat model**, and **bge-m3** from the dropdown list under **Embedding model**.* ### 6. Update Chat Configuration @@ -128,7 +127,7 @@ To deploy a local model, e.g., **Mistral**, using Xinference: ### 1. Check firewall settings -Ensure that your host machine's firewall allows inbound connections on port 9997. +Ensure that your host machine's firewall allows inbound connections on port 9997. ### 2. Start an Xinference instance @@ -151,13 +150,13 @@ In RAGFlow, click on your logo on the top right of the page **>** **Model provid ### 5. Complete basic Xinference settings -Enter an accessible base URL, such as `http://:9997/v1`. +Enter an accessible base URL, such as `http://:9997/v1`. > For rerank model, please use the `http://:9997/v1/rerank` as the base URL. ### 6. Update System Model Settings Click on your logo **>** **Model providers** **>** **System Model Settings** to update your model. - + *You should now be able to find **mistral** from the dropdown list under **Chat model**.* ### 7. Update Chat Configuration @@ -173,7 +172,7 @@ To deploy a local model, e.g., **Qwen2**, using IPEX-LLM-accelerated Ollama: ### 1. Check firewall settings Ensure that your host machine's firewall allows inbound connections on port 11434. For example: - + ```bash sudo ufw allow 11434/tcp ``` @@ -182,7 +181,7 @@ sudo ufw allow 11434/tcp #### 2.1 Install IPEX-LLM for Ollama -:::tip NOTE +:::tip NOTE IPEX-LLM's supports Ollama on Linux and Windows systems. ::: @@ -194,7 +193,7 @@ For detailed information about installing IPEX-LLM for Ollama, see [Run llama.cp #### 2.2 Initialize Ollama -1. Activate the `llm-cpp` Conda environment and initialize Ollama: +1. Activate the `llm-cpp` Conda environment and initialize Ollama: - + ```bash conda activate llm-cpp init-ollama @@ -221,7 +220,7 @@ For detailed information about installing IPEX-LLM for Ollama, see [Run llama.cp 2. If the installed `ipex-llm[cpp]` requires an upgrade to the Ollama binary files, remove the old binary files and reinitialize Ollama using `init-ollama` (Linux) or `init-ollama.bat` (Windows). - + *A symbolic link to Ollama appears in your current directory, and you can use this executable file following standard Ollama commands.* #### 2.3 Launch Ollama service @@ -229,7 +228,7 @@ For detailed information about installing IPEX-LLM for Ollama, see [Run llama.cp 1. Set the environment variable `OLLAMA_NUM_GPU` to `999` to ensure that all layers of your model run on the Intel GPU; otherwise, some layers may default to CPU. 2. For optimal performance on Intel Arc™ A-Series Graphics with Linux OS (Kernel 6.2), set the following environment variable before launching the Ollama service: - ```bash + ```bash export SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 ``` 3. Launch the Ollama service: @@ -317,12 +316,12 @@ To enable IPEX-LLM accelerated Ollama in RAGFlow, you must also complete the con 3. [Update System Model Settings](#6-update-system-model-settings) 4. [Update Chat Configuration](#7-update-chat-configuration) -### 5. Deploy VLLM +### 5. Deploy VLLM ubuntu 22.04/24.04 ```bash - pip install vllm + pip install vllm ``` ### 5.1 RUN VLLM WITH BEST PRACTISE diff --git a/docs/guides/models/llm_api_key_setup.md b/docs/guides/models/llm_api_key_setup.md index b996105c42d..d2cf67597cc 100644 --- a/docs/guides/models/llm_api_key_setup.md +++ b/docs/guides/models/llm_api_key_setup.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideKey } --- - # Configure model API key An API key is required for RAGFlow to interact with an online AI model. This guide provides information about setting your model API key in RAGFlow. @@ -33,7 +32,7 @@ You have two options for configuring your model API key: - Update `api_key` with yours. - Update `base_url` if you use a proxy to connect to the remote service. 3. Reboot your system for your changes to take effect. -4. Log into RAGFlow. +4. Log into RAGFlow. _After logging into RAGFlow, you will find your chosen model appears under **Added models** on the **Model providers** page._ ### Configure model API key after logging into RAGFlow diff --git a/docs/guides/team/join_or_leave_team.md b/docs/guides/team/join_or_leave_team.md index a4acf573792..dfc80ed5a1e 100644 --- a/docs/guides/team/join_or_leave_team.md +++ b/docs/guides/team/join_or_leave_team.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideLogOut } --- - # Join or leave a team Accept an invitation to join a team, decline an invitation, or leave a team. diff --git a/docs/guides/team/manage_team_members.md b/docs/guides/team/manage_team_members.md index c529c1c0695..6df75899108 100644 --- a/docs/guides/team/manage_team_members.md +++ b/docs/guides/team/manage_team_members.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideUserCog } --- - # Manage team members Invite or remove team members. diff --git a/docs/guides/team/share_agents.md b/docs/guides/team/share_agents.md index 84f13e7c0b9..f901f08ebfc 100644 --- a/docs/guides/team/share_agents.md +++ b/docs/guides/team/share_agents.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideShare2 } --- - # Share Agent Share an Agent with your team members. @@ -14,7 +13,7 @@ Share an Agent with your team members. When ready, you may share your Agents with your team members so that they can use them. Please note that your Agents are not shared automatically; you must manually enable sharing by selecting the corresponding **Permissions** radio button: -1. Click the intended Agent to open its editing canvas. +1. Click the intended Agent to open its editing canvas. 2. Click **Management** > **Settings** to show the **Agent settings** dialogue. 3. Change **Permissions** from **Only me** to **Team**. 4. Click **Save** to apply your changes. diff --git a/docs/guides/team/share_chat_assistant.md b/docs/guides/team/share_chat_assistant.md index c8d04eb8b26..719fbda51ac 100644 --- a/docs/guides/team/share_chat_assistant.md +++ b/docs/guides/team/share_chat_assistant.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideShare2 } --- - # Share chat assistant Sharing chat assistant is currently exclusive to RAGFlow Enterprise, but will be made available in due course. \ No newline at end of file diff --git a/docs/guides/team/share_knowledge_bases.md b/docs/guides/team/share_knowledge_bases.md index 57e67912ee8..3f00c9bd8ea 100644 --- a/docs/guides/team/share_knowledge_bases.md +++ b/docs/guides/team/share_knowledge_bases.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideShare2 } --- - # Share dataset Share a dataset with team members. diff --git a/docs/guides/team/share_model.md b/docs/guides/team/share_model.md index 831415baa37..5a97e671651 100644 --- a/docs/guides/team/share_model.md +++ b/docs/guides/team/share_model.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideShare2 } --- - # Share models Sharing models is currently exclusive to RAGFlow Enterprise. \ No newline at end of file diff --git a/docs/guides/tracing.mdx b/docs/guides/tracing.mdx index 41b5a41a6ac..13cf99874b8 100644 --- a/docs/guides/tracing.mdx +++ b/docs/guides/tracing.mdx @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideLocateFixed } --- - # Tracing Observability & Tracing with Langfuse. @@ -18,10 +17,10 @@ This document is contributed by our community contributor [jannikmaierhoefer](ht RAGFlow ships with a built-in [Langfuse](https://langfuse.com) integration so that you can **inspect and debug every retrieval and generation step** of your RAG pipelines in near real-time. -Langfuse stores traces, spans and prompt payloads in a purpose-built observability backend and offers filtering and visualisations on top. +Langfuse stores traces, spans and prompt payloads in a purpose-built observability backend and offers filtering and visualisations on top. :::info NOTE -• RAGFlow **≥ 0.18.0** (contains the Langfuse connector) +• RAGFlow **≥ 0.18.0** (contains the Langfuse connector) • A Langfuse workspace (cloud or self-hosted) with a _Project Public Key_ and _Secret Key_ ::: @@ -29,9 +28,9 @@ Langfuse stores traces, spans and prompt payloads in a purpose-built observabili ## 1. Collect your Langfuse credentials -1. Sign in to your Langfuse dashboard. -2. Open **Settings ▸ Projects** and either create a new project or select an existing one. -3. Copy the **Public Key** and **Secret Key**. +1. Sign in to your Langfuse dashboard. +2. Open **Settings ▸ Projects** and either create a new project or select an existing one. +3. Copy the **Public Key** and **Secret Key**. 4. Note the Langfuse **host** (e.g. `https://cloud.langfuse.com`). Use the base URL of your own installation if you self-host. > The keys are _project-scoped_: one pair of keys is enough for all environments that should write into the same project. @@ -42,10 +41,10 @@ Langfuse stores traces, spans and prompt payloads in a purpose-built observabili RAGFlow stores the credentials _per tenant_. You can configure them either via the web UI or the HTTP API. -1. Log in to RAGFlow and click your avatar in the top-right corner. -2. Select **API ▸ Scroll down to the bottom ▸ Langfuse Configuration**. -3. Fill in you Langfuse **Host**, **Public Key** and **Secret Key**. -4. Click **Save**. +1. Log in to RAGFlow and click your avatar in the top-right corner. +2. Select **API ▸ Scroll down to the bottom ▸ Langfuse Configuration**. +3. Fill in you Langfuse **Host**, **Public Key** and **Secret Key**. +4. Click **Save**. ![Example RAGFlow trace in Langfuse](https://langfuse.com/images/docs/ragflow/ragflow-configuration.gif) @@ -55,14 +54,14 @@ Once saved, RAGFlow starts emitting traces automatically – no code change requ ## 3. Run a pipeline and watch the traces -1. Execute any chat or retrieval pipeline in RAGFlow (e.g. the Quickstart demo). -2. Open your Langfuse project ▸ **Traces**. +1. Execute any chat or retrieval pipeline in RAGFlow (e.g. the Quickstart demo). +2. Open your Langfuse project ▸ **Traces**. 3. Filter by **name ~ `ragflow-*`** (RAGFlow prefixes each trace with `ragflow-`). For every user request you will see: -• a **trace** representing the overall request -• **spans** for retrieval, ranking and generation steps +• a **trace** representing the overall request +• **spans** for retrieval, ranking and generation steps • the complete **prompts**, **retrieved documents** and **LLM responses** as metadata ![Example RAGFlow trace in Langfuse](https://langfuse.com/images/docs/ragflow/ragflow-trace-frame.png) diff --git a/docs/guides/upgrade_ragflow.mdx b/docs/guides/upgrade_ragflow.mdx index e299dc74b69..2169dac0a40 100644 --- a/docs/guides/upgrade_ragflow.mdx +++ b/docs/guides/upgrade_ragflow.mdx @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideArrowBigUpDash } --- - # Upgrading import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx index 3a0f336eb13..748f71584b8 100644 --- a/docs/quickstart.mdx +++ b/docs/quickstart.mdx @@ -5,7 +5,6 @@ sidebar_custom_props: { sidebarIcon: LucideRocket } --- - # Get started import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; @@ -15,9 +14,9 @@ RAGFlow is an open-source RAG (Retrieval-Augmented Generation) engine based on d This quick start guide describes a general process from: -- Starting up a local RAGFlow server, -- Creating a dataset, -- Intervening with file parsing, to +- Starting up a local RAGFlow server, +- Creating a dataset, +- Intervening with file parsing, to - Establishing an AI chat based on your datasets. :::danger IMPORTANT @@ -74,7 +73,7 @@ This section provides instructions on setting up the RAGFlow server on Linux. If :::caution WARNING This change will be reset after a system reboot. If you forget to update the value the next time you start up the server, you may get a `Can't connect to ES cluster` exception. ::: - + 1.3. To ensure your change remains permanent, add or update the `vm.max_map_count` value in **/etc/sysctl.conf** accordingly: ```bash @@ -148,7 +147,7 @@ This section provides instructions on setting up the RAGFlow server on Linux. If ``` #### If you are on Windows with Docker Desktop WSL 2 backend, then use docker-desktop to set `vm.max_map_count`: - 1.1. Run the following in WSL: + 1.1. Run the following in WSL: ```bash $ wsl -d docker-desktop -u root $ sysctl -w vm.max_map_count=262144 @@ -175,7 +174,7 @@ This section provides instructions on setting up the RAGFlow server on Linux. If ``` ```bash - # Append a line, which reads: + # Append a line, which reads: vm.max_map_count = 262144 ``` ::: @@ -230,13 +229,13 @@ This section provides instructions on setting up the RAGFlow server on Linux. If / /_/ // /| | / / __ / /_ / // __ \| | /| / / / _, _// ___ |/ /_/ // __/ / // /_/ /| |/ |/ / /_/ |_|/_/ |_|\____//_/ /_/ \____/ |__/|__/ - + * Running on all addresses (0.0.0.0) ``` :::danger IMPORTANT If you skip this confirmation step and directly log in to RAGFlow, your browser may prompt a `network anomaly` error because, at that moment, your RAGFlow may not be fully initialized. - ::: + ::: 5. In your web browser, enter the IP address of your server and log in to RAGFlow. @@ -248,24 +247,24 @@ This section provides instructions on setting up the RAGFlow server on Linux. If RAGFlow is a RAG engine and needs to work with an LLM to offer grounded, hallucination-free question-answering capabilities. RAGFlow supports most mainstream LLMs. For a complete list of supported models, please refer to [Supported Models](./references/supported_models.mdx). -:::note -RAGFlow also supports deploying LLMs locally using Ollama, Xinference, or LocalAI, but this part is not covered in this quick start guide. +:::note +RAGFlow also supports deploying LLMs locally using Ollama, Xinference, or LocalAI, but this part is not covered in this quick start guide. ::: -To add and configure an LLM: +To add and configure an LLM: 1. Click on your logo on the top right of the page **>** **Model providers**. 2. Click on the desired LLM and update the API key accordingly. -3. Click **System Model Settings** to select the default models: +3. Click **System Model Settings** to select the default models: - - Chat model, - - Embedding model, + - Chat model, + - Embedding model, - Image-to-text model, - and more. -> Some models, such as the image-to-text model **qwen-vl-max**, are subsidiary to a specific LLM. And you may need to update your API key to access these models. +> Some models, such as the image-to-text model **qwen-vl-max**, are subsidiary to a specific LLM. And you may need to update your API key to access these models. ## Create your first dataset @@ -281,21 +280,21 @@ To create your first dataset: ![dataset configuration](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/configure_knowledge_base.jpg) -3. RAGFlow offers multiple chunk templates that cater to different document layouts and file formats. Select the embedding model and chunking method (template) for your dataset. +3. RAGFlow offers multiple chunk templates that cater to different document layouts and file formats. Select the embedding model and chunking method (template) for your dataset. - :::danger IMPORTANT - Once you have selected an embedding model and used it to parse a file, you are no longer allowed to change it. The obvious reason is that we must ensure that all files in a specific dataset are parsed using the *same* embedding model (ensure that they are being compared in the same embedding space). + :::danger IMPORTANT + Once you have selected an embedding model and used it to parse a file, you are no longer allowed to change it. The obvious reason is that we must ensure that all files in a specific dataset are parsed using the *same* embedding model (ensure that they are being compared in the same embedding space). ::: _You are taken to the **Dataset** page of your dataset._ -4. Click **+ Add file** **>** **Local files** to start uploading a particular file to the dataset. +4. Click **+ Add file** **>** **Local files** to start uploading a particular file to the dataset. 5. In the uploaded file entry, click the play button to start file parsing: ![parse file](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/parse_file.jpg) - :::caution NOTE + :::caution NOTE - If your file parsing gets stuck at below 1%, see [this FAQ](./faq.mdx#why-does-my-document-parsing-stall-at-under-one-percent). - If your file parsing gets stuck at near completion, see [this FAQ](./faq.mdx#why-does-my-pdf-parsing-stall-near-completion-while-the-log-does-not-show-any-error) ::: diff --git a/docs/references/glossary.mdx b/docs/references/glossary.mdx index f4cb071e77c..dce691c6664 100644 --- a/docs/references/glossary.mdx +++ b/docs/references/glossary.mdx @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideCaseUpper } --- - # Glossary Definitions of key terms and basic concepts related to RAGFlow. diff --git a/docs/references/http_api_reference.md b/docs/references/http_api_reference.md index dbfe8b66cb6..9e011e8ca3e 100644 --- a/docs/references/http_api_reference.md +++ b/docs/references/http_api_reference.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideGlobe } --- - # HTTP API A complete reference for RAGFlow's RESTful API. Before proceeding, please ensure you [have your RAGFlow API key ready for authentication](https://ragflow.io/docs/dev/acquire_ragflow_api_key). @@ -82,17 +81,17 @@ curl --request POST \ ##### Request Parameters -- `model` (*Body parameter*) `string`, *Required* +- `model` (*Body parameter*) `string`, *Required* The model used to generate the response. The server will parse this automatically, so you can set it to any value for now. -- `messages` (*Body parameter*) `list[object]`, *Required* +- `messages` (*Body parameter*) `list[object]`, *Required* A list of historical chat messages used to generate the response. This must contain at least one message with the `user` role. -- `stream` (*Body parameter*) `boolean` +- `stream` (*Body parameter*) `boolean` Whether to receive the response as a stream. Set this to `false` explicitly if you prefer to receive the entire response in one go instead of as a stream. -- `extra_body` (*Body parameter*) `object` - Extra request parameters: +- `extra_body` (*Body parameter*) `object` + Extra request parameters: - `reference`: `boolean` - include reference in the final chunk (stream) or in the final message (non-stream). - `metadata_condition`: `object` - metadata filter conditions applied to retrieval results. @@ -212,16 +211,16 @@ curl --request POST \ ##### Request Parameters -- `model` (*Body parameter*) `string`, *Required* +- `model` (*Body parameter*) `string`, *Required* The model used to generate the response. The server will parse this automatically, so you can set it to any value for now. -- `messages` (*Body parameter*) `list[object]`, *Required* +- `messages` (*Body parameter*) `list[object]`, *Required* A list of historical chat messages used to generate the response. This must contain at least one message with the `user` role. -- `stream` (*Body parameter*) `boolean` +- `stream` (*Body parameter*) `boolean` Whether to receive the response as a stream. Set this to `false` explicitly if you prefer to receive the entire response in one go instead of as a stream. -- `session_id` (*Body parameter*) `string` +- `session_id` (*Body parameter*) `string` Agent session id. #### Response @@ -477,33 +476,33 @@ curl --request POST \ ##### Request parameters -- `"name"`: (*Body parameter*), `string`, *Required* - The unique name of the dataset to create. It must adhere to the following requirements: +- `"name"`: (*Body parameter*), `string`, *Required* + The unique name of the dataset to create. It must adhere to the following requirements: - Basic Multilingual Plane (BMP) only - Maximum 128 characters - Case-insensitive -- `"avatar"`: (*Body parameter*), `string` +- `"avatar"`: (*Body parameter*), `string` Base64 encoding of the avatar. - Maximum 65535 characters -- `"description"`: (*Body parameter*), `string` +- `"description"`: (*Body parameter*), `string` A brief description of the dataset to create. - Maximum 65535 characters -- `"embedding_model"`: (*Body parameter*), `string` +- `"embedding_model"`: (*Body parameter*), `string` The name of the embedding model to use. For example: `"BAAI/bge-large-zh-v1.5@BAAI"` - Maximum 255 characters - Must follow `model_name@model_factory` format -- `"permission"`: (*Body parameter*), `string` - Specifies who can access the dataset to create. Available options: +- `"permission"`: (*Body parameter*), `string` + Specifies who can access the dataset to create. Available options: - `"me"`: (Default) Only you can manage the dataset. - `"team"`: All team members can manage the dataset. -- `"chunk_method"`: (*Body parameter*), `enum` - The default chunk method of the dataset to create. Mutually exclusive with `"parse_type"` and `"pipeline_id"`. If you set `"chunk_method"`, do not include `"parse_type"` or `"pipeline_id"`. - Available options: +- `"chunk_method"`: (*Body parameter*), `enum` + The default chunk method of the dataset to create. Mutually exclusive with `"parse_type"` and `"pipeline_id"`. If you set `"chunk_method"`, do not include `"parse_type"` or `"pipeline_id"`. + Available options: - `"naive"`: General (default) - `"book"`: Book - `"email"`: Email @@ -517,8 +516,8 @@ curl --request POST \ - `"table"`: Table - `"tag"`: Tag -- `"parser_config"`: (*Body parameter*), `object` - The configuration settings for the dataset parser. The attributes in this JSON object vary with the selected `"chunk_method"`: +- `"parser_config"`: (*Body parameter*), `object` + The configuration settings for the dataset parser. The attributes in this JSON object vary with the selected `"chunk_method"`: - If `"chunk_method"` is `"naive"`, the `"parser_config"` object contains the following attributes: - `"auto_keywords"`: `int` - Defaults to `0` @@ -550,17 +549,17 @@ curl --request POST \ - Defaults to: `{"use_raptor": false}` - `"graphrag"`: `object` GRAPHRAG-specific settings. - Defaults to: `{"use_graphrag": false}` - - If `"chunk_method"` is `"qa"`, `"manuel"`, `"paper"`, `"book"`, `"laws"`, or `"presentation"`, the `"parser_config"` object contains the following attribute: + - If `"chunk_method"` is `"qa"`, `"manuel"`, `"paper"`, `"book"`, `"laws"`, or `"presentation"`, the `"parser_config"` object contains the following attribute: - `"raptor"`: `object` RAPTOR-specific settings. - Defaults to: `{"use_raptor": false}`. - If `"chunk_method"` is `"table"`, `"picture"`, `"one"`, or `"email"`, `"parser_config"` is an empty JSON object. -- `"parse_type"`: (*Body parameter*), `int` - The ingestion pipeline parse type identifier, i.e., the number of parsers in your **Parser** component. +- `"parse_type"`: (*Body parameter*), `int` + The ingestion pipeline parse type identifier, i.e., the number of parsers in your **Parser** component. - Required (along with `"pipeline_id"`) if specifying an ingestion pipeline. - Must not be included when `"chunk_method"` is specified. -- `"pipeline_id"`: (*Body parameter*), `string` +- `"pipeline_id"`: (*Body parameter*), `string` The ingestion pipeline ID. Can be found in the corresponding URL in the RAGFlow UI. - Required (along with `"parse_type"`) if specifying an ingestion pipeline. - Must be a 32-character lowercase hexadecimal string, e.g., `"d0bebe30ae2211f0970942010a8e0005"`. @@ -597,10 +596,10 @@ Success: "name": "RAGFlow example", "pagerank": 0, "parser_config": { - "chunk_token_num": 128, - "delimiter": "\\n!?;。;!?", - "html4excel": false, - "layout_recognize": "DeepDOC", + "chunk_token_num": 128, + "delimiter": "\\n!?;。;!?", + "html4excel": false, + "layout_recognize": "DeepDOC", "raptor": { "use_raptor": false } @@ -658,7 +657,7 @@ curl --request DELETE \ ##### Request parameters -- `"ids"`: (*Body parameter*), `list[string]` or `null`, *Required* +- `"ids"`: (*Body parameter*), `list[string]` or `null`, *Required* Specifies the datasets to delete: - If `null`, all datasets will be deleted. - If an array of IDs, only the specified datasets will be deleted. @@ -670,7 +669,7 @@ Success: ```json { - "code": 0 + "code": 0 } ``` @@ -723,32 +722,32 @@ curl --request PUT \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The ID of the dataset to update. -- `"name"`: (*Body parameter*), `string` +- `"name"`: (*Body parameter*), `string` The revised name of the dataset. - Basic Multilingual Plane (BMP) only - Maximum 128 characters - Case-insensitive -- `"avatar"`: (*Body parameter*), `string` +- `"avatar"`: (*Body parameter*), `string` The updated base64 encoding of the avatar. - Maximum 65535 characters -- `"embedding_model"`: (*Body parameter*), `string` - The updated embedding model name. +- `"embedding_model"`: (*Body parameter*), `string` + The updated embedding model name. - Ensure that `"chunk_count"` is `0` before updating `"embedding_model"`. - Maximum 255 characters - Must follow `model_name@model_factory` format -- `"permission"`: (*Body parameter*), `string` - The updated dataset permission. Available options: +- `"permission"`: (*Body parameter*), `string` + The updated dataset permission. Available options: - `"me"`: (Default) Only you can manage the dataset. - `"team"`: All team members can manage the dataset. -- `"pagerank"`: (*Body parameter*), `int` +- `"pagerank"`: (*Body parameter*), `int` refer to [Set page rank](https://ragflow.io/docs/dev/set_page_rank) - Default: `0` - Minimum: `0` - Maximum: `100` -- `"chunk_method"`: (*Body parameter*), `enum` - The chunking method for the dataset. Available options: +- `"chunk_method"`: (*Body parameter*), `enum` + The chunking method for the dataset. Available options: - `"naive"`: General (default) - `"book"`: Book - `"email"`: Email @@ -761,8 +760,8 @@ curl --request PUT \ - `"qa"`: Q&A - `"table"`: Table - `"tag"`: Tag -- `"parser_config"`: (*Body parameter*), `object` - The configuration settings for the dataset parser. The attributes in this JSON object vary with the selected `"chunk_method"`: +- `"parser_config"`: (*Body parameter*), `object` + The configuration settings for the dataset parser. The attributes in this JSON object vary with the selected `"chunk_method"`: - If `"chunk_method"` is `"naive"`, the `"parser_config"` object contains the following attributes: - `"auto_keywords"`: `int` - Defaults to `0` @@ -791,7 +790,7 @@ curl --request PUT \ - Defaults to: `{"use_raptor": false}` - `"graphrag"`: `object` GRAPHRAG-specific settings. - Defaults to: `{"use_graphrag": false}` - - If `"chunk_method"` is `"qa"`, `"manuel"`, `"paper"`, `"book"`, `"laws"`, or `"presentation"`, the `"parser_config"` object contains the following attribute: + - If `"chunk_method"` is `"qa"`, `"manuel"`, `"paper"`, `"book"`, `"laws"`, or `"presentation"`, the `"parser_config"` object contains the following attribute: - `"raptor"`: `object` RAPTOR-specific settings. - Defaults to: `{"use_raptor": false}`. - If `"chunk_method"` is `"table"`, `"picture"`, `"one"`, or `"email"`, `"parser_config"` is an empty JSON object. @@ -802,7 +801,7 @@ Success: ```json { - "code": 0 + "code": 0 } ``` @@ -840,19 +839,19 @@ curl --request GET \ ##### Request parameters -- `page`: (*Filter parameter*) +- `page`: (*Filter parameter*) Specifies the page on which the datasets will be displayed. Defaults to `1`. -- `page_size`: (*Filter parameter*) +- `page_size`: (*Filter parameter*) The number of datasets on each page. Defaults to `30`. -- `orderby`: (*Filter parameter*) +- `orderby`: (*Filter parameter*) The field by which datasets should be sorted. Available options: - `create_time` (default) - `update_time` -- `desc`: (*Filter parameter*) +- `desc`: (*Filter parameter*) Indicates whether the retrieved datasets should be sorted in descending order. Defaults to `true`. -- `name`: (*Filter parameter*) +- `name`: (*Filter parameter*) The name of the dataset to retrieve. -- `id`: (*Filter parameter*) +- `id`: (*Filter parameter*) The ID of the dataset to retrieve. #### Response @@ -935,7 +934,7 @@ curl --request GET \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The ID of the target dataset. #### Response @@ -1015,7 +1014,7 @@ curl --request DELETE \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The ID of the target dataset. #### Response @@ -1063,7 +1062,7 @@ curl --request POST \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The ID of the target dataset. #### Response @@ -1113,7 +1112,7 @@ curl --request GET \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The ID of the target dataset. #### Response @@ -1178,7 +1177,7 @@ curl --request POST \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The ID of the target dataset. #### Response @@ -1228,7 +1227,7 @@ curl --request GET \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The ID of the target dataset. #### Response @@ -1304,9 +1303,9 @@ curl --request POST \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The ID of the dataset to which the documents will be uploaded. -- `'file'`: (*Body parameter*) +- `'file'`: (*Body parameter*) A document to upload. #### Response @@ -1381,8 +1380,8 @@ curl --request PUT \ --header 'Content-Type: application/json' \ --data ' { - "name": "manual.txt", - "chunk_method": "manual", + "name": "manual.txt", + "chunk_method": "manual", "parser_config": {"chunk_token_num": 128} }' @@ -1390,14 +1389,14 @@ curl --request PUT \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The ID of the associated dataset. -- `document_id`: (*Path parameter*) +- `document_id`: (*Path parameter*) The ID of the document to update. - `"name"`: (*Body parameter*), `string` - `"meta_fields"`: (*Body parameter*), `dict[str, Any]` The meta fields of the document. -- `"chunk_method"`: (*Body parameter*), `string` - The parsing method to apply to the document: +- `"chunk_method"`: (*Body parameter*), `string` + The parsing method to apply to the document: - `"naive"`: General - `"manual`: Manual - `"qa"`: Q&A @@ -1409,8 +1408,8 @@ curl --request PUT \ - `"picture"`: Picture - `"one"`: One - `"email"`: Email -- `"parser_config"`: (*Body parameter*), `object` - The configuration settings for the dataset parser. The attributes in this JSON object vary with the selected `"chunk_method"`: +- `"parser_config"`: (*Body parameter*), `object` + The configuration settings for the dataset parser. The attributes in this JSON object vary with the selected `"chunk_method"`: - If `"chunk_method"` is `"naive"`, the `"parser_config"` object contains the following attributes: - `"chunk_token_num"`: Defaults to `256`. - `"layout_recognize"`: Defaults to `true`. @@ -1421,10 +1420,10 @@ curl --request PUT \ - If `"chunk_method"` is `"qa"`, `"manuel"`, `"paper"`, `"book"`, `"laws"`, or `"presentation"`, the `"parser_config"` object contains the following attribute: - `"raptor"`: RAPTOR-specific settings. Defaults to: `{"use_raptor": false}`. - If `"chunk_method"` is `"table"`, `"picture"`, `"one"`, or `"email"`, `"parser_config"` is an empty JSON object. -- `"enabled"`: (*Body parameter*), `integer` - Whether the document should be **available** in the knowledge base. - - `1` → (available) - - `0` → (unavailable) +- `"enabled"`: (*Body parameter*), `integer` + Whether the document should be **available** in the knowledge base. + - `1` → (available) + - `0` → (unavailable) #### Response @@ -1548,9 +1547,9 @@ curl --request GET \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The associated dataset ID. -- `documents_id`: (*Path parameter*) +- `documents_id`: (*Path parameter*) The ID of the document to download. #### Response @@ -1598,30 +1597,30 @@ curl --request GET \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The associated dataset ID. -- `keywords`: (*Filter parameter*), `string` +- `keywords`: (*Filter parameter*), `string` The keywords used to match document titles. - `page`: (*Filter parameter*), `integer` Specifies the page on which the documents will be displayed. Defaults to `1`. -- `page_size`: (*Filter parameter*), `integer` +- `page_size`: (*Filter parameter*), `integer` The maximum number of documents on each page. Defaults to `30`. -- `orderby`: (*Filter parameter*), `string` +- `orderby`: (*Filter parameter*), `string` The field by which documents should be sorted. Available options: - `create_time` (default) - `update_time` -- `desc`: (*Filter parameter*), `boolean` +- `desc`: (*Filter parameter*), `boolean` Indicates whether the retrieved documents should be sorted in descending order. Defaults to `true`. -- `id`: (*Filter parameter*), `string` +- `id`: (*Filter parameter*), `string` The ID of the document to retrieve. -- `create_time_from`: (*Filter parameter*), `integer` +- `create_time_from`: (*Filter parameter*), `integer` Unix timestamp for filtering documents created after this time. 0 means no filter. Defaults to `0`. -- `create_time_to`: (*Filter parameter*), `integer` +- `create_time_to`: (*Filter parameter*), `integer` Unix timestamp for filtering documents created before this time. 0 means no filter. Defaults to `0`. -- `suffix`: (*Filter parameter*), `array[string]` +- `suffix`: (*Filter parameter*), `array[string]` Filter by file suffix. Supports multiple values, e.g., `pdf`, `txt`, and `docx`. Defaults to all suffixes. -- `run`: (*Filter parameter*), `array[string]` - Filter by document processing status. Supports numeric, text, and mixed formats: +- `run`: (*Filter parameter*), `array[string]` + Filter by document processing status. Supports numeric, text, and mixed formats: - Numeric format: `["0", "1", "2", "3", "4"]` - Text format: `[UNSTART, RUNNING, CANCEL, DONE, FAIL]` - Mixed format: `[UNSTART, 1, DONE]` (mixing numeric and text formats) @@ -1630,7 +1629,7 @@ curl --request GET \ - `1` / `RUNNING`: Document is currently being processed - `2` / `CANCEL`: Document processing was cancelled - `3` / `DONE`: Document processing completed successfully - - `4` / `FAIL`: Document processing failed + - `4` / `FAIL`: Document processing failed Defaults to all statuses. - `metadata_condition`: (*Filter parameter*), `object` (JSON in query) Optional metadata filter applied to documents when `document_ids` is not provided. Uses the same structure as retrieval: @@ -1744,9 +1743,9 @@ curl --request DELETE \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The associated dataset ID. -- `"ids"`: (*Body parameter*), `list[string]` +- `"ids"`: (*Body parameter*), `list[string]` The IDs of the documents to delete. If it is not specified, all documents in the specified dataset will be deleted. #### Response @@ -1801,9 +1800,9 @@ curl --request POST \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The dataset ID. -- `"document_ids"`: (*Body parameter*), `list[string]`, *Required* +- `"document_ids"`: (*Body parameter*), `list[string]`, *Required* The IDs of the documents to parse. #### Response @@ -1858,9 +1857,9 @@ curl --request DELETE \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The associated dataset ID. -- `"document_ids"`: (*Body parameter*), `list[string]`, *Required* +- `"document_ids"`: (*Body parameter*), `list[string]`, *Required* The IDs of the documents for which the parsing should be stopped. #### Response @@ -1920,13 +1919,13 @@ curl --request POST \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The associated dataset ID. -- `document_ids`: (*Path parameter*) +- `document_ids`: (*Path parameter*) The associated document ID. -- `"content"`: (*Body parameter*), `string`, *Required* +- `"content"`: (*Body parameter*), `string`, *Required* The text content of the chunk. -- `"important_keywords`(*Body parameter*), `list[string]` +- `"important_keywords`(*Body parameter*), `list[string]` The key terms or phrases to tag with the chunk. - `"questions"`(*Body parameter*), `list[string]` If there is a given question, the embedded chunks will be based on them @@ -1982,22 +1981,22 @@ Lists chunks in a specified document. ```bash curl --request GET \ --url http://{address}/api/v1/datasets/{dataset_id}/documents/{document_id}/chunks?keywords={keywords}&page={page}&page_size={page_size}&id={chunk_id} \ - --header 'Authorization: Bearer ' + --header 'Authorization: Bearer ' ``` ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The associated dataset ID. -- `document_id`: (*Path parameter*) +- `document_id`: (*Path parameter*) The associated document ID. -- `keywords`(*Filter parameter*), `string` +- `keywords`(*Filter parameter*), `string` The keywords used to match chunk content. -- `page`(*Filter parameter*), `integer` +- `page`(*Filter parameter*), `integer` Specifies the page on which the chunks will be displayed. Defaults to `1`. -- `page_size`(*Filter parameter*), `integer` +- `page_size`(*Filter parameter*), `integer` The maximum number of chunks on each page. Defaults to `1024`. -- `id`(*Filter parameter*), `string` +- `id`(*Filter parameter*), `string` The ID of the chunk to retrieve. #### Response @@ -2102,11 +2101,11 @@ curl --request DELETE \ ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The associated dataset ID. -- `document_ids`: (*Path parameter*) +- `document_ids`: (*Path parameter*) The associated document ID. -- `"chunk_ids"`: (*Body parameter*), `list[string]` +- `"chunk_ids"`: (*Body parameter*), `list[string]` The IDs of the chunks to delete. If it is not specified, all chunks of the specified document will be deleted. #### Response @@ -2156,26 +2155,26 @@ curl --request PUT \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ' \ --data ' - { - "content": "ragflow123", - "important_keywords": [] + { + "content": "ragflow123", + "important_keywords": [] }' ``` ##### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The associated dataset ID. -- `document_ids`: (*Path parameter*) +- `document_ids`: (*Path parameter*) The associated document ID. -- `chunk_id`: (*Path parameter*) +- `chunk_id`: (*Path parameter*) The ID of the chunk to update. -- `"content"`: (*Body parameter*), `string` +- `"content"`: (*Body parameter*), `string` The text content of the chunk. -- `"important_keywords"`: (*Body parameter*), `list[string]` +- `"important_keywords"`: (*Body parameter*), `list[string]` A list of key terms or phrases to tag with the chunk. -- `"available"`: (*Body parameter*) `boolean` - The chunk's availability status in the dataset. Value options: +- `"available"`: (*Body parameter*) `boolean` + The chunk's availability status in the dataset. Value options: - `true`: Available (default) - `false`: Unavailable @@ -2251,18 +2250,18 @@ Batch update or delete document-level metadata within a specified dataset. If bo #### Request parameters -- `dataset_id`: (*Path parameter*) +- `dataset_id`: (*Path parameter*) The associated dataset ID. -- `"selector"`: (*Body parameter*), `object`, *optional* - A document selector: - - `"document_ids"`: `list[string]` *optional* - The associated document ID. - - `"metadata_condition"`: `object`, *optional* +- `"selector"`: (*Body parameter*), `object`, *optional* + A document selector: + - `"document_ids"`: `list[string]` *optional* + The associated document ID. + - `"metadata_condition"`: `object`, *optional* - `"logic"`: Defines the logic relation between conditions if multiple conditions are provided. Options: - `"and"` (default) - `"or"` - - `"conditions"`: `list[object]` *optional* - Each object: `{ "name": string, "comparison_operator": string, "value": string }` + - `"conditions"`: `list[object]` *optional* + Each object: `{ "name": string, "comparison_operator": string, "value": string }` - `"name"`: `string` The key name to search by. - `"comparison_operator"`: `string` Available options: - `"is"` @@ -2279,14 +2278,14 @@ Batch update or delete document-level metadata within a specified dataset. If bo - `"≤"` - `"empty"` - `"not empty"` - - `"value"`: `string` The key value to search by. -- `"updates"`: (*Body parameter*), `list[object]`, *optional* - Replaces metadata of the retrieved documents. Each object: `{ "key": string, "match": string, "value": string }`. + - `"value"`: `string` The key value to search by. +- `"updates"`: (*Body parameter*), `list[object]`, *optional* + Replaces metadata of the retrieved documents. Each object: `{ "key": string, "match": string, "value": string }`. - `"key"`: `string` The name of the key to update. - `"match"`: `string` *optional* The current value of the key to update. When omitted, the corresponding keys are updated to `"value"` regardless of their current values. - `"value"`: `string` The new value to set for the specified keys. -- `"deletes`: (*Body parameter*), `list[ojbect]`, *optional* - Deletes metadata of the retrieved documents. Each object: `{ "key": string, "value": string }`. +- `"deletes`: (*Body parameter*), `list[ojbect]`, *optional* + Deletes metadata of the retrieved documents. Each object: `{ "key": string, "value": string }`. - `"key"`: `string` The name of the key to delete. - `"value"`: `string` *Optional* The value of the key to delete. - When provided, only keys with a matching value are deleted. @@ -2348,16 +2347,16 @@ Retrieves chunks from specified datasets. - `'content-Type: application/json'` - `'Authorization: Bearer '` - Body: - - `"question"`: `string` - - `"dataset_ids"`: `list[string]` + - `"question"`: `string` + - `"dataset_ids"`: `list[string]` - `"document_ids"`: `list[string]` - - `"page"`: `integer` - - `"page_size"`: `integer` - - `"similarity_threshold"`: `float` - - `"vector_similarity_weight"`: `float` - - `"top_k"`: `integer` - - `"rerank_id"`: `string` - - `"keyword"`: `boolean` + - `"page"`: `integer` + - `"page_size"`: `integer` + - `"similarity_threshold"`: `float` + - `"vector_similarity_weight"`: `float` + - `"top_k"`: `integer` + - `"rerank_id"`: `string` + - `"keyword"`: `boolean` - `"highlight"`: `boolean` - `"cross_languages"`: `list[string]` - `"metadata_condition"`: `object` @@ -2396,45 +2395,45 @@ curl --request POST \ ##### Request parameter -- `"question"`: (*Body parameter*), `string`, *Required* +- `"question"`: (*Body parameter*), `string`, *Required* The user query or query keywords. -- `"dataset_ids"`: (*Body parameter*) `list[string]` +- `"dataset_ids"`: (*Body parameter*) `list[string]` The IDs of the datasets to search. If you do not set this argument, ensure that you set `"document_ids"`. -- `"document_ids"`: (*Body parameter*), `list[string]` +- `"document_ids"`: (*Body parameter*), `list[string]` The IDs of the documents to search. Ensure that all selected documents use the same embedding model. Otherwise, an error will occur. If you do not set this argument, ensure that you set `"dataset_ids"`. -- `"page"`: (*Body parameter*), `integer` +- `"page"`: (*Body parameter*), `integer` Specifies the page on which the chunks will be displayed. Defaults to `1`. -- `"page_size"`: (*Body parameter*) +- `"page_size"`: (*Body parameter*) The maximum number of chunks on each page. Defaults to `30`. -- `"similarity_threshold"`: (*Body parameter*) +- `"similarity_threshold"`: (*Body parameter*) The minimum similarity score. Defaults to `0.2`. -- `"vector_similarity_weight"`: (*Body parameter*), `float` +- `"vector_similarity_weight"`: (*Body parameter*), `float` The weight of vector cosine similarity. Defaults to `0.3`. If x represents the weight of vector cosine similarity, then (1 - x) is the term similarity weight. -- `"top_k"`: (*Body parameter*), `integer` +- `"top_k"`: (*Body parameter*), `integer` The number of chunks engaged in vector cosine computation. Defaults to `1024`. -- `"use_kg"`: (*Body parameter*), `boolean` +- `"use_kg"`: (*Body parameter*), `boolean` Whether to search chunks related to the generated knowledge graph for multi-hop queries. Defaults to `False`. Before enabling this, ensure you have successfully constructed a knowledge graph for the specified datasets. See [here](https://ragflow.io/docs/dev/construct_knowledge_graph) for details. -- `"toc_enhance"`: (*Body parameter*), `boolean` +- `"toc_enhance"`: (*Body parameter*), `boolean` Whether to search chunks with extracted table of content. Defaults to `False`. Before enabling this, ensure you have enabled `TOC_Enhance` and successfully extracted table of contents for the specified datasets. See [here](https://ragflow.io/docs/dev/enable_table_of_contents) for details. -- `"rerank_id"`: (*Body parameter*), `integer` +- `"rerank_id"`: (*Body parameter*), `integer` The ID of the rerank model. -- `"keyword"`: (*Body parameter*), `boolean` - Indicates whether to enable keyword-based matching: +- `"keyword"`: (*Body parameter*), `boolean` + Indicates whether to enable keyword-based matching: - `true`: Enable keyword-based matching. - `false`: Disable keyword-based matching (default). -- `"highlight"`: (*Body parameter*), `boolean` - Specifies whether to enable highlighting of matched terms in the results: +- `"highlight"`: (*Body parameter*), `boolean` + Specifies whether to enable highlighting of matched terms in the results: - `true`: Enable highlighting of matched terms. - `false`: Disable highlighting of matched terms (default). -- `"cross_languages"`: (*Body parameter*) `list[string]` +- `"cross_languages"`: (*Body parameter*) `list[string]` The languages that should be translated into, in order to achieve keywords retrievals in different languages. -- `"metadata_condition"`: (*Body parameter*), `object` - The metadata condition used for filtering chunks: +- `"metadata_condition"`: (*Body parameter*), `object` + The metadata condition used for filtering chunks: - `"logic"`: (*Body parameter*), `string` - `"and"`: Return only results that satisfy *every* condition (default). - `"or"`: Return results that satisfy *any* condition. - - `"conditions"`: (*Body parameter*), `array` - A list of metadata filter conditions. + - `"conditions"`: (*Body parameter*), `array` + A list of metadata filter conditions. - `"name"`: `string` - The metadata field name to filter by, e.g., `"author"`, `"company"`, `"url"`. Ensure this parameter before use. See [Set metadata](../guides/dataset/set_metadata.md) for details. - `comparison_operator`: `string` - The comparison operator. Can be one of: - `"contains"` @@ -2541,16 +2540,16 @@ curl --request POST \ ##### Request parameters -- `"name"`: (*Body parameter*), `string`, *Required* +- `"name"`: (*Body parameter*), `string`, *Required* The name of the chat assistant. -- `"avatar"`: (*Body parameter*), `string` +- `"avatar"`: (*Body parameter*), `string` Base64 encoding of the avatar. -- `"dataset_ids"`: (*Body parameter*), `list[string]` +- `"dataset_ids"`: (*Body parameter*), `list[string]` The IDs of the associated datasets. -- `"llm"`: (*Body parameter*), `object` - The LLM settings for the chat assistant to create. If it is not explicitly set, a JSON object with the following values will be generated as the default. An `llm` JSON object contains the following attributes: - - `"model_name"`, `string` - The chat model name. If not set, the user's default chat model will be used. +- `"llm"`: (*Body parameter*), `object` + The LLM settings for the chat assistant to create. If it is not explicitly set, a JSON object with the following values will be generated as the default. An `llm` JSON object contains the following attributes: + - `"model_name"`, `string` + The chat model name. If not set, the user's default chat model will be used. :::caution WARNING `model_type` is an *internal* parameter, serving solely as a temporary workaround for the current model-configuration design limitations. @@ -2561,23 +2560,23 @@ curl --request POST \ - It is subject to change or removal in future releases. ::: - - `"model_type"`: `string` + - `"model_type"`: `string` A model type specifier. Only `"chat"` and `"image2text"` are recognized; any other inputs, or when omitted, are treated as `"chat"`. - `"model_name"`, `string` - - `"temperature"`: `float` - Controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses. Defaults to `0.1`. - - `"top_p"`: `float` - Also known as “nucleus sampling”, this parameter sets a threshold to select a smaller set of words to sample from. It focuses on the most likely words, cutting off the less probable ones. Defaults to `0.3` - - `"presence_penalty"`: `float` + - `"temperature"`: `float` + Controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses. Defaults to `0.1`. + - `"top_p"`: `float` + Also known as “nucleus sampling”, this parameter sets a threshold to select a smaller set of words to sample from. It focuses on the most likely words, cutting off the less probable ones. Defaults to `0.3` + - `"presence_penalty"`: `float` This discourages the model from repeating the same information by penalizing words that have already appeared in the conversation. Defaults to `0.4`. - - `"frequency penalty"`: `float` + - `"frequency penalty"`: `float` Similar to the presence penalty, this reduces the model’s tendency to repeat the same words frequently. Defaults to `0.7`. -- `"prompt"`: (*Body parameter*), `object` - Instructions for the LLM to follow. If it is not explicitly set, a JSON object with the following values will be generated as the default. A `prompt` JSON object contains the following attributes: +- `"prompt"`: (*Body parameter*), `object` + Instructions for the LLM to follow. If it is not explicitly set, a JSON object with the following values will be generated as the default. A `prompt` JSON object contains the following attributes: - `"similarity_threshold"`: `float` RAGFlow employs either a combination of weighted keyword similarity and weighted vector cosine similarity, or a combination of weighted keyword similarity and weighted reranking score during retrieval. This argument sets the threshold for similarities between the user query and chunks. If a similarity score falls below this threshold, the corresponding chunk will be excluded from the results. The default value is `0.2`. - `"keywords_similarity_weight"`: `float` This argument sets the weight of keyword similarity in the hybrid similarity score with vector cosine similarity or reranking model similarity. By adjusting this weight, you can control the influence of keyword similarity in relation to other similarity measures. The default value is `0.7`. - `"top_n"`: `int` This argument specifies the number of top chunks with similarity scores above the `similarity_threshold` that are fed to the LLM. The LLM will *only* access these 'top N' chunks. The default value is `6`. - - `"variables"`: `object[]` This argument lists the variables to use in the 'System' field of **Chat Configurations**. Note that: + - `"variables"`: `object[]` This argument lists the variables to use in the 'System' field of **Chat Configurations**. Note that: - `"knowledge"` is a reserved variable, which represents the retrieved chunks. - All the variables in 'System' should be curly bracketed. - The default value is `[{"key": "knowledge", "optional": true}]`. @@ -2685,32 +2684,32 @@ curl --request PUT \ #### Parameters -- `chat_id`: (*Path parameter*) +- `chat_id`: (*Path parameter*) The ID of the chat assistant to update. -- `"name"`: (*Body parameter*), `string`, *Required* +- `"name"`: (*Body parameter*), `string`, *Required* The revised name of the chat assistant. -- `"avatar"`: (*Body parameter*), `string` +- `"avatar"`: (*Body parameter*), `string` Base64 encoding of the avatar. -- `"dataset_ids"`: (*Body parameter*), `list[string]` +- `"dataset_ids"`: (*Body parameter*), `list[string]` The IDs of the associated datasets. -- `"llm"`: (*Body parameter*), `object` - The LLM settings for the chat assistant to create. If it is not explicitly set, a dictionary with the following values will be generated as the default. An `llm` object contains the following attributes: - - `"model_name"`, `string` - The chat model name. If not set, the user's default chat model will be used. - - `"temperature"`: `float` - Controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses. Defaults to `0.1`. - - `"top_p"`: `float` - Also known as “nucleus sampling”, this parameter sets a threshold to select a smaller set of words to sample from. It focuses on the most likely words, cutting off the less probable ones. Defaults to `0.3` - - `"presence_penalty"`: `float` +- `"llm"`: (*Body parameter*), `object` + The LLM settings for the chat assistant to create. If it is not explicitly set, a dictionary with the following values will be generated as the default. An `llm` object contains the following attributes: + - `"model_name"`, `string` + The chat model name. If not set, the user's default chat model will be used. + - `"temperature"`: `float` + Controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses. Defaults to `0.1`. + - `"top_p"`: `float` + Also known as “nucleus sampling”, this parameter sets a threshold to select a smaller set of words to sample from. It focuses on the most likely words, cutting off the less probable ones. Defaults to `0.3` + - `"presence_penalty"`: `float` This discourages the model from repeating the same information by penalizing words that have already appeared in the conversation. Defaults to `0.2`. - - `"frequency penalty"`: `float` + - `"frequency penalty"`: `float` Similar to the presence penalty, this reduces the model’s tendency to repeat the same words frequently. Defaults to `0.7`. -- `"prompt"`: (*Body parameter*), `object` - Instructions for the LLM to follow. A `prompt` object contains the following attributes: +- `"prompt"`: (*Body parameter*), `object` + Instructions for the LLM to follow. A `prompt` object contains the following attributes: - `"similarity_threshold"`: `float` RAGFlow employs either a combination of weighted keyword similarity and weighted vector cosine similarity, or a combination of weighted keyword similarity and weighted rerank score during retrieval. This argument sets the threshold for similarities between the user query and chunks. If a similarity score falls below this threshold, the corresponding chunk will be excluded from the results. The default value is `0.2`. - `"keywords_similarity_weight"`: `float` This argument sets the weight of keyword similarity in the hybrid similarity score with vector cosine similarity or reranking model similarity. By adjusting this weight, you can control the influence of keyword similarity in relation to other similarity measures. The default value is `0.7`. - `"top_n"`: `int` This argument specifies the number of top chunks with similarity scores above the `similarity_threshold` that are fed to the LLM. The LLM will *only* access these 'top N' chunks. The default value is `8`. - - `"variables"`: `object[]` This argument lists the variables to use in the 'System' field of **Chat Configurations**. Note that: + - `"variables"`: `object[]` This argument lists the variables to use in the 'System' field of **Chat Configurations**. Note that: - `"knowledge"` is a reserved variable, which represents the retrieved chunks. - All the variables in 'System' should be curly bracketed. - The default value is `[{"key": "knowledge", "optional": true}]` @@ -2772,7 +2771,7 @@ curl --request DELETE \ ##### Request parameters -- `"ids"`: (*Body parameter*), `list[string]` +- `"ids"`: (*Body parameter*), `list[string]` The IDs of the chat assistants to delete. If it is not specified, all chat assistants in the system will be deleted. #### Response @@ -2819,19 +2818,19 @@ curl --request GET \ ##### Request parameters -- `page`: (*Filter parameter*), `integer` +- `page`: (*Filter parameter*), `integer` Specifies the page on which the chat assistants will be displayed. Defaults to `1`. -- `page_size`: (*Filter parameter*), `integer` +- `page_size`: (*Filter parameter*), `integer` The number of chat assistants on each page. Defaults to `30`. -- `orderby`: (*Filter parameter*), `string` +- `orderby`: (*Filter parameter*), `string` The attribute by which the results are sorted. Available options: - `create_time` (default) - `update_time` -- `desc`: (*Filter parameter*), `boolean` +- `desc`: (*Filter parameter*), `boolean` Indicates whether the retrieved chat assistants should be sorted in descending order. Defaults to `true`. -- `id`: (*Filter parameter*), `string` +- `id`: (*Filter parameter*), `string` The ID of the chat assistant to retrieve. -- `name`: (*Filter parameter*), `string` +- `name`: (*Filter parameter*), `string` The name of the chat assistant to retrieve. #### Response @@ -2932,11 +2931,11 @@ curl --request POST \ ##### Request parameters -- `chat_id`: (*Path parameter*) +- `chat_id`: (*Path parameter*) The ID of the associated chat assistant. -- `"name"`: (*Body parameter*), `string` +- `"name"`: (*Body parameter*), `string` The name of the chat session to create. -- `"user_id"`: (*Body parameter*), `string` +- `"user_id"`: (*Body parameter*), `string` Optional user-defined ID. #### Response @@ -3007,13 +3006,13 @@ curl --request PUT \ ##### Request Parameter -- `chat_id`: (*Path parameter*) +- `chat_id`: (*Path parameter*) The ID of the associated chat assistant. -- `session_id`: (*Path parameter*) +- `session_id`: (*Path parameter*) The ID of the session to update. -- `"name"`: (*Body Parameter*), `string` +- `"name"`: (*Body Parameter*), `string` The revised name of the session. -- `"user_id"`: (*Body parameter*), `string` +- `"user_id"`: (*Body parameter*), `string` Optional user-defined ID. #### Response @@ -3060,23 +3059,23 @@ curl --request GET \ ##### Request Parameters -- `chat_id`: (*Path parameter*) +- `chat_id`: (*Path parameter*) The ID of the associated chat assistant. -- `page`: (*Filter parameter*), `integer` +- `page`: (*Filter parameter*), `integer` Specifies the page on which the sessions will be displayed. Defaults to `1`. -- `page_size`: (*Filter parameter*), `integer` +- `page_size`: (*Filter parameter*), `integer` The number of sessions on each page. Defaults to `30`. -- `orderby`: (*Filter parameter*), `string` - The field by which sessions should be sorted. Available options: +- `orderby`: (*Filter parameter*), `string` + The field by which sessions should be sorted. Available options: - `create_time` (default) - `update_time` -- `desc`: (*Filter parameter*), `boolean` +- `desc`: (*Filter parameter*), `boolean` Indicates whether the retrieved sessions should be sorted in descending order. Defaults to `true`. -- `name`: (*Filter parameter*) `string` +- `name`: (*Filter parameter*) `string` The name of the chat session to retrieve. -- `id`: (*Filter parameter*), `string` +- `id`: (*Filter parameter*), `string` The ID of the chat session to retrieve. -- `user_id`: (*Filter parameter*), `string` +- `user_id`: (*Filter parameter*), `string` The optional user-defined ID passed in when creating session. #### Response @@ -3148,9 +3147,9 @@ curl --request DELETE \ ##### Request Parameters -- `chat_id`: (*Path parameter*) +- `chat_id`: (*Path parameter*) The ID of the associated chat assistant. -- `"ids"`: (*Body Parameter*), `list[string]` +- `"ids"`: (*Body Parameter*), `list[string]` The IDs of the sessions to delete. If it is not specified, all sessions associated with the specified chat assistant will be deleted. #### Response @@ -3246,20 +3245,20 @@ curl --request POST \ ##### Request Parameters -- `chat_id`: (*Path parameter*) +- `chat_id`: (*Path parameter*) The ID of the associated chat assistant. -- `"question"`: (*Body Parameter*), `string`, *Required* +- `"question"`: (*Body Parameter*), `string`, *Required* The question to start an AI-powered conversation. -- `"stream"`: (*Body Parameter*), `boolean` +- `"stream"`: (*Body Parameter*), `boolean` Indicates whether to output responses in a streaming way: - `true`: Enable streaming (default). - `false`: Disable streaming. -- `"session_id"`: (*Body Parameter*) +- `"session_id"`: (*Body Parameter*) The ID of session. If it is not provided, a new session will be generated. -- `"user_id"`: (*Body parameter*), `string` +- `"user_id"`: (*Body parameter*), `string` The optional user-defined ID. Valid *only* when no `session_id` is provided. -- `"metadata_condition"`: (*Body parameter*), `object` - Optional metadata filter conditions applied to retrieval results. +- `"metadata_condition"`: (*Body parameter*), `object` + Optional metadata filter conditions applied to retrieval results. - `logic`: `string`, one of `and` / `or` - `conditions`: `list[object]` where each condition contains: - `name`: `string` metadata key @@ -3414,9 +3413,9 @@ curl --request POST \ ##### Request parameters -- `agent_id`: (*Path parameter*) +- `agent_id`: (*Path parameter*) The ID of the associated agent. -- `user_id`: (*Filter parameter*) +- `user_id`: (*Filter parameter*) The optional user-defined ID for parsing docs (especially images) when creating a session while uploading files. #### Response @@ -3628,7 +3627,7 @@ Failure: ### Converse with agent -**POST** `/api/v1/agents/{agent_id}/completions` +**POST** `/api/v1/agents/{agent_id}/completions` Asks a specified agent a question to start an AI-powered conversation. @@ -3690,7 +3689,7 @@ curl --request POST \ }' ``` -- If the **Begin** component takes parameters, include their values in the body of `"inputs"` as follows: +- If the **Begin** component takes parameters, include their values in the body of `"inputs"` as follows: ```bash curl --request POST \ @@ -3743,24 +3742,24 @@ curl --request POST \ ##### Request Parameters -- `agent_id`: (*Path parameter*), `string` +- `agent_id`: (*Path parameter*), `string` The ID of the associated agent. -- `"question"`: (*Body Parameter*), `string`, *Required* +- `"question"`: (*Body Parameter*), `string`, *Required* The question to start an AI-powered conversation. -- `"stream"`: (*Body Parameter*), `boolean` - Indicates whether to output responses in a streaming way: +- `"stream"`: (*Body Parameter*), `boolean` + Indicates whether to output responses in a streaming way: - `true`: Enable streaming (default). - `false`: Disable streaming. -- `"session_id"`: (*Body Parameter*) +- `"session_id"`: (*Body Parameter*) The ID of the session. If it is not provided, a new session will be generated. -- `"inputs"`: (*Body Parameter*) - Variables specified in the **Begin** component. -- `"user_id"`: (*Body parameter*), `string` +- `"inputs"`: (*Body Parameter*) + Variables specified in the **Begin** component. +- `"user_id"`: (*Body parameter*), `string` The optional user-defined ID. Valid *only* when no `session_id` is provided. :::tip NOTE -For now, this method does *not* support a file type input/variable. As a workaround, use the following to upload a file to an agent: -`http://{address}/v1/canvas/upload/{agent_id}` +For now, this method does *not* support a file type input/variable. As a workaround, use the following to upload a file to an agent: +`http://{address}/v1/canvas/upload/{agent_id}` *You will get a corresponding file ID from its response body.* ::: @@ -4307,23 +4306,23 @@ curl --request GET \ ##### Request Parameters -- `agent_id`: (*Path parameter*) +- `agent_id`: (*Path parameter*) The ID of the associated agent. -- `page`: (*Filter parameter*), `integer` +- `page`: (*Filter parameter*), `integer` Specifies the page on which the sessions will be displayed. Defaults to `1`. -- `page_size`: (*Filter parameter*), `integer` +- `page_size`: (*Filter parameter*), `integer` The number of sessions on each page. Defaults to `30`. -- `orderby`: (*Filter parameter*), `string` - The field by which sessions should be sorted. Available options: +- `orderby`: (*Filter parameter*), `string` + The field by which sessions should be sorted. Available options: - `create_time` (default) - `update_time` -- `desc`: (*Filter parameter*), `boolean` +- `desc`: (*Filter parameter*), `boolean` Indicates whether the retrieved sessions should be sorted in descending order. Defaults to `true`. -- `id`: (*Filter parameter*), `string` +- `id`: (*Filter parameter*), `string` The ID of the agent session to retrieve. -- `user_id`: (*Filter parameter*), `string` +- `user_id`: (*Filter parameter*), `string` The optional user-defined ID passed in when creating session. -- `dsl`: (*Filter parameter*), `boolean` +- `dsl`: (*Filter parameter*), `boolean` Indicates whether to include the dsl field of the sessions in the response. Defaults to `true`. #### Response @@ -4509,9 +4508,9 @@ curl --request DELETE \ ##### Request Parameters -- `agent_id`: (*Path parameter*) +- `agent_id`: (*Path parameter*) The ID of the associated agent. -- `"ids"`: (*Body Parameter*), `list[string]` +- `"ids"`: (*Body Parameter*), `list[string]` The IDs of the sessions to delete. If it is not specified, all sessions associated with the specified agent will be deleted. #### Response @@ -4642,19 +4641,19 @@ curl --request GET \ ##### Request parameters -- `page`: (*Filter parameter*), `integer` +- `page`: (*Filter parameter*), `integer` Specifies the page on which the agents will be displayed. Defaults to `1`. -- `page_size`: (*Filter parameter*), `integer` +- `page_size`: (*Filter parameter*), `integer` The number of agents on each page. Defaults to `30`. -- `orderby`: (*Filter parameter*), `string` +- `orderby`: (*Filter parameter*), `string` The attribute by which the results are sorted. Available options: - `create_time` (default) - `update_time` -- `desc`: (*Filter parameter*), `boolean` +- `desc`: (*Filter parameter*), `boolean` Indicates whether the retrieved agents should be sorted in descending order. Defaults to `true`. -- `id`: (*Filter parameter*), `string` +- `id`: (*Filter parameter*), `string` The ID of the agent to retrieve. -- `title`: (*Filter parameter*), `string` +- `title`: (*Filter parameter*), `string` The name of the agent to retrieve. #### Response @@ -4766,11 +4765,11 @@ curl --request POST \ ##### Request parameters -- `title`: (*Body parameter*), `string`, *Required* +- `title`: (*Body parameter*), `string`, *Required* The title of the agent. -- `description`: (*Body parameter*), `string` +- `description`: (*Body parameter*), `string` The description of the agent. Defaults to `None`. -- `dsl`: (*Body parameter*), `object`, *Required* +- `dsl`: (*Body parameter*), `object`, *Required* The canvas DSL object of the agent. #### Response @@ -4832,13 +4831,13 @@ curl --request PUT \ ##### Request parameters -- `agent_id`: (*Path parameter*), `string` +- `agent_id`: (*Path parameter*), `string` The id of the agent to be updated. -- `title`: (*Body parameter*), `string` +- `title`: (*Body parameter*), `string` The title of the agent. -- `description`: (*Body parameter*), `string` +- `description`: (*Body parameter*), `string` The description of the agent. -- `dsl`: (*Body parameter*), `object` +- `dsl`: (*Body parameter*), `object` The canvas DSL object of the agent. Only specify the parameter you want to change in the request body. If a parameter does not exist or is `None`, it won't be updated. @@ -4892,7 +4891,7 @@ curl --request DELETE \ ##### Request parameters -- `agent_id`: (*Path parameter*), `string` +- `agent_id`: (*Path parameter*), `string` The id of the agent to be deleted. #### Response @@ -5976,7 +5975,7 @@ curl --request GET ##### Request parameters -- `address`: (*Path parameter*), string +- `address`: (*Path parameter*), string The host and port of the backend service (e.g., `localhost:7897`). --- @@ -6019,11 +6018,11 @@ Content-Type: application/json } ``` -Explanation: +Explanation: -- Each service is reported as "ok" or "nok". -- The top-level `status` reflects overall health. -- If any service is "nok", detailed error info appears in `_meta`. +- Each service is reported as "ok" or "nok". +- The top-level `status` reflects overall health. +- If any service is "nok", detailed error info appears in `_meta`. --- @@ -6062,9 +6061,9 @@ curl --request POST \ ##### Request parameters -- `'file'`: (*Form parameter*), `file`, *Required* +- `'file'`: (*Form parameter*), `file`, *Required* The file(s) to upload. Multiple files can be uploaded in a single request. -- `'parent_id'`: (*Form parameter*), `string` +- `'parent_id'`: (*Form parameter*), `string` The parent folder ID where the file will be uploaded. If not specified, files will be uploaded to the root folder. #### Response @@ -6133,11 +6132,11 @@ curl --request POST \ ##### Request parameters -- `"name"`: (*Body parameter*), `string`, *Required* +- `"name"`: (*Body parameter*), `string`, *Required* The name of the file or folder to create. -- `"parent_id"`: (*Body parameter*), `string` +- `"parent_id"`: (*Body parameter*), `string` The parent folder ID. If not specified, the file/folder will be created in the root folder. -- `"type"`: (*Body parameter*), `string` +- `"type"`: (*Body parameter*), `string` The type of the file to create. Available options: - `"FOLDER"`: Create a folder - `"VIRTUAL"`: Create a virtual file @@ -6194,18 +6193,18 @@ curl --request GET \ ##### Request parameters -- `parent_id`: (*Filter parameter*), `string` +- `parent_id`: (*Filter parameter*), `string` The folder ID to list files from. If not specified, the root folder is used by default. -- `keywords`: (*Filter parameter*), `string` +- `keywords`: (*Filter parameter*), `string` Search keyword to filter files by name. -- `page`: (*Filter parameter*), `integer` +- `page`: (*Filter parameter*), `integer` Specifies the page on which the files will be displayed. Defaults to `1`. -- `page_size`: (*Filter parameter*), `integer` +- `page_size`: (*Filter parameter*), `integer` The number of files on each page. Defaults to `15`. -- `orderby`: (*Filter parameter*), `string` +- `orderby`: (*Filter parameter*), `string` The field by which files should be sorted. Available options: - `create_time` (default) -- `desc`: (*Filter parameter*), `boolean` +- `desc`: (*Filter parameter*), `boolean` Indicates whether the retrieved files should be sorted in descending order. Defaults to `true`. #### Response @@ -6313,7 +6312,7 @@ curl --request GET \ ##### Request parameters -- `file_id`: (*Filter parameter*), `string`, *Required* +- `file_id`: (*Filter parameter*), `string`, *Required* The ID of the file whose immediate parent folder to retrieve. #### Response @@ -6366,7 +6365,7 @@ curl --request GET \ ##### Request parameters -- `file_id`: (*Filter parameter*), `string`, *Required* +- `file_id`: (*Filter parameter*), `string`, *Required* The ID of the file whose parent folders to retrieve. #### Response @@ -6432,7 +6431,7 @@ curl --request POST \ ##### Request parameters -- `"file_ids"`: (*Body parameter*), `list[string]`, *Required* +- `"file_ids"`: (*Body parameter*), `list[string]`, *Required* The IDs of the files or folders to delete. #### Response @@ -6489,9 +6488,9 @@ curl --request POST \ ##### Request parameters -- `"file_id"`: (*Body parameter*), `string`, *Required* +- `"file_id"`: (*Body parameter*), `string`, *Required* The ID of the file or folder to rename. -- `"name"`: (*Body parameter*), `string`, *Required* +- `"name"`: (*Body parameter*), `string`, *Required* The new name for the file or folder. Note: Changing file extensions is *not* supported. #### Response @@ -6549,7 +6548,7 @@ curl --request GET \ ##### Request parameters -- `file_id`: (*Path parameter*), `string`, *Required* +- `file_id`: (*Path parameter*), `string`, *Required* The ID of the file to download. #### Response @@ -6601,9 +6600,9 @@ curl --request POST \ ##### Request parameters -- `"src_file_ids"`: (*Body parameter*), `list[string]`, *Required* +- `"src_file_ids"`: (*Body parameter*), `list[string]`, *Required* The IDs of the files or folders to move. -- `"dest_file_id"`: (*Body parameter*), `string`, *Required* +- `"dest_file_id"`: (*Body parameter*), `string`, *Required* The ID of the destination folder. #### Response @@ -6669,9 +6668,9 @@ curl --request POST \ ##### Request parameters -- `"file_ids"`: (*Body parameter*), `list[string]`, *Required* +- `"file_ids"`: (*Body parameter*), `list[string]`, *Required* The IDs of the files to convert. If a folder ID is provided, all files within that folder will be converted. -- `"kb_ids"`: (*Body parameter*), `list[string]`, *Required* +- `"kb_ids"`: (*Body parameter*), `list[string]`, *Required* The IDs of the target datasets. #### Response diff --git a/docs/references/python_api_reference.md b/docs/references/python_api_reference.md index 4d60d8459de..364f5c7e274 100644 --- a/docs/references/python_api_reference.md +++ b/docs/references/python_api_reference.md @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: SiPython } --- - # Python API A complete reference for RAGFlow's Python APIs. Before proceeding, please ensure you [have your RAGFlow API key ready for authentication](https://ragflow.io/docs/dev/acquire_ragflow_api_key). @@ -111,7 +110,7 @@ RAGFlow.create_dataset( avatar: Optional[str] = None, description: Optional[str] = None, embedding_model: Optional[str] = "BAAI/bge-large-zh-v1.5@BAAI", - permission: str = "me", + permission: str = "me", chunk_method: str = "naive", parser_config: DataSet.ParserConfig = None ) -> DataSet @@ -139,7 +138,7 @@ A brief description of the dataset to create. Defaults to `None`. ##### permission -Specifies who can access the dataset to create. Available options: +Specifies who can access the dataset to create. Available options: - `"me"`: (Default) Only you can manage the dataset. - `"team"`: All team members can manage the dataset. @@ -164,29 +163,29 @@ The chunking method of the dataset to create. Available options: The parser configuration of the dataset. A `ParserConfig` object's attributes vary based on the selected `chunk_method`: -- `chunk_method`=`"naive"`: +- `chunk_method`=`"naive"`: `{"chunk_token_num":512,"delimiter":"\\n","html4excel":False,"layout_recognize":True,"raptor":{"use_raptor":False}}`. -- `chunk_method`=`"qa"`: +- `chunk_method`=`"qa"`: `{"raptor": {"use_raptor": False}}` -- `chunk_method`=`"manuel"`: +- `chunk_method`=`"manuel"`: `{"raptor": {"use_raptor": False}}` -- `chunk_method`=`"table"`: +- `chunk_method`=`"table"`: `None` -- `chunk_method`=`"paper"`: +- `chunk_method`=`"paper"`: `{"raptor": {"use_raptor": False}}` -- `chunk_method`=`"book"`: +- `chunk_method`=`"book"`: `{"raptor": {"use_raptor": False}}` -- `chunk_method`=`"laws"`: +- `chunk_method`=`"laws"`: `{"raptor": {"use_raptor": False}}` -- `chunk_method`=`"picture"`: +- `chunk_method`=`"picture"`: `None` -- `chunk_method`=`"presentation"`: +- `chunk_method`=`"presentation"`: `{"raptor": {"use_raptor": False}}` -- `chunk_method`=`"one"`: +- `chunk_method`=`"one"`: `None` -- `chunk_method`=`"knowledge-graph"`: +- `chunk_method`=`"knowledge-graph"`: `{"chunk_token_num":128,"delimiter":"\\n","entity_types":["organization","person","location","event","time"]}` -- `chunk_method`=`"email"`: +- `chunk_method`=`"email"`: `None` #### Returns @@ -239,9 +238,9 @@ rag_object.delete_datasets(ids=["d94a8dc02c9711f0930f7fbc369eab6d","e94a8dc02c97 ```python RAGFlow.list_datasets( - page: int = 1, - page_size: int = 30, - orderby: str = "create_time", + page: int = 1, + page_size: int = 30, + orderby: str = "create_time", desc: bool = True, id: str = None, name: str = None @@ -320,25 +319,25 @@ A dictionary representing the attributes to update, with the following keys: - Basic Multilingual Plane (BMP) only - Maximum 128 characters - Case-insensitive -- `"avatar"`: (*Body parameter*), `string` +- `"avatar"`: (*Body parameter*), `string` The updated base64 encoding of the avatar. - Maximum 65535 characters -- `"embedding_model"`: (*Body parameter*), `string` - The updated embedding model name. +- `"embedding_model"`: (*Body parameter*), `string` + The updated embedding model name. - Ensure that `"chunk_count"` is `0` before updating `"embedding_model"`. - Maximum 255 characters - Must follow `model_name@model_factory` format -- `"permission"`: (*Body parameter*), `string` - The updated dataset permission. Available options: +- `"permission"`: (*Body parameter*), `string` + The updated dataset permission. Available options: - `"me"`: (Default) Only you can manage the dataset. - `"team"`: All team members can manage the dataset. -- `"pagerank"`: (*Body parameter*), `int` +- `"pagerank"`: (*Body parameter*), `int` refer to [Set page rank](https://ragflow.io/docs/dev/set_page_rank) - Default: `0` - Minimum: `0` - Maximum: `100` -- `"chunk_method"`: (*Body parameter*), `enum` - The chunking method for the dataset. Available options: +- `"chunk_method"`: (*Body parameter*), `enum` + The chunking method for the dataset. Available options: - `"naive"`: General (default) - `"book"`: Book - `"email"`: Email @@ -388,7 +387,7 @@ Uploads documents to the current dataset. A list of dictionaries representing the documents to upload, each containing the following keys: -- `"display_name"`: (Optional) The file name to display in the dataset. +- `"display_name"`: (Optional) The file name to display in the dataset. - `"blob"`: (Optional) The binary content of the file to upload. #### Returns @@ -434,29 +433,29 @@ A dictionary representing the attributes to update, with the following keys: - `"one"`: One - `"email"`: Email - `"parser_config"`: `dict[str, Any]` The parsing configuration for the document. Its attributes vary based on the selected `"chunk_method"`: - - `"chunk_method"`=`"naive"`: + - `"chunk_method"`=`"naive"`: `{"chunk_token_num":128,"delimiter":"\\n","html4excel":False,"layout_recognize":True,"raptor":{"use_raptor":False}}`. - - `chunk_method`=`"qa"`: + - `chunk_method`=`"qa"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"manuel"`: + - `chunk_method`=`"manuel"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"table"`: + - `chunk_method`=`"table"`: `None` - - `chunk_method`=`"paper"`: + - `chunk_method`=`"paper"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"book"`: + - `chunk_method`=`"book"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"laws"`: + - `chunk_method`=`"laws"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"presentation"`: + - `chunk_method`=`"presentation"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"picture"`: + - `chunk_method`=`"picture"`: `None` - - `chunk_method`=`"one"`: + - `chunk_method`=`"one"`: `None` - - `chunk_method`=`"knowledge-graph"`: + - `chunk_method`=`"knowledge-graph"`: `{"chunk_token_num":128,"delimiter":"\\n","entity_types":["organization","person","location","event","time"]}` - - `chunk_method`=`"email"`: + - `chunk_method`=`"email"`: `None` #### Returns @@ -589,27 +588,27 @@ A `Document` object contains the following attributes: - `"FAIL"` - `status`: `str` Reserved for future use. - `parser_config`: `ParserConfig` Configuration object for the parser. Its attributes vary based on the selected `chunk_method`: - - `chunk_method`=`"naive"`: + - `chunk_method`=`"naive"`: `{"chunk_token_num":128,"delimiter":"\\n","html4excel":False,"layout_recognize":True,"raptor":{"use_raptor":False}}`. - - `chunk_method`=`"qa"`: + - `chunk_method`=`"qa"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"manuel"`: + - `chunk_method`=`"manuel"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"table"`: + - `chunk_method`=`"table"`: `None` - - `chunk_method`=`"paper"`: + - `chunk_method`=`"paper"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"book"`: + - `chunk_method`=`"book"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"laws"`: + - `chunk_method`=`"laws"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"presentation"`: + - `chunk_method`=`"presentation"`: `{"raptor": {"use_raptor": False}}` - - `chunk_method`=`"picure"`: + - `chunk_method`=`"picure"`: `None` - - `chunk_method`=`"one"`: + - `chunk_method`=`"one"`: `None` - - `chunk_method`=`"email"`: + - `chunk_method`=`"email"`: `None` #### Examples @@ -727,9 +726,9 @@ A list of tuples with detailed parsing results: ... ] ``` -- `status`: The final parsing state (e.g., `success`, `failed`, `cancelled`). -- `chunk_count`: The number of content chunks created from the document. -- `token_count`: The total number of tokens processed. +- `status`: The final parsing state (e.g., `success`, `failed`, `cancelled`). +- `chunk_count`: The number of content chunks created from the document. +- `token_count`: The total number of tokens processed. --- @@ -989,11 +988,11 @@ The user query or query keywords. Defaults to `""`. ##### dataset_ids: `list[str]`, *Required* -The IDs of the datasets to search. Defaults to `None`. +The IDs of the datasets to search. Defaults to `None`. ##### document_ids: `list[str]` -The IDs of the documents to search. Defaults to `None`. You must ensure all selected documents use the same embedding model. Otherwise, an error will occur. +The IDs of the documents to search. Defaults to `None`. You must ensure all selected documents use the same embedding model. Otherwise, an error will occur. ##### page: `int` @@ -1026,7 +1025,7 @@ Indicates whether to enable keyword-based matching: - `True`: Enable keyword-based matching. - `False`: Disable keyword-based matching (default). -##### cross_languages: `list[string]` +##### cross_languages: `list[string]` The languages that should be translated into, in order to achieve keywords retrievals in different languages. @@ -1067,10 +1066,10 @@ for c in rag_object.retrieve(dataset_ids=[dataset.id],document_ids=[doc.id]): ```python RAGFlow.create_chat( - name: str, - avatar: str = "", - dataset_ids: list[str] = [], - llm: Chat.LLM = None, + name: str, + avatar: str = "", + dataset_ids: list[str] = [], + llm: Chat.LLM = None, prompt: Chat.Prompt = None ) -> Chat ``` @@ -1095,15 +1094,15 @@ The IDs of the associated datasets. Defaults to `[""]`. The LLM settings for the chat assistant to create. Defaults to `None`. When the value is `None`, a dictionary with the following values will be generated as the default. An `LLM` object contains the following attributes: -- `model_name`: `str` - The chat model name. If it is `None`, the user's default chat model will be used. -- `temperature`: `float` - Controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses. Defaults to `0.1`. -- `top_p`: `float` - Also known as “nucleus sampling”, this parameter sets a threshold to select a smaller set of words to sample from. It focuses on the most likely words, cutting off the less probable ones. Defaults to `0.3` -- `presence_penalty`: `float` +- `model_name`: `str` + The chat model name. If it is `None`, the user's default chat model will be used. +- `temperature`: `float` + Controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses. Defaults to `0.1`. +- `top_p`: `float` + Also known as “nucleus sampling”, this parameter sets a threshold to select a smaller set of words to sample from. It focuses on the most likely words, cutting off the less probable ones. Defaults to `0.3` +- `presence_penalty`: `float` This discourages the model from repeating the same information by penalizing words that have already appeared in the conversation. Defaults to `0.2`. -- `frequency penalty`: `float` +- `frequency penalty`: `float` Similar to the presence penalty, this reduces the model’s tendency to repeat the same words frequently. Defaults to `0.7`. ##### prompt: `Chat.Prompt` @@ -1163,8 +1162,8 @@ A dictionary representing the attributes to update, with the following keys: - `"dataset_ids"`: `list[str]` The datasets to update. - `"llm"`: `dict` The LLM settings: - `"model_name"`, `str` The chat model name. - - `"temperature"`, `float` Controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses. - - `"top_p"`, `float` Also known as “nucleus sampling”, this parameter sets a threshold to select a smaller set of words to sample from. + - `"temperature"`, `float` Controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses. + - `"top_p"`, `float` Also known as “nucleus sampling”, this parameter sets a threshold to select a smaller set of words to sample from. - `"presence_penalty"`, `float` This discourages the model from repeating the same information by penalizing words that have appeared in the conversation. - `"frequency penalty"`, `float` Similar to presence penalty, this reduces the model’s tendency to repeat the same words. - `"prompt"` : Instructions for the LLM to follow. @@ -1234,9 +1233,9 @@ rag_object.delete_chats(ids=["id_1","id_2"]) ```python RAGFlow.list_chats( - page: int = 1, - page_size: int = 30, - orderby: str = "create_time", + page: int = 1, + page_size: int = 30, + orderby: str = "create_time", desc: bool = True, id: str = None, name: str = None @@ -1266,11 +1265,11 @@ The attribute by which the results are sorted. Available options: Indicates whether the retrieved chat assistants should be sorted in descending order. Defaults to `True`. -##### id: `str` +##### id: `str` The ID of the chat assistant to retrieve. Defaults to `None`. -##### name: `str` +##### name: `str` The name of the chat assistant to retrieve. Defaults to `None`. @@ -1370,9 +1369,9 @@ session.update({"name": "updated_name"}) ```python Chat.list_sessions( - page: int = 1, - page_size: int = 30, - orderby: str = "create_time", + page: int = 1, + page_size: int = 30, + orderby: str = "create_time", desc: bool = True, id: str = None, name: str = None @@ -1509,25 +1508,25 @@ The content of the message. Defaults to `"Hi! I am your assistant, can I help yo A list of `Chunk` objects representing references to the message, each containing the following attributes: -- `id` `str` +- `id` `str` The chunk ID. -- `content` `str` +- `content` `str` The content of the chunk. -- `img_id` `str` +- `img_id` `str` The ID of the snapshot of the chunk. Applicable only when the source of the chunk is an image, PPT, PPTX, or PDF file. -- `document_id` `str` +- `document_id` `str` The ID of the referenced document. -- `document_name` `str` +- `document_name` `str` The name of the referenced document. -- `position` `list[str]` +- `position` `list[str]` The location information of the chunk within the referenced document. -- `dataset_id` `str` +- `dataset_id` `str` The ID of the dataset to which the referenced document belongs. -- `similarity` `float` +- `similarity` `float` A composite similarity score of the chunk ranging from `0` to `1`, with a higher value indicating greater similarity. It is the weighted sum of `vector_similarity` and `term_similarity`. -- `vector_similarity` `float` +- `vector_similarity` `float` A vector similarity score of the chunk ranging from `0` to `1`, with a higher value indicating greater similarity between vector embeddings. -- `term_similarity` `float` +- `term_similarity` `float` A keyword similarity score of the chunk ranging from `0` to `1`, with a higher value indicating greater similarity between keywords. #### Examples @@ -1538,7 +1537,7 @@ from ragflow_sdk import RAGFlow rag_object = RAGFlow(api_key="", base_url="http://:9380") assistant = rag_object.list_chats(name="Miss R") assistant = assistant[0] -session = assistant.create_session() +session = assistant.create_session() print("\n==================== Miss R =====================\n") print("Hello. What can I do for you?") @@ -1546,7 +1545,7 @@ print("Hello. What can I do for you?") while True: question = input("\n==================== User =====================\n> ") print("\n==================== Miss R =====================\n") - + cont = "" for ans in session.ask(question, stream=True): print(ans.content[len(cont):], end='', flush=True) @@ -1634,25 +1633,25 @@ The content of the message. Defaults to `"Hi! I am your assistant, can I help yo A list of `Chunk` objects representing references to the message, each containing the following attributes: -- `id` `str` +- `id` `str` The chunk ID. -- `content` `str` +- `content` `str` The content of the chunk. -- `image_id` `str` +- `image_id` `str` The ID of the snapshot of the chunk. Applicable only when the source of the chunk is an image, PPT, PPTX, or PDF file. -- `document_id` `str` +- `document_id` `str` The ID of the referenced document. -- `document_name` `str` +- `document_name` `str` The name of the referenced document. -- `position` `list[str]` +- `position` `list[str]` The location information of the chunk within the referenced document. -- `dataset_id` `str` +- `dataset_id` `str` The ID of the dataset to which the referenced document belongs. -- `similarity` `float` +- `similarity` `float` A composite similarity score of the chunk ranging from `0` to `1`, with a higher value indicating greater similarity. It is the weighted sum of `vector_similarity` and `term_similarity`. -- `vector_similarity` `float` +- `vector_similarity` `float` A vector similarity score of the chunk ranging from `0` to `1`, with a higher value indicating greater similarity between vector embeddings. -- `term_similarity` `float` +- `term_similarity` `float` A keyword similarity score of the chunk ranging from `0` to `1`, with a higher value indicating greater similarity between keywords. #### Examples @@ -1663,7 +1662,7 @@ from ragflow_sdk import RAGFlow, Agent rag_object = RAGFlow(api_key="", base_url="http://:9380") AGENT_id = "AGENT_ID" agent = rag_object.list_agents(id = AGENT_id)[0] -session = agent.create_session() +session = agent.create_session() print("\n===== Miss R ====\n") print("Hello. What can I do for you?") @@ -1671,7 +1670,7 @@ print("Hello. What can I do for you?") while True: question = input("\n===== User ====\n> ") print("\n==== Miss R ====\n") - + cont = "" for ans in session.ask(question, stream=True): print(ans.content[len(cont):], end='', flush=True) @@ -1684,9 +1683,9 @@ while True: ```python Agent.list_sessions( - page: int = 1, - page_size: int = 30, - orderby: str = "update_time", + page: int = 1, + page_size: int = 30, + orderby: str = "update_time", desc: bool = True, id: str = None ) -> List[Session] @@ -1777,9 +1776,9 @@ agent.delete_sessions(ids=["id_1","id_2"]) ```python RAGFlow.list_agents( - page: int = 1, - page_size: int = 30, - orderby: str = "create_time", + page: int = 1, + page_size: int = 30, + orderby: str = "create_time", desc: bool = True, id: str = None, title: str = None @@ -1809,11 +1808,11 @@ The attribute by which the results are sorted. Available options: Indicates whether the retrieved agents should be sorted in descending order. Defaults to `True`. -##### id: `str` +##### id: `str` The ID of the agent to retrieve. Defaults to `None`. -##### name: `str` +##### name: `str` The name of the agent to retrieve. Defaults to `None`. diff --git a/docs/references/supported_models.mdx b/docs/references/supported_models.mdx index 1d7a0387c62..d35f203a537 100644 --- a/docs/references/supported_models.mdx +++ b/docs/references/supported_models.mdx @@ -5,7 +5,6 @@ sidebar_custom_props: { categoryIcon: LucideBox } --- - # Supported models import APITable from '@site/src/components/APITable'; diff --git a/docs/release_notes.md b/docs/release_notes.md index e724f503726..fc779973afc 100644 --- a/docs/release_notes.md +++ b/docs/release_notes.md @@ -5,7 +5,6 @@ sidebar_custom_props: { sidebarIcon: LucideClipboardPenLine } --- - # Releases Key features, improvements and bug fixes in the latest releases. @@ -23,7 +22,7 @@ Released on December 31, 2025. ### Fixed issues -- Memory: +- Memory: - The RAGFlow server failed to start if an empty memory object existed. - Unable to delete a newly created empty Memory. - RAG: MDX file parsing was not supported. @@ -259,7 +258,7 @@ Ecommerce Customer Service Workflow: A template designed to handle enquiries abo ### Fixed issues -- Dataset: +- Dataset: - Unable to share resources with the team. - Inappropriate restrictions on the number and size of uploaded files. - Chat: @@ -275,13 +274,13 @@ Released on August 20, 2025. ### Improvements -- Revamps the user interface for the **Datasets**, **Chat**, and **Search** pages. +- Revamps the user interface for the **Datasets**, **Chat**, and **Search** pages. - Search and Chat: Introduces document-level metadata filtering, allowing automatic or manual filtering during chats or searches. - Search: Supports creating search apps tailored to various business scenarios - Chat: Supports comparing answer performance of up to three chat model settings on a single **Chat** page. -- Agent: - - Implements a toggle in the **Agent** component to enable or disable citation. - - Introduces a drag-and-drop method for creating components. +- Agent: + - Implements a toggle in the **Agent** component to enable or disable citation. + - Introduces a drag-and-drop method for creating components. - Documentation: Corrects inaccuracies in the API reference. ### New Agent templates @@ -291,8 +290,8 @@ Released on August 20, 2025. ### Fixed issues - The timeout mechanism introduced in v0.20.0 caused tasks like GraphRAG to halt. -- Predefined opening greeting in the **Agent** component was missing during conversations. -- An automatic line break issue in the prompt editor. +- Predefined opening greeting in the **Agent** component was missing during conversations. +- An automatic line break issue in the prompt editor. - A memory leak issue caused by PyPDF. [#9469](https://github.com/infiniflow/ragflow/pull/9469) ### API changes @@ -376,7 +375,7 @@ Released on June 23, 2025. ### Newly supported models -- Qwen 3 Embedding. [#8184](https://github.com/infiniflow/ragflow/pull/8184) +- Qwen 3 Embedding. [#8184](https://github.com/infiniflow/ragflow/pull/8184) - Voyage Multimodal 3. [#7987](https://github.com/infiniflow/ragflow/pull/7987) ## v0.19.0 From 44bada64c955671dc5a997ace486d104cb2bd557 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Tue, 13 Jan 2026 09:41:35 +0800 Subject: [PATCH 088/335] Feat: support tree structured deep-research policy. (#12559) ### What problem does this PR solve? #12558 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- Dockerfile | 1 - agentic_reasoning/__init__.py | 1 - agentic_reasoning/deep_research.py | 311 --- agentic_reasoning/prompts.py | 147 -- api/apps/kb_app.py | 1 + api/db/services/conversation_service.py | 2 + api/db/services/dialog_service.py | 27 +- pyproject.toml | 1 - rag/advanced_rag/__init__.py | 20 + ...tructured_query_decomposition_retrieval.py | 126 ++ rag/nlp/search.py | 1 + rag/prompts/generator.py | 61 +- rag/prompts/multi_queries_gen.md | 41 + rag/prompts/sufficiency_check.md | 24 + uv.lock | 1813 ++++++++--------- 15 files changed, 1181 insertions(+), 1396 deletions(-) delete mode 100644 agentic_reasoning/__init__.py delete mode 100644 agentic_reasoning/deep_research.py delete mode 100644 agentic_reasoning/prompts.py create mode 100644 rag/advanced_rag/__init__.py create mode 100644 rag/advanced_rag/tree_structured_query_decomposition_retrieval.py create mode 100644 rag/prompts/multi_queries_gen.md create mode 100644 rag/prompts/sufficiency_check.md diff --git a/Dockerfile b/Dockerfile index aaec6f16e28..a1eb2433932 100644 --- a/Dockerfile +++ b/Dockerfile @@ -187,7 +187,6 @@ COPY deepdoc deepdoc COPY rag rag COPY agent agent COPY graphrag graphrag -COPY agentic_reasoning agentic_reasoning COPY pyproject.toml uv.lock ./ COPY mcp mcp COPY plugin plugin diff --git a/agentic_reasoning/__init__.py b/agentic_reasoning/__init__.py deleted file mode 100644 index 1422de46e4f..00000000000 --- a/agentic_reasoning/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .deep_research import DeepResearcher as DeepResearcher \ No newline at end of file diff --git a/agentic_reasoning/deep_research.py b/agentic_reasoning/deep_research.py deleted file mode 100644 index 17afdab1871..00000000000 --- a/agentic_reasoning/deep_research.py +++ /dev/null @@ -1,311 +0,0 @@ -# -# Copyright 2024 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import logging -import re -from functools import partial -from agentic_reasoning.prompts import BEGIN_SEARCH_QUERY, BEGIN_SEARCH_RESULT, END_SEARCH_RESULT, MAX_SEARCH_LIMIT, \ - END_SEARCH_QUERY, REASON_PROMPT, RELEVANT_EXTRACTION_PROMPT -from api.db.services.llm_service import LLMBundle -from rag.nlp import extract_between -from rag.prompts import kb_prompt -from rag.utils.tavily_conn import Tavily - - -class DeepResearcher: - def __init__(self, - chat_mdl: LLMBundle, - prompt_config: dict, - kb_retrieve: partial = None, - kg_retrieve: partial = None - ): - self.chat_mdl = chat_mdl - self.prompt_config = prompt_config - self._kb_retrieve = kb_retrieve - self._kg_retrieve = kg_retrieve - - def _remove_tags(text: str, start_tag: str, end_tag: str) -> str: - """Remove tags but keep the content between them.""" - if not text: - return text - text = re.sub(re.escape(start_tag), "", text) - return re.sub(re.escape(end_tag), "", text) - - @staticmethod - def _remove_query_tags(text: str) -> str: - """Remove Query Tags""" - return DeepResearcher._remove_tags(text, BEGIN_SEARCH_QUERY, END_SEARCH_QUERY) - - @staticmethod - def _remove_result_tags(text: str) -> str: - """Remove Result Tags""" - return DeepResearcher._remove_tags(text, BEGIN_SEARCH_RESULT, END_SEARCH_RESULT) - - async def _generate_reasoning(self, msg_history): - """Generate reasoning steps (delta output)""" - raw_answer = "" - cleaned_answer = "" - if msg_history[-1]["role"] != "user": - msg_history.append({"role": "user", "content": "Continues reasoning with the new information.\n"}) - else: - msg_history[-1]["content"] += "\n\nContinues reasoning with the new information.\n" - - async for delta in self.chat_mdl.async_chat_streamly_delta(REASON_PROMPT, msg_history, {"temperature": 0.7}): - if not delta: - continue - raw_answer += delta - cleaned_full = re.sub(r"^.*", "", raw_answer, flags=re.DOTALL) - if not cleaned_full: - continue - if cleaned_full.startswith(cleaned_answer): - delta_clean = cleaned_full[len(cleaned_answer):] - else: - delta_clean = cleaned_full - if not delta_clean: - continue - cleaned_answer = cleaned_full - yield delta_clean - - def _extract_search_queries(self, query_think, question, step_index): - """Extract search queries from thinking""" - queries = extract_between(query_think, BEGIN_SEARCH_QUERY, END_SEARCH_QUERY) - if not queries and step_index == 0: - # If this is the first step and no queries are found, use the original question as the query - queries = [question] - return queries - - def _truncate_previous_reasoning(self, all_reasoning_steps): - """Truncate previous reasoning steps to maintain a reasonable length""" - truncated_prev_reasoning = "" - for i, step in enumerate(all_reasoning_steps): - truncated_prev_reasoning += f"Step {i + 1}: {step}\n\n" - - prev_steps = truncated_prev_reasoning.split('\n\n') - if len(prev_steps) <= 5: - truncated_prev_reasoning = '\n\n'.join(prev_steps) - else: - truncated_prev_reasoning = '' - for i, step in enumerate(prev_steps): - if i == 0 or i >= len(prev_steps) - 4 or BEGIN_SEARCH_QUERY in step or BEGIN_SEARCH_RESULT in step: - truncated_prev_reasoning += step + '\n\n' - else: - if truncated_prev_reasoning[-len('\n\n...\n\n'):] != '\n\n...\n\n': - truncated_prev_reasoning += '...\n\n' - - return truncated_prev_reasoning.strip('\n') - - def _retrieve_information(self, search_query): - """Retrieve information from different sources""" - # 1. Knowledge base retrieval - kbinfos = [] - try: - kbinfos = self._kb_retrieve(question=search_query) if self._kb_retrieve else {"chunks": [], "doc_aggs": []} - except Exception as e: - logging.error(f"Knowledge base retrieval error: {e}") - - # 2. Web retrieval (if Tavily API is configured) - try: - if self.prompt_config.get("tavily_api_key"): - tav = Tavily(self.prompt_config["tavily_api_key"]) - tav_res = tav.retrieve_chunks(search_query) - kbinfos["chunks"].extend(tav_res["chunks"]) - kbinfos["doc_aggs"].extend(tav_res["doc_aggs"]) - except Exception as e: - logging.error(f"Web retrieval error: {e}") - - # 3. Knowledge graph retrieval (if configured) - try: - if self.prompt_config.get("use_kg") and self._kg_retrieve: - ck = self._kg_retrieve(question=search_query) - if ck["content_with_weight"]: - kbinfos["chunks"].insert(0, ck) - except Exception as e: - logging.error(f"Knowledge graph retrieval error: {e}") - - return kbinfos - - def _update_chunk_info(self, chunk_info, kbinfos): - """Update chunk information for citations""" - if not chunk_info["chunks"]: - # If this is the first retrieval, use the retrieval results directly - for k in chunk_info.keys(): - chunk_info[k] = kbinfos[k] - else: - # Merge newly retrieved information, avoiding duplicates - cids = [c["chunk_id"] for c in chunk_info["chunks"]] - for c in kbinfos["chunks"]: - if c["chunk_id"] not in cids: - chunk_info["chunks"].append(c) - - dids = [d["doc_id"] for d in chunk_info["doc_aggs"]] - for d in kbinfos["doc_aggs"]: - if d["doc_id"] not in dids: - chunk_info["doc_aggs"].append(d) - - async def _extract_relevant_info(self, truncated_prev_reasoning, search_query, kbinfos): - """Extract and summarize relevant information (delta output)""" - raw_answer = "" - cleaned_answer = "" - async for delta in self.chat_mdl.async_chat_streamly_delta( - RELEVANT_EXTRACTION_PROMPT.format( - prev_reasoning=truncated_prev_reasoning, - search_query=search_query, - document="\n".join(kb_prompt(kbinfos, 4096)) - ), - [{"role": "user", - "content": f'Now you should analyze each web page and find helpful information based on the current search query "{search_query}" and previous reasoning steps.'}], - {"temperature": 0.7}): - if not delta: - continue - raw_answer += delta - cleaned_full = re.sub(r"^.*", "", raw_answer, flags=re.DOTALL) - if not cleaned_full: - continue - if cleaned_full.startswith(cleaned_answer): - delta_clean = cleaned_full[len(cleaned_answer):] - else: - delta_clean = cleaned_full - if not delta_clean: - continue - cleaned_answer = cleaned_full - yield delta_clean - - async def thinking(self, chunk_info: dict, question: str): - executed_search_queries = [] - msg_history = [{"role": "user", "content": f'Question:\"{question}\"\n'}] - all_reasoning_steps = [] - think = "" - last_idx = 0 - endswith_think = False - last_full = "" - - def emit_delta(full_text: str): - nonlocal last_idx, endswith_think, last_full - if full_text == last_full: - return None - last_full = full_text - delta_ans = full_text[last_idx:] - - if delta_ans.find("") == 0: - last_idx += len("") - delta = "" - elif delta_ans.find("") > 0: - delta = full_text[last_idx:last_idx + delta_ans.find("")] - last_idx += delta_ans.find("") - elif delta_ans.endswith(""): - endswith_think = True - delta = re.sub(r"(|)", "", delta_ans) - elif endswith_think: - endswith_think = False - delta = "" - else: - last_idx = len(full_text) - if full_text.endswith(""): - last_idx -= len("") - delta = re.sub(r"(|)", "", delta_ans) - - if not delta: - return None - if delta == "": - return {"answer": "", "reference": {}, "audio_binary": None, "final": False, "start_to_think": True} - if delta == "": - return {"answer": "", "reference": {}, "audio_binary": None, "final": False, "end_to_think": True} - return {"answer": delta, "reference": {}, "audio_binary": None, "final": False} - - def flush_think_close(): - nonlocal endswith_think - if endswith_think: - endswith_think = False - return {"answer": "", "reference": {}, "audio_binary": None, "final": False, "end_to_think": True} - return None - - for step_index in range(MAX_SEARCH_LIMIT + 1): - # Check if the maximum search limit has been reached - if step_index == MAX_SEARCH_LIMIT - 1: - summary_think = f"\n{BEGIN_SEARCH_RESULT}\nThe maximum search limit is exceeded. You are not allowed to search.\n{END_SEARCH_RESULT}\n" - payload = emit_delta(think + summary_think) - if payload: - yield payload - all_reasoning_steps.append(summary_think) - msg_history.append({"role": "assistant", "content": summary_think}) - break - - # Step 1: Generate reasoning - query_think = "" - async for delta in self._generate_reasoning(msg_history): - query_think += delta - payload = emit_delta(think + self._remove_query_tags(query_think)) - if payload: - yield payload - - think += self._remove_query_tags(query_think) - all_reasoning_steps.append(query_think) - - # Step 2: Extract search queries - queries = self._extract_search_queries(query_think, question, step_index) - if not queries and step_index > 0: - # If not the first step and no queries, end the search process - break - - # Process each search query - for search_query in queries: - msg_history.append({"role": "assistant", "content": search_query}) - think += f"\n\n> {step_index + 1}. {search_query}\n\n" - payload = emit_delta(think) - if payload: - yield payload - - # Check if the query has already been executed - if search_query in executed_search_queries: - summary_think = f"\n{BEGIN_SEARCH_RESULT}\nYou have searched this query. Please refer to previous results.\n{END_SEARCH_RESULT}\n" - payload = emit_delta(think + summary_think) - if payload: - yield payload - all_reasoning_steps.append(summary_think) - msg_history.append({"role": "user", "content": summary_think}) - think += summary_think - continue - - executed_search_queries.append(search_query) - - # Step 3: Truncate previous reasoning steps - truncated_prev_reasoning = self._truncate_previous_reasoning(all_reasoning_steps) - - # Step 4: Retrieve information - kbinfos = self._retrieve_information(search_query) - - # Step 5: Update chunk information - self._update_chunk_info(chunk_info, kbinfos) - - # Step 6: Extract relevant information - think += "\n\n" - summary_think = "" - async for delta in self._extract_relevant_info(truncated_prev_reasoning, search_query, kbinfos): - summary_think += delta - payload = emit_delta(think + self._remove_result_tags(summary_think)) - if payload: - yield payload - - all_reasoning_steps.append(summary_think) - msg_history.append( - {"role": "user", "content": f"\n\n{BEGIN_SEARCH_RESULT}{summary_think}{END_SEARCH_RESULT}\n\n"}) - think += self._remove_result_tags(summary_think) - - final_payload = emit_delta(think + "") - if final_payload: - yield final_payload - close_payload = flush_think_close() - if close_payload: - yield close_payload diff --git a/agentic_reasoning/prompts.py b/agentic_reasoning/prompts.py deleted file mode 100644 index 8bf101b291a..00000000000 --- a/agentic_reasoning/prompts.py +++ /dev/null @@ -1,147 +0,0 @@ -# -# Copyright 2024 The InfiniFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -BEGIN_SEARCH_QUERY = "<|begin_search_query|>" -END_SEARCH_QUERY = "<|end_search_query|>" -BEGIN_SEARCH_RESULT = "<|begin_search_result|>" -END_SEARCH_RESULT = "<|end_search_result|>" -MAX_SEARCH_LIMIT = 6 - -REASON_PROMPT = f"""You are an advanced reasoning agent. Your goal is to answer the user's question by breaking it down into a series of verifiable steps. - -You have access to a powerful search tool to find information. - -**Your Task:** -1. Analyze the user's question. -2. If you need information, issue a search query to find a specific fact. -3. Review the search results. -4. Repeat the search process until you have all the facts needed to answer the question. -5. Once you have gathered sufficient information, synthesize the facts and provide the final answer directly. - -**Tool Usage:** -- To search, you MUST write your query between the special tokens: {BEGIN_SEARCH_QUERY}your query{END_SEARCH_QUERY}. -- The system will provide results between {BEGIN_SEARCH_RESULT}search results{END_SEARCH_RESULT}. -- You have a maximum of {MAX_SEARCH_LIMIT} search attempts. - ---- -**Example 1: Multi-hop Question** - -**Question:** "Are both the directors of Jaws and Casino Royale from the same country?" - -**Your Thought Process & Actions:** -First, I need to identify the director of Jaws. -{BEGIN_SEARCH_QUERY}who is the director of Jaws?{END_SEARCH_QUERY} -[System returns search results] -{BEGIN_SEARCH_RESULT} -Jaws is a 1975 American thriller film directed by Steven Spielberg. -{END_SEARCH_RESULT} -Okay, the director of Jaws is Steven Spielberg. Now I need to find out his nationality. -{BEGIN_SEARCH_QUERY}where is Steven Spielberg from?{END_SEARCH_QUERY} -[System returns search results] -{BEGIN_SEARCH_RESULT} -Steven Allan Spielberg is an American filmmaker. Born in Cincinnati, Ohio... -{END_SEARCH_RESULT} -So, Steven Spielberg is from the USA. Next, I need to find the director of Casino Royale. -{BEGIN_SEARCH_QUERY}who is the director of Casino Royale 2006?{END_SEARCH_QUERY} -[System returns search results] -{BEGIN_SEARCH_RESULT} -Casino Royale is a 2006 spy film directed by Martin Campbell. -{END_SEARCH_RESULT} -The director of Casino Royale is Martin Campbell. Now I need his nationality. -{BEGIN_SEARCH_QUERY}where is Martin Campbell from?{END_SEARCH_QUERY} -[System returns search results] -{BEGIN_SEARCH_RESULT} -Martin Campbell (born 24 October 1943) is a New Zealand film and television director. -{END_SEARCH_RESULT} -I have all the information. Steven Spielberg is from the USA, and Martin Campbell is from New Zealand. They are not from the same country. - -Final Answer: No, the directors of Jaws and Casino Royale are not from the same country. Steven Spielberg is from the USA, and Martin Campbell is from New Zealand. - ---- -**Example 2: Simple Fact Retrieval** - -**Question:** "When was the founder of craigslist born?" - -**Your Thought Process & Actions:** -First, I need to know who founded craigslist. -{BEGIN_SEARCH_QUERY}who founded craigslist?{END_SEARCH_QUERY} -[System returns search results] -{BEGIN_SEARCH_RESULT} -Craigslist was founded in 1995 by Craig Newmark. -{END_SEARCH_RESULT} -The founder is Craig Newmark. Now I need his birth date. -{BEGIN_SEARCH_QUERY}when was Craig Newmark born?{END_SEARCH_QUERY} -[System returns search results] -{BEGIN_SEARCH_RESULT} -Craig Newmark was born on December 6, 1952. -{END_SEARCH_RESULT} -I have found the answer. - -Final Answer: The founder of craigslist, Craig Newmark, was born on December 6, 1952. - ---- -**Important Rules:** -- **One Fact at a Time:** Decompose the problem and issue one search query at a time to find a single, specific piece of information. -- **Be Precise:** Formulate clear and precise search queries. If a search fails, rephrase it. -- **Synthesize at the End:** Do not provide the final answer until you have completed all necessary searches. -- **Language Consistency:** Your search queries should be in the same language as the user's question. - -Now, begin your work. Please answer the following question by thinking step-by-step. -""" - -RELEVANT_EXTRACTION_PROMPT = """You are a highly efficient information extraction module. Your sole purpose is to extract the single most relevant piece of information from the provided `Searched Web Pages` that directly answers the `Current Search Query`. - -**Your Task:** -1. Read the `Current Search Query` to understand what specific information is needed. -2. Scan the `Searched Web Pages` to find the answer to that query. -3. Extract only the essential, factual information that answers the query. Be concise. - -**Context (For Your Information Only):** -The `Previous Reasoning Steps` are provided to give you context on the overall goal, but your primary focus MUST be on answering the `Current Search Query`. Do not use information from the previous steps in your output. - -**Output Format:** -Your response must follow one of two formats precisely. - -1. **If a direct and relevant answer is found:** - - Start your response immediately with `Final Information`. - - Provide only the extracted fact(s). Do not add any extra conversational text. - - *Example:* - `Current Search Query`: Where is Martin Campbell from? - `Searched Web Pages`: [Long article snippet about Martin Campbell's career, which includes the sentence "Martin Campbell (born 24 October 1943) is a New Zealand film and television director..."] - - *Your Output:* - Final Information - Martin Campbell is a New Zealand film and television director. - -2. **If no relevant answer that directly addresses the query is found in the web pages:** - - Start your response immediately with `Final Information`. - - Write the exact phrase: `No helpful information found.` - ---- -**BEGIN TASK** - -**Inputs:** - -- **Previous Reasoning Steps:** -{prev_reasoning} - -- **Current Search Query:** -{search_query} - -- **Searched Web Pages:** -{document} -""" \ No newline at end of file diff --git a/api/apps/kb_app.py b/api/apps/kb_app.py index fff982563f9..26ea12f9626 100644 --- a/api/apps/kb_app.py +++ b/api/apps/kb_app.py @@ -174,6 +174,7 @@ async def update_metadata_setting(): message="Database error (Knowledgebase rename)!") kb = kb.to_dict() kb["parser_config"]["metadata"] = req["metadata"] + kb["parser_config"]["enable_metadata"] = req.get("enable_metadata", True) KnowledgebaseService.update_by_id(kb["id"], kb) return get_json_result(data=kb) diff --git a/api/db/services/conversation_service.py b/api/db/services/conversation_service.py index 693489bf8ac..3287ac15784 100644 --- a/api/db/services/conversation_service.py +++ b/api/db/services/conversation_service.py @@ -64,6 +64,7 @@ def get_all_conversation_by_dialog_ids(cls, dialog_ids): offset += limit return res + def structure_answer(conv, ans, message_id, session_id): reference = ans["reference"] if not isinstance(reference, dict): @@ -107,6 +108,7 @@ def structure_answer(conv, ans, message_id, session_id): conv.reference[-1] = reference return ans + async def async_completion(tenant_id, chat_id, question, name="New session", session_id=None, stream=True, **kwargs): assert name, "`name` can not be empty." dia = DialogService.query(id=chat_id, tenant_id=tenant_id, status=StatusEnum.VALID.value) diff --git a/api/db/services/dialog_service.py b/api/db/services/dialog_service.py index 54f70658be4..ed178434d5d 100644 --- a/api/db/services/dialog_service.py +++ b/api/db/services/dialog_service.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import asyncio import binascii import logging import re @@ -23,7 +24,6 @@ from timeit import default_timer as timer from langfuse import Langfuse from peewee import fn -from agentic_reasoning import DeepResearcher from api.db.services.file_service import FileService from common.constants import LLMType, ParserType, StatusEnum from api.db.db_models import DB, Dialog @@ -36,6 +36,7 @@ from api.db.services.tenant_llm_service import TenantLLMService from common.time_utils import current_timestamp, datetime_format from graphrag.general.mind_map_extractor import MindMapExtractor +from rag.advanced_rag import DeepResearcher from rag.app.resume import forbidden_select_fields4resume from rag.app.tag import label_question from rag.nlp.search import index_name @@ -380,16 +381,35 @@ async def async_chat(dialog, messages, stream=True, **kwargs): doc_ids=attachments, ), ) + queue = asyncio.Queue() + async def callback(msg:str): + nonlocal queue + await queue.put(msg + "
    ") + + await callback("") + task = asyncio.create_task(reasoner.research(kbinfos, questions[-1], questions[-1], callback=callback)) + while True: + msg = await queue.get() + if msg.find("") == 0: + yield {"answer": "", "reference": {}, "audio_binary": None, "final": False, "start_to_think": True} + elif msg.find("") == 0: + yield {"answer": "", "reference": {}, "audio_binary": None, "final": False, "end_to_think": True} + break + else: + yield {"answer": msg, "reference": {}, "audio_binary": None, "final": False} + await task + ''' async for think in reasoner.thinking(kbinfos, attachments_ + " ".join(questions)): if isinstance(think, str): thought = think knowledges = [t for t in think.split("\n") if t] elif stream: yield think + ''' else: if embd_mdl: - kbinfos = retriever.retrieval( + kbinfos = await asyncio.to_thread(retriever.retrieval, " ".join(questions), embd_mdl, tenant_ids, @@ -420,8 +440,7 @@ async def async_chat(dialog, messages, stream=True, **kwargs): if ck["content_with_weight"]: kbinfos["chunks"].insert(0, ck) - knowledges = kb_prompt(kbinfos, max_tokens) - + knowledges = kb_prompt(kbinfos, max_tokens) logging.debug("{}->{}".format(" ".join(questions), "\n->".join(knowledges))) retrieval_ts = timer() diff --git a/pyproject.toml b/pyproject.toml index 2575194eb50..f8e5338f605 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -177,7 +177,6 @@ url = "https://pypi.tuna.tsinghua.edu.cn/simple" [tool.setuptools] packages = [ 'agent', - 'agentic_reasoning', 'api', 'deepdoc', 'graphrag', diff --git a/rag/advanced_rag/__init__.py b/rag/advanced_rag/__init__.py new file mode 100644 index 00000000000..bde0ff643df --- /dev/null +++ b/rag/advanced_rag/__init__.py @@ -0,0 +1,20 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from .tree_structured_query_decomposition_retrieval import TreeStructuredQueryDecompositionRetrieval as DeepResearcher + + +__all__ = ['DeepResearcher'] \ No newline at end of file diff --git a/rag/advanced_rag/tree_structured_query_decomposition_retrieval.py b/rag/advanced_rag/tree_structured_query_decomposition_retrieval.py new file mode 100644 index 00000000000..77689cab064 --- /dev/null +++ b/rag/advanced_rag/tree_structured_query_decomposition_retrieval.py @@ -0,0 +1,126 @@ +# +# Copyright 2024 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import asyncio +import logging +from functools import partial +from api.db.services.llm_service import LLMBundle +from rag.prompts import kb_prompt +from rag.prompts.generator import sufficiency_check, multi_queries_gen +from rag.utils.tavily_conn import Tavily +from timeit import default_timer as timer + + +class TreeStructuredQueryDecompositionRetrieval: + def __init__(self, + chat_mdl: LLMBundle, + prompt_config: dict, + kb_retrieve: partial = None, + kg_retrieve: partial = None + ): + self.chat_mdl = chat_mdl + self.prompt_config = prompt_config + self._kb_retrieve = kb_retrieve + self._kg_retrieve = kg_retrieve + self._lock = asyncio.Lock() + + def _retrieve_information(self, search_query): + """Retrieve information from different sources""" + # 1. Knowledge base retrieval + kbinfos = [] + try: + kbinfos = self._kb_retrieve(question=search_query) if self._kb_retrieve else {"chunks": [], "doc_aggs": []} + except Exception as e: + logging.error(f"Knowledge base retrieval error: {e}") + + # 2. Web retrieval (if Tavily API is configured) + try: + if self.prompt_config.get("tavily_api_key"): + tav = Tavily(self.prompt_config["tavily_api_key"]) + tav_res = tav.retrieve_chunks(search_query) + kbinfos["chunks"].extend(tav_res["chunks"]) + kbinfos["doc_aggs"].extend(tav_res["doc_aggs"]) + except Exception as e: + logging.error(f"Web retrieval error: {e}") + + # 3. Knowledge graph retrieval (if configured) + try: + if self.prompt_config.get("use_kg") and self._kg_retrieve: + ck = self._kg_retrieve(question=search_query) + if ck["content_with_weight"]: + kbinfos["chunks"].insert(0, ck) + except Exception as e: + logging.error(f"Knowledge graph retrieval error: {e}") + + return kbinfos + + async def _async_update_chunk_info(self, chunk_info, kbinfos): + async with self._lock: + """Update chunk information for citations""" + if not chunk_info["chunks"]: + # If this is the first retrieval, use the retrieval results directly + for k in chunk_info.keys(): + chunk_info[k] = kbinfos[k] + else: + # Merge newly retrieved information, avoiding duplicates + cids = [c["chunk_id"] for c in chunk_info["chunks"]] + for c in kbinfos["chunks"]: + if c["chunk_id"] not in cids: + chunk_info["chunks"].append(c) + + dids = [d["doc_id"] for d in chunk_info["doc_aggs"]] + for d in kbinfos["doc_aggs"]: + if d["doc_id"] not in dids: + chunk_info["doc_aggs"].append(d) + + async def research(self, chunk_info, question, query, depth=3, callback=None): + if callback: + await callback("") + await self._research(chunk_info, question, query, depth, callback) + if callback: + await callback("") + + async def _research(self, chunk_info, question, query, depth=3, callback=None): + if depth == 0: + #if callback: + # await callback("Reach the max search depth.") + return "" + if callback: + await callback(f"Searching by `{query}`...") + st = timer() + ret = self._retrieve_information(query) + if callback: + await callback("Retrieval %d results by %.1fms"%(len(ret["chunks"]), (timer()-st)*1000)) + await self._async_update_chunk_info(chunk_info, ret) + ret = kb_prompt(ret, self.chat_mdl.max_length*0.5) + + if callback: + await callback("Checking the sufficiency for retrieved information.") + suff = await sufficiency_check(self.chat_mdl, question, ret) + if suff["is_sufficient"]: + if callback: + await callback("Yes, it's sufficient.") + return ret + + #if callback: + # await callback("The retrieved information is not sufficient. Planing next steps...") + succ_question_info = await multi_queries_gen(self.chat_mdl, question, query, suff["missing_information"], ret) + if callback: + await callback("Next step is to search for the following questions:\n" + "\n - ".join(step["question"] for step in succ_question_info["questions"])) + steps = [] + for step in succ_question_info["questions"]: + steps.append(asyncio.create_task(self._research(chunk_info, step["question"], step["query"], depth-1, callback))) + results = await asyncio.gather(*steps, return_exceptions=True) + return "\n".join([str(r) for r in results]) diff --git a/rag/nlp/search.py b/rag/nlp/search.py index b10dc85726b..46b8b5b0a2b 100644 --- a/rag/nlp/search.py +++ b/rag/nlp/search.py @@ -382,6 +382,7 @@ def retrieval( # Ensure RERANK_LIMIT is multiple of page_size RERANK_LIMIT = math.ceil(64 / page_size) * page_size if page_size > 1 else 1 + RERANK_LIMIT = max(30, RERANK_LIMIT) req = { "kb_ids": kb_ids, "doc_ids": doc_ids, diff --git a/rag/prompts/generator.py b/rag/prompts/generator.py index 25fd4702e61..f65bfeab646 100644 --- a/rag/prompts/generator.py +++ b/rag/prompts/generator.py @@ -38,7 +38,7 @@ def get_value(d, k1, k2): def chunks_format(reference): - if not reference or (reference is not dict): + if not reference or not isinstance(reference, dict): return [] return [ { @@ -485,20 +485,26 @@ async def gen_meta_filter(chat_mdl, meta_data: dict, query: str) -> dict: return {"conditions": []} -async def gen_json(system_prompt: str, user_prompt: str, chat_mdl, gen_conf=None): +async def gen_json(system_prompt: str, user_prompt: str, chat_mdl, gen_conf={}, max_retry=2): from graphrag.utils import get_llm_cache, set_llm_cache cached = get_llm_cache(chat_mdl.llm_name, system_prompt, user_prompt, gen_conf) if cached: return json_repair.loads(cached) _, msg = message_fit_in(form_message(system_prompt, user_prompt), chat_mdl.max_length) - ans = await chat_mdl.async_chat(msg[0]["content"], msg[1:], gen_conf=gen_conf) - ans = re.sub(r"(^.*
    |```json\n|```\n*$)", "", ans, flags=re.DOTALL) - try: - res = json_repair.loads(ans) - set_llm_cache(chat_mdl.llm_name, system_prompt, ans, user_prompt, gen_conf) - return res - except Exception: - logging.exception(f"Loading json failure: {ans}") + err = "" + ans = "" + for _ in range(max_retry): + if ans and err: + msg[-1]["content"] += f"\nGenerated JSON is as following:\n{ans}\nBut exception while loading:\n{err}\nPlease reconsider and correct it." + ans = await chat_mdl.async_chat(msg[0]["content"], msg[1:], gen_conf=gen_conf) + ans = re.sub(r"(^.*
    |```json\n|```\n*$)", "", ans, flags=re.DOTALL) + try: + res = json_repair.loads(ans) + set_llm_cache(chat_mdl.llm_name, system_prompt, ans, user_prompt, gen_conf) + return res + except Exception as e: + logging.exception(f"Loading json failure: {ans}") + err += str(e) TOC_DETECTION = load_prompt("toc_detection") @@ -847,8 +853,6 @@ async def run_toc_from_text(chunks, chat_mdl, callback=None): TOC_RELEVANCE_SYSTEM = load_prompt("toc_relevance_system") TOC_RELEVANCE_USER = load_prompt("toc_relevance_user") - - async def relevant_chunks_with_toc(query: str, toc: list[dict], chat_mdl, topn: int = 6): import numpy as np try: @@ -876,8 +880,6 @@ async def relevant_chunks_with_toc(query: str, toc: list[dict], chat_mdl, topn: META_DATA = load_prompt("meta_data") - - async def gen_metadata(chat_mdl, schema: dict, content: str): template = PROMPT_JINJA_ENV.from_string(META_DATA) for k, desc in schema["properties"].items(): @@ -890,3 +892,34 @@ async def gen_metadata(chat_mdl, schema: dict, content: str): _, msg = message_fit_in(form_message(system_prompt, user_prompt), chat_mdl.max_length) ans = await chat_mdl.async_chat(msg[0]["content"], msg[1:]) return re.sub(r"^.*", "", ans, flags=re.DOTALL) + + +SUFFICIENCY_CHECK = load_prompt("sufficiency_check") +async def sufficiency_check(chat_mdl, question: str, ret_content: str): + try: + return await gen_json( + PROMPT_JINJA_ENV.from_string(SUFFICIENCY_CHECK).render(question=question, retrieved_docs=ret_content), + "Output:\n", + chat_mdl + ) + except Exception as e: + logging.exception(e) + return {} + + +MULTI_QUERIES_GEN = load_prompt("multi_queries_gen") +async def multi_queries_gen(chat_mdl, question: str, query:str, missing_infos:list[str], ret_content: str): + try: + return await gen_json( + PROMPT_JINJA_ENV.from_string(MULTI_QUERIES_GEN).render( + original_question=question, + original_query=query, + missing_info="\n - ".join(missing_infos), + retrieved_docs=ret_content + ), + "Output:\n", + chat_mdl + ) + except Exception as e: + logging.exception(e) + return {} \ No newline at end of file diff --git a/rag/prompts/multi_queries_gen.md b/rag/prompts/multi_queries_gen.md new file mode 100644 index 00000000000..7d1b2993e63 --- /dev/null +++ b/rag/prompts/multi_queries_gen.md @@ -0,0 +1,41 @@ +You are a query optimization expert. +The user's original query failed to retrieve sufficient information; +please generate multiple complementary improved questions and corresponding queries. + +Original query: +{{ original_query }} + +Original question: +{{ original_question }} + +Currently, retrieved content: +{{ retrieved_docs }} + +Missing information: +{{ missing_info }} + +Please generate 2-3 complementary queries to help find the missing information. These queries should: +1. Focus on different missing information points. +2. Use different expressions. +3. Avoid being identical to the original query. +4. Remain concise and clear. + +Output format (JSON): +```json +{ + "reasoning": "Explanation of query generation strategy", + "questions": [ + {"question": "Improved question 1", "query": "Improved query 1"}, + {"question": "Improved question 2", "query": "Improved query 2"}, + {"question": "Improved question 3", "query": "Improved query 3"} + ] +} +``` + +Requirements: +1. Questions array contains 1-3 questions and corresponding queries. +2. Each question length is between 5-200 characters. +3. Each query length is between 1-5 keywords. +4. Each query MUST be in the same language as the retrieved content in. +5. DO NOT generate question and query that is similar to the original query. +6. Reasoning explains the generation strategy. \ No newline at end of file diff --git a/rag/prompts/sufficiency_check.md b/rag/prompts/sufficiency_check.md new file mode 100644 index 00000000000..705b9146590 --- /dev/null +++ b/rag/prompts/sufficiency_check.md @@ -0,0 +1,24 @@ +You are a information retrieval evaluation expert. Please assess whether the currently retrieved content is sufficient to answer the user's question. + +User question: +{{ question }} + +Retrieved content: +{{ retrieved_docs }} + +Please determine whether these content are sufficient to answer the user's question. + +Output format (JSON): +```json +{ + "is_sufficient": true/false, + "reasoning": "Your reasoning for the judgment", + "missing_information": ["Missing information 1", "Missing information 2"] +} +``` + +Requirements: +1. If the retrieved content contains key information needed to answer the query, judge as sufficient (true). +2. If key information is missing, judge as insufficient (false), and list the missing information. +3. The `reasoning` should be concise and clear. +4. The `missing_information` should only be filled when insufficient, otherwise empty array. \ No newline at end of file diff --git a/uv.lock b/uv.lock index 82ff34cec7d..1e88de68236 100644 --- a/uv.lock +++ b/uv.lock @@ -33,7 +33,7 @@ wheels = [ [[package]] name = "aiohttp" -version = "3.13.2" +version = "3.13.3" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "aiohappyeyeballs" }, @@ -44,76 +44,76 @@ dependencies = [ { name = "propcache" }, { name = "yarl" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1c/ce/3b83ebba6b3207a7135e5fcaba49706f8a4b6008153b4e30540c982fae26/aiohttp-3.13.2.tar.gz", hash = "sha256:40176a52c186aefef6eb3cad2cdd30cd06e3afbe88fe8ab2af9c0b90f228daca", size = 7837994, upload-time = "2025-10-28T20:59:39.937Z" } -wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/29/9b/01f00e9856d0a73260e86dd8ed0c2234a466c5c1712ce1c281548df39777/aiohttp-3.13.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:b1e56bab2e12b2b9ed300218c351ee2a3d8c8fdab5b1ec6193e11a817767e47b", size = 737623, upload-time = "2025-10-28T20:56:30.797Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5a/1b/4be39c445e2b2bd0aab4ba736deb649fabf14f6757f405f0c9685019b9e9/aiohttp-3.13.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:364e25edaabd3d37b1db1f0cbcee8c73c9a3727bfa262b83e5e4cf3489a2a9dc", size = 492664, upload-time = "2025-10-28T20:56:32.708Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/28/66/d35dcfea8050e131cdd731dff36434390479b4045a8d0b9d7111b0a968f1/aiohttp-3.13.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:c5c94825f744694c4b8db20b71dba9a257cd2ba8e010a803042123f3a25d50d7", size = 491808, upload-time = "2025-10-28T20:56:34.57Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/00/29/8e4609b93e10a853b65f8291e64985de66d4f5848c5637cddc70e98f01f8/aiohttp-3.13.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ba2715d842ffa787be87cbfce150d5e88c87a98e0b62e0f5aa489169a393dbbb", size = 1738863, upload-time = "2025-10-28T20:56:36.377Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9d/fa/4ebdf4adcc0def75ced1a0d2d227577cd7b1b85beb7edad85fcc87693c75/aiohttp-3.13.2-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:585542825c4bc662221fb257889e011a5aa00f1ae4d75d1d246a5225289183e3", size = 1700586, upload-time = "2025-10-28T20:56:38.034Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/da/04/73f5f02ff348a3558763ff6abe99c223381b0bace05cd4530a0258e52597/aiohttp-3.13.2-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:39d02cb6025fe1aabca329c5632f48c9532a3dabccd859e7e2f110668972331f", size = 1768625, upload-time = "2025-10-28T20:56:39.75Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f8/49/a825b79ffec124317265ca7d2344a86bcffeb960743487cb11988ffb3494/aiohttp-3.13.2-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:e67446b19e014d37342f7195f592a2a948141d15a312fe0e700c2fd2f03124f6", size = 1867281, upload-time = "2025-10-28T20:56:41.471Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b9/48/adf56e05f81eac31edcfae45c90928f4ad50ef2e3ea72cb8376162a368f8/aiohttp-3.13.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4356474ad6333e41ccefd39eae869ba15a6c5299c9c01dfdcfdd5c107be4363e", size = 1752431, upload-time = "2025-10-28T20:56:43.162Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/30/ab/593855356eead019a74e862f21523db09c27f12fd24af72dbc3555b9bfd9/aiohttp-3.13.2-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:eeacf451c99b4525f700f078becff32c32ec327b10dcf31306a8a52d78166de7", size = 1562846, upload-time = "2025-10-28T20:56:44.85Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/39/0f/9f3d32271aa8dc35036e9668e31870a9d3b9542dd6b3e2c8a30931cb27ae/aiohttp-3.13.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:d8a9b889aeabd7a4e9af0b7f4ab5ad94d42e7ff679aaec6d0db21e3b639ad58d", size = 1699606, upload-time = "2025-10-28T20:56:46.519Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2c/3c/52d2658c5699b6ef7692a3f7128b2d2d4d9775f2a68093f74bca06cf01e1/aiohttp-3.13.2-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:fa89cb11bc71a63b69568d5b8a25c3ca25b6d54c15f907ca1c130d72f320b76b", size = 1720663, upload-time = "2025-10-28T20:56:48.528Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9b/d4/8f8f3ff1fb7fb9e3f04fcad4e89d8a1cd8fc7d05de67e3de5b15b33008ff/aiohttp-3.13.2-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:8aa7c807df234f693fed0ecd507192fc97692e61fee5702cdc11155d2e5cadc8", size = 1737939, upload-time = "2025-10-28T20:56:50.77Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/03/d3/ddd348f8a27a634daae39a1b8e291ff19c77867af438af844bf8b7e3231b/aiohttp-3.13.2-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:9eb3e33fdbe43f88c3c75fa608c25e7c47bbd80f48d012763cb67c47f39a7e16", size = 1555132, upload-time = "2025-10-28T20:56:52.568Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/39/b8/46790692dc46218406f94374903ba47552f2f9f90dad554eed61bfb7b64c/aiohttp-3.13.2-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:9434bc0d80076138ea986833156c5a48c9c7a8abb0c96039ddbb4afc93184169", size = 1764802, upload-time = "2025-10-28T20:56:54.292Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ba/e4/19ce547b58ab2a385e5f0b8aa3db38674785085abcf79b6e0edd1632b12f/aiohttp-3.13.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:ff15c147b2ad66da1f2cbb0622313f2242d8e6e8f9b79b5206c84523a4473248", size = 1719512, upload-time = "2025-10-28T20:56:56.428Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/70/30/6355a737fed29dcb6dfdd48682d5790cb5eab050f7b4e01f49b121d3acad/aiohttp-3.13.2-cp312-cp312-win32.whl", hash = "sha256:27e569eb9d9e95dbd55c0fc3ec3a9335defbf1d8bc1d20171a49f3c4c607b93e", size = 426690, upload-time = "2025-10-28T20:56:58.736Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0a/0d/b10ac09069973d112de6ef980c1f6bb31cb7dcd0bc363acbdad58f927873/aiohttp-3.13.2-cp312-cp312-win_amd64.whl", hash = "sha256:8709a0f05d59a71f33fd05c17fc11fcb8c30140506e13c2f5e8ee1b8964e1b45", size = 453465, upload-time = "2025-10-28T20:57:00.795Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bf/78/7e90ca79e5aa39f9694dcfd74f4720782d3c6828113bb1f3197f7e7c4a56/aiohttp-3.13.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:7519bdc7dfc1940d201651b52bf5e03f5503bda45ad6eacf64dda98be5b2b6be", size = 732139, upload-time = "2025-10-28T20:57:02.455Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/db/ed/1f59215ab6853fbaa5c8495fa6cbc39edfc93553426152b75d82a5f32b76/aiohttp-3.13.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:088912a78b4d4f547a1f19c099d5a506df17eacec3c6f4375e2831ec1d995742", size = 490082, upload-time = "2025-10-28T20:57:04.784Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/68/7b/fe0fe0f5e05e13629d893c760465173a15ad0039c0a5b0d0040995c8075e/aiohttp-3.13.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:5276807b9de9092af38ed23ce120539ab0ac955547b38563a9ba4f5b07b95293", size = 489035, upload-time = "2025-10-28T20:57:06.894Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d2/04/db5279e38471b7ac801d7d36a57d1230feeee130bbe2a74f72731b23c2b1/aiohttp-3.13.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1237c1375eaef0db4dcd7c2559f42e8af7b87ea7d295b118c60c36a6e61cb811", size = 1720387, upload-time = "2025-10-28T20:57:08.685Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/31/07/8ea4326bd7dae2bd59828f69d7fdc6e04523caa55e4a70f4a8725a7e4ed2/aiohttp-3.13.2-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:96581619c57419c3d7d78703d5b78c1e5e5fc0172d60f555bdebaced82ded19a", size = 1688314, upload-time = "2025-10-28T20:57:10.693Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/48/ab/3d98007b5b87ffd519d065225438cc3b668b2f245572a8cb53da5dd2b1bc/aiohttp-3.13.2-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:a2713a95b47374169409d18103366de1050fe0ea73db358fc7a7acb2880422d4", size = 1756317, upload-time = "2025-10-28T20:57:12.563Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/97/3d/801ca172b3d857fafb7b50c7c03f91b72b867a13abca982ed6b3081774ef/aiohttp-3.13.2-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:228a1cd556b3caca590e9511a89444925da87d35219a49ab5da0c36d2d943a6a", size = 1858539, upload-time = "2025-10-28T20:57:14.623Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f7/0d/4764669bdf47bd472899b3d3db91fffbe925c8e3038ec591a2fd2ad6a14d/aiohttp-3.13.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ac6cde5fba8d7d8c6ac963dbb0256a9854e9fafff52fbcc58fdf819357892c3e", size = 1739597, upload-time = "2025-10-28T20:57:16.399Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c4/52/7bd3c6693da58ba16e657eb904a5b6decfc48ecd06e9ac098591653b1566/aiohttp-3.13.2-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f2bef8237544f4e42878c61cef4e2839fee6346dc60f5739f876a9c50be7fcdb", size = 1555006, upload-time = "2025-10-28T20:57:18.288Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/48/30/9586667acec5993b6f41d2ebcf96e97a1255a85f62f3c653110a5de4d346/aiohttp-3.13.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:16f15a4eac3bc2d76c45f7ebdd48a65d41b242eb6c31c2245463b40b34584ded", size = 1683220, upload-time = "2025-10-28T20:57:20.241Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/71/01/3afe4c96854cfd7b30d78333852e8e851dceaec1c40fd00fec90c6402dd2/aiohttp-3.13.2-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:bb7fb776645af5cc58ab804c58d7eba545a97e047254a52ce89c157b5af6cd0b", size = 1712570, upload-time = "2025-10-28T20:57:22.253Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/11/2c/22799d8e720f4697a9e66fd9c02479e40a49de3de2f0bbe7f9f78a987808/aiohttp-3.13.2-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:e1b4951125ec10c70802f2cb09736c895861cd39fd9dcb35107b4dc8ae6220b8", size = 1733407, upload-time = "2025-10-28T20:57:24.37Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/34/cb/90f15dd029f07cebbd91f8238a8b363978b530cd128488085b5703683594/aiohttp-3.13.2-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:550bf765101ae721ee1d37d8095f47b1f220650f85fe1af37a90ce75bab89d04", size = 1550093, upload-time = "2025-10-28T20:57:26.257Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/69/46/12dce9be9d3303ecbf4d30ad45a7683dc63d90733c2d9fe512be6716cd40/aiohttp-3.13.2-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:fe91b87fc295973096251e2d25a811388e7d8adf3bd2b97ef6ae78bc4ac6c476", size = 1758084, upload-time = "2025-10-28T20:57:28.349Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f9/c8/0932b558da0c302ffd639fc6362a313b98fdf235dc417bc2493da8394df7/aiohttp-3.13.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:e0c8e31cfcc4592cb200160344b2fb6ae0f9e4effe06c644b5a125d4ae5ebe23", size = 1716987, upload-time = "2025-10-28T20:57:30.233Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5d/8b/f5bd1a75003daed099baec373aed678f2e9b34f2ad40d85baa1368556396/aiohttp-3.13.2-cp313-cp313-win32.whl", hash = "sha256:0740f31a60848d6edb296a0df827473eede90c689b8f9f2a4cdde74889eb2254", size = 425859, upload-time = "2025-10-28T20:57:32.105Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5d/28/a8a9fc6957b2cee8902414e41816b5ab5536ecf43c3b1843c10e82c559b2/aiohttp-3.13.2-cp313-cp313-win_amd64.whl", hash = "sha256:a88d13e7ca367394908f8a276b89d04a3652044612b9a408a0bb22a5ed976a1a", size = 452192, upload-time = "2025-10-28T20:57:34.166Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9b/36/e2abae1bd815f01c957cbf7be817b3043304e1c87bad526292a0410fdcf9/aiohttp-3.13.2-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:2475391c29230e063ef53a66669b7b691c9bfc3f1426a0f7bcdf1216bdbac38b", size = 735234, upload-time = "2025-10-28T20:57:36.415Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ca/e3/1ee62dde9b335e4ed41db6bba02613295a0d5b41f74a783c142745a12763/aiohttp-3.13.2-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:f33c8748abef4d8717bb20e8fb1b3e07c6adacb7fd6beaae971a764cf5f30d61", size = 490733, upload-time = "2025-10-28T20:57:38.205Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1a/aa/7a451b1d6a04e8d15a362af3e9b897de71d86feac3babf8894545d08d537/aiohttp-3.13.2-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:ae32f24bbfb7dbb485a24b30b1149e2f200be94777232aeadba3eecece4d0aa4", size = 491303, upload-time = "2025-10-28T20:57:40.122Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/57/1e/209958dbb9b01174870f6a7538cd1f3f28274fdbc88a750c238e2c456295/aiohttp-3.13.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5d7f02042c1f009ffb70067326ef183a047425bb2ff3bc434ead4dd4a4a66a2b", size = 1717965, upload-time = "2025-10-28T20:57:42.28Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/08/aa/6a01848d6432f241416bc4866cae8dc03f05a5a884d2311280f6a09c73d6/aiohttp-3.13.2-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:93655083005d71cd6c072cdab54c886e6570ad2c4592139c3fb967bfc19e4694", size = 1667221, upload-time = "2025-10-28T20:57:44.869Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/87/4f/36c1992432d31bbc789fa0b93c768d2e9047ec8c7177e5cd84ea85155f36/aiohttp-3.13.2-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:0db1e24b852f5f664cd728db140cf11ea0e82450471232a394b3d1a540b0f906", size = 1757178, upload-time = "2025-10-28T20:57:47.216Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ac/b4/8e940dfb03b7e0f68a82b88fd182b9be0a65cb3f35612fe38c038c3112cf/aiohttp-3.13.2-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:b009194665bcd128e23eaddef362e745601afa4641930848af4c8559e88f18f9", size = 1838001, upload-time = "2025-10-28T20:57:49.337Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d7/ef/39f3448795499c440ab66084a9db7d20ca7662e94305f175a80f5b7e0072/aiohttp-3.13.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c038a8fdc8103cd51dbd986ecdce141473ffd9775a7a8057a6ed9c3653478011", size = 1716325, upload-time = "2025-10-28T20:57:51.327Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d7/51/b311500ffc860b181c05d91c59a1313bdd05c82960fdd4035a15740d431e/aiohttp-3.13.2-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:66bac29b95a00db411cd758fea0e4b9bdba6d549dfe333f9a945430f5f2cc5a6", size = 1547978, upload-time = "2025-10-28T20:57:53.554Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/31/64/b9d733296ef79815226dab8c586ff9e3df41c6aff2e16c06697b2d2e6775/aiohttp-3.13.2-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:4ebf9cfc9ba24a74cf0718f04aac2a3bbe745902cc7c5ebc55c0f3b5777ef213", size = 1682042, upload-time = "2025-10-28T20:57:55.617Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3f/30/43d3e0f9d6473a6db7d472104c4eff4417b1e9df01774cb930338806d36b/aiohttp-3.13.2-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:a4b88ebe35ce54205c7074f7302bd08a4cb83256a3e0870c72d6f68a3aaf8e49", size = 1680085, upload-time = "2025-10-28T20:57:57.59Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/16/51/c709f352c911b1864cfd1087577760ced64b3e5bee2aa88b8c0c8e2e4972/aiohttp-3.13.2-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:98c4fb90bb82b70a4ed79ca35f656f4281885be076f3f970ce315402b53099ae", size = 1728238, upload-time = "2025-10-28T20:57:59.525Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/19/e2/19bd4c547092b773caeb48ff5ae4b1ae86756a0ee76c16727fcfd281404b/aiohttp-3.13.2-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:ec7534e63ae0f3759df3a1ed4fa6bc8f75082a924b590619c0dd2f76d7043caa", size = 1544395, upload-time = "2025-10-28T20:58:01.914Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cf/87/860f2803b27dfc5ed7be532832a3498e4919da61299b4a1f8eb89b8ff44d/aiohttp-3.13.2-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:5b927cf9b935a13e33644cbed6c8c4b2d0f25b713d838743f8fe7191b33829c4", size = 1742965, upload-time = "2025-10-28T20:58:03.972Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/67/7f/db2fc7618925e8c7a601094d5cbe539f732df4fb570740be88ed9e40e99a/aiohttp-3.13.2-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:88d6c017966a78c5265d996c19cdb79235be5e6412268d7e2ce7dee339471b7a", size = 1697585, upload-time = "2025-10-28T20:58:06.189Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0c/07/9127916cb09bb38284db5036036042b7b2c514c8ebaeee79da550c43a6d6/aiohttp-3.13.2-cp314-cp314-win32.whl", hash = "sha256:f7c183e786e299b5d6c49fb43a769f8eb8e04a2726a2bd5887b98b5cc2d67940", size = 431621, upload-time = "2025-10-28T20:58:08.636Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fb/41/554a8a380df6d3a2bba8a7726429a23f4ac62aaf38de43bb6d6cde7b4d4d/aiohttp-3.13.2-cp314-cp314-win_amd64.whl", hash = "sha256:fe242cd381e0fb65758faf5ad96c2e460df6ee5b2de1072fe97e4127927e00b4", size = 457627, upload-time = "2025-10-28T20:58:11Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c7/8e/3824ef98c039d3951cb65b9205a96dd2b20f22241ee17d89c5701557c826/aiohttp-3.13.2-cp314-cp314t-macosx_10_13_universal2.whl", hash = "sha256:f10d9c0b0188fe85398c61147bbd2a657d616c876863bfeff43376e0e3134673", size = 767360, upload-time = "2025-10-28T20:58:13.358Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a4/0f/6a03e3fc7595421274fa34122c973bde2d89344f8a881b728fa8c774e4f1/aiohttp-3.13.2-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:e7c952aefdf2460f4ae55c5e9c3e80aa72f706a6317e06020f80e96253b1accd", size = 504616, upload-time = "2025-10-28T20:58:15.339Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c6/aa/ed341b670f1bc8a6f2c6a718353d13b9546e2cef3544f573c6a1ff0da711/aiohttp-3.13.2-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:c20423ce14771d98353d2e25e83591fa75dfa90a3c1848f3d7c68243b4fbded3", size = 509131, upload-time = "2025-10-28T20:58:17.693Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7f/f0/c68dac234189dae5c4bbccc0f96ce0cc16b76632cfc3a08fff180045cfa4/aiohttp-3.13.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e96eb1a34396e9430c19d8338d2ec33015e4a87ef2b4449db94c22412e25ccdf", size = 1864168, upload-time = "2025-10-28T20:58:20.113Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8f/65/75a9a76db8364b5d0e52a0c20eabc5d52297385d9af9c35335b924fafdee/aiohttp-3.13.2-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:23fb0783bc1a33640036465019d3bba069942616a6a2353c6907d7fe1ccdaf4e", size = 1719200, upload-time = "2025-10-28T20:58:22.583Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f5/55/8df2ed78d7f41d232f6bd3ff866b6f617026551aa1d07e2f03458f964575/aiohttp-3.13.2-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:2e1a9bea6244a1d05a4e57c295d69e159a5c50d8ef16aa390948ee873478d9a5", size = 1843497, upload-time = "2025-10-28T20:58:24.672Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e9/e0/94d7215e405c5a02ccb6a35c7a3a6cfff242f457a00196496935f700cde5/aiohttp-3.13.2-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:0a3d54e822688b56e9f6b5816fb3de3a3a64660efac64e4c2dc435230ad23bad", size = 1935703, upload-time = "2025-10-28T20:58:26.758Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0b/78/1eeb63c3f9b2d1015a4c02788fb543141aad0a03ae3f7a7b669b2483f8d4/aiohttp-3.13.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7a653d872afe9f33497215745da7a943d1dc15b728a9c8da1c3ac423af35178e", size = 1792738, upload-time = "2025-10-28T20:58:29.787Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/41/75/aaf1eea4c188e51538c04cc568040e3082db263a57086ea74a7d38c39e42/aiohttp-3.13.2-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:56d36e80d2003fa3fc0207fac644216d8532e9504a785ef9a8fd013f84a42c61", size = 1624061, upload-time = "2025-10-28T20:58:32.529Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9b/c2/3b6034de81fbcc43de8aeb209073a2286dfb50b86e927b4efd81cf848197/aiohttp-3.13.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:78cd586d8331fb8e241c2dd6b2f4061778cc69e150514b39a9e28dd050475661", size = 1789201, upload-time = "2025-10-28T20:58:34.618Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c9/38/c15dcf6d4d890217dae79d7213988f4e5fe6183d43893a9cf2fe9e84ca8d/aiohttp-3.13.2-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:20b10bbfbff766294fe99987f7bb3b74fdd2f1a2905f2562132641ad434dcf98", size = 1776868, upload-time = "2025-10-28T20:58:38.835Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/04/75/f74fd178ac81adf4f283a74847807ade5150e48feda6aef024403716c30c/aiohttp-3.13.2-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:9ec49dff7e2b3c85cdeaa412e9d438f0ecd71676fde61ec57027dd392f00c693", size = 1790660, upload-time = "2025-10-28T20:58:41.507Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e7/80/7368bd0d06b16b3aba358c16b919e9c46cf11587dc572091031b0e9e3ef0/aiohttp-3.13.2-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:94f05348c4406450f9d73d38efb41d669ad6cd90c7ee194810d0eefbfa875a7a", size = 1617548, upload-time = "2025-10-28T20:58:43.674Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7d/4b/a6212790c50483cb3212e507378fbe26b5086d73941e1ec4b56a30439688/aiohttp-3.13.2-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:fa4dcb605c6f82a80c7f95713c2b11c3b8e9893b3ebd2bc9bde93165ed6107be", size = 1817240, upload-time = "2025-10-28T20:58:45.787Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ff/f7/ba5f0ba4ea8d8f3c32850912944532b933acbf0f3a75546b89269b9b7dde/aiohttp-3.13.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:cf00e5db968c3f67eccd2778574cf64d8b27d95b237770aa32400bd7a1ca4f6c", size = 1762334, upload-time = "2025-10-28T20:58:47.936Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7e/83/1a5a1856574588b1cad63609ea9ad75b32a8353ac995d830bf5da9357364/aiohttp-3.13.2-cp314-cp314t-win32.whl", hash = "sha256:d23b5fe492b0805a50d3371e8a728a9134d8de5447dce4c885f5587294750734", size = 464685, upload-time = "2025-10-28T20:58:50.642Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9f/4d/d22668674122c08f4d56972297c51a624e64b3ed1efaa40187607a7cb66e/aiohttp-3.13.2-cp314-cp314t-win_amd64.whl", hash = "sha256:ff0a7b0a82a7ab905cbda74006318d1b12e37c797eb1b0d4eb3e316cf47f658f", size = 498093, upload-time = "2025-10-28T20:58:52.782Z" }, +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/50/42/32cf8e7704ceb4481406eb87161349abb46a57fee3f008ba9cb610968646/aiohttp-3.13.3.tar.gz", hash = "sha256:a949eee43d3782f2daae4f4a2819b2cb9b0c5d3b7f7a927067cc84dafdbb9f88", size = 7844556, upload-time = "2026-01-03T17:33:05.204Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a0/be/4fc11f202955a69e0db803a12a062b8379c970c7c84f4882b6da17337cc1/aiohttp-3.13.3-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:b903a4dfee7d347e2d87697d0713be59e0b87925be030c9178c5faa58ea58d5c", size = 739732, upload-time = "2026-01-03T17:30:14.23Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/97/2c/621d5b851f94fa0bb7430d6089b3aa970a9d9b75196bc93bb624b0db237a/aiohttp-3.13.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:a45530014d7a1e09f4a55f4f43097ba0fd155089372e105e4bff4ca76cb1b168", size = 494293, upload-time = "2026-01-03T17:30:15.96Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5d/43/4be01406b78e1be8320bb8316dc9c42dbab553d281c40364e0f862d5661c/aiohttp-3.13.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:27234ef6d85c914f9efeb77ff616dbf4ad2380be0cda40b4db086ffc7ddd1b7d", size = 493533, upload-time = "2026-01-03T17:30:17.431Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8d/a8/5a35dc56a06a2c90d4742cbf35294396907027f80eea696637945a106f25/aiohttp-3.13.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d32764c6c9aafb7fb55366a224756387cd50bfa720f32b88e0e6fa45b27dcf29", size = 1737839, upload-time = "2026-01-03T17:30:19.422Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bf/62/4b9eeb331da56530bf2e198a297e5303e1c1ebdceeb00fe9b568a65c5a0c/aiohttp-3.13.3-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:b1a6102b4d3ebc07dad44fbf07b45bb600300f15b552ddf1851b5390202ea2e3", size = 1703932, upload-time = "2026-01-03T17:30:21.756Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7c/f6/af16887b5d419e6a367095994c0b1332d154f647e7dc2bd50e61876e8e3d/aiohttp-3.13.3-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c014c7ea7fb775dd015b2d3137378b7be0249a448a1612268b5a90c2d81de04d", size = 1771906, upload-time = "2026-01-03T17:30:23.932Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ce/83/397c634b1bcc24292fa1e0c7822800f9f6569e32934bdeef09dae7992dfb/aiohttp-3.13.3-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:2b8d8ddba8f95ba17582226f80e2de99c7a7948e66490ef8d947e272a93e9463", size = 1871020, upload-time = "2026-01-03T17:30:26Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/86/f6/a62cbbf13f0ac80a70f71b1672feba90fdb21fd7abd8dbf25c0105fb6fa3/aiohttp-3.13.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9ae8dd55c8e6c4257eae3a20fd2c8f41edaea5992ed67156642493b8daf3cecc", size = 1755181, upload-time = "2026-01-03T17:30:27.554Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0a/87/20a35ad487efdd3fba93d5843efdfaa62d2f1479eaafa7453398a44faf13/aiohttp-3.13.3-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:01ad2529d4b5035578f5081606a465f3b814c542882804e2e8cda61adf5c71bf", size = 1561794, upload-time = "2026-01-03T17:30:29.254Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/de/95/8fd69a66682012f6716e1bc09ef8a1a2a91922c5725cb904689f112309c4/aiohttp-3.13.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:bb4f7475e359992b580559e008c598091c45b5088f28614e855e42d39c2f1033", size = 1697900, upload-time = "2026-01-03T17:30:31.033Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e5/66/7b94b3b5ba70e955ff597672dad1691333080e37f50280178967aff68657/aiohttp-3.13.3-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:c19b90316ad3b24c69cd78d5c9b4f3aa4497643685901185b65166293d36a00f", size = 1728239, upload-time = "2026-01-03T17:30:32.703Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/47/71/6f72f77f9f7d74719692ab65a2a0252584bf8d5f301e2ecb4c0da734530a/aiohttp-3.13.3-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:96d604498a7c782cb15a51c406acaea70d8c027ee6b90c569baa6e7b93073679", size = 1740527, upload-time = "2026-01-03T17:30:34.695Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fa/b4/75ec16cbbd5c01bdaf4a05b19e103e78d7ce1ef7c80867eb0ace42ff4488/aiohttp-3.13.3-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:084911a532763e9d3dd95adf78a78f4096cd5f58cdc18e6fdbc1b58417a45423", size = 1554489, upload-time = "2026-01-03T17:30:36.864Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/52/8f/bc518c0eea29f8406dcf7ed1f96c9b48e3bc3995a96159b3fc11f9e08321/aiohttp-3.13.3-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:7a4a94eb787e606d0a09404b9c38c113d3b099d508021faa615d70a0131907ce", size = 1767852, upload-time = "2026-01-03T17:30:39.433Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9d/f2/a07a75173124f31f11ea6f863dc44e6f09afe2bca45dd4e64979490deab1/aiohttp-3.13.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:87797e645d9d8e222e04160ee32aa06bc5c163e8499f24db719e7852ec23093a", size = 1722379, upload-time = "2026-01-03T17:30:41.081Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3c/4a/1a3fee7c21350cac78e5c5cef711bac1b94feca07399f3d406972e2d8fcd/aiohttp-3.13.3-cp312-cp312-win32.whl", hash = "sha256:b04be762396457bef43f3597c991e192ee7da460a4953d7e647ee4b1c28e7046", size = 428253, upload-time = "2026-01-03T17:30:42.644Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d9/b7/76175c7cb4eb73d91ad63c34e29fc4f77c9386bba4a65b53ba8e05ee3c39/aiohttp-3.13.3-cp312-cp312-win_amd64.whl", hash = "sha256:e3531d63d3bdfa7e3ac5e9b27b2dd7ec9df3206a98e0b3445fa906f233264c57", size = 455407, upload-time = "2026-01-03T17:30:44.195Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/97/8a/12ca489246ca1faaf5432844adbfce7ff2cc4997733e0af120869345643a/aiohttp-3.13.3-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:5dff64413671b0d3e7d5918ea490bdccb97a4ad29b3f311ed423200b2203e01c", size = 734190, upload-time = "2026-01-03T17:30:45.832Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/32/08/de43984c74ed1fca5c014808963cc83cb00d7bb06af228f132d33862ca76/aiohttp-3.13.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:87b9aab6d6ed88235aa2970294f496ff1a1f9adcd724d800e9b952395a80ffd9", size = 491783, upload-time = "2026-01-03T17:30:47.466Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/17/f8/8dd2cf6112a5a76f81f81a5130c57ca829d101ad583ce57f889179accdda/aiohttp-3.13.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:425c126c0dc43861e22cb1c14ba4c8e45d09516d0a3ae0a3f7494b79f5f233a3", size = 490704, upload-time = "2026-01-03T17:30:49.373Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6d/40/a46b03ca03936f832bc7eaa47cfbb1ad012ba1be4790122ee4f4f8cba074/aiohttp-3.13.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7f9120f7093c2a32d9647abcaf21e6ad275b4fbec5b55969f978b1a97c7c86bf", size = 1720652, upload-time = "2026-01-03T17:30:50.974Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f7/7e/917fe18e3607af92657e4285498f500dca797ff8c918bd7d90b05abf6c2a/aiohttp-3.13.3-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:697753042d57f4bf7122cab985bf15d0cef23c770864580f5af4f52023a56bd6", size = 1692014, upload-time = "2026-01-03T17:30:52.729Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/71/b6/cefa4cbc00d315d68973b671cf105b21a609c12b82d52e5d0c9ae61d2a09/aiohttp-3.13.3-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:6de499a1a44e7de70735d0b39f67c8f25eb3d91eb3103be99ca0fa882cdd987d", size = 1759777, upload-time = "2026-01-03T17:30:54.537Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fb/e3/e06ee07b45e59e6d81498b591fc589629be1553abb2a82ce33efe2a7b068/aiohttp-3.13.3-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:37239e9f9a7ea9ac5bf6b92b0260b01f8a22281996da609206a84df860bc1261", size = 1861276, upload-time = "2026-01-03T17:30:56.512Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7c/24/75d274228acf35ceeb2850b8ce04de9dd7355ff7a0b49d607ee60c29c518/aiohttp-3.13.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f76c1e3fe7d7c8afad7ed193f89a292e1999608170dcc9751a7462a87dfd5bc0", size = 1743131, upload-time = "2026-01-03T17:30:58.256Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/04/98/3d21dde21889b17ca2eea54fdcff21b27b93f45b7bb94ca029c31ab59dc3/aiohttp-3.13.3-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:fc290605db2a917f6e81b0e1e0796469871f5af381ce15c604a3c5c7e51cb730", size = 1556863, upload-time = "2026-01-03T17:31:00.445Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9e/84/da0c3ab1192eaf64782b03971ab4055b475d0db07b17eff925e8c93b3aa5/aiohttp-3.13.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:4021b51936308aeea0367b8f006dc999ca02bc118a0cc78c303f50a2ff6afb91", size = 1682793, upload-time = "2026-01-03T17:31:03.024Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ff/0f/5802ada182f575afa02cbd0ec5180d7e13a402afb7c2c03a9aa5e5d49060/aiohttp-3.13.3-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:49a03727c1bba9a97d3e93c9f93ca03a57300f484b6e935463099841261195d3", size = 1716676, upload-time = "2026-01-03T17:31:04.842Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3f/8c/714d53bd8b5a4560667f7bbbb06b20c2382f9c7847d198370ec6526af39c/aiohttp-3.13.3-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:3d9908a48eb7416dc1f4524e69f1d32e5d90e3981e4e37eb0aa1cd18f9cfa2a4", size = 1733217, upload-time = "2026-01-03T17:31:06.868Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7d/79/e2176f46d2e963facea939f5be2d26368ce543622be6f00a12844d3c991f/aiohttp-3.13.3-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:2712039939ec963c237286113c68dbad80a82a4281543f3abf766d9d73228998", size = 1552303, upload-time = "2026-01-03T17:31:08.958Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ab/6a/28ed4dea1759916090587d1fe57087b03e6c784a642b85ef48217b0277ae/aiohttp-3.13.3-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:7bfdc049127717581866fa4708791220970ce291c23e28ccf3922c700740fdc0", size = 1763673, upload-time = "2026-01-03T17:31:10.676Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e8/35/4a3daeb8b9fab49240d21c04d50732313295e4bd813a465d840236dd0ce1/aiohttp-3.13.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:8057c98e0c8472d8846b9c79f56766bcc57e3e8ac7bfd510482332366c56c591", size = 1721120, upload-time = "2026-01-03T17:31:12.575Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bc/9f/d643bb3c5fb99547323e635e251c609fbbc660d983144cfebec529e09264/aiohttp-3.13.3-cp313-cp313-win32.whl", hash = "sha256:1449ceddcdbcf2e0446957863af03ebaaa03f94c090f945411b61269e2cb5daf", size = 427383, upload-time = "2026-01-03T17:31:14.382Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4e/f1/ab0395f8a79933577cdd996dd2f9aa6014af9535f65dddcf88204682fe62/aiohttp-3.13.3-cp313-cp313-win_amd64.whl", hash = "sha256:693781c45a4033d31d4187d2436f5ac701e7bbfe5df40d917736108c1cc7436e", size = 453899, upload-time = "2026-01-03T17:31:15.958Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/99/36/5b6514a9f5d66f4e2597e40dea2e3db271e023eb7a5d22defe96ba560996/aiohttp-3.13.3-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:ea37047c6b367fd4bd632bff8077449b8fa034b69e812a18e0132a00fae6e808", size = 737238, upload-time = "2026-01-03T17:31:17.909Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f7/49/459327f0d5bcd8c6c9ca69e60fdeebc3622861e696490d8674a6d0cb90a6/aiohttp-3.13.3-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:6fc0e2337d1a4c3e6acafda6a78a39d4c14caea625124817420abceed36e2415", size = 492292, upload-time = "2026-01-03T17:31:19.919Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e8/0b/b97660c5fd05d3495b4eb27f2d0ef18dc1dc4eff7511a9bf371397ff0264/aiohttp-3.13.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:c685f2d80bb67ca8c3837823ad76196b3694b0159d232206d1e461d3d434666f", size = 493021, upload-time = "2026-01-03T17:31:21.636Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/54/d4/438efabdf74e30aeceb890c3290bbaa449780583b1270b00661126b8aae4/aiohttp-3.13.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:48e377758516d262bde50c2584fc6c578af272559c409eecbdd2bae1601184d6", size = 1717263, upload-time = "2026-01-03T17:31:23.296Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/71/f2/7bddc7fd612367d1459c5bcf598a9e8f7092d6580d98de0e057eb42697ad/aiohttp-3.13.3-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:34749271508078b261c4abb1767d42b8d0c0cc9449c73a4df494777dc55f0687", size = 1669107, upload-time = "2026-01-03T17:31:25.334Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/00/5a/1aeaecca40e22560f97610a329e0e5efef5e0b5afdf9f857f0d93839ab2e/aiohttp-3.13.3-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:82611aeec80eb144416956ec85b6ca45a64d76429c1ed46ae1b5f86c6e0c9a26", size = 1760196, upload-time = "2026-01-03T17:31:27.394Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f8/f8/0ff6992bea7bd560fc510ea1c815f87eedd745fe035589c71ce05612a19a/aiohttp-3.13.3-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:2fff83cfc93f18f215896e3a190e8e5cb413ce01553901aca925176e7568963a", size = 1843591, upload-time = "2026-01-03T17:31:29.238Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e3/d1/e30e537a15f53485b61f5be525f2157da719819e8377298502aebac45536/aiohttp-3.13.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bbe7d4cecacb439e2e2a8a1a7b935c25b812af7a5fd26503a66dadf428e79ec1", size = 1720277, upload-time = "2026-01-03T17:31:31.053Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/84/45/23f4c451d8192f553d38d838831ebbc156907ea6e05557f39563101b7717/aiohttp-3.13.3-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:b928f30fe49574253644b1ca44b1b8adbd903aa0da4b9054a6c20fc7f4092a25", size = 1548575, upload-time = "2026-01-03T17:31:32.87Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6a/ed/0a42b127a43712eda7807e7892c083eadfaf8429ca8fb619662a530a3aab/aiohttp-3.13.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:7b5e8fe4de30df199155baaf64f2fcd604f4c678ed20910db8e2c66dc4b11603", size = 1679455, upload-time = "2026-01-03T17:31:34.76Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2e/b5/c05f0c2b4b4fe2c9d55e73b6d3ed4fd6c9dc2684b1d81cbdf77e7fad9adb/aiohttp-3.13.3-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:8542f41a62bcc58fc7f11cf7c90e0ec324ce44950003feb70640fc2a9092c32a", size = 1687417, upload-time = "2026-01-03T17:31:36.699Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c9/6b/915bc5dad66aef602b9e459b5a973529304d4e89ca86999d9d75d80cbd0b/aiohttp-3.13.3-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:5e1d8c8b8f1d91cd08d8f4a3c2b067bfca6ec043d3ff36de0f3a715feeedf926", size = 1729968, upload-time = "2026-01-03T17:31:38.622Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/11/3b/e84581290a9520024a08640b63d07673057aec5ca548177a82026187ba73/aiohttp-3.13.3-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:90455115e5da1c3c51ab619ac57f877da8fd6d73c05aacd125c5ae9819582aba", size = 1545690, upload-time = "2026-01-03T17:31:40.57Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f5/04/0c3655a566c43fd647c81b895dfe361b9f9ad6d58c19309d45cff52d6c3b/aiohttp-3.13.3-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:042e9e0bcb5fba81886c8b4fbb9a09d6b8a00245fd8d88e4d989c1f96c74164c", size = 1746390, upload-time = "2026-01-03T17:31:42.857Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1f/53/71165b26978f719c3419381514c9690bd5980e764a09440a10bb816ea4ab/aiohttp-3.13.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:2eb752b102b12a76ca02dff751a801f028b4ffbbc478840b473597fc91a9ed43", size = 1702188, upload-time = "2026-01-03T17:31:44.984Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/29/a7/cbe6c9e8e136314fa1980da388a59d2f35f35395948a08b6747baebb6aa6/aiohttp-3.13.3-cp314-cp314-win32.whl", hash = "sha256:b556c85915d8efaed322bf1bdae9486aa0f3f764195a0fb6ee962e5c71ef5ce1", size = 433126, upload-time = "2026-01-03T17:31:47.463Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/de/56/982704adea7d3b16614fc5936014e9af85c0e34b58f9046655817f04306e/aiohttp-3.13.3-cp314-cp314-win_amd64.whl", hash = "sha256:9bf9f7a65e7aa20dd764151fb3d616c81088f91f8df39c3893a536e279b4b984", size = 459128, upload-time = "2026-01-03T17:31:49.2Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6c/2a/3c79b638a9c3d4658d345339d22070241ea341ed4e07b5ac60fb0f418003/aiohttp-3.13.3-cp314-cp314t-macosx_10_13_universal2.whl", hash = "sha256:05861afbbec40650d8a07ea324367cb93e9e8cc7762e04dd4405df99fa65159c", size = 769512, upload-time = "2026-01-03T17:31:51.134Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/29/b9/3e5014d46c0ab0db8707e0ac2711ed28c4da0218c358a4e7c17bae0d8722/aiohttp-3.13.3-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:2fc82186fadc4a8316768d61f3722c230e2c1dcab4200d52d2ebdf2482e47592", size = 506444, upload-time = "2026-01-03T17:31:52.85Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/90/03/c1d4ef9a054e151cd7839cdc497f2638f00b93cbe8043983986630d7a80c/aiohttp-3.13.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:0add0900ff220d1d5c5ebbf99ed88b0c1bbf87aa7e4262300ed1376a6b13414f", size = 510798, upload-time = "2026-01-03T17:31:54.91Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ea/76/8c1e5abbfe8e127c893fe7ead569148a4d5a799f7cf958d8c09f3eedf097/aiohttp-3.13.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:568f416a4072fbfae453dcf9a99194bbb8bdeab718e08ee13dfa2ba0e4bebf29", size = 1868835, upload-time = "2026-01-03T17:31:56.733Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8e/ac/984c5a6f74c363b01ff97adc96a3976d9c98940b8969a1881575b279ac5d/aiohttp-3.13.3-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:add1da70de90a2569c5e15249ff76a631ccacfe198375eead4aadf3b8dc849dc", size = 1720486, upload-time = "2026-01-03T17:31:58.65Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b2/9a/b7039c5f099c4eb632138728828b33428585031a1e658d693d41d07d89d1/aiohttp-3.13.3-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:10b47b7ba335d2e9b1239fa571131a87e2d8ec96b333e68b2a305e7a98b0bae2", size = 1847951, upload-time = "2026-01-03T17:32:00.989Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3c/02/3bec2b9a1ba3c19ff89a43a19324202b8eb187ca1e928d8bdac9bbdddebd/aiohttp-3.13.3-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:3dd4dce1c718e38081c8f35f323209d4c1df7d4db4bab1b5c88a6b4d12b74587", size = 1941001, upload-time = "2026-01-03T17:32:03.122Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/37/df/d879401cedeef27ac4717f6426c8c36c3091c6e9f08a9178cc87549c537f/aiohttp-3.13.3-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:34bac00a67a812570d4a460447e1e9e06fae622946955f939051e7cc895cfab8", size = 1797246, upload-time = "2026-01-03T17:32:05.255Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8d/15/be122de1f67e6953add23335c8ece6d314ab67c8bebb3f181063010795a7/aiohttp-3.13.3-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:a19884d2ee70b06d9204b2727a7b9f983d0c684c650254679e716b0b77920632", size = 1627131, upload-time = "2026-01-03T17:32:07.607Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/12/12/70eedcac9134cfa3219ab7af31ea56bc877395b1ac30d65b1bc4b27d0438/aiohttp-3.13.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:5f8ca7f2bb6ba8348a3614c7918cc4bb73268c5ac2a207576b7afea19d3d9f64", size = 1795196, upload-time = "2026-01-03T17:32:09.59Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/32/11/b30e1b1cd1f3054af86ebe60df96989c6a414dd87e27ad16950eee420bea/aiohttp-3.13.3-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:b0d95340658b9d2f11d9697f59b3814a9d3bb4b7a7c20b131df4bcef464037c0", size = 1782841, upload-time = "2026-01-03T17:32:11.445Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/88/0d/d98a9367b38912384a17e287850f5695c528cff0f14f791ce8ee2e4f7796/aiohttp-3.13.3-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:a1e53262fd202e4b40b70c3aff944a8155059beedc8a89bba9dc1f9ef06a1b56", size = 1795193, upload-time = "2026-01-03T17:32:13.705Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/43/a5/a2dfd1f5ff5581632c7f6a30e1744deda03808974f94f6534241ef60c751/aiohttp-3.13.3-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:d60ac9663f44168038586cab2157e122e46bdef09e9368b37f2d82d354c23f72", size = 1621979, upload-time = "2026-01-03T17:32:15.965Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fa/f0/12973c382ae7c1cccbc4417e129c5bf54c374dfb85af70893646e1f0e749/aiohttp-3.13.3-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:90751b8eed69435bac9ff4e3d2f6b3af1f57e37ecb0fbeee59c0174c9e2d41df", size = 1822193, upload-time = "2026-01-03T17:32:18.219Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3c/5f/24155e30ba7f8c96918af1350eb0663e2430aad9e001c0489d89cd708ab1/aiohttp-3.13.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:fc353029f176fd2b3ec6cfc71be166aba1936fe5d73dd1992ce289ca6647a9aa", size = 1769801, upload-time = "2026-01-03T17:32:20.25Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/eb/f8/7314031ff5c10e6ece114da79b338ec17eeff3a079e53151f7e9f43c4723/aiohttp-3.13.3-cp314-cp314t-win32.whl", hash = "sha256:2e41b18a58da1e474a057b3d35248d8320029f61d70a37629535b16a0c8f3767", size = 466523, upload-time = "2026-01-03T17:32:22.215Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b4/63/278a98c715ae467624eafe375542d8ba9b4383a016df8fdefe0ae28382a7/aiohttp-3.13.3-cp314-cp314t-win_amd64.whl", hash = "sha256:44531a36aa2264a1860089ffd4dce7baf875ee5a6079d5fb42e261c704ef7344", size = 499694, upload-time = "2026-01-03T17:32:24.546Z" }, ] [[package]] @@ -161,14 +161,11 @@ wheels = [ [[package]] name = "aiosqlite" -version = "0.21.0" +version = "0.22.1" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -dependencies = [ - { name = "typing-extensions" }, -] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/13/7d/8bca2bf9a247c2c5dfeec1d7a5f40db6518f88d314b8bca9da29670d2671/aiosqlite-0.21.0.tar.gz", hash = "sha256:131bb8056daa3bc875608c631c678cda73922a2d4ba8aec373b19f18c17e7aa3", size = 13454, upload-time = "2025-02-03T07:30:16.235Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4e/8a/64761f4005f17809769d23e518d915db74e6310474e733e3593cfc854ef1/aiosqlite-0.22.1.tar.gz", hash = "sha256:043e0bd78d32888c0a9ca90fc788b38796843360c855a7262a532813133a0650", size = 14821, upload-time = "2025-12-23T19:25:43.997Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f5/10/6c25ed6de94c49f88a91fa5018cb4c0f3625f31d5be9f771ebe5cc7cd506/aiosqlite-0.21.0-py3-none-any.whl", hash = "sha256:2549cf4057f95f53dcba16f2b64e8e2791d7e1adedb13197dd8ed77bb226d7d0", size = 15792, upload-time = "2025-02-03T07:30:13.6Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/00/b7/e3bf5133d697a08128598c8d0abc5e16377b51465a33756de24fa7dee953/aiosqlite-0.22.1-py3-none-any.whl", hash = "sha256:21c002eb13823fad740196c5a2e9d8e62f6243bd9e7e4a1f87fb5e44ecb4fceb", size = 17405, upload-time = "2025-12-23T19:25:42.139Z" }, ] [[package]] @@ -182,12 +179,13 @@ wheels = [ [[package]] name = "akshare" -version = "1.17.94" +version = "1.18.10" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "aiohttp" }, { name = "akracer", marker = "sys_platform == 'linux'" }, { name = "beautifulsoup4" }, + { name = "curl-cffi" }, { name = "decorator" }, { name = "html5lib" }, { name = "jsonpath" }, @@ -203,9 +201,9 @@ dependencies = [ { name = "urllib3" }, { name = "xlrd" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/32/ef/80a2f01b71b116b6a0702a51f07418b448143ca02ff1c3f5b20bb891ad74/akshare-1.17.94.tar.gz", hash = "sha256:634ba927dbff3287c004f5bbe1ffb819453dafc2adc5275496760c70c3742cbf", size = 852884, upload-time = "2025-12-12T06:49:21.304Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fa/04/9a43970c8e19c28d697681ad79139e04e1f42e89b21cc5b9e20a84e3f2f7/akshare-1.18.10.tar.gz", hash = "sha256:992554fafc5a4099bc005189422850d6d27042f83c197056168514ce1b1ecdf4", size = 858844, upload-time = "2026-01-12T08:52:07.675Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/91/8e/c8fc1f23b0a3b92631550736b6d1213d17bb93a611b17c9e6b051a07cc85/akshare-1.17.94-py3-none-any.whl", hash = "sha256:aaa0f4b8512b7e843999cb0325c04d90f9a09963e53d816f8f53c976aa2c9b23", size = 1071713, upload-time = "2025-12-12T06:49:19.813Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d9/55/9615bd8b8c51df8ea833291b96e848eeaac7e08273503fe94ac56c4b4754/akshare-1.18.10-py3-none-any.whl", hash = "sha256:258ab5f97309bc70f017ca070a65338f9473e5df961c15ba300966eef93702cb", size = 1080428, upload-time = "2026-01-12T08:52:05.852Z" }, ] [[package]] @@ -247,15 +245,15 @@ wheels = [ [[package]] name = "anyio" -version = "4.12.0" +version = "4.12.1" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "idna" }, { name = "typing-extensions", marker = "python_full_version < '3.13'" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/16/ce/8a777047513153587e5434fd752e89334ac33e379aa3497db860eeb60377/anyio-4.12.0.tar.gz", hash = "sha256:73c693b567b0c55130c104d0b43a9baf3aa6a31fc6110116509f27bf75e21ec0", size = 228266, upload-time = "2025-11-28T23:37:38.911Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/96/f0/5eb65b2bb0d09ac6776f2eb54adee6abe8228ea05b20a5ad0e4945de8aac/anyio-4.12.1.tar.gz", hash = "sha256:41cfcc3a4c85d3f05c932da7c26d0201ac36f72abd4435ba90d0464a3ffed703", size = 228685, upload-time = "2026-01-06T11:45:21.246Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7f/9c/36c5c37947ebfb8c7f22e0eb6e4d188ee2d53aa3880f3f2744fb894f0cb1/anyio-4.12.0-py3-none-any.whl", hash = "sha256:dad2376a628f98eeca4881fc56cd06affd18f659b17a747d3ff0307ced94b1bb", size = 113362, upload-time = "2025-11-28T23:36:57.897Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/38/0e/27be9fdef66e72d64c0cdc3cc2823101b80585f8119b5c112c2e8f5f7dab/anyio-4.12.1-py3-none-any.whl", hash = "sha256:d405828884fc140aa80a3c667b8beed277f1dfedec42ba031bd6ac3db606ab6c", size = 113592, upload-time = "2026-01-06T11:45:19.497Z" }, ] [[package]] @@ -450,7 +448,7 @@ wheels = [ [[package]] name = "azure-storage-blob" -version = "12.22.0" +version = "12.28.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "azure-core" }, @@ -458,9 +456,9 @@ dependencies = [ { name = "isodate" }, { name = "typing-extensions" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/92/de/9cea85c0d5fc21f99bcf9f060fc2287cb95236b70431fa63cb69890a121e/azure-storage-blob-12.22.0.tar.gz", hash = "sha256:b3804bb4fe8ab1c32771fa464053da772a682c2737b19da438a3f4e5e3b3736e", size = 564873, upload-time = "2024-08-06T20:54:41.054Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/71/24/072ba8e27b0e2d8fec401e9969b429d4f5fc4c8d4f0f05f4661e11f7234a/azure_storage_blob-12.28.0.tar.gz", hash = "sha256:e7d98ea108258d29aa0efbfd591b2e2075fa1722a2fae8699f0b3c9de11eff41", size = 604225, upload-time = "2026-01-06T23:48:57.282Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a8/52/b578c94048469fbf9f6378e2b2a46a2d0ccba3d59a7845dbed22ebf61601/azure_storage_blob-12.22.0-py3-none-any.whl", hash = "sha256:bb7d2d824ce3f11f14a27ee7d9281289f7e072ac8311c52e3652672455b7d5e8", size = 404892, upload-time = "2024-08-06T20:54:43.612Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d8/3a/6ef2047a072e54e1142718d433d50e9514c999a58f51abfff7902f3a72f8/azure_storage_blob-12.28.0-py3-none-any.whl", hash = "sha256:00fb1db28bf6a7b7ecaa48e3b1d5c83bfadacc5a678b77826081304bd87d6461", size = 431499, upload-time = "2026-01-06T23:48:58.995Z" }, ] [[package]] @@ -498,25 +496,25 @@ wheels = [ [[package]] name = "bce-python-sdk" -version = "0.9.55" +version = "0.9.59" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "future" }, { name = "pycryptodome" }, { name = "six" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ff/ae/f31ee3ccae94e1a07d8886a413f08c1581349e6cb45bf8b3c608fbf173e4/bce_python_sdk-0.9.55.tar.gz", hash = "sha256:bed63f8a0975f2e9daecf53417c3d5b803232ad87f35a0b16e25850710ce209c", size = 275733, upload-time = "2025-12-02T12:02:38.041Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c1/8e/ddfacf065fd0a514bda38b489988ea21636ac3be09c79239f24cdc36d71b/bce_python_sdk-0.9.59.tar.gz", hash = "sha256:54ad09394b0a5baf8c8ef87ac919f9d111c1b0536086286b80ada71651d8e4c8", size = 278672, upload-time = "2026-01-05T11:46:14.19Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8f/01/1b13a627e5f0239f24b168138d9a948e876d4b387c03f59d31699578c960/bce_python_sdk-0.9.55-py3-none-any.whl", hash = "sha256:6045d19d783b548644cce50a2f41ef5242da6654fb91b2c21629f309ca6dbf4c", size = 390463, upload-time = "2025-12-02T12:02:36.417Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2f/b0/38ea413e3a4aa44c199ff74001b3b2510b6b0f237c7840237976094ab574/bce_python_sdk-0.9.59-py3-none-any.whl", hash = "sha256:9a63ffc36ac5cb984b79ce6909288f00862010eda576f7575c7f0fb7cdef419c", size = 394807, upload-time = "2026-01-05T11:45:59.752Z" }, ] [[package]] name = "beartype" -version = "0.22.8" +version = "0.22.9" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8c/1d/794ae2acaa67c8b216d91d5919da2606c2bb14086849ffde7f5555f3a3a5/beartype-0.22.8.tar.gz", hash = "sha256:b19b21c9359722ee3f7cc433f063b3e13997b27ae8226551ea5062e621f61165", size = 1602262, upload-time = "2025-12-03T05:11:10.766Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c7/94/1009e248bbfbab11397abca7193bea6626806be9a327d399810d523a07cb/beartype-0.22.9.tar.gz", hash = "sha256:8f82b54aa723a2848a56008d18875f91c1db02c32ef6a62319a002e3e25a975f", size = 1608866, upload-time = "2025-12-13T06:50:30.72Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/14/2a/fbcbf5a025d3e71ddafad7efd43e34ec4362f4d523c3c471b457148fb211/beartype-0.22.8-py3-none-any.whl", hash = "sha256:b832882d04e41a4097bab9f63e6992bc6de58c414ee84cba9b45b67314f5ab2e", size = 1331895, upload-time = "2025-12-03T05:11:08.373Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/71/cc/18245721fa7747065ab478316c7fea7c74777d07f37ae60db2e84f8172e8/beartype-0.22.9-py3-none-any.whl", hash = "sha256:d16c9bbc61ea14637596c5f6fbff2ee99cbe3573e46a716401734ef50c3060c2", size = 1333658, upload-time = "2025-12-13T06:50:28.266Z" }, ] [[package]] @@ -614,52 +612,52 @@ wheels = [ [[package]] name = "blinker" -version = "1.7.0" +version = "1.9.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a1/13/6df5fc090ff4e5d246baf1f45fe9e5623aa8565757dfa5bd243f6a545f9e/blinker-1.7.0.tar.gz", hash = "sha256:e6820ff6fa4e4d1d8e2747c2283749c3f547e4fee112b98555cdcdae32996182", size = 28134, upload-time = "2023-11-01T22:06:01.588Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/21/28/9b3f50ce0e048515135495f198351908d99540d69bfdc8c1d15b73dc55ce/blinker-1.9.0.tar.gz", hash = "sha256:b4ce2265a7abece45e7cc896e98dbebe6cead56bcf805a3d23136d145f5445bf", size = 22460, upload-time = "2024-11-08T17:25:47.436Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fa/2a/7f3714cbc6356a0efec525ce7a0613d581072ed6eb53eb7b9754f33db807/blinker-1.7.0-py3-none-any.whl", hash = "sha256:c3f865d4d54db7abc53758a01601cf343fe55b84c1de4e3fa910e420b438d5b9", size = 13068, upload-time = "2023-11-01T22:06:00.162Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/10/cb/f2ad4230dc2eb1a74edf38f1a38b9b52277f75bef262d8908e60d957e13c/blinker-1.9.0-py3-none-any.whl", hash = "sha256:ba0efaa9080b619ff2f3459d1d500c57bddea4a6b424b60a91141db6fd2f08bc", size = 8458, upload-time = "2024-11-08T17:25:46.184Z" }, ] [[package]] name = "boto3" -version = "1.34.140" +version = "1.42.25" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "botocore" }, { name = "jmespath" }, { name = "s3transfer" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3f/79/c9a3651e563c5ac762080b8cef8e85659400a78d9ccffcf83916f68f4b04/boto3-1.34.140.tar.gz", hash = "sha256:578bbd5e356005719b6b610d03edff7ea1b0824d078afe62d3fb8bea72f83a87", size = 108704, upload-time = "2024-07-05T19:20:32.085Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/29/30/755a6c4b27ad4effefa9e407f84c6f0a69f75a21c0090beb25022dfcfd3f/boto3-1.42.25.tar.gz", hash = "sha256:ccb5e757dd62698d25766cc54cf5c47bea43287efa59c93cf1df8c8fbc26eeda", size = 112811, upload-time = "2026-01-09T20:27:44.73Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7b/26/76ee022975d33c9460ba0b3edefade5569597aa43bfb57c72722b1c5356a/boto3-1.34.140-py3-none-any.whl", hash = "sha256:23ca8d8f7a30c3bbd989808056b5fc5d68ff5121c02c722c6167b6b1bb7f8726", size = 139171, upload-time = "2024-07-05T19:20:11.416Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/14/79/012734f4e510b0a6beec2a3d5f437b3e8ef52174b1d38b1d5fdc542316d7/boto3-1.42.25-py3-none-any.whl", hash = "sha256:8128bde4f9d5ffce129c76d1a2efe220e3af967a2ad30bc305ba088bbc96343d", size = 140575, upload-time = "2026-01-09T20:27:42.788Z" }, ] [[package]] name = "botocore" -version = "1.34.140" +version = "1.42.25" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "jmespath" }, { name = "python-dateutil" }, { name = "urllib3" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a5/9a/3ae02c5dcc8f9a188e03d897aac898bd20d7f3eb5b910c9e071caf70f172/botocore-1.34.140.tar.gz", hash = "sha256:86302b2226c743b9eec7915a4c6cfaffd338ae03989cd9ee181078ef39d1ab39", size = 12565133, upload-time = "2024-07-05T19:19:26.79Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2c/b5/8f961c65898deb5417c9e9e908ea6c4d2fe8bb52ff04e552f679c88ed2ce/botocore-1.42.25.tar.gz", hash = "sha256:7ae79d1f77d3771e83e4dd46bce43166a1ba85d58a49cffe4c4a721418616054", size = 14879737, upload-time = "2026-01-09T20:27:34.676Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f5/23/91c8b50588470d80317f4afca93d3d542139bdc38ed5ad1b512fba416af3/botocore-1.34.140-py3-none-any.whl", hash = "sha256:43940d3a67d946ba3301631ba4078476a75f1015d4fb0fb0272d0b754b2cf9de", size = 12354845, upload-time = "2024-07-05T19:19:10.578Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1e/b0/61e3e61d437c8c73f0821ce8a8e2594edfc1f423e354c38fa56396a4e4ca/botocore-1.42.25-py3-none-any.whl", hash = "sha256:470261966aab1d09a1cd4ba56810098834443602846559ba9504f6613dfa52dc", size = 14553881, upload-time = "2026-01-09T20:27:30.487Z" }, ] [[package]] name = "boxsdk" -version = "10.2.0" +version = "10.3.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "requests" }, { name = "requests-toolbelt" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/15/7f/72688f50bd112188ca344cbee8d0c733a7dabaf1f6556b2eda55341a6193/boxsdk-10.2.0.tar.gz", hash = "sha256:824dd1d10ac50d5a536f7b9efc46391ab0a9b1e158c80c4af62162e7bed173fd", size = 265669, upload-time = "2025-12-10T13:51:08.725Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/df/25/d859cc617d832506e80327a277b0e0cc7d1114d66e966fdab8b218ffaf17/boxsdk-10.3.0.tar.gz", hash = "sha256:5b8ec0e2ed70160e16fe2fc1240d3896c88d50bd30796b021e95cfbe977b3444", size = 272690, upload-time = "2025-12-19T11:31:15.369Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e1/01/7b5d501301557dc54685e931b12c75dc7df925fc5acf189e4a44bae51fad/boxsdk-10.2.0-py3-none-any.whl", hash = "sha256:8576450c8844a1805027b46d132548a113b4e93e1cc8613316699d4863e7787f", size = 557206, upload-time = "2025-12-10T13:51:07.461Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/05/af/fec6a530efdfc3d7739d821cdcb63de7c9979954fa21ef6d16d0b678c8ed/boxsdk-10.3.0-py3-none-any.whl", hash = "sha256:3f65792834315177765c096402e35f43400c4c99c9b6e82f9ac40c8de3da4767", size = 574729, upload-time = "2025-12-19T11:31:13.575Z" }, ] [[package]] @@ -711,11 +709,11 @@ wheels = [ [[package]] name = "cachetools" -version = "5.3.3" +version = "6.2.4" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b3/4d/27a3e6dd09011649ad5210bdf963765bc8fa81a0827a4fc01bafd2705c5b/cachetools-5.3.3.tar.gz", hash = "sha256:ba29e2dfa0b8b556606f097407ed1aa62080ee108ab0dc5ec9d6a723a007d105", size = 26522, upload-time = "2024-02-26T20:33:23.386Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bc/1d/ede8680603f6016887c062a2cf4fc8fdba905866a3ab8831aa8aa651320c/cachetools-6.2.4.tar.gz", hash = "sha256:82c5c05585e70b6ba2d3ae09ea60b79548872185d2f24ae1f2709d37299fd607", size = 31731, upload-time = "2025-12-15T18:24:53.744Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fb/2b/a64c2d25a37aeb921fddb929111413049fc5f8b9a4c1aefaffaafe768d54/cachetools-5.3.3-py3-none-any.whl", hash = "sha256:0abad1021d3f8325b2fc1d2e9c8b9c9d57b04c3932657a72465447332c24d945", size = 9325, upload-time = "2024-02-26T20:33:20.308Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2c/fc/1d7b80d0eb7b714984ce40efc78859c022cd930e402f599d8ca9e39c78a4/cachetools-6.2.4-py3-none-any.whl", hash = "sha256:69a7a52634fed8b8bf6e24a050fb60bff1c9bd8f6d24572b99c32d4e71e62a51", size = 11551, upload-time = "2025-12-15T18:24:52.332Z" }, ] [[package]] @@ -750,44 +748,41 @@ sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9b/99/01c6a987c92050 [[package]] name = "cbor2" -version = "5.7.1" -source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a2/b8/c0f6a7d46f816cb18b1fda61a2fe648abe16039f1ff93ea720a6e9fb3cee/cbor2-5.7.1.tar.gz", hash = "sha256:7a405a1d7c8230ee9acf240aad48ae947ef584e8af05f169f3c1bde8f01f8b71", size = 102467, upload-time = "2025-10-24T09:23:06.569Z" } -wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/56/54/48426472f0c051982c647331441aed09b271a0500356ae0b7054c813d174/cbor2-5.7.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:bd5ca44891c06f6b85d440836c967187dc1d30b15f86f315d55c675d3a841078", size = 69031, upload-time = "2025-10-24T09:22:25.438Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d3/68/1dd58c7706e9752188358223db58c83f3c48e07f728aa84221ffd244652f/cbor2-5.7.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:537d73ef930ccc1a7b6a2e8d2cbf81407d270deb18e40cda5eb511bd70f71078", size = 68825, upload-time = "2025-10-24T09:22:26.497Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/09/4e/380562fe9f9995a1875fb5ec26fd041e19d61f4630cb690a98c5195945fc/cbor2-5.7.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:edbf814dd7763b6eda27a5770199f6ccd55bd78be8f4367092460261bfbf19d0", size = 286222, upload-time = "2025-10-24T09:22:27.546Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7c/bb/9eccdc1ea3c4d5c7cdb2e49b9de49534039616be5455ce69bd64c0b2efe2/cbor2-5.7.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9fc81da8c0e09beb42923e455e477b36ff14a03b9ca18a8a2e9b462de9a953e8", size = 285688, upload-time = "2025-10-24T09:22:28.651Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/59/8c/4696d82f5bd04b3d45d9a64ec037fa242630c134e3218d6c252b4f59b909/cbor2-5.7.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e4a7d660d428911a3aadb7105e94438d7671ab977356fdf647a91aab751033bd", size = 277063, upload-time = "2025-10-24T09:22:29.775Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/95/50/6538e44ca970caaad2fa376b81701d073d84bf597aac07a59d0a253b1a7f/cbor2-5.7.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:228e0af9c0a9ddf6375b6ae010eaa1942a1901d403f134ac9ee6a76a322483f9", size = 278334, upload-time = "2025-10-24T09:22:30.904Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/64/a9/156ccd2207fb26b5b61d23728b4dbdc595d1600125aa79683a4a8ddc9313/cbor2-5.7.1-cp312-cp312-win_amd64.whl", hash = "sha256:2d08a6c0d9ed778448e185508d870f4160ba74f59bb17a966abd0d14d0ff4dd3", size = 68404, upload-time = "2025-10-24T09:22:32.108Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4f/49/adc53615e9dd32c4421f6935dfa2235013532c6e6b28ee515bbdd92618be/cbor2-5.7.1-cp312-cp312-win_arm64.whl", hash = "sha256:752506cfe72da0f4014b468b30191470ee8919a64a0772bd3b36a4fccf5fcefc", size = 64047, upload-time = "2025-10-24T09:22:33.147Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/16/b1/51fb868fe38d893c570bb90b38d365ff0f00421402c1ae8f63b31b25d665/cbor2-5.7.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:59d5da59fffe89692d5bd1530eef4d26e4eb7aa794aaa1f4e192614786409009", size = 69068, upload-time = "2025-10-24T09:22:34.464Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b9/db/5abc62ec456f552f617aac3359a5d7114b23be9c4d886169592cd5f074b9/cbor2-5.7.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:533117918d518e01348f8cd0331271c207e7224b9a1ed492a0ff00847f28edc8", size = 68927, upload-time = "2025-10-24T09:22:35.458Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9a/c2/58d787395c99874d2a2395b3a22c9d48a3cfc5a7dcd5817bf74764998b75/cbor2-5.7.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8d6d9436ff3c3323ea5863ecf7ae1139590991685b44b9eb6b7bb1734a594af6", size = 285185, upload-time = "2025-10-24T09:22:36.867Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d0/9c/b680b264a8f4b9aa59c95e166c816275a13138cbee92dd2917f58bca47b9/cbor2-5.7.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:661b871ca754a619fcd98c13a38b4696b2b57dab8b24235c00b0ba322c040d24", size = 284440, upload-time = "2025-10-24T09:22:38.08Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1f/59/68183c655d6226d0eee10027f52516882837802a8d5746317a88362ed686/cbor2-5.7.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:d8065aa90d715fd9bb28727b2d774ee16e695a0e1627ae76e54bf19f9d99d63f", size = 276876, upload-time = "2025-10-24T09:22:39.561Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ee/a2/1964e0a569d2b81e8f4862753fee7701ae5773c22e45492a26f92f62e75a/cbor2-5.7.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:cb1b7047d73590cfe8e373e2c804fa99be47e55b1b6186602d0f86f384cecec1", size = 278216, upload-time = "2025-10-24T09:22:41.132Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/00/78/9b566d68cb88bb1ecebe354765625161c9d6060a16e55008006d6359f776/cbor2-5.7.1-cp313-cp313-win_amd64.whl", hash = "sha256:31d511df7ebd6624fdb4cecdafb4ffb9a205f9ff8c8d98edd1bef0d27f944d74", size = 68451, upload-time = "2025-10-24T09:22:42.227Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/db/85/7a6a922d147d027fd5d8fd5224b39e8eaf152a42e8cf16351458096d3d62/cbor2-5.7.1-cp313-cp313-win_arm64.whl", hash = "sha256:f5d37f7b0f84394d2995bd8722cb01c86a885c4821a864a34b7b4d9950c5e26e", size = 64111, upload-time = "2025-10-24T09:22:43.213Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5f/f0/f220222a57371e33434ba7bdc25de31d611cbc0ade2a868e03c3553305e7/cbor2-5.7.1-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:e5826e4fa4c33661960073f99cf67c82783895524fb66f3ebdd635c19b5a7d68", size = 69002, upload-time = "2025-10-24T09:22:44.316Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c7/3c/34b62ba5173541659f248f005d13373530f02fb997b78fde00bf01ede4f4/cbor2-5.7.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:f19a00d6ac9a77cb611073250b06bf4494b41ba78a1716704f7008e0927d9366", size = 69177, upload-time = "2025-10-24T09:22:45.711Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/77/fd/2400d820d9733df00a5c18aa74201e51d710fb91588687eb594f4a7688ea/cbor2-5.7.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d2113aea044cd172f199da3520bc4401af69eae96c5180ca7eb660941928cb89", size = 284259, upload-time = "2025-10-24T09:22:46.749Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/42/65/280488ef196c1d71ba123cd406ea47727bb3a0e057767a733d9793fcc428/cbor2-5.7.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6f17eacea2d28fecf28ac413c1d7927cde0a11957487d2630655d6b5c9c46a0b", size = 281958, upload-time = "2025-10-24T09:22:48.876Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/42/82/bcdd3fdc73bd5f4194fdb08c808112010add9530bae1dcfdb1e2b2ceae19/cbor2-5.7.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:d65deea39cae533a629561e7da672402c46731122b6129ed7c8eaa1efe04efce", size = 276025, upload-time = "2025-10-24T09:22:50.147Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ae/a8/a6065dd6a157b877d7d8f3fe96f410fb191a2db1e6588f4d20b5f9a507c2/cbor2-5.7.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:57d8cc29ec1fd20500748e0e767ff88c13afcee839081ba4478c41fcda6ee18b", size = 275978, upload-time = "2025-10-24T09:22:51.873Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/62/f4/37934045174af9e4253a340b43f07197af54002070cb80fae82d878f1f14/cbor2-5.7.1-cp314-cp314-win_amd64.whl", hash = "sha256:94fb939d0946f80c49ba45105ca3a3e13e598fc9abd63efc6661b02d4b4d2c50", size = 70269, upload-time = "2025-10-24T09:22:53.275Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0b/fd/933416643e7f5540ae818691fb23fa4189010c6efa39a12c4f59d825da28/cbor2-5.7.1-cp314-cp314-win_arm64.whl", hash = "sha256:4fd7225ac820bbb9f03bd16bc1a7efb6c4d1c451f22c0a153ff4ec46495c59c5", size = 66182, upload-time = "2025-10-24T09:22:54.697Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d5/7d/383bafeabb54c17fe5b6d5aca4e863e6b7df10bcc833b34aa169e9dfce1a/cbor2-5.7.1-py3-none-any.whl", hash = "sha256:68834e4eff2f56629ce6422b0634bc3f74c5a4269de5363f5265fe452c706ba7", size = 23829, upload-time = "2025-10-24T09:23:05.54Z" }, +version = "5.8.0" +source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d9/8e/8b4fdde28e42ffcd741a37f4ffa9fb59cd4fe01625b544dfcfd9ccb54f01/cbor2-5.8.0.tar.gz", hash = "sha256:b19c35fcae9688ac01ef75bad5db27300c2537eb4ee00ed07e05d8456a0d4931", size = 107825, upload-time = "2025-12-30T18:44:22.455Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2f/4f/3a16e3e8fd7e5fd86751a4f1aad218a8d19a96e75ec3989c3e95a8fe1d8f/cbor2-5.8.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4b3f91fa699a5ce22470e973601c62dd9d55dc3ca20ee446516ac075fcab27c9", size = 70270, upload-time = "2025-12-30T18:43:46.005Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/38/81/0d0cf0796fe8081492a61c45278f03def21a929535a492dd97c8438f5dbe/cbor2-5.8.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:518c118a5e00001854adb51f3164e647aa99b6a9877d2a733a28cb5c0a4d6857", size = 286242, upload-time = "2025-12-30T18:43:47.026Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7b/a9/fdab6c10190cfb8d639e01f2b168f2406fc847a2a6bc00e7de78c3381d0a/cbor2-5.8.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:cff2a1999e49cd51c23d1b6786a012127fd8f722c5946e82bd7ab3eb307443f3", size = 285412, upload-time = "2025-12-30T18:43:48.563Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/31/59/746a8e630996217a3afd523f583fcf7e3d16640d63f9a03f0f4e4f74b5b1/cbor2-5.8.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:4c4492160212374973cdc14e46f0565f2462721ef922b40f7ea11e7d613dfb2a", size = 278041, upload-time = "2025-12-30T18:43:49.92Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0f/a3/f3bbeb6dedd45c6e0cddd627ea790dea295eaf82c83f0e2159b733365ebd/cbor2-5.8.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:546c7c7c4c6bcdc54a59242e0e82cea8f332b17b4465ae628718fef1fce401ca", size = 278185, upload-time = "2025-12-30T18:43:51.192Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/67/e5/9013d6b857ceb6cdb2851ffb5a887f53f2bab934a528c9d6fa73d9989d84/cbor2-5.8.0-cp312-cp312-win_amd64.whl", hash = "sha256:074f0fa7535dd7fdee247c2c99f679d94f3aa058ccb1ccf4126cc72d6d89cbae", size = 69817, upload-time = "2025-12-30T18:43:52.352Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a8/ab/7aa94ba3d44ecbc3a97bdb2fb6a8298063fe2e0b611e539a6fe41e36da20/cbor2-5.8.0-cp312-cp312-win_arm64.whl", hash = "sha256:f95fed480b2a0d843f294d2a1ef4cc0f6a83c7922927f9f558e1f5a8dc54b7ca", size = 64923, upload-time = "2025-12-30T18:43:53.719Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a6/0d/5a3f20bafaefeb2c1903d961416f051c0950f0d09e7297a3aa6941596b29/cbor2-5.8.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:6d8d104480845e2f28c6165b4c961bbe58d08cb5638f368375cfcae051c28015", size = 70332, upload-time = "2025-12-30T18:43:54.694Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/57/66/177a3f089e69db69c987453ab4934086408c3338551e4984734597be9f80/cbor2-5.8.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:43efee947e5ab67d406d6e0dc61b5dee9d2f5e89ae176f90677a3741a20ca2e7", size = 285985, upload-time = "2025-12-30T18:43:55.733Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b7/8e/9e17b8e4ed80a2ce97e2dfa5915c169dbb31599409ddb830f514b57f96cc/cbor2-5.8.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:be7ae582f50be539e09c134966d0fd63723fc4789b8dff1f6c2e3f24ae3eaf32", size = 285173, upload-time = "2025-12-30T18:43:57.321Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cc/33/9f92e107d78f88ac22723ac15d0259d220ba98c1d855e51796317f4c4114/cbor2-5.8.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:50f5c709561a71ea7970b4cd2bf9eda4eccacc0aac212577080fdfe64183e7f5", size = 278395, upload-time = "2025-12-30T18:43:58.497Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2f/3f/46b80050a4a35ce5cf7903693864a9fdea7213567dc8faa6e25cb375c182/cbor2-5.8.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a6790ecc73aa93e76d2d9076fc42bf91a9e69f2295e5fa702e776dbe986465bd", size = 278330, upload-time = "2025-12-30T18:43:59.656Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/eb/d2/d41f8c04c783a4d204e364be2d38043d4f732a3bed6f4c732e321cf34c7b/cbor2-5.8.0-cp313-cp313-win_amd64.whl", hash = "sha256:c114af8099fa65a19a514db87ce7a06e942d8fea2730afd49be39f8e16e7f5e0", size = 69841, upload-time = "2025-12-30T18:44:01.159Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1b/8c/0397a82f6e67665009951453c83058e4c77ba54b9a9017ede56d6870306c/cbor2-5.8.0-cp313-cp313-win_arm64.whl", hash = "sha256:ab3ba00494ad8669a459b12a558448d309c271fa4f89b116ad496ee35db38fea", size = 64982, upload-time = "2025-12-30T18:44:02.138Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4b/0c/0654233d7543ac8a50f4785f172430ddc97538ba418eb305d6e529d1a120/cbor2-5.8.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:ad72381477133046ce217617d839ea4e9454f8b77d9a6351b229e214102daeb7", size = 70710, upload-time = "2025-12-30T18:44:03.209Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/84/62/4671d24e557d7f5a74a01b422c538925140c0495e57decde7e566f91d029/cbor2-5.8.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6da25190fad3434ce99876b11d4ca6b8828df6ca232cf7344cd14ae1166fb718", size = 285005, upload-time = "2025-12-30T18:44:05.109Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/87/85/0c67d763a08e848c9a80d7e4723ba497cce676f41bc7ca1828ae90a0a872/cbor2-5.8.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c13919e3a24c5a6d286551fa288848a4cedc3e507c58a722ccd134e461217d99", size = 282435, upload-time = "2025-12-30T18:44:06.465Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b2/01/0650972b4dbfbebcfbe37cbba7fc3cd9019a8da6397ab3446e07175e342b/cbor2-5.8.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:f8c40d32e5972047a777f9bf730870828f3cf1c43b3eb96fd0429c57a1d3b9e6", size = 277493, upload-time = "2025-12-30T18:44:07.609Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b3/6c/7704a4f32adc7f10f3b41ec067f500a4458f7606397af5e4cf2d368fd288/cbor2-5.8.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:7627894bc0b3d5d0807f31e3107e11b996205470c4429dc2bb4ef8bfe7f64e1e", size = 276085, upload-time = "2025-12-30T18:44:09.021Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/88/6d/e43452347630efe8133f5304127539100d937c138c0996d27ec63963ec2c/cbor2-5.8.0-cp314-cp314-win_amd64.whl", hash = "sha256:b51c5e59becae746ca4de2bbaa8a2f5c64a68fec05cea62941b1a84a8335f7d1", size = 71657, upload-time = "2025-12-30T18:44:10.162Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8b/66/9a780ef34ab10a0437666232e885378cdd5f60197b1b5e61a62499e5a10a/cbor2-5.8.0-cp314-cp314-win_arm64.whl", hash = "sha256:53b630f4db4b9f477ad84077283dd17ecf9894738aa17ef4938c369958e02a71", size = 67171, upload-time = "2025-12-30T18:44:11.619Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d6/4f/101071f880b4da05771128c0b89f41e334cff044dee05fb013c8f4be661c/cbor2-5.8.0-py3-none-any.whl", hash = "sha256:3727d80f539567b03a7aa11890e57798c67092c38df9e6c23abb059e0f65069c", size = 24374, upload-time = "2025-12-30T18:44:21.476Z" }, ] [[package]] name = "certifi" -version = "2025.11.12" +version = "2026.1.4" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a2/8c/58f469717fa48465e4a50c014a0400602d3c437d7c0c468e17ada824da3a/certifi-2025.11.12.tar.gz", hash = "sha256:d8ab5478f2ecd78af242878415affce761ca6bc54a22a27e026d7c25357c3316", size = 160538, upload-time = "2025-11-12T02:54:51.517Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e0/2d/a891ca51311197f6ad14a7ef42e2399f36cf2f9bd44752b3dc4eab60fdc5/certifi-2026.1.4.tar.gz", hash = "sha256:ac726dd470482006e014ad384921ed6438c457018f4b3d204aea4281258b2120", size = 154268, upload-time = "2026-01-04T02:42:41.825Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/70/7d/9bc192684cea499815ff478dfcdc13835ddf401365057044fb721ec6bddb/certifi-2025.11.12-py3-none-any.whl", hash = "sha256:97de8790030bbd5c2d96b7ec782fc2f7820ef8dba6db909ccf95449f2d062d4b", size = 159438, upload-time = "2025-11-12T02:54:49.735Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e6/ad/3cc14f097111b4de0040c83a525973216457bbeeb63739ef1ed275c1c021/certifi-2026.1.4-py3-none-any.whl", hash = "sha256:9943707519e4add1115f44c2bc244f782c0249876bf51b6599fee1ffbedd685c", size = 152900, upload-time = "2026-01-04T02:42:40.15Z" }, ] [[package]] @@ -1084,76 +1079,76 @@ wheels = [ [[package]] name = "coverage" -version = "7.13.0" -source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b6/45/2c665ca77ec32ad67e25c77daf1cee28ee4558f3bc571cdbaf88a00b9f23/coverage-7.13.0.tar.gz", hash = "sha256:a394aa27f2d7ff9bc04cf703817773a59ad6dfbd577032e690f961d2460ee936", size = 820905, upload-time = "2025-12-08T13:14:38.055Z" } -wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9b/f1/2619559f17f31ba00fc40908efd1fbf1d0a5536eb75dc8341e7d660a08de/coverage-7.13.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:0b3d67d31383c4c68e19a88e28fc4c2e29517580f1b0ebec4a069d502ce1e0bf", size = 218274, upload-time = "2025-12-08T13:12:52.095Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2b/11/30d71ae5d6e949ff93b2a79a2c1b4822e00423116c5c6edfaeef37301396/coverage-7.13.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:581f086833d24a22c89ae0fe2142cfaa1c92c930adf637ddf122d55083fb5a0f", size = 218638, upload-time = "2025-12-08T13:12:53.418Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/79/c2/fce80fc6ded8d77e53207489d6065d0fed75db8951457f9213776615e0f5/coverage-7.13.0-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:0a3a30f0e257df382f5f9534d4ce3d4cf06eafaf5192beb1a7bd066cb10e78fb", size = 250129, upload-time = "2025-12-08T13:12:54.744Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5b/b6/51b5d1eb6fcbb9a1d5d6984e26cbe09018475c2922d554fd724dd0f056ee/coverage-7.13.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:583221913fbc8f53b88c42e8dbb8fca1d0f2e597cb190ce45916662b8b9d9621", size = 252885, upload-time = "2025-12-08T13:12:56.401Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0d/f8/972a5affea41de798691ab15d023d3530f9f56a72e12e243f35031846ff7/coverage-7.13.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5f5d9bd30756fff3e7216491a0d6d520c448d5124d3d8e8f56446d6412499e74", size = 253974, upload-time = "2025-12-08T13:12:57.718Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8a/56/116513aee860b2c7968aa3506b0f59b22a959261d1dbf3aea7b4450a7520/coverage-7.13.0-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:a23e5a1f8b982d56fa64f8e442e037f6ce29322f1f9e6c2344cd9e9f4407ee57", size = 250538, upload-time = "2025-12-08T13:12:59.254Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d6/75/074476d64248fbadf16dfafbf93fdcede389ec821f74ca858d7c87d2a98c/coverage-7.13.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:9b01c22bc74a7fb44066aaf765224c0d933ddf1f5047d6cdfe4795504a4493f8", size = 251912, upload-time = "2025-12-08T13:13:00.604Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f2/d2/aa4f8acd1f7c06024705c12609d8698c51b27e4d635d717cd1934c9668e2/coverage-7.13.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:898cce66d0836973f48dda4e3514d863d70142bdf6dfab932b9b6a90ea5b222d", size = 250054, upload-time = "2025-12-08T13:13:01.892Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/19/98/8df9e1af6a493b03694a1e8070e024e7d2cdc77adedc225a35e616d505de/coverage-7.13.0-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:3ab483ea0e251b5790c2aac03acde31bff0c736bf8a86829b89382b407cd1c3b", size = 249619, upload-time = "2025-12-08T13:13:03.236Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d8/71/f8679231f3353018ca66ef647fa6fe7b77e6bff7845be54ab84f86233363/coverage-7.13.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1d84e91521c5e4cb6602fe11ece3e1de03b2760e14ae4fcf1a4b56fa3c801fcd", size = 251496, upload-time = "2025-12-08T13:13:04.511Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/04/86/9cb406388034eaf3c606c22094edbbb82eea1fa9d20c0e9efadff20d0733/coverage-7.13.0-cp312-cp312-win32.whl", hash = "sha256:193c3887285eec1dbdb3f2bd7fbc351d570ca9c02ca756c3afbc71b3c98af6ef", size = 220808, upload-time = "2025-12-08T13:13:06.422Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1c/59/af483673df6455795daf5f447c2f81a3d2fcfc893a22b8ace983791f6f34/coverage-7.13.0-cp312-cp312-win_amd64.whl", hash = "sha256:4f3e223b2b2db5e0db0c2b97286aba0036ca000f06aca9b12112eaa9af3d92ae", size = 221616, upload-time = "2025-12-08T13:13:07.95Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/64/b0/959d582572b30a6830398c60dd419c1965ca4b5fb38ac6b7093a0d50ca8d/coverage-7.13.0-cp312-cp312-win_arm64.whl", hash = "sha256:086cede306d96202e15a4b77ace8472e39d9f4e5f9fd92dd4fecdfb2313b2080", size = 220261, upload-time = "2025-12-08T13:13:09.581Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7c/cc/bce226595eb3bf7d13ccffe154c3c487a22222d87ff018525ab4dd2e9542/coverage-7.13.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:28ee1c96109974af104028a8ef57cec21447d42d0e937c0275329272e370ebcf", size = 218297, upload-time = "2025-12-08T13:13:10.977Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3b/9f/73c4d34600aae03447dff3d7ad1d0ac649856bfb87d1ca7d681cfc913f9e/coverage-7.13.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:d1e97353dcc5587b85986cda4ff3ec98081d7e84dd95e8b2a6d59820f0545f8a", size = 218673, upload-time = "2025-12-08T13:13:12.562Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/63/ab/8fa097db361a1e8586535ae5073559e6229596b3489ec3ef2f5b38df8cb2/coverage-7.13.0-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:99acd4dfdfeb58e1937629eb1ab6ab0899b131f183ee5f23e0b5da5cba2fec74", size = 249652, upload-time = "2025-12-08T13:13:13.909Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/90/3a/9bfd4de2ff191feb37ef9465855ca56a6f2f30a3bca172e474130731ac3d/coverage-7.13.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:ff45e0cd8451e293b63ced93161e189780baf444119391b3e7d25315060368a6", size = 252251, upload-time = "2025-12-08T13:13:15.553Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/df/61/b5d8105f016e1b5874af0d7c67542da780ccd4a5f2244a433d3e20ceb1ad/coverage-7.13.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f4f72a85316d8e13234cafe0a9f81b40418ad7a082792fa4165bd7d45d96066b", size = 253492, upload-time = "2025-12-08T13:13:16.849Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f3/b8/0fad449981803cc47a4694768b99823fb23632150743f9c83af329bb6090/coverage-7.13.0-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:11c21557d0e0a5a38632cbbaca5f008723b26a89d70db6315523df6df77d6232", size = 249850, upload-time = "2025-12-08T13:13:18.142Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9a/e9/8d68337c3125014d918cf4327d5257553a710a2995a6a6de2ac77e5aa429/coverage-7.13.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:76541dc8d53715fb4f7a3a06b34b0dc6846e3c69bc6204c55653a85dd6220971", size = 251633, upload-time = "2025-12-08T13:13:19.56Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/55/14/d4112ab26b3a1bc4b3c1295d8452dcf399ed25be4cf649002fb3e64b2d93/coverage-7.13.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:6e9e451dee940a86789134b6b0ffbe31c454ade3b849bb8a9d2cca2541a8e91d", size = 249586, upload-time = "2025-12-08T13:13:20.883Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2c/a9/22b0000186db663b0d82f86c2f1028099ae9ac202491685051e2a11a5218/coverage-7.13.0-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:5c67dace46f361125e6b9cace8fe0b729ed8479f47e70c89b838d319375c8137", size = 249412, upload-time = "2025-12-08T13:13:22.22Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a1/2e/42d8e0d9e7527fba439acdc6ed24a2b97613b1dc85849b1dd935c2cffef0/coverage-7.13.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:f59883c643cb19630500f57016f76cfdcd6845ca8c5b5ea1f6e17f74c8e5f511", size = 251191, upload-time = "2025-12-08T13:13:23.899Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a4/af/8c7af92b1377fd8860536aadd58745119252aaaa71a5213e5a8e8007a9f5/coverage-7.13.0-cp313-cp313-win32.whl", hash = "sha256:58632b187be6f0be500f553be41e277712baa278147ecb7559983c6d9faf7ae1", size = 220829, upload-time = "2025-12-08T13:13:25.182Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/58/f9/725e8bf16f343d33cbe076c75dc8370262e194ff10072c0608b8e5cf33a3/coverage-7.13.0-cp313-cp313-win_amd64.whl", hash = "sha256:73419b89f812f498aca53f757dd834919b48ce4799f9d5cad33ca0ae442bdb1a", size = 221640, upload-time = "2025-12-08T13:13:26.836Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8a/ff/e98311000aa6933cc79274e2b6b94a2fe0fe3434fca778eba82003675496/coverage-7.13.0-cp313-cp313-win_arm64.whl", hash = "sha256:eb76670874fdd6091eedcc856128ee48c41a9bbbb9c3f1c7c3cf169290e3ffd6", size = 220269, upload-time = "2025-12-08T13:13:28.116Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cf/cf/bbaa2e1275b300343ea865f7d424cc0a2e2a1df6925a070b2b2d5d765330/coverage-7.13.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:6e63ccc6e0ad8986386461c3c4b737540f20426e7ec932f42e030320896c311a", size = 218990, upload-time = "2025-12-08T13:13:29.463Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/21/1d/82f0b3323b3d149d7672e7744c116e9c170f4957e0c42572f0366dbb4477/coverage-7.13.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:494f5459ffa1bd45e18558cd98710c36c0b8fbfa82a5eabcbe671d80ecffbfe8", size = 219340, upload-time = "2025-12-08T13:13:31.524Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fb/e3/fe3fd4702a3832a255f4d43013eacb0ef5fc155a5960ea9269d8696db28b/coverage-7.13.0-cp313-cp313t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:06cac81bf10f74034e055e903f5f946e3e26fc51c09fc9f584e4a1605d977053", size = 260638, upload-time = "2025-12-08T13:13:32.965Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ad/01/63186cb000307f2b4da463f72af9b85d380236965574c78e7e27680a2593/coverage-7.13.0-cp313-cp313t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:f2ffc92b46ed6e6760f1d47a71e56b5664781bc68986dbd1836b2b70c0ce2071", size = 262705, upload-time = "2025-12-08T13:13:34.378Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7c/a1/c0dacef0cc865f2455d59eed3548573ce47ed603205ffd0735d1d78b5906/coverage-7.13.0-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0602f701057c6823e5db1b74530ce85f17c3c5be5c85fc042ac939cbd909426e", size = 265125, upload-time = "2025-12-08T13:13:35.73Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ef/92/82b99223628b61300bd382c205795533bed021505eab6dd86e11fb5d7925/coverage-7.13.0-cp313-cp313t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:25dc33618d45456ccb1d37bce44bc78cf269909aa14c4db2e03d63146a8a1493", size = 259844, upload-time = "2025-12-08T13:13:37.69Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cf/2c/89b0291ae4e6cd59ef042708e1c438e2290f8c31959a20055d8768349ee2/coverage-7.13.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:71936a8b3b977ddd0b694c28c6a34f4fff2e9dd201969a4ff5d5fc7742d614b0", size = 262700, upload-time = "2025-12-08T13:13:39.525Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bf/f9/a5f992efae1996245e796bae34ceb942b05db275e4b34222a9a40b9fbd3b/coverage-7.13.0-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:936bc20503ce24770c71938d1369461f0c5320830800933bc3956e2a4ded930e", size = 260321, upload-time = "2025-12-08T13:13:41.172Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4c/89/a29f5d98c64fedbe32e2ac3c227fbf78edc01cc7572eee17d61024d89889/coverage-7.13.0-cp313-cp313t-musllinux_1_2_riscv64.whl", hash = "sha256:af0a583efaacc52ae2521f8d7910aff65cdb093091d76291ac5820d5e947fc1c", size = 259222, upload-time = "2025-12-08T13:13:43.282Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b3/c3/940fe447aae302a6701ee51e53af7e08b86ff6eed7631e5740c157ee22b9/coverage-7.13.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:f1c23e24a7000da892a312fb17e33c5f94f8b001de44b7cf8ba2e36fbd15859e", size = 261411, upload-time = "2025-12-08T13:13:44.72Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/eb/31/12a4aec689cb942a89129587860ed4d0fd522d5fda81237147fde554b8ae/coverage-7.13.0-cp313-cp313t-win32.whl", hash = "sha256:5f8a0297355e652001015e93be345ee54393e45dc3050af4a0475c5a2b767d46", size = 221505, upload-time = "2025-12-08T13:13:46.332Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/65/8c/3b5fe3259d863572d2b0827642c50c3855d26b3aefe80bdc9eba1f0af3b0/coverage-7.13.0-cp313-cp313t-win_amd64.whl", hash = "sha256:6abb3a4c52f05e08460bd9acf04fec027f8718ecaa0d09c40ffbc3fbd70ecc39", size = 222569, upload-time = "2025-12-08T13:13:47.79Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b0/39/f71fa8316a96ac72fc3908839df651e8eccee650001a17f2c78cdb355624/coverage-7.13.0-cp313-cp313t-win_arm64.whl", hash = "sha256:3ad968d1e3aa6ce5be295ab5fe3ae1bf5bb4769d0f98a80a0252d543a2ef2e9e", size = 220841, upload-time = "2025-12-08T13:13:49.243Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f8/4b/9b54bedda55421449811dcd5263a2798a63f48896c24dfb92b0f1b0845bd/coverage-7.13.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:453b7ec753cf5e4356e14fe858064e5520c460d3bbbcb9c35e55c0d21155c256", size = 218343, upload-time = "2025-12-08T13:13:50.811Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/59/df/c3a1f34d4bba2e592c8979f924da4d3d4598b0df2392fbddb7761258e3dc/coverage-7.13.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:af827b7cbb303e1befa6c4f94fd2bf72f108089cfa0f8abab8f4ca553cf5ca5a", size = 218672, upload-time = "2025-12-08T13:13:52.284Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/07/62/eec0659e47857698645ff4e6ad02e30186eb8afd65214fd43f02a76537cb/coverage-7.13.0-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:9987a9e4f8197a1000280f7cc089e3ea2c8b3c0a64d750537809879a7b4ceaf9", size = 249715, upload-time = "2025-12-08T13:13:53.791Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/23/2d/3c7ff8b2e0e634c1f58d095f071f52ed3c23ff25be524b0ccae8b71f99f8/coverage-7.13.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:3188936845cd0cb114fa6a51842a304cdbac2958145d03be2377ec41eb285d19", size = 252225, upload-time = "2025-12-08T13:13:55.274Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/aa/ac/fb03b469d20e9c9a81093575003f959cf91a4a517b783aab090e4538764b/coverage-7.13.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a2bdb3babb74079f021696cb46b8bb5f5661165c385d3a238712b031a12355be", size = 253559, upload-time = "2025-12-08T13:13:57.161Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/29/62/14afa9e792383c66cc0a3b872a06ded6e4ed1079c7d35de274f11d27064e/coverage-7.13.0-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:7464663eaca6adba4175f6c19354feea61ebbdd735563a03d1e472c7072d27bb", size = 249724, upload-time = "2025-12-08T13:13:58.692Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/31/b7/333f3dab2939070613696ab3ee91738950f0467778c6e5a5052e840646b7/coverage-7.13.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:8069e831f205d2ff1f3d355e82f511eb7c5522d7d413f5db5756b772ec8697f8", size = 251582, upload-time = "2025-12-08T13:14:00.642Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/81/cb/69162bda9381f39b2287265d7e29ee770f7c27c19f470164350a38318764/coverage-7.13.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:6fb2d5d272341565f08e962cce14cdf843a08ac43bd621783527adb06b089c4b", size = 249538, upload-time = "2025-12-08T13:14:02.556Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e0/76/350387b56a30f4970abe32b90b2a434f87d29f8b7d4ae40d2e8a85aacfb3/coverage-7.13.0-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:5e70f92ef89bac1ac8a99b3324923b4749f008fdbd7aa9cb35e01d7a284a04f9", size = 249349, upload-time = "2025-12-08T13:14:04.015Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/86/0d/7f6c42b8d59f4c7e43ea3059f573c0dcfed98ba46eb43c68c69e52ae095c/coverage-7.13.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:4b5de7d4583e60d5fd246dd57fcd3a8aa23c6e118a8c72b38adf666ba8e7e927", size = 251011, upload-time = "2025-12-08T13:14:05.505Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d7/f1/4bb2dff379721bb0b5c649d5c5eaf438462cad824acf32eb1b7ca0c7078e/coverage-7.13.0-cp314-cp314-win32.whl", hash = "sha256:a6c6e16b663be828a8f0b6c5027d36471d4a9f90d28444aa4ced4d48d7d6ae8f", size = 221091, upload-time = "2025-12-08T13:14:07.127Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ba/44/c239da52f373ce379c194b0ee3bcc121020e397242b85f99e0afc8615066/coverage-7.13.0-cp314-cp314-win_amd64.whl", hash = "sha256:0900872f2fdb3ee5646b557918d02279dc3af3dfb39029ac4e945458b13f73bc", size = 221904, upload-time = "2025-12-08T13:14:08.542Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/89/1f/b9f04016d2a29c2e4a0307baefefad1a4ec5724946a2b3e482690486cade/coverage-7.13.0-cp314-cp314-win_arm64.whl", hash = "sha256:3a10260e6a152e5f03f26db4a407c4c62d3830b9af9b7c0450b183615f05d43b", size = 220480, upload-time = "2025-12-08T13:14:10.958Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/16/d4/364a1439766c8e8647860584171c36010ca3226e6e45b1753b1b249c5161/coverage-7.13.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:9097818b6cc1cfb5f174e3263eba4a62a17683bcfe5c4b5d07f4c97fa51fbf28", size = 219074, upload-time = "2025-12-08T13:14:13.345Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ce/f4/71ba8be63351e099911051b2089662c03d5671437a0ec2171823c8e03bec/coverage-7.13.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:0018f73dfb4301a89292c73be6ba5f58722ff79f51593352759c1790ded1cabe", size = 219342, upload-time = "2025-12-08T13:14:15.02Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5e/25/127d8ed03d7711a387d96f132589057213e3aef7475afdaa303412463f22/coverage-7.13.0-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:166ad2a22ee770f5656e1257703139d3533b4a0b6909af67c6b4a3adc1c98657", size = 260713, upload-time = "2025-12-08T13:14:16.907Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fd/db/559fbb6def07d25b2243663b46ba9eb5a3c6586c0c6f4e62980a68f0ee1c/coverage-7.13.0-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:f6aaef16d65d1787280943f1c8718dc32e9cf141014e4634d64446702d26e0ff", size = 262825, upload-time = "2025-12-08T13:14:18.68Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/37/99/6ee5bf7eff884766edb43bd8736b5e1c5144d0fe47498c3779326fe75a35/coverage-7.13.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e999e2dcc094002d6e2c7bbc1fb85b58ba4f465a760a8014d97619330cdbbbf3", size = 265233, upload-time = "2025-12-08T13:14:20.55Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d8/90/92f18fe0356ea69e1f98f688ed80cec39f44e9f09a1f26a1bbf017cc67f2/coverage-7.13.0-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:00c3d22cf6fb1cf3bf662aaaa4e563be8243a5ed2630339069799835a9cc7f9b", size = 259779, upload-time = "2025-12-08T13:14:22.367Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/90/5d/b312a8b45b37a42ea7d27d7d3ff98ade3a6c892dd48d1d503e773503373f/coverage-7.13.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:22ccfe8d9bb0d6134892cbe1262493a8c70d736b9df930f3f3afae0fe3ac924d", size = 262700, upload-time = "2025-12-08T13:14:24.309Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/63/f8/b1d0de5c39351eb71c366f872376d09386640840a2e09b0d03973d791e20/coverage-7.13.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:9372dff5ea15930fea0445eaf37bbbafbc771a49e70c0aeed8b4e2c2614cc00e", size = 260302, upload-time = "2025-12-08T13:14:26.068Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/aa/7c/d42f4435bc40c55558b3109a39e2d456cddcec37434f62a1f1230991667a/coverage-7.13.0-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:69ac2c492918c2461bc6ace42d0479638e60719f2a4ef3f0815fa2df88e9f940", size = 259136, upload-time = "2025-12-08T13:14:27.604Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b8/d3/23413241dc04d47cfe19b9a65b32a2edd67ecd0b817400c2843ebc58c847/coverage-7.13.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:739c6c051a7540608d097b8e13c76cfa85263ced467168dc6b477bae3df7d0e2", size = 261467, upload-time = "2025-12-08T13:14:29.09Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/13/e6/6e063174500eee216b96272c0d1847bf215926786f85c2bd024cf4d02d2f/coverage-7.13.0-cp314-cp314t-win32.whl", hash = "sha256:fe81055d8c6c9de76d60c94ddea73c290b416e061d40d542b24a5871bad498b7", size = 221875, upload-time = "2025-12-08T13:14:31.106Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3b/46/f4fb293e4cbe3620e3ac2a3e8fd566ed33affb5861a9b20e3dd6c1896cbc/coverage-7.13.0-cp314-cp314t-win_amd64.whl", hash = "sha256:445badb539005283825959ac9fa4a28f712c214b65af3a2c464f1adc90f5fcbc", size = 222982, upload-time = "2025-12-08T13:14:33.1Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/68/62/5b3b9018215ed9733fbd1ae3b2ed75c5de62c3b55377a52cae732e1b7805/coverage-7.13.0-cp314-cp314t-win_arm64.whl", hash = "sha256:de7f6748b890708578fc4b7bb967d810aeb6fcc9bff4bb77dbca77dab2f9df6a", size = 221016, upload-time = "2025-12-08T13:14:34.601Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8d/4c/1968f32fb9a2604645827e11ff84a31e59d532e01995f904723b4f5328b3/coverage-7.13.0-py3-none-any.whl", hash = "sha256:850d2998f380b1e266459ca5b47bc9e7daf9af1d070f66317972f382d46f1904", size = 210068, upload-time = "2025-12-08T13:14:36.236Z" }, +version = "7.13.1" +source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/23/f9/e92df5e07f3fc8d4c7f9a0f146ef75446bf870351cd37b788cf5897f8079/coverage-7.13.1.tar.gz", hash = "sha256:b7593fe7eb5feaa3fbb461ac79aac9f9fc0387a5ca8080b0c6fe2ca27b091afd", size = 825862, upload-time = "2025-12-28T15:42:56.969Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ce/8a/87af46cccdfa78f53db747b09f5f9a21d5fc38d796834adac09b30a8ce74/coverage-7.13.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:6f34591000f06e62085b1865c9bc5f7858df748834662a51edadfd2c3bfe0dd3", size = 218927, upload-time = "2025-12-28T15:40:52.814Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/82/a8/6e22fdc67242a4a5a153f9438d05944553121c8f4ba70cb072af4c41362e/coverage-7.13.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:b67e47c5595b9224599016e333f5ec25392597a89d5744658f837d204e16c63e", size = 219288, upload-time = "2025-12-28T15:40:54.262Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d0/0a/853a76e03b0f7c4375e2ca025df45c918beb367f3e20a0a8e91967f6e96c/coverage-7.13.1-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:3e7b8bd70c48ffb28461ebe092c2345536fb18bbbf19d287c8913699735f505c", size = 250786, upload-time = "2025-12-28T15:40:56.059Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ea/b4/694159c15c52b9f7ec7adf49d50e5f8ee71d3e9ef38adb4445d13dd56c20/coverage-7.13.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:c223d078112e90dc0e5c4e35b98b9584164bea9fbbd221c0b21c5241f6d51b62", size = 253543, upload-time = "2025-12-28T15:40:57.585Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/96/b2/7f1f0437a5c855f87e17cf5d0dc35920b6440ff2b58b1ba9788c059c26c8/coverage-7.13.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:794f7c05af0763b1bbd1b9e6eff0e52ad068be3b12cd96c87de037b01390c968", size = 254635, upload-time = "2025-12-28T15:40:59.443Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e9/d1/73c3fdb8d7d3bddd9473c9c6a2e0682f09fc3dfbcb9c3f36412a7368bcab/coverage-7.13.1-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0642eae483cc8c2902e4af7298bf886d605e80f26382124cddc3967c2a3df09e", size = 251202, upload-time = "2025-12-28T15:41:01.328Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/66/3c/f0edf75dcc152f145d5598329e864bbbe04ab78660fe3e8e395f9fff010f/coverage-7.13.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:9f5e772ed5fef25b3de9f2008fe67b92d46831bd2bc5bdc5dd6bfd06b83b316f", size = 252566, upload-time = "2025-12-28T15:41:03.319Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/17/b3/e64206d3c5f7dcbceafd14941345a754d3dbc78a823a6ed526e23b9cdaab/coverage-7.13.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:45980ea19277dc0a579e432aef6a504fe098ef3a9032ead15e446eb0f1191aee", size = 250711, upload-time = "2025-12-28T15:41:06.411Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/dc/ad/28a3eb970a8ef5b479ee7f0c484a19c34e277479a5b70269dc652b730733/coverage-7.13.1-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:e4f18eca6028ffa62adbd185a8f1e1dd242f2e68164dba5c2b74a5204850b4cf", size = 250278, upload-time = "2025-12-28T15:41:08.285Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/54/e3/c8f0f1a93133e3e1291ca76cbb63565bd4b5c5df63b141f539d747fff348/coverage-7.13.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:f8dca5590fec7a89ed6826fce625595279e586ead52e9e958d3237821fbc750c", size = 252154, upload-time = "2025-12-28T15:41:09.969Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d0/bf/9939c5d6859c380e405b19e736321f1c7d402728792f4c752ad1adcce005/coverage-7.13.1-cp312-cp312-win32.whl", hash = "sha256:ff86d4e85188bba72cfb876df3e11fa243439882c55957184af44a35bd5880b7", size = 221487, upload-time = "2025-12-28T15:41:11.468Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fa/dc/7282856a407c621c2aad74021680a01b23010bb8ebf427cf5eacda2e876f/coverage-7.13.1-cp312-cp312-win_amd64.whl", hash = "sha256:16cc1da46c04fb0fb128b4dc430b78fa2aba8a6c0c9f8eb391fd5103409a6ac6", size = 222299, upload-time = "2025-12-28T15:41:13.386Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/10/79/176a11203412c350b3e9578620013af35bcdb79b651eb976f4a4b32044fa/coverage-7.13.1-cp312-cp312-win_arm64.whl", hash = "sha256:8d9bc218650022a768f3775dd7fdac1886437325d8d295d923ebcfef4892ad5c", size = 220941, upload-time = "2025-12-28T15:41:14.975Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a3/a4/e98e689347a1ff1a7f67932ab535cef82eb5e78f32a9e4132e114bbb3a0a/coverage-7.13.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:cb237bfd0ef4d5eb6a19e29f9e528ac67ac3be932ea6b44fb6cc09b9f3ecff78", size = 218951, upload-time = "2025-12-28T15:41:16.653Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/32/33/7cbfe2bdc6e2f03d6b240d23dc45fdaf3fd270aaf2d640be77b7f16989ab/coverage-7.13.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:1dcb645d7e34dcbcc96cd7c132b1fc55c39263ca62eb961c064eb3928997363b", size = 219325, upload-time = "2025-12-28T15:41:18.609Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/59/f6/efdabdb4929487baeb7cb2a9f7dac457d9356f6ad1b255be283d58b16316/coverage-7.13.1-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:3d42df8201e00384736f0df9be2ced39324c3907607d17d50d50116c989d84cd", size = 250309, upload-time = "2025-12-28T15:41:20.629Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/12/da/91a52516e9d5aea87d32d1523f9cdcf7a35a3b298e6be05d6509ba3cfab2/coverage-7.13.1-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:fa3edde1aa8807de1d05934982416cb3ec46d1d4d91e280bcce7cca01c507992", size = 252907, upload-time = "2025-12-28T15:41:22.257Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/75/38/f1ea837e3dc1231e086db1638947e00d264e7e8c41aa8ecacf6e1e0c05f4/coverage-7.13.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9edd0e01a343766add6817bc448408858ba6b489039eaaa2018474e4001651a4", size = 254148, upload-time = "2025-12-28T15:41:23.87Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7f/43/f4f16b881aaa34954ba446318dea6b9ed5405dd725dd8daac2358eda869a/coverage-7.13.1-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:985b7836931d033570b94c94713c6dba5f9d3ff26045f72c3e5dbc5fe3361e5a", size = 250515, upload-time = "2025-12-28T15:41:25.437Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/84/34/8cba7f00078bd468ea914134e0144263194ce849ec3baad187ffb6203d1c/coverage-7.13.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ffed1e4980889765c84a5d1a566159e363b71d6b6fbaf0bebc9d3c30bc016766", size = 252292, upload-time = "2025-12-28T15:41:28.459Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8c/a4/cffac66c7652d84ee4ac52d3ccb94c015687d3b513f9db04bfcac2ac800d/coverage-7.13.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:8842af7f175078456b8b17f1b73a0d16a65dcbdc653ecefeb00a56b3c8c298c4", size = 250242, upload-time = "2025-12-28T15:41:30.02Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f4/78/9a64d462263dde416f3c0067efade7b52b52796f489b1037a95b0dc389c9/coverage-7.13.1-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:ccd7a6fca48ca9c131d9b0a2972a581e28b13416fc313fb98b6d24a03ce9a398", size = 250068, upload-time = "2025-12-28T15:41:32.007Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/69/c8/a8994f5fece06db7c4a97c8fc1973684e178599b42e66280dded0524ef00/coverage-7.13.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:0403f647055de2609be776965108447deb8e384fe4a553c119e3ff6bfbab4784", size = 251846, upload-time = "2025-12-28T15:41:33.946Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cc/f7/91fa73c4b80305c86598a2d4e54ba22df6bf7d0d97500944af7ef155d9f7/coverage-7.13.1-cp313-cp313-win32.whl", hash = "sha256:549d195116a1ba1e1ae2f5ca143f9777800f6636eab917d4f02b5310d6d73461", size = 221512, upload-time = "2025-12-28T15:41:35.519Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/45/0b/0768b4231d5a044da8f75e097a8714ae1041246bb765d6b5563bab456735/coverage-7.13.1-cp313-cp313-win_amd64.whl", hash = "sha256:5899d28b5276f536fcf840b18b61a9fce23cc3aec1d114c44c07fe94ebeaa500", size = 222321, upload-time = "2025-12-28T15:41:37.371Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9b/b8/bdcb7253b7e85157282450262008f1366aa04663f3e3e4c30436f596c3e2/coverage-7.13.1-cp313-cp313-win_arm64.whl", hash = "sha256:868a2fae76dfb06e87291bcbd4dcbcc778a8500510b618d50496e520bd94d9b9", size = 220949, upload-time = "2025-12-28T15:41:39.553Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/70/52/f2be52cc445ff75ea8397948c96c1b4ee14f7f9086ea62fc929c5ae7b717/coverage-7.13.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:67170979de0dacac3f3097d02b0ad188d8edcea44ccc44aaa0550af49150c7dc", size = 219643, upload-time = "2025-12-28T15:41:41.567Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/47/79/c85e378eaa239e2edec0c5523f71542c7793fe3340954eafb0bc3904d32d/coverage-7.13.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:f80e2bb21bfab56ed7405c2d79d34b5dc0bc96c2c1d2a067b643a09fb756c43a", size = 219997, upload-time = "2025-12-28T15:41:43.418Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fe/9b/b1ade8bfb653c0bbce2d6d6e90cc6c254cbb99b7248531cc76253cb4da6d/coverage-7.13.1-cp313-cp313t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:f83351e0f7dcdb14d7326c3d8d8c4e915fa685cbfdc6281f9470d97a04e9dfe4", size = 261296, upload-time = "2025-12-28T15:41:45.207Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1f/af/ebf91e3e1a2473d523e87e87fd8581e0aa08741b96265730e2d79ce78d8d/coverage-7.13.1-cp313-cp313t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:bb3f6562e89bad0110afbe64e485aac2462efdce6232cdec7862a095dc3412f6", size = 263363, upload-time = "2025-12-28T15:41:47.163Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c4/8b/fb2423526d446596624ac7fde12ea4262e66f86f5120114c3cfd0bb2befa/coverage-7.13.1-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:77545b5dcda13b70f872c3b5974ac64c21d05e65b1590b441c8560115dc3a0d1", size = 265783, upload-time = "2025-12-28T15:41:49.03Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9b/26/ef2adb1e22674913b89f0fe7490ecadcef4a71fa96f5ced90c60ec358789/coverage-7.13.1-cp313-cp313t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:a4d240d260a1aed814790bbe1f10a5ff31ce6c21bc78f0da4a1e8268d6c80dbd", size = 260508, upload-time = "2025-12-28T15:41:51.035Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ce/7d/f0f59b3404caf662e7b5346247883887687c074ce67ba453ea08c612b1d5/coverage-7.13.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:d2287ac9360dec3837bfdad969963a5d073a09a85d898bd86bea82aa8876ef3c", size = 263357, upload-time = "2025-12-28T15:41:52.631Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1a/b1/29896492b0b1a047604d35d6fa804f12818fa30cdad660763a5f3159e158/coverage-7.13.1-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:0d2c11f3ea4db66b5cbded23b20185c35066892c67d80ec4be4bab257b9ad1e0", size = 260978, upload-time = "2025-12-28T15:41:54.589Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/48/f2/971de1238a62e6f0a4128d37adadc8bb882ee96afbe03ff1570291754629/coverage-7.13.1-cp313-cp313t-musllinux_1_2_riscv64.whl", hash = "sha256:3fc6a169517ca0d7ca6846c3c5392ef2b9e38896f61d615cb75b9e7134d4ee1e", size = 259877, upload-time = "2025-12-28T15:41:56.263Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6a/fc/0474efcbb590ff8628830e9aaec5f1831594874360e3251f1fdec31d07a3/coverage-7.13.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:d10a2ed46386e850bb3de503a54f9fe8192e5917fcbb143bfef653a9355e9a53", size = 262069, upload-time = "2025-12-28T15:41:58.093Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/88/4f/3c159b7953db37a7b44c0eab8a95c37d1aa4257c47b4602c04022d5cb975/coverage-7.13.1-cp313-cp313t-win32.whl", hash = "sha256:75a6f4aa904301dab8022397a22c0039edc1f51e90b83dbd4464b8a38dc87842", size = 222184, upload-time = "2025-12-28T15:41:59.763Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/58/a5/6b57d28f81417f9335774f20679d9d13b9a8fb90cd6160957aa3b54a2379/coverage-7.13.1-cp313-cp313t-win_amd64.whl", hash = "sha256:309ef5706e95e62578cda256b97f5e097916a2c26247c287bbe74794e7150df2", size = 223250, upload-time = "2025-12-28T15:42:01.52Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/81/7c/160796f3b035acfbb58be80e02e484548595aa67e16a6345e7910ace0a38/coverage-7.13.1-cp313-cp313t-win_arm64.whl", hash = "sha256:92f980729e79b5d16d221038dbf2e8f9a9136afa072f9d5d6ed4cb984b126a09", size = 221521, upload-time = "2025-12-28T15:42:03.275Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/aa/8e/ba0e597560c6563fc0adb902fda6526df5d4aa73bb10adf0574d03bd2206/coverage-7.13.1-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:97ab3647280d458a1f9adb85244e81587505a43c0c7cff851f5116cd2814b894", size = 218996, upload-time = "2025-12-28T15:42:04.978Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6b/8e/764c6e116f4221dc7aa26c4061181ff92edb9c799adae6433d18eeba7a14/coverage-7.13.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:8f572d989142e0908e6acf57ad1b9b86989ff057c006d13b76c146ec6a20216a", size = 219326, upload-time = "2025-12-28T15:42:06.691Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4f/a6/6130dc6d8da28cdcbb0f2bf8865aeca9b157622f7c0031e48c6cf9a0e591/coverage-7.13.1-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:d72140ccf8a147e94274024ff6fd8fb7811354cf7ef88b1f0a988ebaa5bc774f", size = 250374, upload-time = "2025-12-28T15:42:08.786Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/82/2b/783ded568f7cd6b677762f780ad338bf4b4750205860c17c25f7c708995e/coverage-7.13.1-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:d3c9f051b028810f5a87c88e5d6e9af3c0ff32ef62763bf15d29f740453ca909", size = 252882, upload-time = "2025-12-28T15:42:10.515Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cd/b2/9808766d082e6a4d59eb0cc881a57fc1600eb2c5882813eefff8254f71b5/coverage-7.13.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f398ba4df52d30b1763f62eed9de5620dcde96e6f491f4c62686736b155aa6e4", size = 254218, upload-time = "2025-12-28T15:42:12.208Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/44/ea/52a985bb447c871cb4d2e376e401116520991b597c85afdde1ea9ef54f2c/coverage-7.13.1-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:132718176cc723026d201e347f800cd1a9e4b62ccd3f82476950834dad501c75", size = 250391, upload-time = "2025-12-28T15:42:14.21Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7f/1d/125b36cc12310718873cfc8209ecfbc1008f14f4f5fa0662aa608e579353/coverage-7.13.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:9e549d642426e3579b3f4b92d0431543b012dcb6e825c91619d4e93b7363c3f9", size = 252239, upload-time = "2025-12-28T15:42:16.292Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6a/16/10c1c164950cade470107f9f14bbac8485f8fb8515f515fca53d337e4a7f/coverage-7.13.1-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:90480b2134999301eea795b3a9dbf606c6fbab1b489150c501da84a959442465", size = 250196, upload-time = "2025-12-28T15:42:18.54Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2a/c6/cd860fac08780c6fd659732f6ced1b40b79c35977c1356344e44d72ba6c4/coverage-7.13.1-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:e825dbb7f84dfa24663dd75835e7257f8882629fc11f03ecf77d84a75134b864", size = 250008, upload-time = "2025-12-28T15:42:20.365Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f0/3a/a8c58d3d38f82a5711e1e0a67268362af48e1a03df27c03072ac30feefcf/coverage-7.13.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:623dcc6d7a7ba450bbdbeedbaa0c42b329bdae16491af2282f12a7e809be7eb9", size = 251671, upload-time = "2025-12-28T15:42:22.114Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f0/bc/fd4c1da651d037a1e3d53e8cb3f8182f4b53271ffa9a95a2e211bacc0349/coverage-7.13.1-cp314-cp314-win32.whl", hash = "sha256:6e73ebb44dca5f708dc871fe0b90cf4cff1a13f9956f747cc87b535a840386f5", size = 221777, upload-time = "2025-12-28T15:42:23.919Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4b/50/71acabdc8948464c17e90b5ffd92358579bd0910732c2a1c9537d7536aa6/coverage-7.13.1-cp314-cp314-win_amd64.whl", hash = "sha256:be753b225d159feb397bd0bf91ae86f689bad0da09d3b301478cd39b878ab31a", size = 222592, upload-time = "2025-12-28T15:42:25.619Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f7/c8/a6fb943081bb0cc926499c7907731a6dc9efc2cbdc76d738c0ab752f1a32/coverage-7.13.1-cp314-cp314-win_arm64.whl", hash = "sha256:228b90f613b25ba0019361e4ab81520b343b622fc657daf7e501c4ed6a2366c0", size = 221169, upload-time = "2025-12-28T15:42:27.629Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/16/61/d5b7a0a0e0e40d62e59bc8c7aa1afbd86280d82728ba97f0673b746b78e2/coverage-7.13.1-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:60cfb538fe9ef86e5b2ab0ca8fc8d62524777f6c611dcaf76dc16fbe9b8e698a", size = 219730, upload-time = "2025-12-28T15:42:29.306Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a3/2c/8881326445fd071bb49514d1ce97d18a46a980712b51fee84f9ab42845b4/coverage-7.13.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:57dfc8048c72ba48a8c45e188d811e5efd7e49b387effc8fb17e97936dde5bf6", size = 220001, upload-time = "2025-12-28T15:42:31.319Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b5/d7/50de63af51dfa3a7f91cc37ad8fcc1e244b734232fbc8b9ab0f3c834a5cd/coverage-7.13.1-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:3f2f725aa3e909b3c5fdb8192490bdd8e1495e85906af74fe6e34a2a77ba0673", size = 261370, upload-time = "2025-12-28T15:42:32.992Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e1/2c/d31722f0ec918fd7453b2758312729f645978d212b410cd0f7c2aed88a94/coverage-7.13.1-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:9ee68b21909686eeb21dfcba2c3b81fee70dcf38b140dcd5aa70680995fa3aa5", size = 263485, upload-time = "2025-12-28T15:42:34.759Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fa/7a/2c114fa5c5fc08ba0777e4aec4c97e0b4a1afcb69c75f1f54cff78b073ab/coverage-7.13.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:724b1b270cb13ea2e6503476e34541a0b1f62280bc997eab443f87790202033d", size = 265890, upload-time = "2025-12-28T15:42:36.517Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/65/d9/f0794aa1c74ceabc780fe17f6c338456bbc4e96bd950f2e969f48ac6fb20/coverage-7.13.1-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:916abf1ac5cf7eb16bc540a5bf75c71c43a676f5c52fcb9fe75a2bd75fb944e8", size = 260445, upload-time = "2025-12-28T15:42:38.646Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/49/23/184b22a00d9bb97488863ced9454068c79e413cb23f472da6cbddc6cfc52/coverage-7.13.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:776483fd35b58d8afe3acbd9988d5de592ab6da2d2a865edfdbc9fdb43e7c486", size = 263357, upload-time = "2025-12-28T15:42:40.788Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7d/bd/58af54c0c9199ea4190284f389005779d7daf7bf3ce40dcd2d2b2f96da69/coverage-7.13.1-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:b6f3b96617e9852703f5b633ea01315ca45c77e879584f283c44127f0f1ec564", size = 260959, upload-time = "2025-12-28T15:42:42.808Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4b/2a/6839294e8f78a4891bf1df79d69c536880ba2f970d0ff09e7513d6e352e9/coverage-7.13.1-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:bd63e7b74661fed317212fab774e2a648bc4bb09b35f25474f8e3325d2945cd7", size = 259792, upload-time = "2025-12-28T15:42:44.818Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ba/c3/528674d4623283310ad676c5af7414b9850ab6d55c2300e8aa4b945ec554/coverage-7.13.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:933082f161bbb3e9f90d00990dc956120f608cdbcaeea15c4d897f56ef4fe416", size = 262123, upload-time = "2025-12-28T15:42:47.108Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/06/c5/8c0515692fb4c73ac379d8dc09b18eaf0214ecb76ea6e62467ba7a1556ff/coverage-7.13.1-cp314-cp314t-win32.whl", hash = "sha256:18be793c4c87de2965e1c0f060f03d9e5aff66cfeae8e1dbe6e5b88056ec153f", size = 222562, upload-time = "2025-12-28T15:42:49.144Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/05/0e/c0a0c4678cb30dac735811db529b321d7e1c9120b79bd728d4f4d6b010e9/coverage-7.13.1-cp314-cp314t-win_amd64.whl", hash = "sha256:0e42e0ec0cd3e0d851cb3c91f770c9301f48647cb2877cb78f74bdaa07639a79", size = 223670, upload-time = "2025-12-28T15:42:51.218Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f5/5f/b177aa0011f354abf03a8f30a85032686d290fdeed4222b27d36b4372a50/coverage-7.13.1-cp314-cp314t-win_arm64.whl", hash = "sha256:eaecf47ef10c72ece9a2a92118257da87e460e113b83cc0d2905cbbe931792b4", size = 221707, upload-time = "2025-12-28T15:42:53.034Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cc/48/d9f421cb8da5afaa1a64570d9989e00fb7955e6acddc5a12979f7666ef60/coverage-7.13.1-py3-none-any.whl", hash = "sha256:2016745cb3ba554469d02819d78958b571792bb68e31302610e898f80dd3a573", size = 210722, upload-time = "2025-12-28T15:42:54.901Z" }, ] [[package]] @@ -1233,8 +1228,7 @@ dependencies = [ { name = "aiosqlite" }, { name = "beautifulsoup4" }, { name = "colorama" }, - { name = "litellm", version = "1.80.5", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "litellm", version = "1.80.9", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, + { name = "litellm" }, { name = "lxml" }, { name = "nltk" }, { name = "numpy" }, @@ -1322,23 +1316,25 @@ wheels = [ [[package]] name = "curl-cffi" -version = "0.13.0" +version = "0.14.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "certifi" }, { name = "cffi" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4e/3d/f39ca1f8fdf14408888e7c25e15eed63eac5f47926e206fb93300d28378c/curl_cffi-0.13.0.tar.gz", hash = "sha256:62ecd90a382bd5023750e3606e0aa7cb1a3a8ba41c14270b8e5e149ebf72c5ca", size = 151303, upload-time = "2025-08-06T13:05:42.988Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9b/c9/0067d9a25ed4592b022d4558157fcdb6e123516083700786d38091688767/curl_cffi-0.14.0.tar.gz", hash = "sha256:5ffbc82e59f05008ec08ea432f0e535418823cda44178ee518906a54f27a5f0f", size = 162633, upload-time = "2025-12-16T03:25:07.931Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/19/d1/acabfd460f1de26cad882e5ef344d9adde1507034528cb6f5698a2e6a2f1/curl_cffi-0.13.0-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:434cadbe8df2f08b2fc2c16dff2779fb40b984af99c06aa700af898e185bb9db", size = 5686337, upload-time = "2025-08-06T13:05:28.985Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2c/1c/cdb4fb2d16a0e9de068e0e5bc02094e105ce58a687ff30b4c6f88e25a057/curl_cffi-0.13.0-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:59afa877a9ae09efa04646a7d068eeea48915a95d9add0a29854e7781679fcd7", size = 2994613, upload-time = "2025-08-06T13:05:31.027Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/04/3e/fdf617c1ec18c3038b77065d484d7517bb30f8fb8847224eb1f601a4e8bc/curl_cffi-0.13.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d06ed389e45a7ca97b17c275dbedd3d6524560270e675c720e93a2018a766076", size = 7931353, upload-time = "2025-08-06T13:05:32.273Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3d/10/6f30c05d251cf03ddc2b9fd19880f3cab8c193255e733444a2df03b18944/curl_cffi-0.13.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b4e0de45ab3b7a835c72bd53640c2347415111b43421b5c7a1a0b18deae2e541", size = 7486378, upload-time = "2025-08-06T13:05:33.672Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/77/81/5bdb7dd0d669a817397b2e92193559bf66c3807f5848a48ad10cf02bf6c7/curl_cffi-0.13.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8eb4083371bbb94e9470d782de235fb5268bf43520de020c9e5e6be8f395443f", size = 8328585, upload-time = "2025-08-06T13:05:35.28Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ce/c1/df5c6b4cfad41c08442e0f727e449f4fb5a05f8aa564d1acac29062e9e8e/curl_cffi-0.13.0-cp39-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:28911b526e8cd4aa0e5e38401bfe6887e8093907272f1f67ca22e6beb2933a51", size = 8739831, upload-time = "2025-08-06T13:05:37.078Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1a/91/6dd1910a212f2e8eafe57877bcf97748eb24849e1511a266687546066b8a/curl_cffi-0.13.0-cp39-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:6d433ffcb455ab01dd0d7bde47109083aa38b59863aa183d29c668ae4c96bf8e", size = 8711908, upload-time = "2025-08-06T13:05:38.741Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6d/e4/15a253f9b4bf8d008c31e176c162d2704a7e0c5e24d35942f759df107b68/curl_cffi-0.13.0-cp39-abi3-win_amd64.whl", hash = "sha256:66a6b75ce971de9af64f1b6812e275f60b88880577bac47ef1fa19694fa21cd3", size = 1614510, upload-time = "2025-08-06T13:05:40.451Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f9/0f/9c5275f17ad6ff5be70edb8e0120fdc184a658c9577ca426d4230f654beb/curl_cffi-0.13.0-cp39-abi3-win_arm64.whl", hash = "sha256:d438a3b45244e874794bc4081dc1e356d2bb926dcc7021e5a8fef2e2105ef1d8", size = 1365753, upload-time = "2025-08-06T13:05:41.879Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/aa/f0/0f21e9688eaac85e705537b3a87a5588d0cefb2f09d83e83e0e8be93aa99/curl_cffi-0.14.0-cp39-abi3-macosx_14_0_arm64.whl", hash = "sha256:e35e89c6a69872f9749d6d5fda642ed4fc159619329e99d577d0104c9aad5893", size = 3087277, upload-time = "2025-12-16T03:24:49.607Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ba/a3/0419bd48fce5b145cb6a2344c6ac17efa588f5b0061f212c88e0723da026/curl_cffi-0.14.0-cp39-abi3-macosx_15_0_x86_64.whl", hash = "sha256:5945478cd28ad7dfb5c54473bcfb6743ee1d66554d57951fdf8fc0e7d8cf4e45", size = 5804650, upload-time = "2025-12-16T03:24:51.518Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e2/07/a238dd062b7841b8caa2fa8a359eb997147ff3161288f0dd46654d898b4d/curl_cffi-0.14.0-cp39-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c42e8fa3c667db9ccd2e696ee47adcd3cd5b0838d7282f3fc45f6c0ef3cfdfa7", size = 8231918, upload-time = "2025-12-16T03:24:52.862Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7c/d2/ce907c9b37b5caf76ac08db40cc4ce3d9f94c5500db68a195af3513eacbc/curl_cffi-0.14.0-cp39-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:060fe2c99c41d3cb7f894de318ddf4b0301b08dca70453d769bd4e74b36b8483", size = 8654624, upload-time = "2025-12-16T03:24:54.579Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f2/ae/6256995b18c75e6ef76b30753a5109e786813aa79088b27c8eabb1ef85c9/curl_cffi-0.14.0-cp39-abi3-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:b158c41a25388690dd0d40b5bc38d1e0f512135f17fdb8029868cbc1993d2e5b", size = 8010654, upload-time = "2025-12-16T03:24:56.507Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fb/10/ff64249e516b103cb762e0a9dca3ee0f04cf25e2a1d5d9838e0f1273d071/curl_cffi-0.14.0-cp39-abi3-manylinux_2_28_i686.whl", hash = "sha256:1439fbef3500fb723333c826adf0efb0e2e5065a703fb5eccce637a2250db34a", size = 7781969, upload-time = "2025-12-16T03:24:57.885Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/51/76/d6f7bb76c2d12811aa7ff16f5e17b678abdd1b357b9a8ac56310ceccabd5/curl_cffi-0.14.0-cp39-abi3-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e7176f2c2d22b542e3cf261072a81deb018cfa7688930f95dddef215caddb469", size = 7969133, upload-time = "2025-12-16T03:24:59.261Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/23/7c/cca39c0ed4e1772613d3cba13091c0e9d3b89365e84b9bf9838259a3cd8f/curl_cffi-0.14.0-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:03f21ade2d72978c2bb8670e9b6de5260e2755092b02d94b70b906813662998d", size = 9080167, upload-time = "2025-12-16T03:25:00.946Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/75/03/a942d7119d3e8911094d157598ae0169b1c6ca1bd3f27d7991b279bcc45b/curl_cffi-0.14.0-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:58ebf02de64ee5c95613209ddacb014c2d2f86298d7080c0a1c12ed876ee0690", size = 9520464, upload-time = "2025-12-16T03:25:02.922Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a2/77/78900e9b0833066d2274bda75cba426fdb4cef7fbf6a4f6a6ca447607bec/curl_cffi-0.14.0-cp39-abi3-win_amd64.whl", hash = "sha256:6e503f9a103f6ae7acfb3890c843b53ec030785a22ae7682a22cc43afb94123e", size = 1677416, upload-time = "2025-12-16T03:25:04.902Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5c/7c/d2ba86b0b3e1e2830bd94163d047de122c69a8df03c5c7c36326c456ad82/curl_cffi-0.14.0-cp39-abi3-win_arm64.whl", hash = "sha256:2eed50a969201605c863c4c31269dfc3e0da52916086ac54553cfa353022425c", size = 1425067, upload-time = "2025-12-16T03:25:06.454Z" }, ] [[package]] @@ -1371,23 +1367,23 @@ sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/51/0b/c0f53a14317b30 [[package]] name = "debugpy" -version = "1.8.18" +version = "1.8.19" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/62/1a/7cb5531840d7ba5d9329644109e62adee41f2f0083d9f8a4039f01de58cf/debugpy-1.8.18.tar.gz", hash = "sha256:02551b1b84a91faadd2db9bc4948873f2398190c95b3cc6f97dc706f43e8c433", size = 1644467, upload-time = "2025-12-10T19:48:07.236Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/73/75/9e12d4d42349b817cd545b89247696c67917aab907012ae5b64bbfea3199/debugpy-1.8.19.tar.gz", hash = "sha256:eea7e5987445ab0b5ed258093722d5ecb8bb72217c5c9b1e21f64efe23ddebdb", size = 1644590, upload-time = "2025-12-15T21:53:28.044Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/83/01/439626e3572a33ac543f25bc1dac1e80bc01c7ce83f3c24dc4441302ca13/debugpy-1.8.18-cp312-cp312-macosx_15_0_universal2.whl", hash = "sha256:530c38114725505a7e4ea95328dbc24aabb9be708c6570623c8163412e6d1d6b", size = 2549961, upload-time = "2025-12-10T19:48:21.73Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cd/73/1eeaa15c20a2b627be57a65bc1ebf2edd8d896950eac323588b127d776f2/debugpy-1.8.18-cp312-cp312-manylinux_2_34_x86_64.whl", hash = "sha256:a114865099283cbed4c9330cb0c9cb7a04cfa92e803577843657302d526141ec", size = 4309855, upload-time = "2025-12-10T19:48:23.41Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e4/6f/2da8ded21ae55df7067e57bd7f67ffed7e08b634f29bdba30c03d3f19918/debugpy-1.8.18-cp312-cp312-win32.whl", hash = "sha256:4d26736dfabf404e9f3032015ec7b0189e7396d0664e29e5bdbe7ac453043c95", size = 5280577, upload-time = "2025-12-10T19:48:25.386Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f5/8e/ebe887218c5b84f9421de7eb7bb7cdf196e84535c3f504a562219297d755/debugpy-1.8.18-cp312-cp312-win_amd64.whl", hash = "sha256:7e68ba950acbcf95ee862210133681f408cbb78d1c9badbb515230ec55ed6487", size = 5322458, upload-time = "2025-12-10T19:48:28.049Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fe/3f/45af037e91e308274a092eb6a86282865fb1f11148cdb7616e811aae33d7/debugpy-1.8.18-cp313-cp313-macosx_15_0_universal2.whl", hash = "sha256:75d14dd04b617ee38e46786394ec0dd5e1ac5e3d10ffb034fd6c7b72111174c2", size = 2538826, upload-time = "2025-12-10T19:48:29.434Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cc/f4/2de6bf624de05134d1bbe0a8750d484363cd212c3ade3d04f5c77d47d0ce/debugpy-1.8.18-cp313-cp313-manylinux_2_34_x86_64.whl", hash = "sha256:1b224887af5121fa702f9f542968170d104e3f9cac827d85fdefe89702dc235c", size = 4292542, upload-time = "2025-12-10T19:48:30.836Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/93/54/89de7ef84d5ac39fc64a773feaedd902536cc5295814cd22d19c6d9dea35/debugpy-1.8.18-cp313-cp313-win32.whl", hash = "sha256:636a5445a3336e4aba323a3545ca2bb373b04b0bc14084a4eb20c989db44429f", size = 5280460, upload-time = "2025-12-10T19:48:32.696Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4f/59/651329e618406229edbef6508a5aa05e43cd027f042740c5b27e46854b23/debugpy-1.8.18-cp313-cp313-win_amd64.whl", hash = "sha256:6da217ac8c1152d698b9809484d50c75bef9cc02fd6886a893a6df81ec952ff8", size = 5322399, upload-time = "2025-12-10T19:48:35.057Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/36/59/5e8bf46a66ca9dfcd0ce4f35c07085aeb60d99bf5c52135973a4e197ed41/debugpy-1.8.18-cp314-cp314-macosx_15_0_universal2.whl", hash = "sha256:be7f622d250fe3429571e84572eb771023f1da22c754f28d2c60a10d74a4cc1b", size = 2537336, upload-time = "2025-12-10T19:48:36.463Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a1/5a/3b37cc266a69da83a4febaa4267bb2062d4bec5287036e2f23d9a30a788c/debugpy-1.8.18-cp314-cp314-manylinux_2_34_x86_64.whl", hash = "sha256:df8bf7cd78019d5d155213bf5a1818b36403d0c3758d669e76827d4db026b840", size = 4268696, upload-time = "2025-12-10T19:48:37.855Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/de/4b/1e13586444440e5754b70055449b70afa187aaa167fa4c20c0c05d9c3b80/debugpy-1.8.18-cp314-cp314-win32.whl", hash = "sha256:32dd56d50fe15c47d0f930a7f0b9d3e5eb8ed04770bc6c313fba6d226f87e1e8", size = 5280624, upload-time = "2025-12-10T19:48:39.28Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7a/21/f8c12baa16212859269dc4c3e4b413778ec1154d332896d3c4cca96ac660/debugpy-1.8.18-cp314-cp314-win_amd64.whl", hash = "sha256:714b61d753cfe3ed5e7bf0aad131506d750e271726ac86e3e265fd7eeebbe765", size = 5321982, upload-time = "2025-12-10T19:48:41.086Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/dc/0d/bf7ac329c132436c57124202b5b5ccd6366e5d8e75eeb184cf078c826e8d/debugpy-1.8.18-py2.py3-none-any.whl", hash = "sha256:ab8cf0abe0fe2dfe1f7e65abc04b1db8740f9be80c1274acb625855c5c3ece6e", size = 5286576, upload-time = "2025-12-10T19:48:56.071Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4a/15/d762e5263d9e25b763b78be72dc084c7a32113a0bac119e2f7acae7700ed/debugpy-1.8.19-cp312-cp312-macosx_15_0_universal2.whl", hash = "sha256:bccb1540a49cde77edc7ce7d9d075c1dbeb2414751bc0048c7a11e1b597a4c2e", size = 2549995, upload-time = "2025-12-15T21:53:43.773Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a7/88/f7d25c68b18873b7c53d7c156ca7a7ffd8e77073aa0eac170a9b679cf786/debugpy-1.8.19-cp312-cp312-manylinux_2_34_x86_64.whl", hash = "sha256:e9c68d9a382ec754dc05ed1d1b4ed5bd824b9f7c1a8cd1083adb84b3c93501de", size = 4309891, upload-time = "2025-12-15T21:53:45.26Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c5/4f/a65e973aba3865794da65f71971dca01ae66666132c7b2647182d5be0c5f/debugpy-1.8.19-cp312-cp312-win32.whl", hash = "sha256:6599cab8a783d1496ae9984c52cb13b7c4a3bd06a8e6c33446832a5d97ce0bee", size = 5286355, upload-time = "2025-12-15T21:53:46.763Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d8/3a/d3d8b48fec96e3d824e404bf428276fb8419dfa766f78f10b08da1cb2986/debugpy-1.8.19-cp312-cp312-win_amd64.whl", hash = "sha256:66e3d2fd8f2035a8f111eb127fa508469dfa40928a89b460b41fd988684dc83d", size = 5328239, upload-time = "2025-12-15T21:53:48.868Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/71/3d/388035a31a59c26f1ecc8d86af607d0c42e20ef80074147cd07b180c4349/debugpy-1.8.19-cp313-cp313-macosx_15_0_universal2.whl", hash = "sha256:91e35db2672a0abaf325f4868fcac9c1674a0d9ad9bb8a8c849c03a5ebba3e6d", size = 2538859, upload-time = "2025-12-15T21:53:50.478Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4a/19/c93a0772d0962294f083dbdb113af1a7427bb632d36e5314297068f55db7/debugpy-1.8.19-cp313-cp313-manylinux_2_34_x86_64.whl", hash = "sha256:85016a73ab84dea1c1f1dcd88ec692993bcbe4532d1b49ecb5f3c688ae50c606", size = 4292575, upload-time = "2025-12-15T21:53:51.821Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5c/56/09e48ab796b0a77e3d7dc250f95251832b8bf6838c9632f6100c98bdf426/debugpy-1.8.19-cp313-cp313-win32.whl", hash = "sha256:b605f17e89ba0ecee994391194285fada89cee111cfcd29d6f2ee11cbdc40976", size = 5286209, upload-time = "2025-12-15T21:53:53.602Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fb/4e/931480b9552c7d0feebe40c73725dd7703dcc578ba9efc14fe0e6d31cfd1/debugpy-1.8.19-cp313-cp313-win_amd64.whl", hash = "sha256:c30639998a9f9cd9699b4b621942c0179a6527f083c72351f95c6ab1728d5b73", size = 5328206, upload-time = "2025-12-15T21:53:55.433Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f6/b9/cbec520c3a00508327476c7fce26fbafef98f412707e511eb9d19a2ef467/debugpy-1.8.19-cp314-cp314-macosx_15_0_universal2.whl", hash = "sha256:1e8c4d1bd230067bf1bbcdbd6032e5a57068638eb28b9153d008ecde288152af", size = 2537372, upload-time = "2025-12-15T21:53:57.318Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/88/5e/cf4e4dc712a141e10d58405c58c8268554aec3c35c09cdcda7535ff13f76/debugpy-1.8.19-cp314-cp314-manylinux_2_34_x86_64.whl", hash = "sha256:d40c016c1f538dbf1762936e3aeb43a89b965069d9f60f9e39d35d9d25e6b809", size = 4268729, upload-time = "2025-12-15T21:53:58.712Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/82/a3/c91a087ab21f1047db328c1d3eb5d1ff0e52de9e74f9f6f6fa14cdd93d58/debugpy-1.8.19-cp314-cp314-win32.whl", hash = "sha256:0601708223fe1cd0e27c6cce67a899d92c7d68e73690211e6788a4b0e1903f5b", size = 5286388, upload-time = "2025-12-15T21:54:00.687Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/17/b8/bfdc30b6e94f1eff09f2dc9cc1f9cd1c6cde3d996bcbd36ce2d9a4956e99/debugpy-1.8.19-cp314-cp314-win_amd64.whl", hash = "sha256:8e19a725f5d486f20e53a1dde2ab8bb2c9607c40c00a42ab646def962b41125f", size = 5327741, upload-time = "2025-12-15T21:54:02.148Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/25/3e/e27078370414ef35fafad2c06d182110073daaeb5d3bf734b0b1eeefe452/debugpy-1.8.19-py2.py3-none-any.whl", hash = "sha256:360ffd231a780abbc414ba0f005dad409e71c78637efe8f2bd75837132a41d38", size = 5292321, upload-time = "2025-12-15T21:54:16.024Z" }, ] [[package]] @@ -1561,27 +1557,29 @@ wheels = [ [[package]] name = "elastic-transport" -version = "8.12.0" +version = "8.17.1" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "certifi" }, { name = "urllib3" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f1/5e/9d697ca2511c2ecb3a239be91d5186a14fdbc97e15369c4ca6524c2929e8/elastic-transport-8.12.0.tar.gz", hash = "sha256:48839b942fcce199eece1558ecea6272e116c58da87ca8d495ef12eb61effaf7", size = 68977, upload-time = "2024-01-19T08:56:39.983Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6a/54/d498a766ac8fa475f931da85a154666cc81a70f8eb4a780bc8e4e934e9ac/elastic_transport-8.17.1.tar.gz", hash = "sha256:5edef32ac864dca8e2f0a613ef63491ee8d6b8cfb52881fa7313ba9290cac6d2", size = 73425, upload-time = "2025-03-13T07:28:30.776Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d6/35/94475b9a18eec053ebce144ff1e28c175772ce82244ada6ffc10b1a65bcc/elastic_transport-8.12.0-py3-none-any.whl", hash = "sha256:87d9dc9dee64a05235e7624ed7e6ab6e5ca16619aa7a6d22e853273b9f1cfbee", size = 59880, upload-time = "2024-01-19T08:56:37.877Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cf/cd/b71d5bc74cde7fc6fd9b2ff9389890f45d9762cbbbf81dc5e51fd7588c4a/elastic_transport-8.17.1-py3-none-any.whl", hash = "sha256:192718f498f1d10c5e9aa8b9cf32aed405e469a7f0e9d6a8923431dbb2c59fb8", size = 64969, upload-time = "2025-03-13T07:28:29.031Z" }, ] [[package]] name = "elasticsearch" -version = "8.12.1" +version = "8.19.3" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "elastic-transport" }, + { name = "python-dateutil" }, + { name = "typing-extensions" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/dc/e3/9be84318c57c7c1f488586fcf1f37edb907dfad8c9450f66429e04d7568a/elasticsearch-8.12.1.tar.gz", hash = "sha256:00c997720fbd0f2afe5417c8193cf65d116817a0250de0521e30c3e81f00b8ac", size = 345835, upload-time = "2024-02-22T04:50:52.634Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6b/79/365e306017a9fcfbbefab1a3b588d2404bea8806b36766ff0f886509a20e/elasticsearch-8.19.3.tar.gz", hash = "sha256:e84dd618a220cac25b962790085045dd27ac72e01c0a5d81bd29a2d47a71f03f", size = 800298, upload-time = "2025-12-23T12:56:00.72Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d6/6f/79f61e0c869363eccc85322b3004bee26ebabf038e84ce2798c872c69fa8/elasticsearch-8.12.1-py3-none-any.whl", hash = "sha256:cc459b7e0fb88dc85b43b9d7d254cffad552b0063a3e0a12290c8fa5f138c038", size = 432136, upload-time = "2024-02-22T04:50:48.223Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/56/0f/ac126833c385b06166d41c486e4911f58ad7791fd1a53dd6e0b8d16ff214/elasticsearch-8.19.3-py3-none-any.whl", hash = "sha256:fe1db2555811192e8a1be78b01234d0a49d32b185ea7eeeb6f059331dee32838", size = 952820, upload-time = "2025-12-23T12:55:56.796Z" }, ] [[package]] @@ -1716,7 +1714,7 @@ wheels = [ [[package]] name = "fastparquet" -version = "2024.11.0" +version = "2025.12.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "cramjam" }, @@ -1725,24 +1723,40 @@ dependencies = [ { name = "packaging" }, { name = "pandas" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b4/66/862da14f5fde4eff2cedc0f51a8dc34ba145088e5041b45b2d57ac54f922/fastparquet-2024.11.0.tar.gz", hash = "sha256:e3b1fc73fd3e1b70b0de254bae7feb890436cb67e99458b88cb9bd3cc44db419", size = 467192, upload-time = "2024-11-15T19:30:10.413Z" } -wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/08/76/068ac7ec9b4fc783be21a75a6a90b8c0654da4d46934d969e524ce287787/fastparquet-2024.11.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:dbad4b014782bd38b58b8e9f514fe958cfa7a6c4e187859232d29fd5c5ddd849", size = 915968, upload-time = "2024-11-12T20:37:52.861Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c7/9e/6d3b4188ad64ed51173263c07109a5f18f9c84a44fa39ab524fca7420cda/fastparquet-2024.11.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:403d31109d398b6be7ce84fa3483fc277c6a23f0b321348c0a505eb098a041cb", size = 685399, upload-time = "2024-11-12T20:37:54.899Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8f/6c/809220bc9fbe83d107df2d664c3fb62fb81867be8f5218ac66c2e6b6a358/fastparquet-2024.11.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cbbb9057a26acf0abad7adf58781ee357258b7708ee44a289e3bee97e2f55d42", size = 1758557, upload-time = "2024-11-12T20:37:56.553Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e0/2c/b3b3e6ca2e531484289024138cd4709c22512b3fe68066d7f9849da4a76c/fastparquet-2024.11.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:63e0e416e25c15daa174aad8ba991c2e9e5b0dc347e5aed5562124261400f87b", size = 1781052, upload-time = "2024-11-12T20:37:58.339Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/21/fe/97ed45092d0311c013996dae633122b7a51c5d9fe8dcbc2c840dc491201e/fastparquet-2024.11.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0e2d7f02f57231e6c86d26e9ea71953737202f20e948790e5d4db6d6a1a150dc", size = 1715797, upload-time = "2024-11-12T20:38:00.694Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/24/df/02fa6aee6c0d53d1563b5bc22097076c609c4c5baa47056b0b4bed456fcf/fastparquet-2024.11.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:fbe4468146b633d8f09d7b196fea0547f213cb5ce5f76e9d1beb29eaa9593a93", size = 1795682, upload-time = "2024-11-12T20:38:02.38Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b0/25/f4f87557589e1923ee0e3bebbc84f08b7c56962bf90f51b116ddc54f2c9f/fastparquet-2024.11.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:29d5c718817bcd765fc519b17f759cad4945974421ecc1931d3bdc3e05e57fa9", size = 1857842, upload-time = "2024-11-12T20:38:04.196Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b1/f9/98cd0c39115879be1044d59c9b76e8292776e99bb93565bf990078fd11c4/fastparquet-2024.11.0-cp312-cp312-win_amd64.whl", hash = "sha256:74a0b3c40ab373442c0fda96b75a36e88745d8b138fcc3a6143e04682cbbb8ca", size = 673269, upload-time = "2024-12-11T21:22:48.073Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/47/e3/e7db38704be5db787270d43dde895eaa1a825ab25dc245e71df70860ec12/fastparquet-2024.11.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:59e5c5b51083d5b82572cdb7aed0346e3181e3ac9d2e45759da2e804bdafa7ee", size = 912523, upload-time = "2024-11-12T20:38:06.003Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d3/66/e3387c99293dae441634e7724acaa425b27de19a00ee3d546775dace54a9/fastparquet-2024.11.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:bdadf7b6bad789125b823bfc5b0a719ba5c4a2ef965f973702d3ea89cff057f6", size = 683779, upload-time = "2024-11-12T20:38:07.442Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0a/21/d112d0573d086b578bf04302a502e9a7605ea8f1244a7b8577cd945eec78/fastparquet-2024.11.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:46b2db02fc2a1507939d35441c8ab211d53afd75d82eec9767d1c3656402859b", size = 1751113, upload-time = "2024-11-12T20:38:09.36Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6b/a7/040507cee3a7798954e8fdbca21d2dbc532774b02b882d902b8a4a6849ef/fastparquet-2024.11.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a3afdef2895c9f459135a00a7ed3ceafebfbce918a9e7b5d550e4fae39c1b64d", size = 1780496, upload-time = "2024-11-12T20:38:11.022Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bc/75/d0d9f7533d780ec167eede16ad88073ee71696150511126c31940e7f73aa/fastparquet-2024.11.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:36b5c9bd2ffaaa26ff45d59a6cefe58503dd748e0c7fad80dd905749da0f2b9e", size = 1713608, upload-time = "2024-11-12T20:38:12.848Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/30/fa/1d95bc86e45e80669c4f374b2ca26a9e5895a1011bb05d6341b4a7414693/fastparquet-2024.11.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:6b7df5d3b61a19d76e209fe8d3133759af1c139e04ebc6d43f3cc2d8045ef338", size = 1792779, upload-time = "2024-11-12T20:38:14.5Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/13/3d/c076beeb926c79593374c04662a9422a76650eef17cd1c8e10951340764a/fastparquet-2024.11.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:8b35823ac7a194134e5f82fa4a9659e42e8f9ad1f2d22a55fbb7b9e4053aabbb", size = 1851322, upload-time = "2024-11-12T20:38:16.231Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/09/5a/1d0d47e64816002824d4a876644e8c65540fa23f91b701f0daa726931545/fastparquet-2024.11.0-cp313-cp313-win_amd64.whl", hash = "sha256:d20632964e65530374ff7cddd42cc06aa0a1388934903693d6d22592a5ba827b", size = 673266, upload-time = "2024-11-12T20:38:17.661Z" }, +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1e/ad/87f7f5750685e8e0a359d732c85332481ba9b5723af579f8755f81154d0b/fastparquet-2025.12.0.tar.gz", hash = "sha256:85f807d3846c7691855a68ed7ff6ee40654b72b997f5b1199e6310a1e19d1cd5", size = 480045, upload-time = "2025-12-18T16:22:22.016Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6c/b2/229a4482d80a737d0fe6706c4f93adb631f42ec5b0a2b154247d63bb48fe/fastparquet-2025.12.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:27b1cf0557ddddbf0e28db64d4d3bea1384be1d245b2cef280d001811e3600fe", size = 896986, upload-time = "2025-12-18T21:53:52.611Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2c/c2/953117c43bf617379eff79ce8a2318ef49f7f41908faade051fa12281ac8/fastparquet-2025.12.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:9356c59e48825d61719960ccb9ce799ad5cd1b04f2f13368f03fab1f3c645d1e", size = 687642, upload-time = "2025-12-18T21:54:13.594Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/92/35/41deaa9a4fc9ab6c00f3b49afe56cbafee13a111032aa41f23d077b69ad6/fastparquet-2025.12.0-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:c4c92e299a314d4b542dc881eeb4d587dc075c0a5a86c07ccf171d8852e9736d", size = 1764260, upload-time = "2025-12-18T21:58:11.197Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1a/0f/a229b3f699aaccc7b5ec3f5e21cff8aa99bc199499bff08cf38bc6ab52c6/fastparquet-2025.12.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4881dc91c7e6d1d08cda9968ed1816b0c66a74b1826014c26713cad923aaca71", size = 1810920, upload-time = "2025-12-18T21:57:31.514Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/90/c2/ca76afca0c2debef368a42a701d501e696490e0a7138f0337709a724b189/fastparquet-2025.12.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d8d70d90614f19752919037c4a88aaaeda3cd7667aeb54857c48054e2a9e3588", size = 1819692, upload-time = "2025-12-18T21:58:43.095Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ab/41/f235c0d8171f6676b9d4fb8468c781fbe7bf90fed2c4383f2d8d82e574db/fastparquet-2025.12.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:8e2ccf387f629cb11b72fec6f15a55e0f40759b47713124764a9867097bcd377", size = 1784357, upload-time = "2025-12-18T21:58:13.258Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/29/7e/c86bf33b363cf5a1ad71d3ebd4a352131ba99566c78aa58d9e56c98526ba/fastparquet-2025.12.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1978e7f3c32044f2f7a0b35784240dfc3eaeb8065a879fa3011c832fea4e7037", size = 1815777, upload-time = "2025-12-18T21:58:44.432Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d7/0b/769333ab6e6ed401755b550b3338cee96b8f6502db5da55312d86a97db62/fastparquet-2025.12.0-cp312-cp312-win_amd64.whl", hash = "sha256:25e87fff63c011fe658a7547ba83355e02568db1ee26a65e6b75c2287701d5dc", size = 667555, upload-time = "2026-01-06T21:24:36.381Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/13/cf/1801afbc1e84ad0413ec66bf93590472152462c454593e3be3265861aa0f/fastparquet-2025.12.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:1bd79ca75977aaeaae8d2a6cb1958e806991f0ff23207b938522a59a724491b2", size = 893835, upload-time = "2025-12-18T21:53:53.87Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/79/f9/5539b19ae7e1e0ad77f5b8a1e8d480fdf0193639cf97239734173b8730ab/fastparquet-2025.12.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:b6db801b72433d8227fcb92009a631f14d6d49a43b3c599911b58a8a6ffde9e3", size = 686010, upload-time = "2025-12-18T21:54:15.234Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ff/d9/0f39782c500bbf6b2e40a67cac3c9ec2eae70bdaa8b283106c2b3d532a95/fastparquet-2025.12.0-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:23cce7202de91b64abb251cec07125d94e8108eb99aab6ffa42570a89a5c869d", size = 1755599, upload-time = "2025-12-18T21:58:15.016Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b5/16/d0d0c5ca6a9fa13e2f36e6983452d798d8116bd5d05bf23246efd1c23dc8/fastparquet-2025.12.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:038c3ed1f211f538cd03df7b053cc842677efd5832e37b000a8c721584ff42b4", size = 1801454, upload-time = "2025-12-18T21:57:33.097Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/eb/26/6c6a1cae46104a3ec5da87cb5fefb3eac0c07f04e56786f928164942e91a/fastparquet-2025.12.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:424ffcfc89c678eb8e695ff882d114e46beda8b7e13be58b6793f2ee07c84a6f", size = 1812257, upload-time = "2025-12-18T21:58:46.275Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/69/77/6a7158e2817d44fb80f32a4a4c3f8cadf7e273fac34e04155588bf2b3141/fastparquet-2025.12.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:f25aae3e585dd033ed02ee167a825bf1fcb440629c63f7d59d6c4d2789c327a3", size = 1776841, upload-time = "2025-12-18T21:58:16.654Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ee/89/58b1d885dcf05ba619d3a9bbf61b3bff611c4636880077be8659bf29ce94/fastparquet-2025.12.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:90ac4a51e5acb2644ec111532c8fcfc128efcc351ba2ee914394a58460310b93", size = 1810507, upload-time = "2025-12-18T21:58:48.336Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f8/10/380cba3ee18b25384cbf0d229b8cad47d63eb89c630f267cf1e11c64fe16/fastparquet-2025.12.0-cp313-cp313-win_amd64.whl", hash = "sha256:7ac92db3b3200fe3be07363277678bfd532c6723510b40c20510631ca434a049", size = 667416, upload-time = "2025-12-18T21:59:12.405Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1a/3a/7bc677df8d4dadc4f7f2dee035c9578aa0e79e2c0f58ddc78e197e24fbc2/fastparquet-2025.12.0-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:c0fe3f8a73160be7778e1a54ac4463b49a7e35e1f6c7fb9876b36d2ec572bead", size = 900184, upload-time = "2025-12-18T21:53:56.193Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c5/aa/2c726bfd2a6c0e18854a924c3faeee1c2e934b03915c8d2111a3c3f7c0fd/fastparquet-2025.12.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:aec3a736e3c43f7d8f911946f4c56b8cc17e803932ca0cb75bb2643796adabeb", size = 692174, upload-time = "2025-12-18T21:54:16.329Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e3/c4/a0936ac68c7209ab4979ac45ab59d6efa700b5ddac62031f4ddd6b462f0d/fastparquet-2025.12.0-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:8aa32817dd571b10974b04c66e470a181208840466f155280ff3df43946c6b92", size = 1755044, upload-time = "2025-12-18T21:58:18.404Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/64/54/0b06b3c8a778fd0795426e2a529672cb6925541ba2a1076e3d8940a6c565/fastparquet-2025.12.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9f5a9dc0036838950e449d6d05dd48e25b6b2741568b4e0872823195e23890b1", size = 1793074, upload-time = "2025-12-18T21:57:34.995Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/11/23/7b5109f7ec39dbe3dc847a3a3d63105a78717d9fe874abbba7a90f047b31/fastparquet-2025.12.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:05971c0974b5bb00c01622fe248f83008e58f06224212c778f7d46ccb092a7d2", size = 1802137, upload-time = "2025-12-18T21:58:50.504Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6a/8b/f3acc13ffec64803bbbb56977147e8ea105426f5034c9041d5d6d01c7e62/fastparquet-2025.12.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:e86a3407933ff510dad077139eaae2c664d2bdeeb0b6ece2a1e1c98c87257dd3", size = 1781629, upload-time = "2025-12-18T21:58:20.015Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/13/66/c102a8b01976afd4408ccfc7f121516168faaafb86a201716116ce5120d0/fastparquet-2025.12.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:00349200d1103a34e34a94f535c1bf19870ab1654388b8a2aa50ca34046fc071", size = 1806721, upload-time = "2025-12-18T21:58:52.495Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b2/83/13340110f7daa99db2c9f090a2790602515dabc6dc263e88931482aaaf66/fastparquet-2025.12.0-cp314-cp314-win_amd64.whl", hash = "sha256:8f42036889a5729da1cae6e2a599b9c8b93af6f99973015ac14225d529300982", size = 673274, upload-time = "2025-12-18T21:59:13.642Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ff/df/22f149b01de42cc69a4faa1047e1902a91bf1085e79ccba20caceded8607/fastparquet-2025.12.0-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:a4e9165c98f0fdac70aba728055424b0b2830a9cb02e9048d3d82d2e9c0294c1", size = 929604, upload-time = "2025-12-18T21:53:57.814Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f1/e8/18b0831254eb8a3b07caf374a23dc011eeffa5f8bc5507d2b43498bc577d/fastparquet-2025.12.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:69b80faf4c9d154fc95d3f291a55b1d782c684e9fcfe443a274c3e92d36a963c", size = 708902, upload-time = "2025-12-18T21:54:17.803Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e8/0c/a29aa2c84b46d35e5dc4ece79f0fca67a6889a51ac3d0330a7fb22cf82fd/fastparquet-2025.12.0-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:8b9c9108127778d9628cce342f4e4c98890a4b686f677ed4973bc0edd6e25af9", size = 1771639, upload-time = "2025-12-18T21:58:21.761Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9f/62/2d851d5effe3c95b36ae948fb7da46d00ae8f88ae0d6907403b2ac5183c9/fastparquet-2025.12.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9c052cacccfc6f8cb2ca98e809380969214b79471d49867f802184d3ea68d1e9", size = 1830649, upload-time = "2025-12-18T21:57:36.884Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bf/a1/868f2d5db3fc9965e4ca6a68f6ab5fef3ade0104136e3556299c952bc720/fastparquet-2025.12.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c027278b5372e11a005b8d1ad9d85e86a9d70077dc8918cda99f90e657dc7251", size = 1820867, upload-time = "2025-12-18T21:58:54.645Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/20/9c/f900734e546425509cf1f5cc9cd4f75275dff45c40d8c65feb0f148e4118/fastparquet-2025.12.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:618cc4388f5bc1d85587c0842f6c0d1af8ab2e27a5aa8074aa233b157f68f2c0", size = 1786865, upload-time = "2025-12-18T21:58:23.136Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/34/14/88068907d837964d407d5835df6672ea635881d6e0937ca21dac088342bc/fastparquet-2025.12.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:3e3fac9215a00a6a6836400437a7797841cb2f6393e38ff0a77c5e1aa37cfa44", size = 1817440, upload-time = "2025-12-18T21:58:56.702Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7a/d9/5c4a0871d7b111c7115c02feb071c07a0a1c1da0afc1c35d9acb7958fd95/fastparquet-2025.12.0-cp314-cp314t-win_amd64.whl", hash = "sha256:1bbacfff213b1cfbfa189ba1023f3fa9e3025ce6590c1becdb76a6ac1e84e623", size = 707783, upload-time = "2025-12-18T21:59:15.138Z" }, ] [[package]] @@ -1812,11 +1826,11 @@ wheels = [ [[package]] name = "filelock" -version = "3.15.4" +version = "3.20.3" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/08/dd/49e06f09b6645156550fb9aee9cc1e59aba7efbc972d665a1bd6ae0435d4/filelock-3.15.4.tar.gz", hash = "sha256:2207938cbc1844345cb01a5a95524dae30f0ce089eba5b00378295a17e3e90cb", size = 18007, upload-time = "2024-06-22T15:59:14.749Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1d/65/ce7f1b70157833bf3cb851b556a37d4547ceafc158aa9b34b36782f23696/filelock-3.20.3.tar.gz", hash = "sha256:18c57ee915c7ec61cff0ecf7f0f869936c7c30191bb0cf406f1341778d0834e1", size = 19485, upload-time = "2026-01-09T17:55:05.421Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ae/f0/48285f0262fe47103a4a45972ed2f9b93e4c80b8fd609fa98da78b2a5706/filelock-3.15.4-py3-none-any.whl", hash = "sha256:6ca1fffae96225dab4c6eaf1c4f4f28cd2568d3ec2a44e15a08520504de468e7", size = 16159, upload-time = "2024-06-22T15:59:12.695Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b5/36/7fb70f04bf00bc646cd5bb45aa9eddb15e19437a28b8fb2b4a5249fac770/filelock-3.20.3-py3-none-any.whl", hash = "sha256:4b0dda527ee31078689fc205ec4f1c1bf7d56cf88b6dc9426c4f230e46c2dce1", size = 16701, upload-time = "2026-01-09T17:55:04.334Z" }, ] [[package]] @@ -1835,18 +1849,19 @@ sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8a/e4/05e80adeadc39f [[package]] name = "flask" -version = "3.0.3" +version = "3.1.2" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "blinker" }, { name = "click" }, { name = "itsdangerous" }, { name = "jinja2" }, + { name = "markupsafe" }, { name = "werkzeug" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/41/e1/d104c83026f8d35dfd2c261df7d64738341067526406b40190bc063e829a/flask-3.0.3.tar.gz", hash = "sha256:ceb27b0af3823ea2737928a4d99d125a06175b8512c445cbd9a9ce200ef76842", size = 676315, upload-time = "2024-04-07T19:26:11.035Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/dc/6d/cfe3c0fcc5e477df242b98bfe186a4c34357b4847e87ecaef04507332dab/flask-3.1.2.tar.gz", hash = "sha256:bf656c15c80190ed628ad08cdfd3aaa35beb087855e2f494910aa3774cc4fd87", size = 720160, upload-time = "2025-08-19T21:03:21.205Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/61/80/ffe1da13ad9300f87c93af113edd0638c75138c42a0994becfacac078c06/flask-3.0.3-py3-none-any.whl", hash = "sha256:34e815dfaa43340d1d15a5c3a02b8476004037eb4840b34910c6e21679d288f3", size = 101735, upload-time = "2024-04-07T19:26:08.569Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ec/f9/7f9263c5695f4bd0023734af91bedb2ff8209e8de6ead162f35d8dc762fd/flask-3.1.2-py3-none-any.whl", hash = "sha256:ca1d8112ec8a6158cc29ea4858963350011b5c846a414cdb7a954aa9e967d03c", size = 103308, upload-time = "2025-08-19T21:03:19.499Z" }, ] [[package]] @@ -1904,52 +1919,51 @@ wheels = [ [[package]] name = "flatbuffers" -version = "25.9.23" +version = "25.12.19" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9d/1f/3ee70b0a55137442038f2a33469cc5fddd7e0ad2abf83d7497c18a2b6923/flatbuffers-25.9.23.tar.gz", hash = "sha256:676f9fa62750bb50cf531b42a0a2a118ad8f7f797a511eda12881c016f093b12", size = 22067, upload-time = "2025-09-24T05:25:30.106Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ee/1b/00a78aa2e8fbd63f9af08c9c19e6deb3d5d66b4dda677a0f61654680ee89/flatbuffers-25.9.23-py2.py3-none-any.whl", hash = "sha256:255538574d6cb6d0a79a17ec8bc0d30985913b87513a01cce8bcdb6b4c44d0e2", size = 30869, upload-time = "2025-09-24T05:25:28.912Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e8/2d/d2a548598be01649e2d46231d151a6c56d10b964d94043a335ae56ea2d92/flatbuffers-25.12.19-py2.py3-none-any.whl", hash = "sha256:7634f50c427838bb021c2d66a3d1168e9d199b0607e6329399f04846d42e20b4", size = 26661, upload-time = "2025-12-19T23:16:13.622Z" }, ] [[package]] name = "fonttools" -version = "4.61.0" -source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/33/f9/0e84d593c0e12244150280a630999835a64f2852276161b62a0f98318de0/fonttools-4.61.0.tar.gz", hash = "sha256:ec520a1f0c7758d7a858a00f090c1745f6cde6a7c5e76fb70ea4044a15f712e7", size = 3561884, upload-time = "2025-11-28T17:05:49.491Z" } -wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/00/5d/19e5939f773c7cb05480fe2e881d63870b63ee2b4bdb9a77d55b1d36c7b9/fonttools-4.61.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:e24a1565c4e57111ec7f4915f8981ecbb61adf66a55f378fdc00e206059fcfef", size = 2846930, upload-time = "2025-11-28T17:04:46.639Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/25/b2/0658faf66f705293bd7e739a4f038302d188d424926be9c59bdad945664b/fonttools-4.61.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:e2bfacb5351303cae9f072ccf3fc6ecb437a6f359c0606bae4b1ab6715201d87", size = 2383016, upload-time = "2025-11-28T17:04:48.525Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/29/a3/1fa90b95b690f0d7541f48850adc40e9019374d896c1b8148d15012b2458/fonttools-4.61.0-cp312-cp312-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:0bdcf2e29d65c26299cc3d502f4612365e8b90a939f46cd92d037b6cb7bb544a", size = 4949425, upload-time = "2025-11-28T17:04:50.482Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/af/00/acf18c00f6c501bd6e05ee930f926186f8a8e268265407065688820f1c94/fonttools-4.61.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e6cd0d9051b8ddaf7385f99dd82ec2a058e2b46cf1f1961e68e1ff20fcbb61af", size = 4999632, upload-time = "2025-11-28T17:04:52.508Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5f/e0/19a2b86e54109b1d2ee8743c96a1d297238ae03243897bc5345c0365f34d/fonttools-4.61.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e074bc07c31406f45c418e17c1722e83560f181d122c412fa9e815df0ff74810", size = 4939438, upload-time = "2025-11-28T17:04:54.437Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/04/35/7b57a5f57d46286360355eff8d6b88c64ab6331107f37a273a71c803798d/fonttools-4.61.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:5a9b78da5d5faa17e63b2404b77feeae105c1b7e75f26020ab7a27b76e02039f", size = 5088960, upload-time = "2025-11-28T17:04:56.348Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3e/0e/6c5023eb2e0fe5d1ababc7e221e44acd3ff668781489cc1937a6f83d620a/fonttools-4.61.0-cp312-cp312-win32.whl", hash = "sha256:9821ed77bb676736b88fa87a737c97b6af06e8109667e625a4f00158540ce044", size = 2264404, upload-time = "2025-11-28T17:04:58.149Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/36/0b/63273128c7c5df19b1e4cd92e0a1e6ea5bb74a400c4905054c96ad60a675/fonttools-4.61.0-cp312-cp312-win_amd64.whl", hash = "sha256:0011d640afa61053bc6590f9a3394bd222de7cfde19346588beabac374e9d8ac", size = 2314427, upload-time = "2025-11-28T17:04:59.812Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/17/45/334f0d7f181e5473cfb757e1b60f4e60e7fc64f28d406e5d364a952718c0/fonttools-4.61.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ba774b8cbd8754f54b8eb58124e8bd45f736b2743325ab1a5229698942b9b433", size = 2841801, upload-time = "2025-11-28T17:05:01.621Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cc/63/97b9c78e1f79bc741d4efe6e51f13872d8edb2b36e1b9fb2bab0d4491bb7/fonttools-4.61.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:c84b430616ed73ce46e9cafd0bf0800e366a3e02fb7e1ad7c1e214dbe3862b1f", size = 2379024, upload-time = "2025-11-28T17:05:03.668Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4e/80/c87bc524a90dbeb2a390eea23eae448286983da59b7e02c67fa0ca96a8c5/fonttools-4.61.0-cp313-cp313-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:b2b734d8391afe3c682320840c8191de9bd24e7eb85768dd4dc06ed1b63dbb1b", size = 4923706, upload-time = "2025-11-28T17:05:05.494Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6d/f6/a3b0374811a1de8c3f9207ec88f61ad1bb96f938ed89babae26c065c2e46/fonttools-4.61.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a5c5fff72bf31b0e558ed085e4fd7ed96eb85881404ecc39ed2a779e7cf724eb", size = 4979751, upload-time = "2025-11-28T17:05:07.665Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a5/3b/30f63b4308b449091573285f9d27619563a84f399946bca3eadc9554afbe/fonttools-4.61.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:14a290c5c93fcab76b7f451e6a4b7721b712d90b3b5ed6908f1abcf794e90d6d", size = 4921113, upload-time = "2025-11-28T17:05:09.551Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/41/6c/58e6e9b7d9d8bf2d7010bd7bb493060b39b02a12d1cda64a8bfb116ce760/fonttools-4.61.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:13e3e20a5463bfeb77b3557d04b30bd6a96a6bb5c15c7b2e7908903e69d437a0", size = 5063183, upload-time = "2025-11-28T17:05:11.677Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3f/e3/52c790ab2b07492df059947a1fd7778e105aac5848c0473029a4d20481a2/fonttools-4.61.0-cp313-cp313-win32.whl", hash = "sha256:6781e7a4bb010be1cd69a29927b0305c86b843395f2613bdabe115f7d6ea7f34", size = 2263159, upload-time = "2025-11-28T17:05:13.292Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e9/1f/116013b200fbeba871046554d5d2a45fefa69a05c40e9cdfd0d4fff53edc/fonttools-4.61.0-cp313-cp313-win_amd64.whl", hash = "sha256:c53b47834ae41e8e4829171cc44fec0fdf125545a15f6da41776b926b9645a9a", size = 2313530, upload-time = "2025-11-28T17:05:14.848Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d3/99/59b1e25987787cb714aa9457cee4c9301b7c2153f0b673e2b8679d37669d/fonttools-4.61.0-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:96dfc9bc1f2302224e48e6ee37e656eddbab810b724b52e9d9c13a57a6abad01", size = 2841429, upload-time = "2025-11-28T17:05:16.671Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2b/b2/4c1911d4332c8a144bb3b44416e274ccca0e297157c971ea1b3fbb855590/fonttools-4.61.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:3b2065d94e5d63aafc2591c8b6ccbdb511001d9619f1bca8ad39b745ebeb5efa", size = 2378987, upload-time = "2025-11-28T17:05:18.69Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/24/b0/f442e90fde5d2af2ae0cb54008ab6411edc557ee33b824e13e1d04925ac9/fonttools-4.61.0-cp314-cp314-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:e0d87e81e4d869549585ba0beb3f033718501c1095004f5e6aef598d13ebc216", size = 4873270, upload-time = "2025-11-28T17:05:20.625Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bb/04/f5d5990e33053c8a59b90b1d7e10ad9b97a73f42c745304da0e709635fab/fonttools-4.61.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1cfa2eb9bae650e58f0e8ad53c49d19a844d6034d6b259f30f197238abc1ccee", size = 4968270, upload-time = "2025-11-28T17:05:22.515Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/94/9f/2091402e0d27c9c8c4bab5de0e5cd146d9609a2d7d1c666bbb75c0011c1a/fonttools-4.61.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:4238120002e68296d55e091411c09eab94e111c8ce64716d17df53fd0eb3bb3d", size = 4919799, upload-time = "2025-11-28T17:05:24.437Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a8/72/86adab22fde710b829f8ffbc8f264df01928e5b7a8f6177fa29979ebf256/fonttools-4.61.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:b6ceac262cc62bec01b3bb59abccf41b24ef6580869e306a4e88b7e56bb4bdda", size = 5030966, upload-time = "2025-11-28T17:05:26.115Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e8/a7/7c8e31b003349e845b853f5e0a67b95ff6b052fa4f5224f8b72624f5ac69/fonttools-4.61.0-cp314-cp314-win32.whl", hash = "sha256:adbb4ecee1a779469a77377bbe490565effe8fce6fb2e6f95f064de58f8bac85", size = 2267243, upload-time = "2025-11-28T17:05:27.807Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/20/ee/f434fe7749360497c52b7dcbcfdbccdaab0a71c59f19d572576066717122/fonttools-4.61.0-cp314-cp314-win_amd64.whl", hash = "sha256:02bdf8e04d1a70476564b8640380f04bb4ac74edc1fc71f1bacb840b3e398ee9", size = 2318822, upload-time = "2025-11-28T17:05:29.882Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/33/b3/c16255320255e5c1863ca2b2599bb61a46e2f566db0bbb9948615a8fe692/fonttools-4.61.0-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:627216062d90ab0d98215176d8b9562c4dd5b61271d35f130bcd30f6a8aaa33a", size = 2924917, upload-time = "2025-11-28T17:05:31.46Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e2/b8/08067ae21de705a817777c02ef36ab0b953cbe91d8adf134f9c2da75ed6d/fonttools-4.61.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:7b446623c9cd5f14a59493818eaa80255eec2468c27d2c01b56e05357c263195", size = 2413576, upload-time = "2025-11-28T17:05:33.343Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/42/f1/96ff43f92addce2356780fdc203f2966206f3d22ea20e242c27826fd7442/fonttools-4.61.0-cp314-cp314t-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:70e2a0c0182ee75e493ef33061bfebf140ea57e035481d2f95aa03b66c7a0e05", size = 4877447, upload-time = "2025-11-28T17:05:35.278Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d0/1e/a3d8e51ed9ccfd7385e239ae374b78d258a0fb82d82cab99160a014a45d1/fonttools-4.61.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9064b0f55b947e929ac669af5311ab1f26f750214db6dd9a0c97e091e918f486", size = 5095681, upload-time = "2025-11-28T17:05:37.142Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/eb/f6/d256bd6c1065c146a0bdddf1c62f542e08ae5b3405dbf3fcc52be272f674/fonttools-4.61.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:2cb5e45a824ce14b90510024d0d39dae51bd4fbb54c42a9334ea8c8cf4d95cbe", size = 4974140, upload-time = "2025-11-28T17:05:39.5Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5d/0c/96633eb4b26f138cc48561c6e0c44b4ea48acea56b20b507d6b14f8e80ce/fonttools-4.61.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:6e5ca8c62efdec7972dfdfd454415c4db49b89aeaefaaacada432f3b7eea9866", size = 5001741, upload-time = "2025-11-28T17:05:41.424Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6f/9a/3b536bad3be4f26186f296e749ff17bad3e6d57232c104d752d24b2e265b/fonttools-4.61.0-cp314-cp314t-win32.whl", hash = "sha256:63c7125d31abe3e61d7bb917329b5543c5b3448db95f24081a13aaf064360fc8", size = 2330707, upload-time = "2025-11-28T17:05:43.548Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/18/ea/e6b9ac610451ee9f04477c311ad126de971f6112cb579fa391d2a8edb00b/fonttools-4.61.0-cp314-cp314t-win_amd64.whl", hash = "sha256:67d841aa272be5500de7f447c40d1d8452783af33b4c3599899319f6ef9ad3c1", size = 2395950, upload-time = "2025-11-28T17:05:45.638Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0c/14/634f7daea5ffe6a5f7a0322ba8e1a0e23c9257b80aa91458107896d1dfc7/fonttools-4.61.0-py3-none-any.whl", hash = "sha256:276f14c560e6f98d24ef7f5f44438e55ff5a67f78fa85236b218462c9f5d0635", size = 1144485, upload-time = "2025-11-28T17:05:47.573Z" }, +version = "4.61.1" +source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ec/ca/cf17b88a8df95691275a3d77dc0a5ad9907f328ae53acbe6795da1b2f5ed/fonttools-4.61.1.tar.gz", hash = "sha256:6675329885c44657f826ef01d9e4fb33b9158e9d93c537d84ad8399539bc6f69", size = 3565756, upload-time = "2025-12-12T17:31:24.246Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6f/16/7decaa24a1bd3a70c607b2e29f0adc6159f36a7e40eaba59846414765fd4/fonttools-4.61.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:f3cb4a569029b9f291f88aafc927dd53683757e640081ca8c412781ea144565e", size = 2851593, upload-time = "2025-12-12T17:30:04.225Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/94/98/3c4cb97c64713a8cf499b3245c3bf9a2b8fd16a3e375feff2aed78f96259/fonttools-4.61.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:41a7170d042e8c0024703ed13b71893519a1a6d6e18e933e3ec7507a2c26a4b2", size = 2400231, upload-time = "2025-12-12T17:30:06.47Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b7/37/82dbef0f6342eb01f54bca073ac1498433d6ce71e50c3c3282b655733b31/fonttools-4.61.1-cp312-cp312-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:10d88e55330e092940584774ee5e8a6971b01fc2f4d3466a1d6c158230880796", size = 4954103, upload-time = "2025-12-12T17:30:08.432Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6c/44/f3aeac0fa98e7ad527f479e161aca6c3a1e47bb6996b053d45226fe37bf2/fonttools-4.61.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:15acc09befd16a0fb8a8f62bc147e1a82817542d72184acca9ce6e0aeda9fa6d", size = 5004295, upload-time = "2025-12-12T17:30:10.56Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/14/e8/7424ced75473983b964d09f6747fa09f054a6d656f60e9ac9324cf40c743/fonttools-4.61.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e6bcdf33aec38d16508ce61fd81838f24c83c90a1d1b8c68982857038673d6b8", size = 4944109, upload-time = "2025-12-12T17:30:12.874Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c8/8b/6391b257fa3d0b553d73e778f953a2f0154292a7a7a085e2374b111e5410/fonttools-4.61.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:5fade934607a523614726119164ff621e8c30e8fa1ffffbbd358662056ba69f0", size = 5093598, upload-time = "2025-12-12T17:30:15.79Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d9/71/fd2ea96cdc512d92da5678a1c98c267ddd4d8c5130b76d0f7a80f9a9fde8/fonttools-4.61.1-cp312-cp312-win32.whl", hash = "sha256:75da8f28eff26defba42c52986de97b22106cb8f26515b7c22443ebc9c2d3261", size = 2269060, upload-time = "2025-12-12T17:30:18.058Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/80/3b/a3e81b71aed5a688e89dfe0e2694b26b78c7d7f39a5ffd8a7d75f54a12a8/fonttools-4.61.1-cp312-cp312-win_amd64.whl", hash = "sha256:497c31ce314219888c0e2fce5ad9178ca83fe5230b01a5006726cdf3ac9f24d9", size = 2319078, upload-time = "2025-12-12T17:30:22.862Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4b/cf/00ba28b0990982530addb8dc3e9e6f2fa9cb5c20df2abdda7baa755e8fe1/fonttools-4.61.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:8c56c488ab471628ff3bfa80964372fc13504ece601e0d97a78ee74126b2045c", size = 2846454, upload-time = "2025-12-12T17:30:24.938Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5a/ca/468c9a8446a2103ae645d14fee3f610567b7042aba85031c1c65e3ef7471/fonttools-4.61.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:dc492779501fa723b04d0ab1f5be046797fee17d27700476edc7ee9ae535a61e", size = 2398191, upload-time = "2025-12-12T17:30:27.343Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a3/4b/d67eedaed19def5967fade3297fed8161b25ba94699efc124b14fb68cdbc/fonttools-4.61.1-cp313-cp313-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:64102ca87e84261419c3747a0d20f396eb024bdbeb04c2bfb37e2891f5fadcb5", size = 4928410, upload-time = "2025-12-12T17:30:29.771Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b0/8d/6fb3494dfe61a46258cd93d979cf4725ded4eb46c2a4ca35e4490d84daea/fonttools-4.61.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4c1b526c8d3f615a7b1867f38a9410849c8f4aef078535742198e942fba0e9bd", size = 4984460, upload-time = "2025-12-12T17:30:32.073Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f7/f1/a47f1d30b3dc00d75e7af762652d4cbc3dff5c2697a0dbd5203c81afd9c3/fonttools-4.61.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:41ed4b5ec103bd306bb68f81dc166e77409e5209443e5773cb4ed837bcc9b0d3", size = 4925800, upload-time = "2025-12-12T17:30:34.339Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a7/01/e6ae64a0981076e8a66906fab01539799546181e32a37a0257b77e4aa88b/fonttools-4.61.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:b501c862d4901792adaec7c25b1ecc749e2662543f68bb194c42ba18d6eec98d", size = 5067859, upload-time = "2025-12-12T17:30:36.593Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/73/aa/28e40b8d6809a9b5075350a86779163f074d2b617c15d22343fce81918db/fonttools-4.61.1-cp313-cp313-win32.whl", hash = "sha256:4d7092bb38c53bbc78e9255a59158b150bcdc115a1e3b3ce0b5f267dc35dd63c", size = 2267821, upload-time = "2025-12-12T17:30:38.478Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1a/59/453c06d1d83dc0951b69ef692d6b9f1846680342927df54e9a1ca91c6f90/fonttools-4.61.1-cp313-cp313-win_amd64.whl", hash = "sha256:21e7c8d76f62ab13c9472ccf74515ca5b9a761d1bde3265152a6dc58700d895b", size = 2318169, upload-time = "2025-12-12T17:30:40.951Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/32/8f/4e7bf82c0cbb738d3c2206c920ca34ca74ef9dabde779030145d28665104/fonttools-4.61.1-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:fff4f534200a04b4a36e7ae3cb74493afe807b517a09e99cb4faa89a34ed6ecd", size = 2846094, upload-time = "2025-12-12T17:30:43.511Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/71/09/d44e45d0a4f3a651f23a1e9d42de43bc643cce2971b19e784cc67d823676/fonttools-4.61.1-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:d9203500f7c63545b4ce3799319fe4d9feb1a1b89b28d3cb5abd11b9dd64147e", size = 2396589, upload-time = "2025-12-12T17:30:45.681Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/89/18/58c64cafcf8eb677a99ef593121f719e6dcbdb7d1c594ae5a10d4997ca8a/fonttools-4.61.1-cp314-cp314-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:fa646ecec9528bef693415c79a86e733c70a4965dd938e9a226b0fc64c9d2e6c", size = 4877892, upload-time = "2025-12-12T17:30:47.709Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8a/ec/9e6b38c7ba1e09eb51db849d5450f4c05b7e78481f662c3b79dbde6f3d04/fonttools-4.61.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:11f35ad7805edba3aac1a3710d104592df59f4b957e30108ae0ba6c10b11dd75", size = 4972884, upload-time = "2025-12-12T17:30:49.656Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5e/87/b5339da8e0256734ba0dbbf5b6cdebb1dd79b01dc8c270989b7bcd465541/fonttools-4.61.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:b931ae8f62db78861b0ff1ac017851764602288575d65b8e8ff1963fed419063", size = 4924405, upload-time = "2025-12-12T17:30:51.735Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0b/47/e3409f1e1e69c073a3a6fd8cb886eb18c0bae0ee13db2c8d5e7f8495e8b7/fonttools-4.61.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:b148b56f5de675ee16d45e769e69f87623a4944f7443850bf9a9376e628a89d2", size = 5035553, upload-time = "2025-12-12T17:30:54.823Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bf/b6/1f6600161b1073a984294c6c031e1a56ebf95b6164249eecf30012bb2e38/fonttools-4.61.1-cp314-cp314-win32.whl", hash = "sha256:9b666a475a65f4e839d3d10473fad6d47e0a9db14a2f4a224029c5bfde58ad2c", size = 2271915, upload-time = "2025-12-12T17:30:57.913Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/52/7b/91e7b01e37cc8eb0e1f770d08305b3655e4f002fc160fb82b3390eabacf5/fonttools-4.61.1-cp314-cp314-win_amd64.whl", hash = "sha256:4f5686e1fe5fce75d82d93c47a438a25bf0d1319d2843a926f741140b2b16e0c", size = 2323487, upload-time = "2025-12-12T17:30:59.804Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/39/5c/908ad78e46c61c3e3ed70c3b58ff82ab48437faf84ec84f109592cabbd9f/fonttools-4.61.1-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:e76ce097e3c57c4bcb67c5aa24a0ecdbd9f74ea9219997a707a4061fbe2707aa", size = 2929571, upload-time = "2025-12-12T17:31:02.574Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bd/41/975804132c6dea64cdbfbaa59f3518a21c137a10cccf962805b301ac6ab2/fonttools-4.61.1-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:9cfef3ab326780c04d6646f68d4b4742aae222e8b8ea1d627c74e38afcbc9d91", size = 2435317, upload-time = "2025-12-12T17:31:04.974Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b0/5a/aef2a0a8daf1ebaae4cfd83f84186d4a72ee08fd6a8451289fcd03ffa8a4/fonttools-4.61.1-cp314-cp314t-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:a75c301f96db737e1c5ed5fd7d77d9c34466de16095a266509e13da09751bd19", size = 4882124, upload-time = "2025-12-12T17:31:07.456Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/80/33/d6db3485b645b81cea538c9d1c9219d5805f0877fda18777add4671c5240/fonttools-4.61.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:91669ccac46bbc1d09e9273546181919064e8df73488ea087dcac3e2968df9ba", size = 5100391, upload-time = "2025-12-12T17:31:09.732Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6c/d6/675ba631454043c75fcf76f0ca5463eac8eb0666ea1d7badae5fea001155/fonttools-4.61.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:c33ab3ca9d3ccd581d58e989d67554e42d8d4ded94ab3ade3508455fe70e65f7", size = 4978800, upload-time = "2025-12-12T17:31:11.681Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7f/33/d3ec753d547a8d2bdaedd390d4a814e8d5b45a093d558f025c6b990b554c/fonttools-4.61.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:664c5a68ec406f6b1547946683008576ef8b38275608e1cee6c061828171c118", size = 5006426, upload-time = "2025-12-12T17:31:13.764Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b4/40/cc11f378b561a67bea850ab50063366a0d1dd3f6d0a30ce0f874b0ad5664/fonttools-4.61.1-cp314-cp314t-win32.whl", hash = "sha256:aed04cabe26f30c1647ef0e8fbb207516fd40fe9472e9439695f5c6998e60ac5", size = 2335377, upload-time = "2025-12-12T17:31:16.49Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e4/ff/c9a2b66b39f8628531ea58b320d66d951267c98c6a38684daa8f50fb02f8/fonttools-4.61.1-cp314-cp314t-win_amd64.whl", hash = "sha256:2180f14c141d2f0f3da43f3a81bc8aa4684860f6b0e6f9e165a4831f24e6a23b", size = 2400613, upload-time = "2025-12-12T17:31:18.769Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c7/4e/ce75a57ff3aebf6fc1f4e9d508b8e5810618a33d900ad6c19eb30b290b97/fonttools-4.61.1-py3-none-any.whl", hash = "sha256:17d2bf5d541add43822bcf0c43d7d847b160c9bb01d15d5007d84e2217aaa371", size = 1148996, upload-time = "2025-12-12T17:31:21.03Z" }, ] [[package]] @@ -2062,11 +2076,11 @@ wheels = [ [[package]] name = "fsspec" -version = "2025.12.0" +version = "2026.1.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b6/27/954057b0d1f53f086f681755207dda6de6c660ce133c829158e8e8fe7895/fsspec-2025.12.0.tar.gz", hash = "sha256:c505de011584597b1060ff778bb664c1bc022e87921b0e4f10cc9c44f9635973", size = 309748, upload-time = "2025-12-03T15:23:42.687Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d5/7d/5df2650c57d47c57232af5ef4b4fdbff182070421e405e0d62c6cdbfaa87/fsspec-2026.1.0.tar.gz", hash = "sha256:e987cb0496a0d81bba3a9d1cee62922fb395e7d4c3b575e57f547953334fe07b", size = 310496, upload-time = "2026-01-09T15:21:35.562Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/51/c7/b64cae5dba3a1b138d7123ec36bb5ccd39d39939f18454407e5468f4763f/fsspec-2025.12.0-py3-none-any.whl", hash = "sha256:8bf1fe301b7d8acfa6e8571e3b1c3d158f909666642431cc78a1b7b4dbc5ec5b", size = 201422, upload-time = "2025-12-03T15:23:41.434Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/01/c9/97cc5aae1648dcb851958a3ddf73ccd7dbe5650d95203ecb4d7720b4cdbf/fsspec-2026.1.0-py3-none-any.whl", hash = "sha256:cb76aa913c2285a3b49bdd5fc55b1d7c708d7208126b60f2eb8194fe1b4cbdcc", size = 201838, upload-time = "2026-01-09T15:21:34.041Z" }, ] [[package]] @@ -2118,10 +2132,8 @@ name = "google-ai-generativelanguage" version = "0.6.15" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ - { name = "google-api-core", version = "2.25.2", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, extra = ["grpc"], marker = "python_full_version >= '3.14'" }, - { name = "google-api-core", version = "2.28.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, extra = ["grpc"], marker = "python_full_version < '3.14'" }, - { name = "google-auth", version = "2.41.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "google-auth", version = "2.43.0", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, + { name = "google-api-core", extra = ["grpc"] }, + { name = "google-auth" }, { name = "proto-plus" }, { name = "protobuf" }, ] @@ -2134,18 +2146,12 @@ wheels = [ name = "google-api-core" version = "2.25.2" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -resolution-markers = [ - "python_full_version >= '3.14' and sys_platform == 'darwin'", - "python_full_version >= '3.14' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.14' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.14' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "google-auth", version = "2.41.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform != 'darwin'" }, - { name = "google-auth", version = "2.43.0", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "googleapis-common-protos", marker = "python_full_version >= '3.14'" }, - { name = "proto-plus", marker = "python_full_version >= '3.14'" }, - { name = "protobuf", marker = "python_full_version >= '3.14'" }, - { name = "requests", marker = "python_full_version >= '3.14'" }, + { name = "google-auth" }, + { name = "googleapis-common-protos" }, + { name = "proto-plus" }, + { name = "protobuf" }, + { name = "requests" }, ] sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/09/cd/63f1557235c2440fe0577acdbc32577c5c002684c58c7f4d770a92366a24/google_api_core-2.25.2.tar.gz", hash = "sha256:1c63aa6af0d0d5e37966f157a77f9396d820fba59f9e43e9415bc3dc5baff300", size = 166266, upload-time = "2025-10-03T00:07:34.778Z" } wheels = [ @@ -2154,39 +2160,8 @@ wheels = [ [package.optional-dependencies] grpc = [ - { name = "grpcio", version = "1.67.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform != 'darwin'" }, - { name = "grpcio", version = "1.76.0", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "grpcio-status", marker = "python_full_version >= '3.14'" }, -] - -[[package]] -name = "google-api-core" -version = "2.28.1" -source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -resolution-markers = [ - "python_full_version == '3.13.*' and sys_platform == 'darwin'", - "python_full_version < '3.13' and sys_platform == 'darwin'", - "python_full_version == '3.13.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "python_full_version < '3.13' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.13.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.13.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "(python_full_version < '3.13' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.13' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "google-auth", version = "2.41.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14'" }, - { name = "googleapis-common-protos", marker = "python_full_version < '3.14'" }, - { name = "proto-plus", marker = "python_full_version < '3.14'" }, - { name = "protobuf", marker = "python_full_version < '3.14'" }, - { name = "requests", marker = "python_full_version < '3.14'" }, -] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/61/da/83d7043169ac2c8c7469f0e375610d78ae2160134bf1b80634c482fa079c/google_api_core-2.28.1.tar.gz", hash = "sha256:2b405df02d68e68ce0fbc138559e6036559e685159d148ae5861013dc201baf8", size = 176759, upload-time = "2025-10-28T21:34:51.529Z" } -wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ed/d4/90197b416cb61cefd316964fd9e7bd8324bcbafabf40eef14a9f20b81974/google_api_core-2.28.1-py3-none-any.whl", hash = "sha256:4021b0f8ceb77a6fb4de6fde4502cecab45062e66ff4f2895169e0b35bc9466c", size = 173706, upload-time = "2025-10-28T21:34:50.151Z" }, -] - -[package.optional-dependencies] -grpc = [ - { name = "grpcio", version = "1.67.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14'" }, - { name = "grpcio-status", marker = "python_full_version < '3.14'" }, + { name = "grpcio" }, + { name = "grpcio-status" }, ] [[package]] @@ -2194,10 +2169,8 @@ name = "google-api-python-client" version = "2.187.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ - { name = "google-api-core", version = "2.25.2", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14'" }, - { name = "google-api-core", version = "2.28.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14'" }, - { name = "google-auth", version = "2.41.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "google-auth", version = "2.43.0", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, + { name = "google-api-core" }, + { name = "google-auth" }, { name = "google-auth-httplib2" }, { name = "httplib2" }, { name = "uritemplate" }, @@ -2211,20 +2184,10 @@ wheels = [ name = "google-auth" version = "2.41.1" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -resolution-markers = [ - "python_full_version == '3.13.*' and sys_platform == 'darwin'", - "python_full_version < '3.13' and sys_platform == 'darwin'", - "python_full_version >= '3.14' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "python_full_version == '3.13.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "python_full_version < '3.13' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.14' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.14' and sys_platform != 'darwin' and sys_platform != 'linux')", - "(python_full_version == '3.13.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.13.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "(python_full_version < '3.13' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.13' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "cachetools", marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "pyasn1-modules", marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "rsa", marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, + { name = "cachetools" }, + { name = "pyasn1-modules" }, + { name = "rsa" }, ] sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a8/af/5129ce5b2f9688d2fa49b463e544972a7c82b0fdb50980dafee92e121d9f/google_auth-2.41.1.tar.gz", hash = "sha256:b76b7b1f9e61f0cb7e88870d14f6a94aeef248959ef6992670efee37709cbfd2", size = 292284, upload-time = "2025-09-30T22:51:26.363Z" } wheels = [ @@ -2233,78 +2196,29 @@ wheels = [ [package.optional-dependencies] requests = [ - { name = "requests", marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, -] - -[[package]] -name = "google-auth" -version = "2.43.0" -source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -resolution-markers = [ - "python_full_version >= '3.14' and sys_platform == 'darwin'", -] -dependencies = [ - { name = "cachetools", marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "pyasn1-modules", marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "rsa", marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, -] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ff/ef/66d14cf0e01b08d2d51ffc3c20410c4e134a1548fc246a6081eae585a4fe/google_auth-2.43.0.tar.gz", hash = "sha256:88228eee5fc21b62a1b5fe773ca15e67778cb07dc8363adcb4a8827b52d81483", size = 296359, upload-time = "2025-11-06T00:13:36.587Z" } -wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6f/d1/385110a9ae86d91cc14c5282c61fe9f4dc41c0b9f7d423c6ad77038c4448/google_auth-2.43.0-py2.py3-none-any.whl", hash = "sha256:af628ba6fa493f75c7e9dbe9373d148ca9f4399b5ea29976519e0a3848eddd16", size = 223114, upload-time = "2025-11-06T00:13:35.209Z" }, -] - -[package.optional-dependencies] -requests = [ - { name = "requests", marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, + { name = "requests" }, ] [[package]] name = "google-auth-httplib2" -version = "0.2.1" +version = "0.3.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ - { name = "google-auth", version = "2.41.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "google-auth", version = "2.43.0", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, + { name = "google-auth" }, { name = "httplib2" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e0/83/7ef576d1c7ccea214e7b001e69c006bc75e058a3a1f2ab810167204b698b/google_auth_httplib2-0.2.1.tar.gz", hash = "sha256:5ef03be3927423c87fb69607b42df23a444e434ddb2555b73b3679793187b7de", size = 11086, upload-time = "2025-10-30T21:13:16.569Z" } -wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/44/a7/ca23dd006255f70e2bc469d3f9f0c82ea455335bfd682ad4d677adc435de/google_auth_httplib2-0.2.1-py3-none-any.whl", hash = "sha256:1be94c611db91c01f9703e7f62b0a59bbd5587a95571c7b6fade510d648bc08b", size = 9525, upload-time = "2025-10-30T21:13:15.758Z" }, -] - -[[package]] -name = "google-auth-oauthlib" -version = "1.2.2" -source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -resolution-markers = [ - "python_full_version >= '3.14' and sys_platform == 'darwin'", -] -dependencies = [ - { name = "google-auth", version = "2.43.0", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "requests-oauthlib", marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, -] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fb/87/e10bf24f7bcffc1421b84d6f9c3377c30ec305d082cd737ddaa6d8f77f7c/google_auth_oauthlib-1.2.2.tar.gz", hash = "sha256:11046fb8d3348b296302dd939ace8af0a724042e8029c1b872d87fabc9f41684", size = 20955, upload-time = "2025-04-22T16:40:29.172Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d5/ad/c1f2b1175096a8d04cf202ad5ea6065f108d26be6fc7215876bde4a7981d/google_auth_httplib2-0.3.0.tar.gz", hash = "sha256:177898a0175252480d5ed916aeea183c2df87c1f9c26705d74ae6b951c268b0b", size = 11134, upload-time = "2025-12-15T22:13:51.825Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ac/84/40ee070be95771acd2f4418981edb834979424565c3eec3cd88b6aa09d24/google_auth_oauthlib-1.2.2-py3-none-any.whl", hash = "sha256:fd619506f4b3908b5df17b65f39ca8d66ea56986e5472eb5978fd8f3786f00a2", size = 19072, upload-time = "2025-04-22T16:40:28.174Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/99/d5/3c97526c8796d3caf5f4b3bed2b05e8a7102326f00a334e7a438237f3b22/google_auth_httplib2-0.3.0-py3-none-any.whl", hash = "sha256:426167e5df066e3f5a0fc7ea18768c08e7296046594ce4c8c409c2457dd1f776", size = 9529, upload-time = "2025-12-15T22:13:51.048Z" }, ] [[package]] name = "google-auth-oauthlib" version = "1.2.3" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -resolution-markers = [ - "python_full_version == '3.13.*' and sys_platform == 'darwin'", - "python_full_version < '3.13' and sys_platform == 'darwin'", - "python_full_version >= '3.14' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "python_full_version == '3.13.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "python_full_version < '3.13' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.14' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.14' and sys_platform != 'darwin' and sys_platform != 'linux')", - "(python_full_version == '3.13.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.13.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "(python_full_version < '3.13' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.13' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "google-auth", version = "2.41.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "requests-oauthlib", marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, + { name = "google-auth" }, + { name = "requests-oauthlib" }, ] sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/86/a6/c6336a6ceb682709a4aa39e2e6b5754a458075ca92359512b6cbfcb25ae3/google_auth_oauthlib-1.2.3.tar.gz", hash = "sha256:eb09e450d3cc789ecbc2b3529cb94a713673fd5f7a22c718ad91cf75aedc2ea4", size = 21265, upload-time = "2025-10-30T21:28:19.105Z" } wheels = [ @@ -2317,13 +2231,10 @@ version = "1.70.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "docstring-parser" }, - { name = "google-api-core", version = "2.25.2", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, extra = ["grpc"], marker = "python_full_version >= '3.14'" }, - { name = "google-api-core", version = "2.28.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, extra = ["grpc"], marker = "python_full_version < '3.14'" }, - { name = "google-auth", version = "2.41.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "google-auth", version = "2.43.0", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, + { name = "google-api-core", extra = ["grpc"] }, + { name = "google-auth" }, { name = "google-cloud-bigquery" }, - { name = "google-cloud-resource-manager", version = "1.14.2", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform != 'darwin'" }, - { name = "google-cloud-resource-manager", version = "1.15.0", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14' or sys_platform == 'darwin'" }, + { name = "google-cloud-resource-manager" }, { name = "google-cloud-storage" }, { name = "packaging" }, { name = "proto-plus" }, @@ -2338,22 +2249,20 @@ wheels = [ [[package]] name = "google-cloud-bigquery" -version = "3.38.0" +version = "3.40.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ - { name = "google-api-core", version = "2.25.2", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, extra = ["grpc"], marker = "python_full_version >= '3.14'" }, - { name = "google-api-core", version = "2.28.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, extra = ["grpc"], marker = "python_full_version < '3.14'" }, - { name = "google-auth", version = "2.41.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "google-auth", version = "2.43.0", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, + { name = "google-api-core", extra = ["grpc"] }, + { name = "google-auth" }, { name = "google-cloud-core" }, { name = "google-resumable-media" }, { name = "packaging" }, { name = "python-dateutil" }, { name = "requests" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/07/b2/a17e40afcf9487e3d17db5e36728ffe75c8d5671c46f419d7b6528a5728a/google_cloud_bigquery-3.38.0.tar.gz", hash = "sha256:8afcb7116f5eac849097a344eb8bfda78b7cfaae128e60e019193dd483873520", size = 503666, upload-time = "2025-09-17T20:33:33.47Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/94/0a/62438ca138a095945468968696d9cca75a4cfd059e810402e70b0236d8ba/google_cloud_bigquery-3.40.0.tar.gz", hash = "sha256:b3ccb11caf0029f15b29569518f667553fe08f6f1459b959020c83fbbd8f2e68", size = 509287, upload-time = "2026-01-08T01:07:26.065Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/39/3c/c8cada9ec282b29232ed9aed5a0b5cca6cf5367cb2ffa8ad0d2583d743f1/google_cloud_bigquery-3.38.0-py3-none-any.whl", hash = "sha256:e06e93ff7b245b239945ef59cb59616057598d369edac457ebf292bd61984da6", size = 259257, upload-time = "2025-09-17T20:33:31.404Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/90/6a/90a04270dd60cc70259b73744f6e610ae9a158b21ab50fb695cca0056a3d/google_cloud_bigquery-3.40.0-py3-none-any.whl", hash = "sha256:0469bcf9e3dad3cab65b67cce98180c8c0aacf3253d47f0f8e976f299b49b5ab", size = 261335, upload-time = "2026-01-08T01:07:23.761Z" }, ] [[package]] @@ -2361,59 +2270,25 @@ name = "google-cloud-core" version = "2.5.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ - { name = "google-api-core", version = "2.25.2", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14'" }, - { name = "google-api-core", version = "2.28.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14'" }, - { name = "google-auth", version = "2.41.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "google-auth", version = "2.43.0", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, + { name = "google-api-core" }, + { name = "google-auth" }, ] sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a6/03/ef0bc99d0e0faf4fdbe67ac445e18cdaa74824fd93cd069e7bb6548cb52d/google_cloud_core-2.5.0.tar.gz", hash = "sha256:7c1b7ef5c92311717bd05301aa1a91ffbc565673d3b0b4163a52d8413a186963", size = 36027, upload-time = "2025-10-29T23:17:39.513Z" } wheels = [ { url = "https://pypi.tuna.tsinghua.edu.cn/packages/89/20/bfa472e327c8edee00f04beecc80baeddd2ab33ee0e86fd7654da49d45e9/google_cloud_core-2.5.0-py3-none-any.whl", hash = "sha256:67d977b41ae6c7211ee830c7912e41003ea8194bff15ae7d72fd6f51e57acabc", size = 29469, upload-time = "2025-10-29T23:17:38.548Z" }, ] -[[package]] -name = "google-cloud-resource-manager" -version = "1.14.2" -source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -resolution-markers = [ - "python_full_version >= '3.14' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.14' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.14' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "google-api-core", version = "2.25.2", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, extra = ["grpc"], marker = "python_full_version >= '3.14' and sys_platform != 'darwin'" }, - { name = "google-auth", version = "2.41.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform != 'darwin'" }, - { name = "grpc-google-iam-v1", marker = "python_full_version >= '3.14' and sys_platform != 'darwin'" }, - { name = "proto-plus", marker = "python_full_version >= '3.14' and sys_platform != 'darwin'" }, - { name = "protobuf", marker = "python_full_version >= '3.14' and sys_platform != 'darwin'" }, -] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6e/ca/a4648f5038cb94af4b3942815942a03aa9398f9fb0bef55b3f1585b9940d/google_cloud_resource_manager-1.14.2.tar.gz", hash = "sha256:962e2d904c550d7bac48372607904ff7bb3277e3bb4a36d80cc9a37e28e6eb74", size = 446370, upload-time = "2025-03-17T11:35:56.343Z" } -wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b1/ea/a92631c358da377af34d3a9682c97af83185c2d66363d5939ab4a1169a7f/google_cloud_resource_manager-1.14.2-py3-none-any.whl", hash = "sha256:d0fa954dedd1d2b8e13feae9099c01b8aac515b648e612834f9942d2795a9900", size = 394344, upload-time = "2025-03-17T11:35:54.722Z" }, -] - [[package]] name = "google-cloud-resource-manager" version = "1.15.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -resolution-markers = [ - "python_full_version >= '3.14' and sys_platform == 'darwin'", - "python_full_version == '3.13.*' and sys_platform == 'darwin'", - "python_full_version < '3.13' and sys_platform == 'darwin'", - "python_full_version == '3.13.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "python_full_version < '3.13' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.13.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.13.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "(python_full_version < '3.13' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.13' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "google-api-core", version = "2.25.2", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, extra = ["grpc"], marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "google-api-core", version = "2.28.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, extra = ["grpc"], marker = "python_full_version < '3.14'" }, - { name = "google-auth", version = "2.41.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14'" }, - { name = "google-auth", version = "2.43.0", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "grpc-google-iam-v1", marker = "python_full_version < '3.14' or sys_platform == 'darwin'" }, - { name = "grpcio", version = "1.67.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14'" }, - { name = "grpcio", version = "1.76.0", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "proto-plus", marker = "python_full_version < '3.14' or sys_platform == 'darwin'" }, - { name = "protobuf", marker = "python_full_version < '3.14' or sys_platform == 'darwin'" }, + { name = "google-api-core", extra = ["grpc"] }, + { name = "google-auth" }, + { name = "grpc-google-iam-v1" }, + { name = "grpcio" }, + { name = "proto-plus" }, + { name = "protobuf" }, ] sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fc/19/b95d0e8814ce42522e434cdd85c0cb6236d874d9adf6685fc8e6d1fda9d1/google_cloud_resource_manager-1.15.0.tar.gz", hash = "sha256:3d0b78c3daa713f956d24e525b35e9e9a76d597c438837171304d431084cedaf", size = 449227, upload-time = "2025-10-20T14:57:01.108Z" } wheels = [ @@ -2425,10 +2300,8 @@ name = "google-cloud-storage" version = "2.19.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ - { name = "google-api-core", version = "2.25.2", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14'" }, - { name = "google-api-core", version = "2.28.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14'" }, - { name = "google-auth", version = "2.41.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "google-auth", version = "2.43.0", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, + { name = "google-api-core" }, + { name = "google-auth" }, { name = "google-cloud-core" }, { name = "google-crc32c" }, { name = "google-resumable-media" }, @@ -2441,22 +2314,25 @@ wheels = [ [[package]] name = "google-crc32c" -version = "1.7.1" +version = "1.8.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/19/ae/87802e6d9f9d69adfaedfcfd599266bf386a54d0be058b532d04c794f76d/google_crc32c-1.7.1.tar.gz", hash = "sha256:2bff2305f98846f3e825dbeec9ee406f89da7962accdb29356e4eadc251bd472", size = 14495, upload-time = "2025-03-26T14:29:13.32Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/03/41/4b9c02f99e4c5fb477122cd5437403b552873f014616ac1d19ac8221a58d/google_crc32c-1.8.0.tar.gz", hash = "sha256:a428e25fb7691024de47fecfbff7ff957214da51eddded0da0ae0e0f03a2cf79", size = 14192, upload-time = "2025-12-16T00:35:25.142Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/dd/b7/787e2453cf8639c94b3d06c9d61f512234a82e1d12d13d18584bd3049904/google_crc32c-1.7.1-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:2d73a68a653c57281401871dd4aeebbb6af3191dcac751a76ce430df4d403194", size = 30470, upload-time = "2025-03-26T14:34:31.655Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ed/b4/6042c2b0cbac3ec3a69bb4c49b28d2f517b7a0f4a0232603c42c58e22b44/google_crc32c-1.7.1-cp312-cp312-macosx_12_0_x86_64.whl", hash = "sha256:22beacf83baaf59f9d3ab2bbb4db0fb018da8e5aebdce07ef9f09fce8220285e", size = 30315, upload-time = "2025-03-26T15:01:54.634Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/29/ad/01e7a61a5d059bc57b702d9ff6a18b2585ad97f720bd0a0dbe215df1ab0e/google_crc32c-1.7.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:19eafa0e4af11b0a4eb3974483d55d2d77ad1911e6cf6f832e1574f6781fd337", size = 33180, upload-time = "2025-03-26T14:41:32.168Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3b/a5/7279055cf004561894ed3a7bfdf5bf90a53f28fadd01af7cd166e88ddf16/google_crc32c-1.7.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b6d86616faaea68101195c6bdc40c494e4d76f41e07a37ffdef270879c15fb65", size = 32794, upload-time = "2025-03-26T14:41:33.264Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0f/d6/77060dbd140c624e42ae3ece3df53b9d811000729a5c821b9fd671ceaac6/google_crc32c-1.7.1-cp312-cp312-win_amd64.whl", hash = "sha256:b7491bdc0c7564fcf48c0179d2048ab2f7c7ba36b84ccd3a3e1c3f7a72d3bba6", size = 33477, upload-time = "2025-03-26T14:29:10.94Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8b/72/b8d785e9184ba6297a8620c8a37cf6e39b81a8ca01bb0796d7cbb28b3386/google_crc32c-1.7.1-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:df8b38bdaf1629d62d51be8bdd04888f37c451564c2042d36e5812da9eff3c35", size = 30467, upload-time = "2025-03-26T14:36:06.909Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/34/25/5f18076968212067c4e8ea95bf3b69669f9fc698476e5f5eb97d5b37999f/google_crc32c-1.7.1-cp313-cp313-macosx_12_0_x86_64.whl", hash = "sha256:e42e20a83a29aa2709a0cf271c7f8aefaa23b7ab52e53b322585297bb94d4638", size = 30309, upload-time = "2025-03-26T15:06:15.318Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/92/83/9228fe65bf70e93e419f38bdf6c5ca5083fc6d32886ee79b450ceefd1dbd/google_crc32c-1.7.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:905a385140bf492ac300026717af339790921f411c0dfd9aa5a9e69a08ed32eb", size = 33133, upload-time = "2025-03-26T14:41:34.388Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c3/ca/1ea2fd13ff9f8955b85e7956872fdb7050c4ace8a2306a6d177edb9cf7fe/google_crc32c-1.7.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6b211ddaf20f7ebeec5c333448582c224a7c90a9d98826fbab82c0ddc11348e6", size = 32773, upload-time = "2025-03-26T14:41:35.19Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/89/32/a22a281806e3ef21b72db16f948cad22ec68e4bdd384139291e00ff82fe2/google_crc32c-1.7.1-cp313-cp313-win_amd64.whl", hash = "sha256:0f99eaa09a9a7e642a61e06742856eec8b19fc0037832e03f941fe7cf0c8e4db", size = 33475, upload-time = "2025-03-26T14:29:11.771Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b8/c5/002975aff514e57fc084ba155697a049b3f9b52225ec3bc0f542871dd524/google_crc32c-1.7.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:32d1da0d74ec5634a05f53ef7df18fc646666a25efaaca9fc7dcfd4caf1d98c3", size = 33243, upload-time = "2025-03-26T14:41:35.975Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/61/cb/c585282a03a0cea70fcaa1bf55d5d702d0f2351094d663ec3be1c6c67c52/google_crc32c-1.7.1-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e10554d4abc5238823112c2ad7e4560f96c7bf3820b202660373d769d9e6e4c9", size = 32870, upload-time = "2025-03-26T14:41:37.08Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e9/5f/7307325b1198b59324c0fa9807cafb551afb65e831699f2ce211ad5c8240/google_crc32c-1.8.0-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:4b8286b659c1335172e39563ab0a768b8015e88e08329fa5321f774275fc3113", size = 31300, upload-time = "2025-12-16T00:21:56.723Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/21/8e/58c0d5d86e2220e6a37befe7e6a94dd2f6006044b1a33edf1ff6d9f7e319/google_crc32c-1.8.0-cp312-cp312-macosx_12_0_x86_64.whl", hash = "sha256:2a3dc3318507de089c5384cc74d54318401410f82aa65b2d9cdde9d297aca7cb", size = 30867, upload-time = "2025-12-16T00:38:31.302Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ce/a9/a780cc66f86335a6019f557a8aaca8fbb970728f0efd2430d15ff1beae0e/google_crc32c-1.8.0-cp312-cp312-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:14f87e04d613dfa218d6135e81b78272c3b904e2a7053b841481b38a7d901411", size = 33364, upload-time = "2025-12-16T00:40:22.96Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/21/3f/3457ea803db0198c9aaca2dd373750972ce28a26f00544b6b85088811939/google_crc32c-1.8.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:cb5c869c2923d56cb0c8e6bcdd73c009c36ae39b652dbe46a05eb4ef0ad01454", size = 33740, upload-time = "2025-12-16T00:40:23.96Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/df/c0/87c2073e0c72515bb8733d4eef7b21548e8d189f094b5dad20b0ecaf64f6/google_crc32c-1.8.0-cp312-cp312-win_amd64.whl", hash = "sha256:3cc0c8912038065eafa603b238abf252e204accab2a704c63b9e14837a854962", size = 34437, upload-time = "2025-12-16T00:35:21.395Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d1/db/000f15b41724589b0e7bc24bc7a8967898d8d3bc8caf64c513d91ef1f6c0/google_crc32c-1.8.0-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:3ebb04528e83b2634857f43f9bb8ef5b2bbe7f10f140daeb01b58f972d04736b", size = 31297, upload-time = "2025-12-16T00:23:20.709Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d7/0d/8ebed0c39c53a7e838e2a486da8abb0e52de135f1b376ae2f0b160eb4c1a/google_crc32c-1.8.0-cp313-cp313-macosx_12_0_x86_64.whl", hash = "sha256:450dc98429d3e33ed2926fc99ee81001928d63460f8538f21a5d6060912a8e27", size = 30867, upload-time = "2025-12-16T00:43:14.628Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ce/42/b468aec74a0354b34c8cbf748db20d6e350a68a2b0912e128cabee49806c/google_crc32c-1.8.0-cp313-cp313-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:3b9776774b24ba76831609ffbabce8cdf6fa2bd5e9df37b594221c7e333a81fa", size = 33344, upload-time = "2025-12-16T00:40:24.742Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1c/e8/b33784d6fc77fb5062a8a7854e43e1e618b87d5ddf610a88025e4de6226e/google_crc32c-1.8.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:89c17d53d75562edfff86679244830599ee0a48efc216200691de8b02ab6b2b8", size = 33694, upload-time = "2025-12-16T00:40:25.505Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/92/b1/d3cbd4d988afb3d8e4db94ca953df429ed6db7282ed0e700d25e6c7bfc8d/google_crc32c-1.8.0-cp313-cp313-win_amd64.whl", hash = "sha256:57a50a9035b75643996fbf224d6661e386c7162d1dfdab9bc4ca790947d1007f", size = 34435, upload-time = "2025-12-16T00:35:22.107Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/21/88/8ecf3c2b864a490b9e7010c84fd203ec8cf3b280651106a3a74dd1b0ca72/google_crc32c-1.8.0-cp314-cp314-macosx_12_0_arm64.whl", hash = "sha256:e6584b12cb06796d285d09e33f63309a09368b9d806a551d8036a4207ea43697", size = 31301, upload-time = "2025-12-16T00:24:48.527Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/36/c6/f7ff6c11f5ca215d9f43d3629163727a272eabc356e5c9b2853df2bfe965/google_crc32c-1.8.0-cp314-cp314-macosx_12_0_x86_64.whl", hash = "sha256:f4b51844ef67d6cf2e9425983274da75f18b1597bb2c998e1c0a0e8d46f8f651", size = 30868, upload-time = "2025-12-16T00:48:12.163Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/56/15/c25671c7aad70f8179d858c55a6ae8404902abe0cdcf32a29d581792b491/google_crc32c-1.8.0-cp314-cp314-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:b0d1a7afc6e8e4635564ba8aa5c0548e3173e41b6384d7711a9123165f582de2", size = 33381, upload-time = "2025-12-16T00:40:26.268Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/42/fa/f50f51260d7b0ef5d4898af122d8a7ec5a84e2984f676f746445f783705f/google_crc32c-1.8.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:8b3f68782f3cbd1bce027e48768293072813469af6a61a86f6bb4977a4380f21", size = 33734, upload-time = "2025-12-16T00:40:27.028Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/08/a5/7b059810934a09fb3ccb657e0843813c1fee1183d3bc2c8041800374aa2c/google_crc32c-1.8.0-cp314-cp314-win_amd64.whl", hash = "sha256:d511b3153e7011a27ab6ee6bb3a5404a55b994dc1a7322c0b87b29606d9790e2", size = 34878, upload-time = "2025-12-16T00:35:23.142Z" }, ] [[package]] @@ -2466,8 +2342,7 @@ source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "anyio" }, { name = "distro" }, - { name = "google-auth", version = "2.41.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, extra = ["requests"], marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "google-auth", version = "2.43.0", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, extra = ["requests"], marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, + { name = "google-auth", extra = ["requests"] }, { name = "httpx" }, { name = "pydantic" }, { name = "requests" }, @@ -2483,22 +2358,20 @@ wheels = [ [[package]] name = "google-generativeai" -version = "0.8.5" +version = "0.8.6" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "google-ai-generativelanguage" }, - { name = "google-api-core", version = "2.25.2", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14'" }, - { name = "google-api-core", version = "2.28.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14'" }, + { name = "google-api-core" }, { name = "google-api-python-client" }, - { name = "google-auth", version = "2.41.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "google-auth", version = "2.43.0", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, + { name = "google-auth" }, { name = "protobuf" }, { name = "pydantic" }, { name = "tqdm" }, { name = "typing-extensions" }, ] wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6e/40/c42ff9ded9f09ec9392879a8e6538a00b2dc185e834a3392917626255419/google_generativeai-0.8.5-py3-none-any.whl", hash = "sha256:22b420817fb263f8ed520b33285f45976d5b21e904da32b80d4fd20c055123a2", size = 155427, upload-time = "2025-04-17T00:40:00.67Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/97/0f/ef33b5bb71437966590c6297104c81051feae95d54b11ece08533ef937d3/google_generativeai-0.8.6-py3-none-any.whl", hash = "sha256:37a0eaaa95e5bbf888828e20a4a1b2c196cc9527d194706e58a68ff388aeb0fa", size = 155098, upload-time = "2025-12-16T17:53:58.61Z" }, ] [[package]] @@ -2536,8 +2409,7 @@ wheels = [ [package.optional-dependencies] grpc = [ - { name = "grpcio", version = "1.67.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "grpcio", version = "1.76.0", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, + { name = "grpcio" }, ] [[package]] @@ -2650,8 +2522,7 @@ version = "0.14.3" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "googleapis-common-protos", extra = ["grpc"] }, - { name = "grpcio", version = "1.67.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "grpcio", version = "1.76.0", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, + { name = "grpcio" }, { name = "protobuf" }, ] sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/76/1e/1011451679a983f2f5c6771a1682542ecb027776762ad031fd0d7129164b/grpc_google_iam_v1-0.14.3.tar.gz", hash = "sha256:879ac4ef33136c5491a6300e27575a9ec760f6cdf9a2518798c1b8977a5dc389", size = 23745, upload-time = "2025-10-15T21:14:53.318Z" } @@ -2659,57 +2530,45 @@ wheels = [ { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4a/bd/330a1bbdb1afe0b96311249e699b6dc9cfc17916394fd4503ac5aca2514b/grpc_google_iam_v1-0.14.3-py3-none-any.whl", hash = "sha256:7a7f697e017a067206a3dfef44e4c634a34d3dee135fe7d7a4613fe3e59217e6", size = 32690, upload-time = "2025-10-15T21:14:51.72Z" }, ] -[[package]] -name = "grpcio" -version = "1.67.1" -source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -resolution-markers = [ - "python_full_version == '3.13.*' and sys_platform == 'darwin'", - "python_full_version < '3.13' and sys_platform == 'darwin'", - "python_full_version >= '3.14' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "python_full_version == '3.13.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "python_full_version < '3.13' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.14' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.14' and sys_platform != 'darwin' and sys_platform != 'linux')", - "(python_full_version == '3.13.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.13.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "(python_full_version < '3.13' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.13' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/20/53/d9282a66a5db45981499190b77790570617a604a38f3d103d0400974aeb5/grpcio-1.67.1.tar.gz", hash = "sha256:3dc2ed4cabea4dc14d5e708c2b426205956077cc5de419b4d4079315017e9732", size = 12580022, upload-time = "2024-10-29T06:30:07.787Z" } -wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6e/25/6f95bd18d5f506364379eabc0d5874873cc7dbdaf0757df8d1e82bc07a88/grpcio-1.67.1-cp312-cp312-linux_armv7l.whl", hash = "sha256:267d1745894200e4c604958da5f856da6293f063327cb049a51fe67348e4f953", size = 5089809, upload-time = "2024-10-29T06:24:31.24Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/10/3f/d79e32e5d0354be33a12db2267c66d3cfeff700dd5ccdd09fd44a3ff4fb6/grpcio-1.67.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:85f69fdc1d28ce7cff8de3f9c67db2b0ca9ba4449644488c1e0303c146135ddb", size = 10981985, upload-time = "2024-10-29T06:24:34.942Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/21/f2/36fbc14b3542e3a1c20fb98bd60c4732c55a44e374a4eb68f91f28f14aab/grpcio-1.67.1-cp312-cp312-manylinux_2_17_aarch64.whl", hash = "sha256:f26b0b547eb8d00e195274cdfc63ce64c8fc2d3e2d00b12bf468ece41a0423a0", size = 5588770, upload-time = "2024-10-29T06:24:38.145Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0d/af/bbc1305df60c4e65de8c12820a942b5e37f9cf684ef5e49a63fbb1476a73/grpcio-1.67.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4422581cdc628f77302270ff839a44f4c24fdc57887dc2a45b7e53d8fc2376af", size = 6214476, upload-time = "2024-10-29T06:24:41.006Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/92/cf/1d4c3e93efa93223e06a5c83ac27e32935f998bc368e276ef858b8883154/grpcio-1.67.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1d7616d2ded471231c701489190379e0c311ee0a6c756f3c03e6a62b95a7146e", size = 5850129, upload-time = "2024-10-29T06:24:43.553Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ae/ca/26195b66cb253ac4d5ef59846e354d335c9581dba891624011da0e95d67b/grpcio-1.67.1-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:8a00efecde9d6fcc3ab00c13f816313c040a28450e5e25739c24f432fc6d3c75", size = 6568489, upload-time = "2024-10-29T06:24:46.453Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d1/94/16550ad6b3f13b96f0856ee5dfc2554efac28539ee84a51d7b14526da985/grpcio-1.67.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:699e964923b70f3101393710793289e42845791ea07565654ada0969522d0a38", size = 6149369, upload-time = "2024-10-29T06:24:49.112Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/33/0d/4c3b2587e8ad7f121b597329e6c2620374fccbc2e4e1aa3c73ccc670fde4/grpcio-1.67.1-cp312-cp312-win32.whl", hash = "sha256:4e7b904484a634a0fff132958dabdb10d63e0927398273917da3ee103e8d1f78", size = 3599176, upload-time = "2024-10-29T06:24:51.443Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7d/36/0c03e2d80db69e2472cf81c6123aa7d14741de7cf790117291a703ae6ae1/grpcio-1.67.1-cp312-cp312-win_amd64.whl", hash = "sha256:5721e66a594a6c4204458004852719b38f3d5522082be9061d6510b455c90afc", size = 4346574, upload-time = "2024-10-29T06:24:54.587Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/12/d2/2f032b7a153c7723ea3dea08bffa4bcaca9e0e5bdf643ce565b76da87461/grpcio-1.67.1-cp313-cp313-linux_armv7l.whl", hash = "sha256:aa0162e56fd10a5547fac8774c4899fc3e18c1aa4a4759d0ce2cd00d3696ea6b", size = 5091487, upload-time = "2024-10-29T06:24:57.416Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d0/ae/ea2ff6bd2475a082eb97db1104a903cf5fc57c88c87c10b3c3f41a184fc0/grpcio-1.67.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:beee96c8c0b1a75d556fe57b92b58b4347c77a65781ee2ac749d550f2a365dc1", size = 10943530, upload-time = "2024-10-29T06:25:01.062Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/07/62/646be83d1a78edf8d69b56647327c9afc223e3140a744c59b25fbb279c3b/grpcio-1.67.1-cp313-cp313-manylinux_2_17_aarch64.whl", hash = "sha256:a93deda571a1bf94ec1f6fcda2872dad3ae538700d94dc283c672a3b508ba3af", size = 5589079, upload-time = "2024-10-29T06:25:04.254Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d0/25/71513d0a1b2072ce80d7f5909a93596b7ed10348b2ea4fdcbad23f6017bf/grpcio-1.67.1-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0e6f255980afef598a9e64a24efce87b625e3e3c80a45162d111a461a9f92955", size = 6213542, upload-time = "2024-10-29T06:25:06.824Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/76/9a/d21236297111052dcb5dc85cd77dc7bf25ba67a0f55ae028b2af19a704bc/grpcio-1.67.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9e838cad2176ebd5d4a8bb03955138d6589ce9e2ce5d51c3ada34396dbd2dba8", size = 5850211, upload-time = "2024-10-29T06:25:10.149Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2d/fe/70b1da9037f5055be14f359026c238821b9bcf6ca38a8d760f59a589aacd/grpcio-1.67.1-cp313-cp313-musllinux_1_1_i686.whl", hash = "sha256:a6703916c43b1d468d0756c8077b12017a9fcb6a1ef13faf49e67d20d7ebda62", size = 6572129, upload-time = "2024-10-29T06:25:12.853Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/74/0d/7df509a2cd2a54814598caf2fb759f3e0b93764431ff410f2175a6efb9e4/grpcio-1.67.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:917e8d8994eed1d86b907ba2a61b9f0aef27a2155bca6cbb322430fc7135b7bb", size = 6149819, upload-time = "2024-10-29T06:25:15.803Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0a/08/bc3b0155600898fd10f16b79054e1cca6cb644fa3c250c0fe59385df5e6f/grpcio-1.67.1-cp313-cp313-win32.whl", hash = "sha256:e279330bef1744040db8fc432becc8a727b84f456ab62b744d3fdb83f327e121", size = 3596561, upload-time = "2024-10-29T06:25:19.348Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5a/96/44759eca966720d0f3e1b105c43f8ad4590c97bf8eb3cd489656e9590baa/grpcio-1.67.1-cp313-cp313-win_amd64.whl", hash = "sha256:fa0c739ad8b1996bd24823950e3cb5152ae91fca1c09cc791190bf1627ffefba", size = 4346042, upload-time = "2024-10-29T06:25:21.939Z" }, -] - [[package]] name = "grpcio" version = "1.76.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -resolution-markers = [ - "python_full_version >= '3.14' and sys_platform == 'darwin'", -] dependencies = [ - { name = "typing-extensions", marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, + { name = "typing-extensions" }, ] sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b6/e0/318c1ce3ae5a17894d5791e87aea147587c9e702f24122cc7a5c8bbaeeb1/grpcio-1.76.0.tar.gz", hash = "sha256:7be78388d6da1a25c0d5ec506523db58b18be22d9c37d8d3a32c08be4987bd73", size = 12785182, upload-time = "2025-10-21T16:23:12.106Z" } wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bf/05/8e29121994b8d959ffa0afd28996d452f291b48cfc0875619de0bde2c50c/grpcio-1.76.0-cp312-cp312-linux_armv7l.whl", hash = "sha256:81fd9652b37b36f16138611c7e884eb82e0cec137c40d3ef7c3f9b3ed00f6ed8", size = 5799718, upload-time = "2025-10-21T16:21:17.939Z" }, { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d9/75/11d0e66b3cdf998c996489581bdad8900db79ebd83513e45c19548f1cba4/grpcio-1.76.0-cp312-cp312-macosx_11_0_universal2.whl", hash = "sha256:04bbe1bfe3a68bbfd4e52402ab7d4eb59d72d02647ae2042204326cf4bbad280", size = 11825627, upload-time = "2025-10-21T16:21:20.466Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/28/50/2f0aa0498bc188048f5d9504dcc5c2c24f2eb1a9337cd0fa09a61a2e75f0/grpcio-1.76.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d388087771c837cdb6515539f43b9d4bf0b0f23593a24054ac16f7a960be16f4", size = 6359167, upload-time = "2025-10-21T16:21:23.122Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/66/e5/bbf0bb97d29ede1d59d6588af40018cfc345b17ce979b7b45424628dc8bb/grpcio-1.76.0-cp312-cp312-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:9f8f757bebaaea112c00dba718fc0d3260052ce714e25804a03f93f5d1c6cc11", size = 7044267, upload-time = "2025-10-21T16:21:25.995Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f5/86/f6ec2164f743d9609691115ae8ece098c76b894ebe4f7c94a655c6b03e98/grpcio-1.76.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:980a846182ce88c4f2f7e2c22c56aefd515daeb36149d1c897f83cf57999e0b6", size = 6573963, upload-time = "2025-10-21T16:21:28.631Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/60/bc/8d9d0d8505feccfdf38a766d262c71e73639c165b311c9457208b56d92ae/grpcio-1.76.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:f92f88e6c033db65a5ae3d97905c8fea9c725b63e28d5a75cb73b49bda5024d8", size = 7164484, upload-time = "2025-10-21T16:21:30.837Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/67/e6/5d6c2fc10b95edf6df9b8f19cf10a34263b7fd48493936fffd5085521292/grpcio-1.76.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:4baf3cbe2f0be3289eb68ac8ae771156971848bb8aaff60bad42005539431980", size = 8127777, upload-time = "2025-10-21T16:21:33.577Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3f/c8/dce8ff21c86abe025efe304d9e31fdb0deaaa3b502b6a78141080f206da0/grpcio-1.76.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:615ba64c208aaceb5ec83bfdce7728b80bfeb8be97562944836a7a0a9647d882", size = 7594014, upload-time = "2025-10-21T16:21:41.882Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e0/42/ad28191ebf983a5d0ecef90bab66baa5a6b18f2bfdef9d0a63b1973d9f75/grpcio-1.76.0-cp312-cp312-win32.whl", hash = "sha256:45d59a649a82df5718fd9527ce775fd66d1af35e6d31abdcdc906a49c6822958", size = 3984750, upload-time = "2025-10-21T16:21:44.006Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9e/00/7bd478cbb851c04a48baccaa49b75abaa8e4122f7d86da797500cccdd771/grpcio-1.76.0-cp312-cp312-win_amd64.whl", hash = "sha256:c088e7a90b6017307f423efbb9d1ba97a22aa2170876223f9709e9d1de0b5347", size = 4704003, upload-time = "2025-10-21T16:21:46.244Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fc/ed/71467ab770effc9e8cef5f2e7388beb2be26ed642d567697bb103a790c72/grpcio-1.76.0-cp313-cp313-linux_armv7l.whl", hash = "sha256:26ef06c73eb53267c2b319f43e6634c7556ea37672029241a056629af27c10e2", size = 5807716, upload-time = "2025-10-21T16:21:48.475Z" }, { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2c/85/c6ed56f9817fab03fa8a111ca91469941fb514e3e3ce6d793cb8f1e1347b/grpcio-1.76.0-cp313-cp313-macosx_11_0_universal2.whl", hash = "sha256:45e0111e73f43f735d70786557dc38141185072d7ff8dc1829d6a77ac1471468", size = 11821522, upload-time = "2025-10-21T16:21:51.142Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ac/31/2b8a235ab40c39cbc141ef647f8a6eb7b0028f023015a4842933bc0d6831/grpcio-1.76.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:83d57312a58dcfe2a3a0f9d1389b299438909a02db60e2f2ea2ae2d8034909d3", size = 6362558, upload-time = "2025-10-21T16:21:54.213Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bd/64/9784eab483358e08847498ee56faf8ff6ea8e0a4592568d9f68edc97e9e9/grpcio-1.76.0-cp313-cp313-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:3e2a27c89eb9ac3d81ec8835e12414d73536c6e620355d65102503064a4ed6eb", size = 7049990, upload-time = "2025-10-21T16:21:56.476Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2b/94/8c12319a6369434e7a184b987e8e9f3b49a114c489b8315f029e24de4837/grpcio-1.76.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:61f69297cba3950a524f61c7c8ee12e55c486cb5f7db47ff9dcee33da6f0d3ae", size = 6575387, upload-time = "2025-10-21T16:21:59.051Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/15/0f/f12c32b03f731f4a6242f771f63039df182c8b8e2cf8075b245b409259d4/grpcio-1.76.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:6a15c17af8839b6801d554263c546c69c4d7718ad4321e3166175b37eaacca77", size = 7166668, upload-time = "2025-10-21T16:22:02.049Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ff/2d/3ec9ce0c2b1d92dd59d1c3264aaec9f0f7c817d6e8ac683b97198a36ed5a/grpcio-1.76.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:25a18e9810fbc7e7f03ec2516addc116a957f8cbb8cbc95ccc80faa072743d03", size = 8124928, upload-time = "2025-10-21T16:22:04.984Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1a/74/fd3317be5672f4856bcdd1a9e7b5e17554692d3db9a3b273879dc02d657d/grpcio-1.76.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:931091142fd8cc14edccc0845a79248bc155425eee9a98b2db2ea4f00a235a42", size = 7589983, upload-time = "2025-10-21T16:22:07.881Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/45/bb/ca038cf420f405971f19821c8c15bcbc875505f6ffadafe9ffd77871dc4c/grpcio-1.76.0-cp313-cp313-win32.whl", hash = "sha256:5e8571632780e08526f118f74170ad8d50fb0a48c23a746bef2a6ebade3abd6f", size = 3984727, upload-time = "2025-10-21T16:22:10.032Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/41/80/84087dc56437ced7cdd4b13d7875e7439a52a261e3ab4e06488ba6173b0a/grpcio-1.76.0-cp313-cp313-win_amd64.whl", hash = "sha256:f9f7bd5faab55f47231ad8dba7787866b69f5e93bc306e3915606779bbfb4ba8", size = 4702799, upload-time = "2025-10-21T16:22:12.709Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b4/46/39adac80de49d678e6e073b70204091e76631e03e94928b9ea4ecf0f6e0e/grpcio-1.76.0-cp314-cp314-linux_armv7l.whl", hash = "sha256:ff8a59ea85a1f2191a0ffcc61298c571bc566332f82e5f5be1b83c9d8e668a62", size = 5808417, upload-time = "2025-10-21T16:22:15.02Z" }, { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9c/f5/a4531f7fb8b4e2a60b94e39d5d924469b7a6988176b3422487be61fe2998/grpcio-1.76.0-cp314-cp314-macosx_11_0_universal2.whl", hash = "sha256:06c3d6b076e7b593905d04fdba6a0525711b3466f43b3400266f04ff735de0cd", size = 11828219, upload-time = "2025-10-21T16:22:17.954Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4b/1c/de55d868ed7a8bd6acc6b1d6ddc4aa36d07a9f31d33c912c804adb1b971b/grpcio-1.76.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:fd5ef5932f6475c436c4a55e4336ebbe47bd3272be04964a03d316bbf4afbcbc", size = 6367826, upload-time = "2025-10-21T16:22:20.721Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/59/64/99e44c02b5adb0ad13ab3adc89cb33cb54bfa90c74770f2607eea629b86f/grpcio-1.76.0-cp314-cp314-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:b331680e46239e090f5b3cead313cc772f6caa7d0fc8de349337563125361a4a", size = 7049550, upload-time = "2025-10-21T16:22:23.637Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/43/28/40a5be3f9a86949b83e7d6a2ad6011d993cbe9b6bd27bea881f61c7788b6/grpcio-1.76.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:2229ae655ec4e8999599469559e97630185fdd53ae1e8997d147b7c9b2b72cba", size = 6575564, upload-time = "2025-10-21T16:22:26.016Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4b/a9/1be18e6055b64467440208a8559afac243c66a8b904213af6f392dc2212f/grpcio-1.76.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:490fa6d203992c47c7b9e4a9d39003a0c2bcc1c9aa3c058730884bbbb0ee9f09", size = 7176236, upload-time = "2025-10-21T16:22:28.362Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0f/55/dba05d3fcc151ce6e81327541d2cc8394f442f6b350fead67401661bf041/grpcio-1.76.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:479496325ce554792dba6548fae3df31a72cef7bad71ca2e12b0e58f9b336bfc", size = 8125795, upload-time = "2025-10-21T16:22:31.075Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4a/45/122df922d05655f63930cf42c9e3f72ba20aadb26c100ee105cad4ce4257/grpcio-1.76.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:1c9b93f79f48b03ada57ea24725d83a30284a012ec27eab2cf7e50a550cbbbcc", size = 7592214, upload-time = "2025-10-21T16:22:33.831Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4a/6e/0b899b7f6b66e5af39e377055fb4a6675c9ee28431df5708139df2e93233/grpcio-1.76.0-cp314-cp314-win32.whl", hash = "sha256:747fa73efa9b8b1488a95d0ba1039c8e2dca0f741612d80415b1e1c560febf4e", size = 4062961, upload-time = "2025-10-21T16:22:36.468Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/19/41/0b430b01a2eb38ee887f88c1f07644a1df8e289353b78e82b37ef988fb64/grpcio-1.76.0-cp314-cp314-win_amd64.whl", hash = "sha256:922fa70ba549fce362d2e2871ab542082d66e2aaf0c19480ea453905b01f384e", size = 4834462, upload-time = "2025-10-21T16:22:39.772Z" }, ] [[package]] @@ -2718,8 +2577,7 @@ version = "1.67.1" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "googleapis-common-protos" }, - { name = "grpcio", version = "1.67.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "grpcio", version = "1.76.0", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, + { name = "grpcio" }, { name = "protobuf" }, ] sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/be/c7/fe0e79a80ac6346e0c6c0a24e9e3cbc3ae1c2a009acffb59eab484a6f69b/grpcio_status-1.67.1.tar.gz", hash = "sha256:2bf38395e028ceeecfd8866b081f61628114b384da7d51ae064ddc8d766a5d11", size = 13673, upload-time = "2024-10-29T06:30:21.787Z" } @@ -2787,6 +2645,35 @@ wheels = [ { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a1/14/f1e15b851d1c2af5b0b1a82bf8eb10bda2da62d98180220ba6fd8879bb5b/hf_transfer-0.1.9-cp38-abi3-win_amd64.whl", hash = "sha256:16f208fc678911c37e11aa7b586bc66a37d02e636208f18b6bc53d29b5df40ad", size = 1160240, upload-time = "2025-01-07T10:05:14.324Z" }, ] +[[package]] +name = "hf-xet" +version = "1.2.0" +source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5e/6e/0f11bacf08a67f7fb5ee09740f2ca54163863b07b70d579356e9222ce5d8/hf_xet-1.2.0.tar.gz", hash = "sha256:a8c27070ca547293b6890c4bf389f713f80e8c478631432962bb7f4bc0bd7d7f", size = 506020, upload-time = "2025-10-24T19:04:32.129Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9e/a5/85ef910a0aa034a2abcfadc360ab5ac6f6bc4e9112349bd40ca97551cff0/hf_xet-1.2.0-cp313-cp313t-macosx_10_12_x86_64.whl", hash = "sha256:ceeefcd1b7aed4956ae8499e2199607765fbd1c60510752003b6cc0b8413b649", size = 2861870, upload-time = "2025-10-24T19:04:11.422Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ea/40/e2e0a7eb9a51fe8828ba2d47fe22a7e74914ea8a0db68a18c3aa7449c767/hf_xet-1.2.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:b70218dd548e9840224df5638fdc94bd033552963cfa97f9170829381179c813", size = 2717584, upload-time = "2025-10-24T19:04:09.586Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a5/7d/daf7f8bc4594fdd59a8a596f9e3886133fdc68e675292218a5e4c1b7e834/hf_xet-1.2.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7d40b18769bb9a8bc82a9ede575ce1a44c75eb80e7375a01d76259089529b5dc", size = 3315004, upload-time = "2025-10-24T19:04:00.314Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b1/ba/45ea2f605fbf6d81c8b21e4d970b168b18a53515923010c312c06cd83164/hf_xet-1.2.0-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:cd3a6027d59cfb60177c12d6424e31f4b5ff13d8e3a1247b3a584bf8977e6df5", size = 3222636, upload-time = "2025-10-24T19:03:58.111Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4a/1d/04513e3cab8f29ab8c109d309ddd21a2705afab9d52f2ba1151e0c14f086/hf_xet-1.2.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:6de1fc44f58f6dd937956c8d304d8c2dea264c80680bcfa61ca4a15e7b76780f", size = 3408448, upload-time = "2025-10-24T19:04:20.951Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f0/7c/60a2756d7feec7387db3a1176c632357632fbe7849fce576c5559d4520c7/hf_xet-1.2.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:f182f264ed2acd566c514e45da9f2119110e48a87a327ca271027904c70c5832", size = 3503401, upload-time = "2025-10-24T19:04:22.549Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4e/64/48fffbd67fb418ab07451e4ce641a70de1c40c10a13e25325e24858ebe5a/hf_xet-1.2.0-cp313-cp313t-win_amd64.whl", hash = "sha256:293a7a3787e5c95d7be1857358a9130694a9c6021de3f27fa233f37267174382", size = 2900866, upload-time = "2025-10-24T19:04:33.461Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e2/51/f7e2caae42f80af886db414d4e9885fac959330509089f97cccb339c6b87/hf_xet-1.2.0-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:10bfab528b968c70e062607f663e21e34e2bba349e8038db546646875495179e", size = 2861861, upload-time = "2025-10-24T19:04:19.01Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6e/1d/a641a88b69994f9371bd347f1dd35e5d1e2e2460a2e350c8d5165fc62005/hf_xet-1.2.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:2a212e842647b02eb6a911187dc878e79c4aa0aa397e88dd3b26761676e8c1f8", size = 2717699, upload-time = "2025-10-24T19:04:17.306Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/df/e0/e5e9bba7d15f0318955f7ec3f4af13f92e773fbb368c0b8008a5acbcb12f/hf_xet-1.2.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:30e06daccb3a7d4c065f34fc26c14c74f4653069bb2b194e7f18f17cbe9939c0", size = 3314885, upload-time = "2025-10-24T19:04:07.642Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/21/90/b7fe5ff6f2b7b8cbdf1bd56145f863c90a5807d9758a549bf3d916aa4dec/hf_xet-1.2.0-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:29c8fc913a529ec0a91867ce3d119ac1aac966e098cf49501800c870328cc090", size = 3221550, upload-time = "2025-10-24T19:04:05.55Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6f/cb/73f276f0a7ce46cc6a6ec7d6c7d61cbfe5f2e107123d9bbd0193c355f106/hf_xet-1.2.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:66e159cbfcfbb29f920db2c09ed8b660eb894640d284f102ada929b6e3dc410a", size = 3408010, upload-time = "2025-10-24T19:04:28.598Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b8/1e/d642a12caa78171f4be64f7cd9c40e3ca5279d055d0873188a58c0f5fbb9/hf_xet-1.2.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:9c91d5ae931510107f148874e9e2de8a16052b6f1b3ca3c1b12f15ccb491390f", size = 3503264, upload-time = "2025-10-24T19:04:30.397Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/17/b5/33764714923fa1ff922770f7ed18c2daae034d21ae6e10dbf4347c854154/hf_xet-1.2.0-cp314-cp314t-win_amd64.whl", hash = "sha256:210d577732b519ac6ede149d2f2f34049d44e8622bf14eb3d63bbcd2d4b332dc", size = 2901071, upload-time = "2025-10-24T19:04:37.463Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/96/2d/22338486473df5923a9ab7107d375dbef9173c338ebef5098ef593d2b560/hf_xet-1.2.0-cp37-abi3-macosx_10_12_x86_64.whl", hash = "sha256:46740d4ac024a7ca9b22bebf77460ff43332868b661186a8e46c227fdae01848", size = 2866099, upload-time = "2025-10-24T19:04:15.366Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7f/8c/c5becfa53234299bc2210ba314eaaae36c2875e0045809b82e40a9544f0c/hf_xet-1.2.0-cp37-abi3-macosx_11_0_arm64.whl", hash = "sha256:27df617a076420d8845bea087f59303da8be17ed7ec0cd7ee3b9b9f579dff0e4", size = 2722178, upload-time = "2025-10-24T19:04:13.695Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9a/92/cf3ab0b652b082e66876d08da57fcc6fa2f0e6c70dfbbafbd470bb73eb47/hf_xet-1.2.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3651fd5bfe0281951b988c0facbe726aa5e347b103a675f49a3fa8144c7968fd", size = 3320214, upload-time = "2025-10-24T19:04:03.596Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/46/92/3f7ec4a1b6a65bf45b059b6d4a5d38988f63e193056de2f420137e3c3244/hf_xet-1.2.0-cp37-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:d06fa97c8562fb3ee7a378dd9b51e343bc5bc8190254202c9771029152f5e08c", size = 3229054, upload-time = "2025-10-24T19:04:01.949Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0b/dd/7ac658d54b9fb7999a0ccb07ad863b413cbaf5cf172f48ebcd9497ec7263/hf_xet-1.2.0-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:4c1428c9ae73ec0939410ec73023c4f842927f39db09b063b9482dac5a3bb737", size = 3413812, upload-time = "2025-10-24T19:04:24.585Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/92/68/89ac4e5b12a9ff6286a12174c8538a5930e2ed662091dd2572bbe0a18c8a/hf_xet-1.2.0-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:a55558084c16b09b5ed32ab9ed38421e2d87cf3f1f89815764d1177081b99865", size = 3508920, upload-time = "2025-10-24T19:04:26.927Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cb/44/870d44b30e1dcfb6a65932e3e1506c103a8a5aea9103c337e7a53180322c/hf_xet-1.2.0-cp37-abi3-win_amd64.whl", hash = "sha256:e6584a52253f72c9f52f9e549d5895ca7a471608495c4ecaa6cc73dba2b24d69", size = 2905735, upload-time = "2025-10-24T19:04:35.928Z" }, +] + [[package]] name = "hpack" version = "4.1.0" @@ -2873,20 +2760,23 @@ wheels = [ [[package]] name = "huggingface-hub" -version = "0.25.2" +version = "1.3.1" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "filelock" }, { name = "fsspec" }, + { name = "hf-xet", marker = "platform_machine == 'AMD64' or platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'arm64' or platform_machine == 'x86_64'" }, + { name = "httpx" }, { name = "packaging" }, { name = "pyyaml" }, - { name = "requests" }, + { name = "shellingham" }, { name = "tqdm" }, + { name = "typer-slim" }, { name = "typing-extensions" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/df/fd/5f81bae67096c5ab50d29a0230b8374f0245916cca192f8ee2fada51f4f6/huggingface_hub-0.25.2.tar.gz", hash = "sha256:a1014ea111a5f40ccd23f7f7ba8ac46e20fa3b658ced1f86a00c75c06ec6423c", size = 365806, upload-time = "2024-10-09T08:32:41.565Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/dd/dd/1cc985c5dda36298b152f75e82a1c81f52243b78fb7e9cad637a29561ad1/huggingface_hub-1.3.1.tar.gz", hash = "sha256:e80e0cfb4a75557c51ab20d575bdea6bb6106c2f97b7c75d8490642f1efb6df5", size = 622356, upload-time = "2026-01-09T14:08:16.888Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/64/09/a535946bf2dc88e61341f39dc507530411bb3ea4eac493e5ec833e8f35bd/huggingface_hub-0.25.2-py3-none-any.whl", hash = "sha256:1897caf88ce7f97fe0110603d8f66ac264e3ba6accdf30cd66cc0fed5282ad25", size = 436575, upload-time = "2024-10-09T08:32:39.166Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/90/fb/cb8fe5f71d5622427f20bcab9e06a696a5aaf21bfe7bd0a8a0c63c88abf5/huggingface_hub-1.3.1-py3-none-any.whl", hash = "sha256:efbc7f3153cb84e2bb69b62ed90985e21ecc9343d15647a419fc0ee4b85f0ac3", size = 533351, upload-time = "2026-01-09T14:08:14.519Z" }, ] [[package]] @@ -2927,14 +2817,14 @@ wheels = [ [[package]] name = "hypothesis" -version = "6.148.7" +version = "6.150.1" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "sortedcontainers" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/09/5e/6a506e81d4dfefed2e838b6beaaae87b2e411dda3da0a3abf94099f194ae/hypothesis-6.148.7.tar.gz", hash = "sha256:b96e817e715c5b1a278411e3b9baf6d599d5b12207ba25e41a8f066929f6c2a6", size = 471199, upload-time = "2025-12-05T02:12:38.068Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ad/4e/cd3a398b9834386a79f4eb777dc4004ca439c1019d324771ec8196fc8354/hypothesis-6.150.1.tar.gz", hash = "sha256:dc79672b3771e92e6563ca0c56a24135438f319b257a1a1982deb8fbb791be89", size = 474924, upload-time = "2026-01-12T08:45:45.416Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e9/55/fa5607e4a4af96dfa0e7efd81bbd130735cedd21aac70b25e06191bff92f/hypothesis-6.148.7-py3-none-any.whl", hash = "sha256:94dbd58ebf259afa3bafb1d3bf5761ac1bde6f1477de494798cbf7960aabbdee", size = 538127, upload-time = "2025-12-05T02:12:35.54Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/22/18/f43815244cd99b54d8ac9f44f9799bb7c0115e48e29bc7a1899c0589ee48/hypothesis-6.150.1-py3-none-any.whl", hash = "sha256:7badb28a0da323d6afaf25eae1c93932cb8ac06193355f5e080d6e6465a51da5", size = 542374, upload-time = "2026-01-12T08:45:41.854Z" }, ] [[package]] @@ -3040,14 +2930,14 @@ wheels = [ [[package]] name = "importlib-metadata" -version = "8.7.0" +version = "8.7.1" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "zipp" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/76/66/650a33bd90f786193e4de4b3ad86ea60b53c89b669a5c7be931fac31cdb0/importlib_metadata-8.7.0.tar.gz", hash = "sha256:d13b81ad223b890aa16c5471f2ac3056cf76c5f10f82d6f9292f0b415f389000", size = 56641, upload-time = "2025-04-27T15:29:01.736Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f3/49/3b30cad09e7771a4982d9975a8cbf64f00d4a1ececb53297f1d9a7be1b10/importlib_metadata-8.7.1.tar.gz", hash = "sha256:49fef1ae6440c182052f407c8d34a68f72efc36db9ca90dc0113398f2fdde8bb", size = 57107, upload-time = "2025-12-21T10:00:19.278Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/20/b0/36bd937216ec521246249be3bf9855081de4c5e06a0c9b4219dbeda50373/importlib_metadata-8.7.0-py3-none-any.whl", hash = "sha256:e5dd1551894c77868a30651cef00984d50e1002d06942a7101d34870c5f02afd", size = 27656, upload-time = "2025-04-27T15:29:00.214Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fa/5e/f8e9a1d23b9c20a551a8a02ea3637b4642e22c2626e3a13a9a29cdea99eb/importlib_metadata-8.7.1-py3-none-any.whl", hash = "sha256:5a1f80bf1daa489495071efbb095d75a634cf28a8bc299581244063b53176151", size = 27865, upload-time = "2025-12-21T10:00:18.329Z" }, ] [[package]] @@ -3145,7 +3035,7 @@ wheels = [ [[package]] name = "ipython" -version = "9.8.0" +version = "9.9.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "colorama", marker = "sys_platform == 'win32'" }, @@ -3159,9 +3049,9 @@ dependencies = [ { name = "stack-data" }, { name = "traitlets" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/12/51/a703c030f4928646d390b4971af4938a1b10c9dfce694f0d99a0bb073cb2/ipython-9.8.0.tar.gz", hash = "sha256:8e4ce129a627eb9dd221c41b1d2cdaed4ef7c9da8c17c63f6f578fe231141f83", size = 4424940, upload-time = "2025-12-03T10:18:24.353Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/46/dd/fb08d22ec0c27e73c8bc8f71810709870d51cadaf27b7ddd3f011236c100/ipython-9.9.0.tar.gz", hash = "sha256:48fbed1b2de5e2c7177eefa144aba7fcb82dac514f09b57e2ac9da34ddb54220", size = 4425043, upload-time = "2026-01-05T12:36:46.233Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f1/df/8ee1c5dd1e3308b5d5b2f2dfea323bb2f3827da8d654abb6642051199049/ipython-9.8.0-py3-none-any.whl", hash = "sha256:ebe6d1d58d7d988fbf23ff8ff6d8e1622cfdb194daf4b7b73b792c4ec3b85385", size = 621374, upload-time = "2025-12-03T10:18:22.335Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/86/92/162cfaee4ccf370465c5af1ce36a9eacec1becb552f2033bb3584e6f640a/ipython-9.9.0-py3-none-any.whl", hash = "sha256:b457fe9165df2b84e8ec909a97abcf2ed88f565970efba16b1f7229c283d252b", size = 621431, upload-time = "2026-01-05T12:36:44.669Z" }, ] [[package]] @@ -3213,11 +3103,11 @@ wheels = [ [[package]] name = "itsdangerous" -version = "2.1.2" +version = "2.2.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7f/a1/d3fb83e7a61fa0c0d3d08ad0a94ddbeff3731c05212617dff3a94e097f08/itsdangerous-2.1.2.tar.gz", hash = "sha256:5dbbc68b317e5e42f327f9021763545dc3fc3bfe22e6deb96aaf1fc38874156a", size = 56143, upload-time = "2022-03-24T15:12:15.102Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9c/cb/8ac0172223afbccb63986cc25049b154ecfb5e85932587206f42317be31d/itsdangerous-2.2.0.tar.gz", hash = "sha256:e0050c0b7da1eea53ffaf149c0cfbb5c6e2e2b69c4bef22c81fa6eb73e5f6173", size = 54410, upload-time = "2024-04-16T21:28:15.614Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/68/5f/447e04e828f47465eeab35b5d408b7ebaaaee207f48b7136c5a7267a30ae/itsdangerous-2.1.2-py3-none-any.whl", hash = "sha256:2c2349112351b88699d8d4b6b075022c0808887cb7ad10069318a8b0bc88db44", size = 15749, upload-time = "2022-03-24T15:12:13.2Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/04/96/92447566d16df59b2a776c0fb82dbc4d9e07cd95062562af01e408583fc4/itsdangerous-2.2.0-py3-none-any.whl", hash = "sha256:c6242fc49e35958c8b15141343aa660db5fc54d4f13a1db01a3f5891b98700ef", size = 16234, upload-time = "2024-04-16T21:28:14.499Z" }, ] [[package]] @@ -3340,11 +3230,11 @@ wheels = [ [[package]] name = "joblib" -version = "1.5.2" +version = "1.5.3" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e8/5d/447af5ea094b9e4c4054f82e223ada074c552335b9b4b2d14bd9b35a67c4/joblib-1.5.2.tar.gz", hash = "sha256:3faa5c39054b2f03ca547da9b2f52fde67c06240c31853f306aea97f13647b55", size = 331077, upload-time = "2025-08-27T12:15:46.575Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/41/f2/d34e8b3a08a9cc79a50b2208a93dce981fe615b64d5a4d4abee421d898df/joblib-1.5.3.tar.gz", hash = "sha256:8561a3269e6801106863fd0d6d84bb737be9e7631e33aaed3fb9ce5953688da3", size = 331603, upload-time = "2025-12-15T08:41:46.427Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1e/e8/685f47e0d754320684db4425a0967f7d3fa70126bffd76110b7009a0090f/joblib-1.5.2-py3-none-any.whl", hash = "sha256:4e1f0bdbb987e6d843c70cf43714cb276623def372df3c22fe5266b2670bc241", size = 308396, upload-time = "2025-08-27T12:15:45.188Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7b/91/984aca2ec129e2757d1e4e3c81c3fcda9d0f85b74670a094cc443d9ee949/joblib-1.5.3-py3-none-any.whl", hash = "sha256:5fc3c5039fc5ca8c0276333a188bbd59d6b7ab37fe6632daa76bc7f9ec18e713", size = 309071, upload-time = "2025-12-15T08:41:44.973Z" }, ] [[package]] @@ -3364,7 +3254,7 @@ sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cf/a1/693351acd0a9ed [[package]] name = "jsonschema" -version = "4.25.1" +version = "4.26.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "attrs" }, @@ -3372,9 +3262,9 @@ dependencies = [ { name = "referencing" }, { name = "rpds-py" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/74/69/f7185de793a29082a9f3c7728268ffb31cb5095131a9c139a74078e27336/jsonschema-4.25.1.tar.gz", hash = "sha256:e4a9655ce0da0c0b67a085847e00a3a51449e1157f4f75e9fb5aa545e122eb85", size = 357342, upload-time = "2025-08-18T17:03:50.038Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b3/fc/e067678238fa451312d4c62bf6e6cf5ec56375422aee02f9cb5f909b3047/jsonschema-4.26.0.tar.gz", hash = "sha256:0c26707e2efad8aa1bfc5b7ce170f3fccc2e4918ff85989ba9ffa9facb2be326", size = 366583, upload-time = "2026-01-07T13:41:07.246Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bf/9c/8c95d856233c1f82500c2450b8c68576b4cf1c871db3afac5c34ff84e6fd/jsonschema-4.25.1-py3-none-any.whl", hash = "sha256:3fba0169e345c7175110351d456342c364814cfcf3b964ba4587f22915230a63", size = 90040, upload-time = "2025-08-18T17:03:48.373Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/69/90/f63fb5873511e014207a475e2bb4e8b2e570d655b00ac19a9a0ca0a385ee/jsonschema-4.26.0-py3-none-any.whl", hash = "sha256:d489f15263b8d200f8387e64b4c3a75f06629559fb73deb8fdfb525f2dab50ce", size = 90630, upload-time = "2026-01-07T13:41:05.306Z" }, ] [[package]] @@ -3391,7 +3281,7 @@ wheels = [ [[package]] name = "jupyter-client" -version = "8.7.0" +version = "8.8.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "jupyter-core" }, @@ -3400,9 +3290,9 @@ dependencies = [ { name = "tornado" }, { name = "traitlets" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a6/27/d10de45e8ad4ce872372c4a3a37b7b35b6b064f6f023a5c14ffcced4d59d/jupyter_client-8.7.0.tar.gz", hash = "sha256:3357212d9cbe01209e59190f67a3a7e1f387a4f4e88d1e0433ad84d7b262531d", size = 344691, upload-time = "2025-12-09T18:37:01.953Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/05/e4/ba649102a3bc3fbca54e7239fb924fd434c766f855693d86de0b1f2bec81/jupyter_client-8.8.0.tar.gz", hash = "sha256:d556811419a4f2d96c869af34e854e3f059b7cc2d6d01a9cd9c85c267691be3e", size = 348020, upload-time = "2026-01-08T13:55:47.938Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bb/f5/fddaec430367be9d62a7ed125530e133bfd4a1c0350fe221149ee0f2b526/jupyter_client-8.7.0-py3-none-any.whl", hash = "sha256:3671a94fd25e62f5f2f554f5e95389c2294d89822378a5f2dd24353e1494a9e0", size = 106215, upload-time = "2025-12-09T18:37:00.024Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2d/0b/ceb7694d864abc0a047649aec263878acb9f792e1fec3e676f22dc9015e3/jupyter_client-8.8.0-py3-none-any.whl", hash = "sha256:f93a5b99c5e23a507b773d3a1136bd6e16c67883ccdbd9a829b0bbdb98cd7d7a", size = 107371, upload-time = "2026-01-08T13:55:45.562Z" }, ] [[package]] @@ -3501,7 +3391,7 @@ wheels = [ [[package]] name = "langfuse" -version = "3.10.5" +version = "3.11.2" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "backoff" }, @@ -3515,9 +3405,9 @@ dependencies = [ { name = "requests" }, { name = "wrapt" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/69/21/dff0434290512484436bfa108e36f0adc3457eb4117767de70e76a411cac/langfuse-3.10.5.tar.gz", hash = "sha256:14eb767663f7e7480cd1cd1b3ca457022817c129e666efe97e5c80adb8c5aac0", size = 223142, upload-time = "2025-12-03T17:49:39.747Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/71/10/6b28f3b2c008b1f48478c4f45ceb956dfcc951910f5896b3fe44c20174db/langfuse-3.11.2.tar.gz", hash = "sha256:ab5f296a8056815b7288c7f25bc308a5e79f82a8634467b25daffdde99276e09", size = 230795, upload-time = "2025-12-23T20:42:57.177Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/64/6f/dc15775f82d38da62cd2015110f5802bb175a9ee731a4533fe2a0cdf75b6/langfuse-3.10.5-py3-none-any.whl", hash = "sha256:0223a64109a4293b9bd9b2e0e3229f53b75291cd96341e42cc3eba186973fcdb", size = 398888, upload-time = "2025-12-03T17:49:38.171Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e9/04/95407023b786ed2eef1e2cd220f5baf7b1dd70d88645af129cc1fd1da867/langfuse-3.11.2-py3-none-any.whl", hash = "sha256:84faea9f909694023cc7f0eb45696be190248c8790424f22af57ca4cd7a29f2d", size = 413786, upload-time = "2025-12-23T20:42:55.48Z" }, ] [[package]] @@ -3531,62 +3421,26 @@ wheels = [ [[package]] name = "litellm" -version = "1.80.5" +version = "1.80.15" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -resolution-markers = [ - "python_full_version >= '3.14' and sys_platform == 'darwin'", -] -dependencies = [ - { name = "aiohttp", marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "click", marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "fastuuid", marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "httpx", marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "importlib-metadata", marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "jinja2", marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "jsonschema", marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "openai", marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "pydantic", marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "python-dotenv", marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "tiktoken", marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "tokenizers", marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, -] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/85/b8/357544534bef87dd2858432f3cbd3a0e5cc267caebca5ea86b03618786c5/litellm-1.80.5.tar.gz", hash = "sha256:922791c264845d9ed59e540c8fa74a74d237c1b209568a05ffeacd8b51770deb", size = 11885764, upload-time = "2025-11-22T23:41:42.25Z" } -wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bd/af/1d4693746ff9fbbe27a6e7d6394b801acf234e00c83f45ad1cb5bf2eaa6c/litellm-1.80.5-py3-none-any.whl", hash = "sha256:2ac5f4e88cd57ae056e00da8f872e1c2956653750929fba2fd9b007b400fdb77", size = 10671970, upload-time = "2025-11-22T23:41:39.923Z" }, -] - -[[package]] -name = "litellm" -version = "1.80.9" -source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -resolution-markers = [ - "python_full_version == '3.13.*' and sys_platform == 'darwin'", - "python_full_version < '3.13' and sys_platform == 'darwin'", - "python_full_version >= '3.14' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "python_full_version == '3.13.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "python_full_version < '3.13' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.14' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.14' and sys_platform != 'darwin' and sys_platform != 'linux')", - "(python_full_version == '3.13.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.13.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "(python_full_version < '3.13' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.13' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "aiohttp", marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "click", marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "fastuuid", marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "grpcio", version = "1.67.1", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "httpx", marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "importlib-metadata", marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "jinja2", marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "jsonschema", marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "openai", marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "pydantic", marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "python-dotenv", marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "tiktoken", marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, - { name = "tokenizers", marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, + { name = "aiohttp" }, + { name = "click" }, + { name = "fastuuid" }, + { name = "grpcio" }, + { name = "httpx" }, + { name = "importlib-metadata" }, + { name = "jinja2" }, + { name = "jsonschema" }, + { name = "openai" }, + { name = "pydantic" }, + { name = "python-dotenv" }, + { name = "tiktoken" }, + { name = "tokenizers" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/74/a0/0a6d6992120077fe47dc1432b69071a0a6030bc4f68c01be561382d65521/litellm-1.80.9.tar.gz", hash = "sha256:768b62f26086efbaed40f4dfd353ff66302474bbfb0adf5862066acdb0727df6", size = 12348545, upload-time = "2025-12-08T21:05:00.688Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/12/41/9b28df3e4739df83ddb32dfb2bccb12ad271d986494c9fd60e4927a0a6c3/litellm-1.80.15.tar.gz", hash = "sha256:759d09f33c9c6028c58dcdf71781b17b833ee926525714e09a408602be27f54e", size = 13376508, upload-time = "2026-01-11T18:31:44.95Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0d/02/85f4b50d39d82dcf39bf1fbf2648cb01311866eb2ef2462666348b5ef1fe/litellm-1.80.9-py3-none-any.whl", hash = "sha256:bad02b96ee3d83702639553ffc5961c605f4f937be8167181bc4c80394a1cdd1", size = 11075736, upload-time = "2025-12-08T21:04:57.493Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/df/3b/b1bd693721ccb3c9a37c8233d019a643ac57bef5a93f279e5a63839ee4db/litellm-1.80.15-py3-none-any.whl", hash = "sha256:f354e49456985a235b9ed99df1c19d686d30501f96e68882dcc5b29b1e7c59d9", size = 11670707, upload-time = "2026-01-11T18:31:41.67Z" }, ] [[package]] @@ -3970,11 +3824,11 @@ wheels = [ [[package]] name = "mistune" -version = "3.1.4" +version = "3.2.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d7/02/a7fb8b21d4d55ac93cdcde9d3638da5dd0ebdd3a4fed76c7725e10b81cbe/mistune-3.1.4.tar.gz", hash = "sha256:b5a7f801d389f724ec702840c11d8fc48f2b33519102fc7ee739e8177b672164", size = 94588, upload-time = "2025-08-29T07:20:43.594Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9d/55/d01f0c4b45ade6536c51170b9043db8b2ec6ddf4a35c7ea3f5f559ac935b/mistune-3.2.0.tar.gz", hash = "sha256:708487c8a8cdd99c9d90eb3ed4c3ed961246ff78ac82f03418f5183ab70e398a", size = 95467, upload-time = "2025-12-23T11:36:34.994Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7a/f0/8282d9641415e9e33df173516226b404d367a0fc55e1a60424a152913abc/mistune-3.1.4-py3-none-any.whl", hash = "sha256:93691da911e5d9d2e23bc54472892aff676df27a75274962ff9edc210364266d", size = 53481, upload-time = "2025-08-29T07:20:42.218Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9b/f7/4a5e785ec9fbd65146a27b6b70b6cdc161a66f2024e4b04ac06a67f5578b/mistune-3.2.0-py3-none-any.whl", hash = "sha256:febdc629a3c78616b94393c6580551e0e34cc289987ec6c35ed3f4be42d0eee1", size = 53598, upload-time = "2025-12-23T11:36:33.211Z" }, ] [[package]] @@ -4068,15 +3922,15 @@ wheels = [ [[package]] name = "msoffcrypto-tool" -version = "5.4.2" +version = "6.0.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "cryptography" }, { name = "olefile" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d2/b7/0fd6573157e0ec60c0c470e732ab3322fba4d2834fd24e1088d670522a01/msoffcrypto_tool-5.4.2.tar.gz", hash = "sha256:44b545adba0407564a0cc3d6dde6ca36b7c0fdf352b85bca51618fa1d4817370", size = 41183, upload-time = "2024-08-08T15:50:28.462Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a6/34/6250bdddaeaae24098e45449ea362fb3555a65fba30cad0ad5630ea48d1a/msoffcrypto_tool-6.0.0.tar.gz", hash = "sha256:9a5ebc4c0096b42e5d7ebc2350afdc92dc511061e935ca188468094fdd032bbe", size = 40593, upload-time = "2026-01-12T08:59:56.73Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/03/54/7f6d3d9acad083dae8c22d9ab483b657359a1bf56fee1d7af88794677707/msoffcrypto_tool-5.4.2-py3-none-any.whl", hash = "sha256:274fe2181702d1e5a107ec1b68a4c9fea997a44972ae1cc9ae0cb4f6a50fef0e", size = 48713, upload-time = "2024-08-08T15:50:27.093Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3c/85/9e359fa9279e1d6861faaf9b6f037a3226374deb20a054c3937be6992013/msoffcrypto_tool-6.0.0-py3-none-any.whl", hash = "sha256:46c394ed5d9641e802fc79bf3fb0666a53748b23fa8c4aa634ae9d30d46fe397", size = 48791, upload-time = "2026-01-12T08:59:55.394Z" }, ] [[package]] @@ -4242,7 +4096,7 @@ wheels = [ [[package]] name = "nltk" -version = "3.9.1" +version = "3.9.2" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "click" }, @@ -4250,9 +4104,9 @@ dependencies = [ { name = "regex" }, { name = "tqdm" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3c/87/db8be88ad32c2d042420b6fd9ffd4a149f9a0d7f0e86b3f543be2eeeedd2/nltk-3.9.1.tar.gz", hash = "sha256:87d127bd3de4bd89a4f81265e5fa59cb1b199b27440175370f7417d2bc7ae868", size = 2904691, upload-time = "2024-08-18T19:48:37.769Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f9/76/3a5e4312c19a028770f86fd7c058cf9f4ec4321c6cf7526bab998a5b683c/nltk-3.9.2.tar.gz", hash = "sha256:0f409e9b069ca4177c1903c3e843eef90c7e92992fa4931ae607da6de49e1419", size = 2887629, upload-time = "2025-10-01T07:19:23.764Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4d/66/7d9e26593edda06e8cb531874633f7c2372279c3b0f46235539fe546df8b/nltk-3.9.1-py3-none-any.whl", hash = "sha256:4fa26829c5b00715afe3061398a8989dc643b92ce7dd93fb4585a70930d168a1", size = 1505442, upload-time = "2024-08-18T19:48:21.909Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/60/90/81ac364ef94209c100e12579629dc92bf7a709a84af32f8c551b02c07e94/nltk-3.9.2-py3-none-any.whl", hash = "sha256:1e209d2b3009110635ed9709a67a1a3e33a10f799490fa71cf4bec218c11c88a", size = 1513404, upload-time = "2025-10-01T07:19:21.648Z" }, ] [[package]] @@ -4390,12 +4244,12 @@ name = "onnxruntime-gpu" version = "1.23.2" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ - { name = "coloredlogs", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, - { name = "flatbuffers", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, - { name = "numpy", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, - { name = "packaging", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, - { name = "protobuf", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, - { name = "sympy", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, + { name = "coloredlogs" }, + { name = "flatbuffers" }, + { name = "numpy" }, + { name = "packaging" }, + { name = "protobuf" }, + { name = "sympy" }, ] wheels = [ { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6c/d9/b7140a4f1615195938c7e358c0804bb84271f0d6886b5cbf105c6cb58aae/onnxruntime_gpu-1.23.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4f2d1f720685d729b5258ec1b36dee1de381b8898189908c98cbeecdb2f2b5c2", size = 300509596, upload-time = "2025-10-22T16:56:31.728Z" }, @@ -4407,7 +4261,7 @@ wheels = [ [[package]] name = "openai" -version = "2.11.0" +version = "2.15.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "anyio" }, @@ -4419,9 +4273,9 @@ dependencies = [ { name = "tqdm" }, { name = "typing-extensions" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f4/8c/aa6aea6072f985ace9d6515046b9088ff00c157f9654da0c7b1e129d9506/openai-2.11.0.tar.gz", hash = "sha256:b3da01d92eda31524930b6ec9d7167c535e843918d7ba8a76b1c38f1104f321e", size = 624540, upload-time = "2025-12-11T19:11:58.539Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/94/f4/4690ecb5d70023ce6bfcfeabfe717020f654bde59a775058ec6ac4692463/openai-2.15.0.tar.gz", hash = "sha256:42eb8cbb407d84770633f31bf727d4ffb4138711c670565a41663d9439174fba", size = 627383, upload-time = "2026-01-09T22:10:08.603Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e5/f1/d9251b565fce9f8daeb45611e3e0d2f7f248429e40908dcee3b6fe1b5944/openai-2.11.0-py3-none-any.whl", hash = "sha256:21189da44d2e3d027b08c7a920ba4454b8b7d6d30ae7e64d9de11dbe946d4faa", size = 1064131, upload-time = "2025-12-11T19:11:56.816Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b5/df/c306f7375d42bafb379934c2df4c2fa3964656c8c782bac75ee10c102818/openai-2.15.0-py3-none-any.whl", hash = "sha256:6ae23b932cd7230f7244e52954daa6602716d6b9bf235401a107af731baea6c3", size = 1067879, upload-time = "2026-01-09T22:10:06.446Z" }, ] [[package]] @@ -4783,9 +4637,12 @@ wheels = [ [[package]] name = "peewee" -version = "3.17.1" +version = "3.19.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8d/a5/89cdbc4a7f6d7a0624c120be102db770ee717aa371066581e3daf2beb96f/peewee-3.17.1.tar.gz", hash = "sha256:e009ac4227c4fdc0058a56e822ad5987684f0a1fbb20fed577200785102581c3", size = 2951636, upload-time = "2024-02-05T15:04:14.549Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/88/b0/79462b42e89764998756e0557f2b58a15610a5b4512fbbcccae58fba7237/peewee-3.19.0.tar.gz", hash = "sha256:f88292a6f0d7b906cb26bca9c8599b8f4d8920ebd36124400d0cbaaaf915511f", size = 974035, upload-time = "2026-01-07T17:24:59.597Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1a/41/19c65578ef9a54b3083253c68a607f099642747168fe00f3a2bceb7c3a34/peewee-3.19.0-py3-none-any.whl", hash = "sha256:de220b94766e6008c466e00ce4ba5299b9a832117d9eb36d45d0062f3cfd7417", size = 411885, upload-time = "2026-01-07T17:24:58.33Z" }, +] [[package]] name = "pexpect" @@ -5073,54 +4930,56 @@ wheels = [ [[package]] name = "proto-plus" -version = "1.26.1" +version = "1.27.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "protobuf" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f4/ac/87285f15f7cce6d4a008f33f1757fb5a13611ea8914eb58c3d0d26243468/proto_plus-1.26.1.tar.gz", hash = "sha256:21a515a4c4c0088a773899e23c7bbade3d18f9c66c73edd4c7ee3816bc96a012", size = 56142, upload-time = "2025-03-10T15:54:38.843Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/01/89/9cbe2f4bba860e149108b683bc2efec21f14d5f7ed6e25562ad86acbc373/proto_plus-1.27.0.tar.gz", hash = "sha256:873af56dd0d7e91836aee871e5799e1c6f1bda86ac9a983e0bb9f0c266a568c4", size = 56158, upload-time = "2025-12-16T13:46:25.729Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4e/6d/280c4c2ce28b1593a19ad5239c8b826871fc6ec275c21afc8e1820108039/proto_plus-1.26.1-py3-none-any.whl", hash = "sha256:13285478c2dcf2abb829db158e1047e2f1e8d63a077d94263c2b88b043c75a66", size = 50163, upload-time = "2025-03-10T15:54:37.335Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cd/24/3b7a0818484df9c28172857af32c2397b6d8fcd99d9468bd4684f98ebf0a/proto_plus-1.27.0-py3-none-any.whl", hash = "sha256:1baa7f81cf0f8acb8bc1f6d085008ba4171eaf669629d1b6d1673b21ed1c0a82", size = 50205, upload-time = "2025-12-16T13:46:24.76Z" }, ] [[package]] name = "protobuf" -version = "5.27.2" +version = "5.29.5" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/71/a5/d61e4263e62e6db1990c120d682870e5c50a30fb6b26119a214c7a014847/protobuf-5.27.2.tar.gz", hash = "sha256:f3ecdef226b9af856075f28227ff2c90ce3a594d092c39bee5513573f25e2714", size = 401640, upload-time = "2024-06-25T20:54:53.874Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/43/29/d09e70352e4e88c9c7a198d5645d7277811448d76c23b00345670f7c8a38/protobuf-5.29.5.tar.gz", hash = "sha256:bc1463bafd4b0929216c35f437a8e28731a2b7fe3d98bb77a600efced5a15c84", size = 425226, upload-time = "2025-05-28T23:51:59.82Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e9/9d/318d07d4edd1dc1a29ae67f7bb42b6e8a570f817ebe8608bf3c9c518d4e8/protobuf-5.27.2-cp310-abi3-win32.whl", hash = "sha256:354d84fac2b0d76062e9b3221f4abbbacdfd2a4d8af36bab0474f3a0bb30ab38", size = 405829, upload-time = "2024-06-25T20:54:22.034Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b1/04/73b8fd7f34f3a2b2b64aa31a173b8aebbdb0c55523df4c027846bb44bc1e/protobuf-5.27.2-cp310-abi3-win_amd64.whl", hash = "sha256:0e341109c609749d501986b835f667c6e1e24531096cff9d34ae411595e26505", size = 426919, upload-time = "2024-06-25T20:54:28.399Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/75/44/6ae304790fad936bb4cf09907a05d669b7600458a02b6c960fdaaeeab06e/protobuf-5.27.2-cp38-abi3-macosx_10_9_universal2.whl", hash = "sha256:a109916aaac42bff84702fb5187f3edadbc7c97fc2c99c5ff81dd15dcce0d1e5", size = 412246, upload-time = "2024-06-25T20:54:30.159Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cd/c7/a534268f9c3780be1ba50f5ed96243fa9cf6224a445de662c34e91ce0e61/protobuf-5.27.2-cp38-abi3-manylinux2014_aarch64.whl", hash = "sha256:176c12b1f1c880bf7a76d9f7c75822b6a2bc3db2d28baa4d300e8ce4cde7409b", size = 307143, upload-time = "2024-06-25T20:54:36.048Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/27/e4/8dc4546be46873f8950cb44cdfe19b79d66d26e53c4ee5e3440406257fcd/protobuf-5.27.2-cp38-abi3-manylinux2014_x86_64.whl", hash = "sha256:b848dbe1d57ed7c191dfc4ea64b8b004a3f9ece4bf4d0d80a367b76df20bf36e", size = 309259, upload-time = "2024-06-25T20:54:38.074Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3a/fa/4c3ac5527ed2e5f3577167ecd5f8180ffcdc8bdd59c9f143409c19706456/protobuf-5.27.2-py3-none-any.whl", hash = "sha256:54330f07e4949d09614707c48b06d1a22f8ffb5763c159efd5c0928326a91470", size = 164772, upload-time = "2024-06-25T20:54:52.196Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5f/11/6e40e9fc5bba02988a214c07cf324595789ca7820160bfd1f8be96e48539/protobuf-5.29.5-cp310-abi3-win32.whl", hash = "sha256:3f1c6468a2cfd102ff4703976138844f78ebd1fb45f49011afc5139e9e283079", size = 422963, upload-time = "2025-05-28T23:51:41.204Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/81/7f/73cefb093e1a2a7c3ffd839e6f9fcafb7a427d300c7f8aef9c64405d8ac6/protobuf-5.29.5-cp310-abi3-win_amd64.whl", hash = "sha256:3f76e3a3675b4a4d867b52e4a5f5b78a2ef9565549d4037e06cf7b0942b1d3fc", size = 434818, upload-time = "2025-05-28T23:51:44.297Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/dd/73/10e1661c21f139f2c6ad9b23040ff36fee624310dc28fba20d33fdae124c/protobuf-5.29.5-cp38-abi3-macosx_10_9_universal2.whl", hash = "sha256:e38c5add5a311f2a6eb0340716ef9b039c1dfa428b28f25a7838ac329204a671", size = 418091, upload-time = "2025-05-28T23:51:45.907Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6c/04/98f6f8cf5b07ab1294c13f34b4e69b3722bb609c5b701d6c169828f9f8aa/protobuf-5.29.5-cp38-abi3-manylinux2014_aarch64.whl", hash = "sha256:fa18533a299d7ab6c55a238bf8629311439995f2e7eca5caaff08663606e9015", size = 319824, upload-time = "2025-05-28T23:51:47.545Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/85/e4/07c80521879c2d15f321465ac24c70efe2381378c00bf5e56a0f4fbac8cd/protobuf-5.29.5-cp38-abi3-manylinux2014_x86_64.whl", hash = "sha256:63848923da3325e1bf7e9003d680ce6e14b07e55d0473253a690c3a8b8fd6e61", size = 319942, upload-time = "2025-05-28T23:51:49.11Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7e/cc/7e77861000a0691aeea8f4566e5d3aa716f2b1dece4a24439437e41d3d25/protobuf-5.29.5-py3-none-any.whl", hash = "sha256:6cf42630262c59b2d8de33954443d94b746c952b01434fc58a417fdbd2e84bd5", size = 172823, upload-time = "2025-05-28T23:51:58.157Z" }, ] [[package]] name = "psutil" -version = "7.1.3" -source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e1/88/bdd0a41e5857d5d703287598cbf08dad90aed56774ea52ae071bae9071b6/psutil-7.1.3.tar.gz", hash = "sha256:6c86281738d77335af7aec228328e944b30930899ea760ecf33a4dba66be5e74", size = 489059, upload-time = "2025-11-02T12:25:54.619Z" } -wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bd/93/0c49e776b8734fef56ec9c5c57f923922f2cf0497d62e0f419465f28f3d0/psutil-7.1.3-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:0005da714eee687b4b8decd3d6cc7c6db36215c9e74e5ad2264b90c3df7d92dc", size = 239751, upload-time = "2025-11-02T12:25:58.161Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6f/8d/b31e39c769e70780f007969815195a55c81a63efebdd4dbe9e7a113adb2f/psutil-7.1.3-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:19644c85dcb987e35eeeaefdc3915d059dac7bd1167cdcdbf27e0ce2df0c08c0", size = 240368, upload-time = "2025-11-02T12:26:00.491Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/62/61/23fd4acc3c9eebbf6b6c78bcd89e5d020cfde4acf0a9233e9d4e3fa698b4/psutil-7.1.3-cp313-cp313t-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:95ef04cf2e5ba0ab9eaafc4a11eaae91b44f4ef5541acd2ee91d9108d00d59a7", size = 287134, upload-time = "2025-11-02T12:26:02.613Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/30/1c/f921a009ea9ceb51aa355cb0cc118f68d354db36eae18174bab63affb3e6/psutil-7.1.3-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1068c303be3a72f8e18e412c5b2a8f6d31750fb152f9cb106b54090296c9d251", size = 289904, upload-time = "2025-11-02T12:26:05.207Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a6/82/62d68066e13e46a5116df187d319d1724b3f437ddd0f958756fc052677f4/psutil-7.1.3-cp313-cp313t-win_amd64.whl", hash = "sha256:18349c5c24b06ac5612c0428ec2a0331c26443d259e2a0144a9b24b4395b58fa", size = 249642, upload-time = "2025-11-02T12:26:07.447Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/df/ad/c1cd5fe965c14a0392112f68362cfceb5230819dbb5b1888950d18a11d9f/psutil-7.1.3-cp313-cp313t-win_arm64.whl", hash = "sha256:c525ffa774fe4496282fb0b1187725793de3e7c6b29e41562733cae9ada151ee", size = 245518, upload-time = "2025-11-02T12:26:09.719Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2e/bb/6670bded3e3236eb4287c7bcdc167e9fae6e1e9286e437f7111caed2f909/psutil-7.1.3-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:b403da1df4d6d43973dc004d19cee3b848e998ae3154cc8097d139b77156c353", size = 239843, upload-time = "2025-11-02T12:26:11.968Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b8/66/853d50e75a38c9a7370ddbeefabdd3d3116b9c31ef94dc92c6729bc36bec/psutil-7.1.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:ad81425efc5e75da3f39b3e636293360ad8d0b49bed7df824c79764fb4ba9b8b", size = 240369, upload-time = "2025-11-02T12:26:14.358Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/41/bd/313aba97cb5bfb26916dc29cf0646cbe4dd6a89ca69e8c6edce654876d39/psutil-7.1.3-cp314-cp314t-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8f33a3702e167783a9213db10ad29650ebf383946e91bc77f28a5eb083496bc9", size = 288210, upload-time = "2025-11-02T12:26:16.699Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c2/fa/76e3c06e760927a0cfb5705eb38164254de34e9bd86db656d4dbaa228b04/psutil-7.1.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:fac9cd332c67f4422504297889da5ab7e05fd11e3c4392140f7370f4208ded1f", size = 291182, upload-time = "2025-11-02T12:26:18.848Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0f/1d/5774a91607035ee5078b8fd747686ebec28a962f178712de100d00b78a32/psutil-7.1.3-cp314-cp314t-win_amd64.whl", hash = "sha256:3792983e23b69843aea49c8f5b8f115572c5ab64c153bada5270086a2123c7e7", size = 250466, upload-time = "2025-11-02T12:26:21.183Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/00/ca/e426584bacb43a5cb1ac91fae1937f478cd8fbe5e4ff96574e698a2c77cd/psutil-7.1.3-cp314-cp314t-win_arm64.whl", hash = "sha256:31d77fcedb7529f27bb3a0472bea9334349f9a04160e8e6e5020f22c59893264", size = 245756, upload-time = "2025-11-02T12:26:23.148Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ef/94/46b9154a800253e7ecff5aaacdf8ebf43db99de4a2dfa18575b02548654e/psutil-7.1.3-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:2bdbcd0e58ca14996a42adf3621a6244f1bb2e2e528886959c72cf1e326677ab", size = 238359, upload-time = "2025-11-02T12:26:25.284Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/68/3a/9f93cff5c025029a36d9a92fef47220ab4692ee7f2be0fba9f92813d0cb8/psutil-7.1.3-cp36-abi3-macosx_11_0_arm64.whl", hash = "sha256:bc31fa00f1fbc3c3802141eede66f3a2d51d89716a194bf2cd6fc68310a19880", size = 239171, upload-time = "2025-11-02T12:26:27.23Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ce/b1/5f49af514f76431ba4eea935b8ad3725cdeb397e9245ab919dbc1d1dc20f/psutil-7.1.3-cp36-abi3-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:3bb428f9f05c1225a558f53e30ccbad9930b11c3fc206836242de1091d3e7dd3", size = 263261, upload-time = "2025-11-02T12:26:29.48Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e0/95/992c8816a74016eb095e73585d747e0a8ea21a061ed3689474fabb29a395/psutil-7.1.3-cp36-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:56d974e02ca2c8eb4812c3f76c30e28836fffc311d55d979f1465c1feeb2b68b", size = 264635, upload-time = "2025-11-02T12:26:31.74Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/55/4c/c3ed1a622b6ae2fd3c945a366e64eb35247a31e4db16cf5095e269e8eb3c/psutil-7.1.3-cp37-abi3-win_amd64.whl", hash = "sha256:f39c2c19fe824b47484b96f9692932248a54c43799a84282cfe58d05a6449efd", size = 247633, upload-time = "2025-11-02T12:26:33.887Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c9/ad/33b2ccec09bf96c2b2ef3f9a6f66baac8253d7565d8839e024a6b905d45d/psutil-7.1.3-cp37-abi3-win_arm64.whl", hash = "sha256:bd0d69cee829226a761e92f28140bec9a5ee9d5b4fb4b0cc589068dbfff559b1", size = 244608, upload-time = "2025-11-02T12:26:36.136Z" }, +version = "7.2.1" +source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/73/cb/09e5184fb5fc0358d110fc3ca7f6b1d033800734d34cac10f4136cfac10e/psutil-7.2.1.tar.gz", hash = "sha256:f7583aec590485b43ca601dd9cea0dcd65bd7bb21d30ef4ddbf4ea6b5ed1bdd3", size = 490253, upload-time = "2025-12-29T08:26:00.169Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/77/8e/f0c242053a368c2aa89584ecd1b054a18683f13d6e5a318fc9ec36582c94/psutil-7.2.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:ba9f33bb525b14c3ea563b2fd521a84d2fa214ec59e3e6a2858f78d0844dd60d", size = 129624, upload-time = "2025-12-29T08:26:04.255Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/26/97/a58a4968f8990617decee234258a2b4fc7cd9e35668387646c1963e69f26/psutil-7.2.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:81442dac7abfc2f4f4385ea9e12ddf5a796721c0f6133260687fec5c3780fa49", size = 130132, upload-time = "2025-12-29T08:26:06.228Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/db/6d/ed44901e830739af5f72a85fa7ec5ff1edea7f81bfbf4875e409007149bd/psutil-7.2.1-cp313-cp313t-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ea46c0d060491051d39f0d2cff4f98d5c72b288289f57a21556cc7d504db37fc", size = 180612, upload-time = "2025-12-29T08:26:08.276Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c7/65/b628f8459bca4efbfae50d4bf3feaab803de9a160b9d5f3bd9295a33f0c2/psutil-7.2.1-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:35630d5af80d5d0d49cfc4d64c1c13838baf6717a13effb35869a5919b854cdf", size = 183201, upload-time = "2025-12-29T08:26:10.622Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fb/23/851cadc9764edcc18f0effe7d0bf69f727d4cf2442deb4a9f78d4e4f30f2/psutil-7.2.1-cp313-cp313t-win_amd64.whl", hash = "sha256:923f8653416604e356073e6e0bccbe7c09990acef442def2f5640dd0faa9689f", size = 139081, upload-time = "2025-12-29T08:26:12.483Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/59/82/d63e8494ec5758029f31c6cb06d7d161175d8281e91d011a4a441c8a43b5/psutil-7.2.1-cp313-cp313t-win_arm64.whl", hash = "sha256:cfbe6b40ca48019a51827f20d830887b3107a74a79b01ceb8cc8de4ccb17b672", size = 134767, upload-time = "2025-12-29T08:26:14.528Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/05/c2/5fb764bd61e40e1fe756a44bd4c21827228394c17414ade348e28f83cd79/psutil-7.2.1-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:494c513ccc53225ae23eec7fe6e1482f1b8a44674241b54561f755a898650679", size = 129716, upload-time = "2025-12-29T08:26:16.017Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c9/d2/935039c20e06f615d9ca6ca0ab756cf8408a19d298ffaa08666bc18dc805/psutil-7.2.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:3fce5f92c22b00cdefd1645aa58ab4877a01679e901555067b1bd77039aa589f", size = 130133, upload-time = "2025-12-29T08:26:18.009Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/77/69/19f1eb0e01d24c2b3eacbc2f78d3b5add8a89bf0bb69465bc8d563cc33de/psutil-7.2.1-cp314-cp314t-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:93f3f7b0bb07711b49626e7940d6fe52aa9940ad86e8f7e74842e73189712129", size = 181518, upload-time = "2025-12-29T08:26:20.241Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e1/6d/7e18b1b4fa13ad370787626c95887b027656ad4829c156bb6569d02f3262/psutil-7.2.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d34d2ca888208eea2b5c68186841336a7f5e0b990edec929be909353a202768a", size = 184348, upload-time = "2025-12-29T08:26:22.215Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/98/60/1672114392dd879586d60dd97896325df47d9a130ac7401318005aab28ec/psutil-7.2.1-cp314-cp314t-win_amd64.whl", hash = "sha256:2ceae842a78d1603753561132d5ad1b2f8a7979cb0c283f5b52fb4e6e14b1a79", size = 140400, upload-time = "2025-12-29T08:26:23.993Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fb/7b/d0e9d4513c46e46897b46bcfc410d51fc65735837ea57a25170f298326e6/psutil-7.2.1-cp314-cp314t-win_arm64.whl", hash = "sha256:08a2f175e48a898c8eb8eace45ce01777f4785bc744c90aa2cc7f2fa5462a266", size = 135430, upload-time = "2025-12-29T08:26:25.999Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c5/cf/5180eb8c8bdf6a503c6919f1da28328bd1e6b3b1b5b9d5b01ae64f019616/psutil-7.2.1-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:b2e953fcfaedcfbc952b44744f22d16575d3aa78eb4f51ae74165b4e96e55f42", size = 128137, upload-time = "2025-12-29T08:26:27.759Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c5/2c/78e4a789306a92ade5000da4f5de3255202c534acdadc3aac7b5458fadef/psutil-7.2.1-cp36-abi3-macosx_11_0_arm64.whl", hash = "sha256:05cc68dbb8c174828624062e73078e7e35406f4ca2d0866c272c2410d8ef06d1", size = 128947, upload-time = "2025-12-29T08:26:29.548Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/29/f8/40e01c350ad9a2b3cb4e6adbcc8a83b17ee50dd5792102b6142385937db5/psutil-7.2.1-cp36-abi3-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5e38404ca2bb30ed7267a46c02f06ff842e92da3bb8c5bfdadbd35a5722314d8", size = 154694, upload-time = "2025-12-29T08:26:32.147Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/06/e4/b751cdf839c011a9714a783f120e6a86b7494eb70044d7d81a25a5cd295f/psutil-7.2.1-cp36-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ab2b98c9fc19f13f59628d94df5cc4cc4844bc572467d113a8b517d634e362c6", size = 156136, upload-time = "2025-12-29T08:26:34.079Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/44/ad/bbf6595a8134ee1e94a4487af3f132cef7fce43aef4a93b49912a48c3af7/psutil-7.2.1-cp36-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:f78baafb38436d5a128f837fab2d92c276dfb48af01a240b861ae02b2413ada8", size = 148108, upload-time = "2025-12-29T08:26:36.225Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1c/15/dd6fd869753ce82ff64dcbc18356093471a5a5adf4f77ed1f805d473d859/psutil-7.2.1-cp36-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:99a4cd17a5fdd1f3d014396502daa70b5ec21bf4ffe38393e152f8e449757d67", size = 147402, upload-time = "2025-12-29T08:26:39.21Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/34/68/d9317542e3f2b180c4306e3f45d3c922d7e86d8ce39f941bb9e2e9d8599e/psutil-7.2.1-cp37-abi3-win_amd64.whl", hash = "sha256:b1b0671619343aa71c20ff9767eced0483e4fc9e1f489d50923738caf6a03c17", size = 136938, upload-time = "2025-12-29T08:26:41.036Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3e/73/2ce007f4198c80fcf2cb24c169884f833fe93fbc03d55d302627b094ee91/psutil-7.2.1-cp37-abi3-win_arm64.whl", hash = "sha256:0d67c1822c355aa6f7314d92018fb4268a76668a536f133599b91edd48759442", size = 133836, upload-time = "2025-12-29T08:26:43.086Z" }, ] [[package]] @@ -5568,44 +5427,42 @@ wheels = [ [[package]] name = "pynacl" -version = "1.6.1" +version = "1.6.2" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "cffi", marker = "platform_python_implementation != 'PyPy'" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b2/46/aeca065d227e2265125aea590c9c47fbf5786128c9400ee0eb7c88931f06/pynacl-1.6.1.tar.gz", hash = "sha256:8d361dac0309f2b6ad33b349a56cd163c98430d409fa503b10b70b3ad66eaa1d", size = 3506616, upload-time = "2025-11-10T16:02:13.195Z" } -wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/75/d6/4b2dca33ed512de8f54e5c6074aa06eaeb225bfbcd9b16f33a414389d6bd/pynacl-1.6.1-cp314-cp314t-macosx_10_10_universal2.whl", hash = "sha256:7d7c09749450c385301a3c20dca967a525152ae4608c0a096fe8464bfc3df93d", size = 389109, upload-time = "2025-11-10T16:01:28.79Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3c/30/e8dbb8ff4fa2559bbbb2187ba0d0d7faf728d17cb8396ecf4a898b22d3da/pynacl-1.6.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:fc734c1696ffd49b40f7c1779c89ba908157c57345cf626be2e0719488a076d3", size = 808254, upload-time = "2025-11-10T16:01:37.839Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/44/f9/f5449c652f31da00249638dbab065ad4969c635119094b79b17c3a4da2ab/pynacl-1.6.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:3cd787ec1f5c155dc8ecf39b1333cfef41415dc96d392f1ce288b4fe970df489", size = 1407365, upload-time = "2025-11-10T16:01:40.454Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/eb/2f/9aa5605f473b712065c0a193ebf4ad4725d7a245533f0cd7e5dcdbc78f35/pynacl-1.6.1-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6b35d93ab2df03ecb3aa506be0d3c73609a51449ae0855c2e89c7ed44abde40b", size = 843842, upload-time = "2025-11-10T16:01:30.524Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/32/8d/748f0f6956e207453da8f5f21a70885fbbb2e060d5c9d78e0a4a06781451/pynacl-1.6.1-cp314-cp314t-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:dece79aecbb8f4640a1adbb81e4aa3bfb0e98e99834884a80eb3f33c7c30e708", size = 1445559, upload-time = "2025-11-10T16:01:33.663Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/78/d0/2387f0dcb0e9816f38373999e48db4728ed724d31accdd4e737473319d35/pynacl-1.6.1-cp314-cp314t-manylinux_2_34_aarch64.whl", hash = "sha256:c2228054f04bf32d558fb89bb99f163a8197d5a9bf4efa13069a7fa8d4b93fc3", size = 825791, upload-time = "2025-11-10T16:01:34.823Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/18/3d/ef6fb7eb072aaf15f280bc66f26ab97e7fc9efa50fb1927683013ef47473/pynacl-1.6.1-cp314-cp314t-manylinux_2_34_x86_64.whl", hash = "sha256:2b12f1b97346f177affcdfdc78875ff42637cb40dcf79484a97dae3448083a78", size = 1410843, upload-time = "2025-11-10T16:01:36.401Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e3/fb/23824a017526850ee7d8a1cc4cd1e3e5082800522c10832edbbca8619537/pynacl-1.6.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:e735c3a1bdfde3834503baf1a6d74d4a143920281cb724ba29fb84c9f49b9c48", size = 801140, upload-time = "2025-11-10T16:01:42.013Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5d/d1/ebc6b182cb98603a35635b727d62f094bc201bf610f97a3bb6357fe688d2/pynacl-1.6.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:3384a454adf5d716a9fadcb5eb2e3e72cd49302d1374a60edc531c9957a9b014", size = 1371966, upload-time = "2025-11-10T16:01:43.297Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/64/f4/c9d7b6f02924b1f31db546c7bd2a83a2421c6b4a8e6a2e53425c9f2802e0/pynacl-1.6.1-cp314-cp314t-win32.whl", hash = "sha256:d8615ee34d01c8e0ab3f302dcdd7b32e2bcf698ba5f4809e7cc407c8cdea7717", size = 230482, upload-time = "2025-11-10T16:01:47.688Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c4/2c/942477957fba22da7bf99131850e5ebdff66623418ab48964e78a7a8293e/pynacl-1.6.1-cp314-cp314t-win_amd64.whl", hash = "sha256:5f5b35c1a266f8a9ad22525049280a600b19edd1f785bccd01ae838437dcf935", size = 243232, upload-time = "2025-11-10T16:01:45.208Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7a/0c/bdbc0d04a53b96a765ab03aa2cf9a76ad8653d70bf1665459b9a0dedaa1c/pynacl-1.6.1-cp314-cp314t-win_arm64.whl", hash = "sha256:d984c91fe3494793b2a1fb1e91429539c6c28e9ec8209d26d25041ec599ccf63", size = 187907, upload-time = "2025-11-10T16:01:46.328Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/49/41/3cfb3b4f3519f6ff62bf71bf1722547644bcfb1b05b8fdbdc300249ba113/pynacl-1.6.1-cp38-abi3-macosx_10_10_universal2.whl", hash = "sha256:a6f9fd6d6639b1e81115c7f8ff16b8dedba1e8098d2756275d63d208b0e32021", size = 387591, upload-time = "2025-11-10T16:01:49.1Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/18/21/b8a6563637799f617a3960f659513eccb3fcc655d5fc2be6e9dc6416826f/pynacl-1.6.1-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:e49a3f3d0da9f79c1bec2aa013261ab9fa651c7da045d376bd306cf7c1792993", size = 798866, upload-time = "2025-11-10T16:01:55.688Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e8/6c/dc38033bc3ea461e05ae8f15a81e0e67ab9a01861d352ae971c99de23e7c/pynacl-1.6.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7713f8977b5d25f54a811ec9efa2738ac592e846dd6e8a4d3f7578346a841078", size = 1398001, upload-time = "2025-11-10T16:01:57.101Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9f/05/3ec0796a9917100a62c5073b20c4bce7bf0fea49e99b7906d1699cc7b61b/pynacl-1.6.1-cp38-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5a3becafc1ee2e5ea7f9abc642f56b82dcf5be69b961e782a96ea52b55d8a9fc", size = 834024, upload-time = "2025-11-10T16:01:50.228Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f0/b7/ae9982be0f344f58d9c64a1c25d1f0125c79201634efe3c87305ac7cb3e3/pynacl-1.6.1-cp38-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4ce50d19f1566c391fedc8dc2f2f5be265ae214112ebe55315e41d1f36a7f0a9", size = 1436766, upload-time = "2025-11-10T16:01:51.886Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b4/51/b2ccbf89cf3025a02e044dd68a365cad593ebf70f532299f2c047d2b7714/pynacl-1.6.1-cp38-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:543f869140f67d42b9b8d47f922552d7a967e6c116aad028c9bfc5f3f3b3a7b7", size = 817275, upload-time = "2025-11-10T16:01:53.351Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a8/6c/dd9ee8214edf63ac563b08a9b30f98d116942b621d39a751ac3256694536/pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:a2bb472458c7ca959aeeff8401b8efef329b0fc44a89d3775cffe8fad3398ad8", size = 1401891, upload-time = "2025-11-10T16:01:54.587Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0f/c1/97d3e1c83772d78ee1db3053fd674bc6c524afbace2bfe8d419fd55d7ed1/pynacl-1.6.1-cp38-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:3206fa98737fdc66d59b8782cecc3d37d30aeec4593d1c8c145825a345bba0f0", size = 772291, upload-time = "2025-11-10T16:01:58.111Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4d/ca/691ff2fe12f3bb3e43e8e8df4b806f6384593d427f635104d337b8e00291/pynacl-1.6.1-cp38-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:53543b4f3d8acb344f75fd4d49f75e6572fce139f4bfb4815a9282296ff9f4c0", size = 1370839, upload-time = "2025-11-10T16:01:59.252Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/30/27/06fe5389d30391fce006442246062cc35773c84fbcad0209fbbf5e173734/pynacl-1.6.1-cp38-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:319de653ef84c4f04e045eb250e6101d23132372b0a61a7acf91bac0fda8e58c", size = 791371, upload-time = "2025-11-10T16:02:01.075Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2c/7a/e2bde8c9d39074a5aa046c7d7953401608d1f16f71e237f4bef3fb9d7e49/pynacl-1.6.1-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:262a8de6bba4aee8a66f5edf62c214b06647461c9b6b641f8cd0cb1e3b3196fe", size = 1363031, upload-time = "2025-11-10T16:02:02.656Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/dd/b6/63fd77264dae1087770a1bb414bc604470f58fbc21d83822fc9c76248076/pynacl-1.6.1-cp38-abi3-win32.whl", hash = "sha256:9fd1a4eb03caf8a2fe27b515a998d26923adb9ddb68db78e35ca2875a3830dde", size = 226585, upload-time = "2025-11-10T16:02:07.116Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/12/c8/b419180f3fdb72ab4d45e1d88580761c267c7ca6eda9a20dcbcba254efe6/pynacl-1.6.1-cp38-abi3-win_amd64.whl", hash = "sha256:a569a4069a7855f963940040f35e87d8bc084cb2d6347428d5ad20550a0a1a21", size = 238923, upload-time = "2025-11-10T16:02:04.401Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/35/76/c34426d532e4dce7ff36e4d92cb20f4cbbd94b619964b93d24e8f5b5510f/pynacl-1.6.1-cp38-abi3-win_arm64.whl", hash = "sha256:5953e8b8cfadb10889a6e7bd0f53041a745d1b3d30111386a1bb37af171e6daf", size = 183970, upload-time = "2025-11-10T16:02:05.786Z" }, +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d9/9a/4019b524b03a13438637b11538c82781a5eda427394380381af8f04f467a/pynacl-1.6.2.tar.gz", hash = "sha256:018494d6d696ae03c7e656e5e74cdfd8ea1326962cc401bcf018f1ed8436811c", size = 3511692, upload-time = "2026-01-01T17:48:10.851Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4b/79/0e3c34dc3c4671f67d251c07aa8eb100916f250ee470df230b0ab89551b4/pynacl-1.6.2-cp314-cp314t-macosx_10_10_universal2.whl", hash = "sha256:622d7b07cc5c02c666795792931b50c91f3ce3c2649762efb1ef0d5684c81594", size = 390064, upload-time = "2026-01-01T17:31:57.264Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/eb/1c/23a26e931736e13b16483795c8a6b2f641bf6a3d5238c22b070a5112722c/pynacl-1.6.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d071c6a9a4c94d79eb665db4ce5cedc537faf74f2355e4d502591d850d3913c0", size = 809370, upload-time = "2026-01-01T17:31:59.198Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/87/74/8d4b718f8a22aea9e8dcc8b95deb76d4aae380e2f5b570cc70b5fd0a852d/pynacl-1.6.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:fe9847ca47d287af41e82be1dd5e23023d3c31a951da134121ab02e42ac218c9", size = 1408304, upload-time = "2026-01-01T17:32:01.162Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fd/73/be4fdd3a6a87fe8a4553380c2b47fbd1f7f58292eb820902f5c8ac7de7b0/pynacl-1.6.2-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:04316d1fc625d860b6c162fff704eb8426b1a8bcd3abacea11142cbd99a6b574", size = 844871, upload-time = "2026-01-01T17:32:02.824Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/55/ad/6efc57ab75ee4422e96b5f2697d51bbcf6cdcc091e66310df91fbdc144a8/pynacl-1.6.2-cp314-cp314t-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:44081faff368d6c5553ccf55322ef2819abb40e25afaec7e740f159f74813634", size = 1446356, upload-time = "2026-01-01T17:32:04.452Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/78/b7/928ee9c4779caa0a915844311ab9fb5f99585621c5d6e4574538a17dca07/pynacl-1.6.2-cp314-cp314t-manylinux_2_34_aarch64.whl", hash = "sha256:a9f9932d8d2811ce1a8ffa79dcbdf3970e7355b5c8eb0c1a881a57e7f7d96e88", size = 826814, upload-time = "2026-01-01T17:32:06.078Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f7/a9/1bdba746a2be20f8809fee75c10e3159d75864ef69c6b0dd168fc60e485d/pynacl-1.6.2-cp314-cp314t-manylinux_2_34_x86_64.whl", hash = "sha256:bc4a36b28dd72fb4845e5d8f9760610588a96d5a51f01d84d8c6ff9849968c14", size = 1411742, upload-time = "2026-01-01T17:32:07.651Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f3/2f/5e7ea8d85f9f3ea5b6b87db1d8388daa3587eed181bdeb0306816fdbbe79/pynacl-1.6.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:3bffb6d0f6becacb6526f8f42adfb5efb26337056ee0831fb9a7044d1a964444", size = 801714, upload-time = "2026-01-01T17:32:09.558Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/06/ea/43fe2f7eab5f200e40fb10d305bf6f87ea31b3bbc83443eac37cd34a9e1e/pynacl-1.6.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:2fef529ef3ee487ad8113d287a593fa26f48ee3620d92ecc6f1d09ea38e0709b", size = 1372257, upload-time = "2026-01-01T17:32:11.026Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4d/54/c9ea116412788629b1347e415f72195c25eb2f3809b2d3e7b25f5c79f13a/pynacl-1.6.2-cp314-cp314t-win32.whl", hash = "sha256:a84bf1c20339d06dc0c85d9aea9637a24f718f375d861b2668b2f9f96fa51145", size = 231319, upload-time = "2026-01-01T17:32:12.46Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ce/04/64e9d76646abac2dccf904fccba352a86e7d172647557f35b9fe2a5ee4a1/pynacl-1.6.2-cp314-cp314t-win_amd64.whl", hash = "sha256:320ef68a41c87547c91a8b58903c9caa641ab01e8512ce291085b5fe2fcb7590", size = 244044, upload-time = "2026-01-01T17:32:13.781Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/33/33/7873dc161c6a06f43cda13dec67b6fe152cb2f982581151956fa5e5cdb47/pynacl-1.6.2-cp314-cp314t-win_arm64.whl", hash = "sha256:d29bfe37e20e015a7d8b23cfc8bd6aa7909c92a1b8f41ee416bbb3e79ef182b2", size = 188740, upload-time = "2026-01-01T17:32:15.083Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/be/7b/4845bbf88e94586ec47a432da4e9107e3fc3ce37eb412b1398630a37f7dd/pynacl-1.6.2-cp38-abi3-macosx_10_10_universal2.whl", hash = "sha256:c949ea47e4206af7c8f604b8278093b674f7c79ed0d4719cc836902bf4517465", size = 388458, upload-time = "2026-01-01T17:32:16.829Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1e/b4/e927e0653ba63b02a4ca5b4d852a8d1d678afbf69b3dbf9c4d0785ac905c/pynacl-1.6.2-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:8845c0631c0be43abdd865511c41eab235e0be69c81dc66a50911594198679b0", size = 800020, upload-time = "2026-01-01T17:32:18.34Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7f/81/d60984052df5c97b1d24365bc1e30024379b42c4edcd79d2436b1b9806f2/pynacl-1.6.2-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:22de65bb9010a725b0dac248f353bb072969c94fa8d6b1f34b87d7953cf7bbe4", size = 1399174, upload-time = "2026-01-01T17:32:20.239Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/68/f7/322f2f9915c4ef27d140101dd0ed26b479f7e6f5f183590fd32dfc48c4d3/pynacl-1.6.2-cp38-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:46065496ab748469cdd999246d17e301b2c24ae2fdf739132e580a0e94c94a87", size = 835085, upload-time = "2026-01-01T17:32:22.24Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3e/d0/f301f83ac8dbe53442c5a43f6a39016f94f754d7a9815a875b65e218a307/pynacl-1.6.2-cp38-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8a66d6fb6ae7661c58995f9c6435bda2b1e68b54b598a6a10247bfcdadac996c", size = 1437614, upload-time = "2026-01-01T17:32:23.766Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c4/58/fc6e649762b029315325ace1a8c6be66125e42f67416d3dbd47b69563d61/pynacl-1.6.2-cp38-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:26bfcd00dcf2cf160f122186af731ae30ab120c18e8375684ec2670dccd28130", size = 818251, upload-time = "2026-01-01T17:32:25.69Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c9/a8/b917096b1accc9acd878819a49d3d84875731a41eb665f6ebc826b1af99e/pynacl-1.6.2-cp38-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:c8a231e36ec2cab018c4ad4358c386e36eede0319a0c41fed24f840b1dac59f6", size = 1402859, upload-time = "2026-01-01T17:32:27.215Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/85/42/fe60b5f4473e12c72f977548e4028156f4d340b884c635ec6b063fe7e9a5/pynacl-1.6.2-cp38-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:68be3a09455743ff9505491220b64440ced8973fe930f270c8e07ccfa25b1f9e", size = 791926, upload-time = "2026-01-01T17:32:29.314Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fa/f9/e40e318c604259301cc091a2a63f237d9e7b424c4851cafaea4ea7c4834e/pynacl-1.6.2-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:8b097553b380236d51ed11356c953bf8ce36a29a3e596e934ecabe76c985a577", size = 1363101, upload-time = "2026-01-01T17:32:31.263Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/48/47/e761c254f410c023a469284a9bc210933e18588ca87706ae93002c05114c/pynacl-1.6.2-cp38-abi3-win32.whl", hash = "sha256:5811c72b473b2f38f7e2a3dc4f8642e3a3e9b5e7317266e4ced1fba85cae41aa", size = 227421, upload-time = "2026-01-01T17:32:33.076Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/41/ad/334600e8cacc7d86587fe5f565480fde569dfb487389c8e1be56ac21d8ac/pynacl-1.6.2-cp38-abi3-win_amd64.whl", hash = "sha256:62985f233210dee6548c223301b6c25440852e13d59a8b81490203c3227c5ba0", size = 239754, upload-time = "2026-01-01T17:32:34.557Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/29/7d/5945b5af29534641820d3bd7b00962abbbdfee84ec7e19f0d5b3175f9a31/pynacl-1.6.2-cp38-abi3-win_arm64.whl", hash = "sha256:834a43af110f743a754448463e8fd61259cd4ab5bbedcf70f9dabad1d28a394c", size = 184801, upload-time = "2026-01-01T17:32:36.309Z" }, ] [[package]] name = "pynndescent" -version = "0.5.13" +version = "0.6.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "joblib" }, @@ -5614,9 +5471,9 @@ dependencies = [ { name = "scikit-learn" }, { name = "scipy" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7e/58/560a4db5eb3794d922fe55804b10326534ded3d971e1933c1eef91193f5e/pynndescent-0.5.13.tar.gz", hash = "sha256:d74254c0ee0a1eeec84597d5fe89fedcf778593eeabe32c2f97412934a9800fb", size = 2975955, upload-time = "2024-06-17T15:48:32.914Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4a/fb/7f58c397fb31666756457ee2ac4c0289ef2daad57f4ae4be8dec12f80b03/pynndescent-0.6.0.tar.gz", hash = "sha256:7ffde0fb5b400741e055a9f7d377e3702e02250616834231f6c209e39aac24f5", size = 2992987, upload-time = "2026-01-08T21:29:58.943Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d2/53/d23a97e0a2c690d40b165d1062e2c4ccc796be458a1ce59f6ba030434663/pynndescent-0.5.13-py3-none-any.whl", hash = "sha256:69aabb8f394bc631b6ac475a1c7f3994c54adf3f51cd63b2730fefba5771b949", size = 56850, upload-time = "2024-06-17T15:48:31.184Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b2/e6/94145d714402fd5ade00b5661f2d0ab981219e07f7db9bfa16786cdb9c04/pynndescent-0.6.0-py3-none-any.whl", hash = "sha256:dc8c74844e4c7f5cbd1e0cd6909da86fdc789e6ff4997336e344779c3d5538ef", size = 73511, upload-time = "2026-01-08T21:29:57.306Z" }, ] [[package]] @@ -5704,11 +5561,11 @@ wheels = [ [[package]] name = "pyparsing" -version = "3.2.5" +version = "3.3.1" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f2/a5/181488fc2b9d093e3972d2a472855aae8a03f000592dbfce716a512b3359/pyparsing-3.2.5.tar.gz", hash = "sha256:2df8d5b7b2802ef88e8d016a2eb9c7aeaa923529cd251ed0fe4608275d4105b6", size = 1099274, upload-time = "2025-09-21T04:11:06.277Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/33/c1/1d9de9aeaa1b89b0186e5fe23294ff6517fce1bc69149185577cd31016b2/pyparsing-3.3.1.tar.gz", hash = "sha256:47fad0f17ac1e2cad3de3b458570fbc9b03560aa029ed5e16ee5554da9a2251c", size = 1550512, upload-time = "2025-12-23T03:14:04.391Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/10/5e/1aa9a93198c6b64513c9d7752de7422c06402de6600a8767da1524f9570b/pyparsing-3.2.5-py3-none-any.whl", hash = "sha256:e38a4f02064cf41fe6593d328d0512495ad1f3d8a91c4f73fc401b3079a59a5e", size = 113890, upload-time = "2025-09-21T04:11:04.117Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8b/40/2614036cdd416452f5bf98ec037f38a1afb17f327cb8e6b652d4729e0af8/pyparsing-3.3.1-py3-none-any.whl", hash = "sha256:023b5e7e5520ad96642e2c6db4cb683d3970bd640cdf7115049a6e9c3682df82", size = 121793, upload-time = "2025-12-23T03:14:02.103Z" }, ] [[package]] @@ -5731,22 +5588,31 @@ wheels = [ [[package]] name = "pypdfium2" -version = "5.1.0" +version = "5.3.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1c/87/56782107fa242137b77ccddc30519bbb33e7a9eed9da9649d9db45db2c64/pypdfium2-5.1.0.tar.gz", hash = "sha256:46335ca30a1584b804a6824da84d2e846b4b954bdfc342d035b7bf15ed9a14e5", size = 270104, upload-time = "2025-11-23T13:36:52.589Z" } -wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1a/d7/46ce255322cd29f0db3772667a0da3db8ed137e1e9b9aa306ac5691765b3/pypdfium2-5.1.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:f3dde94d320d582d3c20255b600f1e7e03261bfdea139b7064b54126fc3db4e2", size = 2817789, upload-time = "2025-11-23T13:36:31.423Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/19/a5/4ad3c1b336fdc2b7a88d835c56bcd64ce60d4a95d1a9eaafc44f853da582/pypdfium2-5.1.0-py3-none-macosx_11_0_x86_64.whl", hash = "sha256:dee09b7a3ab1860a17decc97c179a5aaba5a74b2780d53c91daa18d742945892", size = 2940861, upload-time = "2025-11-23T13:36:33.519Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/19/93/d13ca66d5e075d7e27736c51c15955cdd3266ac0a8327613c3c520d43693/pypdfium2-5.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1757d6470cbf5b8d1c825350df2ccd79fd0bfcf5753ff566fd02153a486014b1", size = 2980933, upload-time = "2025-11-23T13:36:35.283Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a2/7c/02744ef9e0363af08f9ed47c0e603ef8713e02d4a48492c76d5bf36f65c3/pypdfium2-5.1.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ad18e95497423f88b33f2976cb78c27f0bd6ef4b4bf340c901f5f28a234c4f06", size = 2762960, upload-time = "2025-11-23T13:36:37.033Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/89/26/f0abcfccb99b0a5c4451b70b0e72ccb7c27387931af01eae982870272202/pypdfium2-5.1.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2faee2f4fbd5bd33dd77c07d15ccaa6687562d883a54c4beb8329ebaee615b7d", size = 3060522, upload-time = "2025-11-23T13:36:38.835Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2f/74/92f508e71178aa85de32454762f84d6f9cef35c468caab3e0f1041dae464/pypdfium2-5.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d688372df169a9dad606c1e5ad34b6e0e6b820f1e0d540b4780711600a7bf8dd", size = 2995178, upload-time = "2025-11-23T13:36:40.319Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/94/9f/91ca099ea64b24e19ef05da72e33d0ef0840e104d89cbdcb618da12629b5/pypdfium2-5.1.0-py3-none-musllinux_1_1_aarch64.whl", hash = "sha256:cfecd2b20f1c05027aaa2af6bfbcc2835b4c8f6455155b0dc2800ec6a2051965", size = 6321704, upload-time = "2025-11-23T13:36:42.177Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e0/4b/5628cfda9f534b3acc1e2cf50f9e9582cd9cfd86cf2ce718da229de6e709/pypdfium2-5.1.0-py3-none-musllinux_1_1_i686.whl", hash = "sha256:5698de8e6d662f1b2cdff5cb62e6f0ee79ffaaa13e282251854cbc64cf712449", size = 6329892, upload-time = "2025-11-23T13:36:43.757Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c5/25/5d2db765f8f82129d75ea2883ed26af3d1a64d8daaa20a11005ac681e2c3/pypdfium2-5.1.0-py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:2cbd73093fbb1710ea1164cdf27583363e1b663b8cc22d555c84af0ee1af50c7", size = 6409889, upload-time = "2025-11-23T13:36:45.387Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/89/d3/135ed8ca46044cd5005cd104ead13bea417777afa65d7af5a710eb68d340/pypdfium2-5.1.0-py3-none-win32.whl", hash = "sha256:11d319cd2e5f71cdc3d68e8a79142b559a0edbcc16fe31d4036fcfc45f0e9ed8", size = 2991546, upload-time = "2025-11-23T13:36:47.373Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/52/8f/884a1b2fd7c747a98e9b4c95097c08b39d042a88837ac72f2945a7f6162c/pypdfium2-5.1.0-py3-none-win_amd64.whl", hash = "sha256:4725f347a8c9ff011a7035d8267ee25912ab1b946034ba0b57f3cca89de8847a", size = 3100176, upload-time = "2025-11-23T13:36:49.234Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d7/5c/72448636ea0ccd44878f77bb5d59a2c967a54eec806ee2e0d894ef0d2434/pypdfium2-5.1.0-py3-none-win_arm64.whl", hash = "sha256:47c5593f7eb6ae0f1e5a940d712d733ede580f09ca91de6c3f89611848695c0f", size = 2941500, upload-time = "2025-11-23T13:36:50.69Z" }, +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/18/83/173dab58beb6c7e772b838199014c173a2436018dd7cfde9bbf4a3be15da/pypdfium2-5.3.0.tar.gz", hash = "sha256:2873ffc95fcb01f329257ebc64a5fdce44b36447b6b171fe62f7db5dc3269885", size = 268742, upload-time = "2026-01-05T16:29:03.02Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e3/a4/6bb5b5918c7fc236ec426be8a0205a984fe0a26ae23d5e4dd497398a6571/pypdfium2-5.3.0-py3-none-android_23_arm64_v8a.whl", hash = "sha256:885df6c78d41600cb086dc0c76b912d165b5bd6931ca08138329ea5a991b3540", size = 2763287, upload-time = "2026-01-05T16:28:24.21Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3e/64/24b41b906006bf07099b095f0420ee1f01a3a83a899f3e3731e4da99c06a/pypdfium2-5.3.0-py3-none-android_23_armeabi_v7a.whl", hash = "sha256:6e53dee6b333ee77582499eff800300fb5aa0c7eb8f52f95ccb5ca35ebc86d48", size = 2303285, upload-time = "2026-01-05T16:28:26.274Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c2/c0/3ec73f4ded83ba6c02acf6e9d228501759d5d74fe57f1b93849ab92dcc20/pypdfium2-5.3.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:ce4466bdd62119fe25a5f74d107acc9db8652062bf217057630c6ff0bb419523", size = 2816066, upload-time = "2026-01-05T16:28:28.099Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/62/ca/e553b3b8b5c2cdc3d955cc313493ac27bbe63fc22624769d56ded585dd5e/pypdfium2-5.3.0-py3-none-macosx_11_0_x86_64.whl", hash = "sha256:cc2647fd03db42b8a56a8835e8bc7899e604e2042cd6fedeea53483185612907", size = 2945545, upload-time = "2026-01-05T16:28:29.489Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a1/56/615b776071e95c8570d579038256d0c77969ff2ff381e427be4ab8967f44/pypdfium2-5.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:35e205f537ddb4069e4b4e22af7ffe84fcf2d686c3fee5e5349f73268a0ef1ca", size = 2979892, upload-time = "2026-01-05T16:28:31.088Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/df/10/27114199b765bdb7d19a9514c07036ad2fc3a579b910e7823ba167ead6de/pypdfium2-5.3.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b5795298f44050797ac030994fc2525ea35d2d714efe70058e0ee22e5f613f27", size = 2765738, upload-time = "2026-01-05T16:28:33.18Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b4/d7/2a3afa35e6c205a4f6264c33b8d2f659707989f93c30b336aa58575f66fa/pypdfium2-5.3.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b7cd43dfceb77137e69e74c933d41506da1dddaff70f3a794fb0ad0d73e90d75", size = 3064338, upload-time = "2026-01-05T16:28:34.731Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a2/f1/6658755cf6e369bb51d0bccb81c51c300404fbe67c2f894c90000b6442dd/pypdfium2-5.3.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d5956867558fd3a793e58691cf169718864610becb765bfe74dd83f05cbf1ae3", size = 3415059, upload-time = "2026-01-05T16:28:37.313Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f5/34/f86482134fa641deb1f524c45ec7ebd6fc8d404df40c5657ddfce528593e/pypdfium2-5.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b3ff1071e9a782625822658dfe6e29e3a644a66960f8713bb17819f5a0ac5987", size = 2998517, upload-time = "2026-01-05T16:28:38.873Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/09/34/40ab99425dcf503c172885904c5dc356c052bfdbd085f9f3cc920e0b8b25/pypdfium2-5.3.0-py3-none-manylinux_2_27_s390x.manylinux_2_28_s390x.whl", hash = "sha256:f319c46ead49d289ab8c1ed2ea63c91e684f35bdc4cf4dc52191c441182ac481", size = 3673154, upload-time = "2026-01-05T16:28:40.347Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a5/67/0f7532f80825a7728a5cbff3f1104857f8f9fe49ebfd6cb25582a89ae8e1/pypdfium2-5.3.0-py3-none-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:6dc67a186da0962294321cace6ccc0a4d212dbc5e9522c640d35725a812324b8", size = 2965002, upload-time = "2026-01-05T16:28:42.143Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ce/6c/c03d2a3d6621b77aac9604bce1c060de2af94950448787298501eac6c6a2/pypdfium2-5.3.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:0ad0afd3d2b5b54d86287266fd6ae3fef0e0a1a3df9d2c4984b3e3f8f70e6330", size = 4130530, upload-time = "2026-01-05T16:28:44.264Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/af/39/9ad1f958cbe35d4693ae87c09ebafda4bb3e4709c7ccaec86c1a829163a3/pypdfium2-5.3.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:1afe35230dc3951b3e79b934c0c35a2e79e2372d06503fce6cf1926d2a816f47", size = 3746568, upload-time = "2026-01-05T16:28:45.897Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2a/e2/4d32310166c2d6955d924737df8b0a3e3efc8d133344a98b10f96320157d/pypdfium2-5.3.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:00385793030cadce08469085cd21b168fd8ff981b009685fef3103bdc5fc4686", size = 4336683, upload-time = "2026-01-05T16:28:47.584Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/14/ea/38c337ff12a8cec4b00fd4fdb0a63a70597a344581e20b02addbd301ab56/pypdfium2-5.3.0-py3-none-musllinux_1_2_ppc64le.whl", hash = "sha256:d911e82676398949697fef80b7f412078df14d725a91c10e383b727051530285", size = 4375030, upload-time = "2026-01-05T16:28:49.5Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a1/77/9d8de90c35d2fc383be8819bcde52f5821dacbd7404a0225e4010b99d080/pypdfium2-5.3.0-py3-none-musllinux_1_2_riscv64.whl", hash = "sha256:ca1dc625ed347fac3d9002a3ed33d521d5803409bd572e7b3f823c12ab2ef58f", size = 3928914, upload-time = "2026-01-05T16:28:51.433Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a5/39/9d4a6fbd78fcb6803b0ea5e4952a31d6182a0aaa2609cfcd0eb88446fdb8/pypdfium2-5.3.0-py3-none-musllinux_1_2_s390x.whl", hash = "sha256:ea4f9db2d3575f22cd41f4c7a855240ded842f135e59a961b5b1351a65ce2b6e", size = 4997777, upload-time = "2026-01-05T16:28:53.589Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9d/38/cdd4ed085c264234a59ad32df1dfe432c77a7403da2381e0fcc1ba60b74e/pypdfium2-5.3.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:0ea24409613df350223c6afc50911c99dca0d43ddaf2616c5a1ebdffa3e1bcb5", size = 4179895, upload-time = "2026-01-05T16:28:55.322Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/93/4c/d2f40145c9012482699664f615d7ae540a346c84f68a8179449e69dcc4d8/pypdfium2-5.3.0-py3-none-win32.whl", hash = "sha256:5bf695d603f9eb8fdd7c1786add5cf420d57fbc81df142ed63c029ce29614df9", size = 2993570, upload-time = "2026-01-05T16:28:58.37Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2c/dc/1388ea650020c26ef3f68856b9227e7f153dcaf445e7e4674a0b8f26891e/pypdfium2-5.3.0-py3-none-win_amd64.whl", hash = "sha256:8365af22a39d4373c265f8e90e561cd64d4ddeaf5e6a66546a8caed216ab9574", size = 3102340, upload-time = "2026-01-05T16:28:59.933Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c8/71/a433668d33999b3aeb2c2dda18aaf24948e862ea2ee148078a35daac6c1c/pypdfium2-5.3.0-py3-none-win_arm64.whl", hash = "sha256:0b2c6bf825e084d91d34456be54921da31e9199d9530b05435d69d1a80501a12", size = 2940987, upload-time = "2026-01-05T16:29:01.511Z" }, ] [[package]] @@ -5901,14 +5767,14 @@ wheels = [ [[package]] name = "python-dateutil" -version = "2.8.2" +version = "2.9.0.post0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "six" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4c/c4/13b4776ea2d76c115c1d1b84579f3764ee6d57204f6be27119f13a61d0a9/python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86", size = 357324, upload-time = "2021-07-14T08:19:19.783Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/66/c0/0c8b6ad9f17a802ee498c46e004a0eb49bc148f2fd230864601a86dcf6db/python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3", size = 342432, upload-time = "2024-03-01T18:36:20.211Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/36/7a/87837f39d0296e723bb9b62bbb257d0355c7f6128853c78955f57342a56d/python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9", size = 247702, upload-time = "2021-07-14T08:19:18.161Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ec/57/56b9bcc3c9c6a792fcbaf139543cee77261f3651ca9da0c93f5c1221264b/python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427", size = 229892, upload-time = "2024-03-01T18:36:18.57Z" }, ] [[package]] @@ -5926,33 +5792,33 @@ wheels = [ [[package]] name = "python-dotenv" -version = "1.0.1" +version = "1.2.1" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bc/57/e84d88dfe0aec03b7a2d4327012c1627ab5f03652216c63d49846d7a6c58/python-dotenv-1.0.1.tar.gz", hash = "sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca", size = 39115, upload-time = "2024-01-23T06:33:00.505Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f0/26/19cadc79a718c5edbec86fd4919a6b6d3f681039a2f6d66d14be94e75fb9/python_dotenv-1.2.1.tar.gz", hash = "sha256:42667e897e16ab0d66954af0e60a9caa94f0fd4ecf3aaf6d2d260eec1aa36ad6", size = 44221, upload-time = "2025-10-26T15:12:10.434Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6a/3e/b68c118422ec867fa7ab88444e1274aa40681c606d59ac27de5a5588f082/python_dotenv-1.0.1-py3-none-any.whl", hash = "sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a", size = 19863, upload-time = "2024-01-23T06:32:58.246Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/14/1b/a298b06749107c305e1fe0f814c6c74aea7b2f1e10989cb30f544a1b3253/python_dotenv-1.2.1-py3-none-any.whl", hash = "sha256:b81ee9561e9ca4004139c6cbba3a238c32b03e4894671e181b671e8cb8425d61", size = 21230, upload-time = "2025-10-26T15:12:09.109Z" }, ] [[package]] name = "python-gitlab" -version = "7.0.0" +version = "7.1.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "requests" }, { name = "requests-toolbelt" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5e/c4/0b613303b4f0fcda69b3d2e03d0a1fb1b6b079a7c7832e03a8d92461e9fe/python_gitlab-7.0.0.tar.gz", hash = "sha256:e4d934430f64efc09e6208b782c61cc0a3389527765e03ffbef17f4323dce441", size = 400568, upload-time = "2025-10-29T15:06:02.069Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/31/98/0b5d0a0367b90aec818298390b60ae65e6a08989cf5140271d0ee0206882/python_gitlab-7.1.0.tar.gz", hash = "sha256:1c34da3de40ad21675d788136f73d20a60649513e692f52c5a9720434db97c46", size = 401058, upload-time = "2025-12-28T01:27:01.369Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4f/9e/811edc46a15f8deb828cba7ef8aab3451dc11ca72d033f3df72a5af865d9/python_gitlab-7.0.0-py3-none-any.whl", hash = "sha256:712a6c8c5e79e7e66f6dabb25d8fe7831a6b238d4a5132f8231df6b3b890ceff", size = 144415, upload-time = "2025-10-29T15:06:00.232Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/14/44/70fa1e395731b6a4b1f249d5f7326f3bb6281e2cf94d6535f679239f4b93/python_gitlab-7.1.0-py3-none-any.whl", hash = "sha256:8e42030cf27674e7ec9ea1f6d2fedcaaef0a6210f5fa22c80721abaa3a4fec90", size = 144441, upload-time = "2025-12-28T01:26:59.726Z" }, ] [[package]] name = "python-multipart" -version = "0.0.20" +version = "0.0.21" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f3/87/f44d7c9f274c7ee665a29b885ec97089ec5dc034c7f3fafa03da9e39a09e/python_multipart-0.0.20.tar.gz", hash = "sha256:8dd0cab45b8e23064ae09147625994d090fa46f5b0d1e13af944c331a7fa9d13", size = 37158, upload-time = "2024-12-16T19:45:46.972Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/78/96/804520d0850c7db98e5ccb70282e29208723f0964e88ffd9d0da2f52ea09/python_multipart-0.0.21.tar.gz", hash = "sha256:7137ebd4d3bbf70ea1622998f902b97a29434a9e8dc40eb203bbcf7c2a2cba92", size = 37196, upload-time = "2025-12-17T09:24:22.446Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/45/58/38b5afbc1a800eeea951b9285d3912613f2603bdf897a4ab0f4bd7f405fc/python_multipart-0.0.20-py3-none-any.whl", hash = "sha256:8a62d3a8335e06589fe01f2a3e178cdcc632f3fbe0d492ad9ee0ec35aab1f104", size = 24546, upload-time = "2024-12-16T19:45:44.423Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/aa/76/03af049af4dcee5d27442f71b6924f01f3efb5d2bd34f23fcd563f2cc5f5/python_multipart-0.0.21-py3-none-any.whl", hash = "sha256:cf7a6713e01c87aa35387f4774e812c4361150938d20d232800f75ffcf266090", size = 24541, upload-time = "2025-12-17T09:24:21.153Z" }, ] [[package]] @@ -6220,8 +6086,7 @@ dependencies = [ { name = "flask-login" }, { name = "flask-mail" }, { name = "flask-session" }, - { name = "google-auth-oauthlib", version = "1.2.2", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version >= '3.14' and sys_platform == 'darwin'" }, - { name = "google-auth-oauthlib", version = "1.2.3", source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }, marker = "python_full_version < '3.14' or sys_platform != 'darwin'" }, + { name = "google-auth-oauthlib" }, { name = "google-genai" }, { name = "google-generativeai" }, { name = "google-search-results" }, @@ -6630,15 +6495,15 @@ wheels = [ [[package]] name = "reportlab" -version = "4.4.6" +version = "4.4.7" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "charset-normalizer" }, { name = "pillow" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/35/ec/f7a50b3cbee58407090bd1f2a9db2f1a23052c5de3bc7408024ca776ee02/reportlab-4.4.6.tar.gz", hash = "sha256:8792c87c23dd034d17530e6ebe4164d61bcc8f7b0eac203fe13cc03cc2c1c607", size = 3910805, upload-time = "2025-12-10T12:37:21.17Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f8/a7/4600cb1cfc975a06552e8927844ddcb8fd90217e9a6068f5c7aa76c3f221/reportlab-4.4.7.tar.gz", hash = "sha256:41e8287af965e5996764933f3e75e7f363c3b6f252ba172f9429e81658d7b170", size = 3714000, upload-time = "2025-12-21T11:50:11.336Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0e/ee/5f7a31ab05cf817e0cc70ae6df51a1a4fda188c899790a3131a24dd78d18/reportlab-4.4.6-py3-none-any.whl", hash = "sha256:c7c31d5c815bae7c76fc17f64ffc417e68992901acddb24504296cc39b065424", size = 1954259, upload-time = "2025-12-10T12:37:18.428Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e7/bf/a29507386366ab17306b187ad247dd78e4599be9032cb5f44c940f547fc0/reportlab-4.4.7-py3-none-any.whl", hash = "sha256:8fa05cbf468e0e76745caf2029a4770276edb3c8e86a0b71e0398926baf50673", size = 1954263, upload-time = "2025-12-21T11:50:08.93Z" }, ] [[package]] @@ -6721,13 +6586,25 @@ wheels = [ { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9a/85/09e9e6bd6cd4cc0ed463d2b6ce3c7741698d45ca157318730a1346df4819/roman_numbers-1.0.2-py3-none-any.whl", hash = "sha256:ffbc00aaf41538208f975d1b1ccfe80372bae1866e7cd632862d8c6b45edf447", size = 3724, upload-time = "2021-01-11T11:54:57.686Z" }, ] +[[package]] +name = "roman-numerals" +version = "4.1.0" +source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ae/f9/41dc953bbeb056c17d5f7a519f50fdf010bd0553be2d630bc69d1e022703/roman_numerals-4.1.0.tar.gz", hash = "sha256:1af8b147eb1405d5839e78aeb93131690495fe9da5c91856cb33ad55a7f1e5b2", size = 9077, upload-time = "2025-12-17T18:25:34.381Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/04/54/6f679c435d28e0a568d8e8a7c0a93a09010818634c3c3907fc98d8983770/roman_numerals-4.1.0-py3-none-any.whl", hash = "sha256:647ba99caddc2cc1e55a51e4360689115551bf4476d90e8162cf8c345fe233c7", size = 7676, upload-time = "2025-12-17T18:25:33.098Z" }, +] + [[package]] name = "roman-numerals-py" -version = "3.1.0" +version = "4.1.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/30/76/48fd56d17c5bdbdf65609abbc67288728a98ed4c02919428d4f52d23b24b/roman_numerals_py-3.1.0.tar.gz", hash = "sha256:be4bf804f083a4ce001b5eb7e3c0862479d10f94c936f6c4e5f250aa5ff5bd2d", size = 9017, upload-time = "2025-02-22T07:34:54.333Z" } +dependencies = [ + { name = "roman-numerals" }, +] +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cb/b5/de96fca640f4f656eb79bbee0e79aeec52e3e0e359f8a3e6a0d366378b64/roman_numerals_py-4.1.0.tar.gz", hash = "sha256:f5d7b2b4ca52dd855ef7ab8eb3590f428c0b1ea480736ce32b01fef2a5f8daf9", size = 4274, upload-time = "2025-12-17T18:25:41.153Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/53/97/d2cbbaa10c9b826af0e10fdf836e1bf344d9f0abb873ebc34d1f49642d3f/roman_numerals_py-3.1.0-py3-none-any.whl", hash = "sha256:9da2ad2fb670bcf24e81070ceb3be72f6c11c440d73bd579fbeca1e9f330954c", size = 7742, upload-time = "2025-02-22T07:34:52.422Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/27/2c/daca29684cbe9fd4bc711f8246da3c10adca1ccc4d24436b17572eb2590e/roman_numerals_py-4.1.0-py3-none-any.whl", hash = "sha256:553114c1167141c1283a51743759723ecd05604a1b6b507225e91dc1a6df0780", size = 4547, upload-time = "2025-12-17T18:25:40.136Z" }, ] [[package]] @@ -6847,14 +6724,14 @@ wheels = [ [[package]] name = "ruamel-yaml" -version = "0.18.16" +version = "0.18.17" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ - { name = "ruamel-yaml-clib", marker = "python_full_version < '3.14' and platform_python_implementation == 'CPython'" }, + { name = "ruamel-yaml-clib", marker = "platform_python_implementation == 'CPython'" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9f/c7/ee630b29e04a672ecfc9b63227c87fd7a37eb67c1bf30fe95376437f897c/ruamel.yaml-0.18.16.tar.gz", hash = "sha256:a6e587512f3c998b2225d68aa1f35111c29fad14aed561a26e73fab729ec5e5a", size = 147269, upload-time = "2025-10-22T17:54:02.346Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3a/2b/7a1f1ebcd6b3f14febdc003e658778d81e76b40df2267904ee6b13f0c5c6/ruamel_yaml-0.18.17.tar.gz", hash = "sha256:9091cd6e2d93a3a4b157ddb8fabf348c3de7f1fb1381346d985b6b247dcd8d3c", size = 149602, upload-time = "2025-12-17T20:02:55.757Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0f/73/bb1bc2529f852e7bf64a2dec885e89ff9f5cc7bbf6c9340eed30ff2c69c5/ruamel.yaml-0.18.16-py3-none-any.whl", hash = "sha256:048f26d64245bae57a4f9ef6feb5b552a386830ef7a826f235ffb804c59efbba", size = 119858, upload-time = "2025-10-22T17:53:59.012Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/af/fe/b6045c782f1fd1ae317d2a6ca1884857ce5c20f59befe6ab25a8603c43a7/ruamel_yaml-0.18.17-py3-none-any.whl", hash = "sha256:9c8ba9eb3e793efdf924b60d521820869d5bf0cb9c6f1b82d82de8295e290b9d", size = 121594, upload-time = "2025-12-17T20:02:07.657Z" }, ] [[package]] @@ -6897,14 +6774,14 @@ wheels = [ [[package]] name = "s3transfer" -version = "0.10.4" +version = "0.16.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "botocore" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c0/0a/1cdbabf9edd0ea7747efdf6c9ab4e7061b085aa7f9bfc36bb1601563b069/s3transfer-0.10.4.tar.gz", hash = "sha256:29edc09801743c21eb5ecbc617a152df41d3c287f67b615f73e5f750583666a7", size = 145287, upload-time = "2024-11-20T21:06:05.981Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/05/04/74127fc843314818edfa81b5540e26dd537353b123a4edc563109d8f17dd/s3transfer-0.16.0.tar.gz", hash = "sha256:8e990f13268025792229cd52fa10cb7163744bf56e719e0b9cb925ab79abf920", size = 153827, upload-time = "2025-12-01T02:30:59.114Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/66/05/7957af15543b8c9799209506df4660cba7afc4cf94bfb60513827e96bed6/s3transfer-0.10.4-py3-none-any.whl", hash = "sha256:244a76a24355363a68164241438de1b72f8781664920260c48465896b712a41e", size = 83175, upload-time = "2024-11-20T21:06:03.961Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fc/51/727abb13f44c1fcf6d145979e1535a35794db0f6e450a0cb46aa24732fe2/s3transfer-0.16.0-py3-none-any.whl", hash = "sha256:18e25d66fed509e3868dc1572b3f427ff947dd2c56f844a5bf09481ad3f3b2fe", size = 86830, upload-time = "2025-12-01T02:30:57.729Z" }, ] [[package]] @@ -6932,7 +6809,7 @@ wheels = [ [[package]] name = "scikit-learn" -version = "1.5.0" +version = "1.8.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "joblib" }, @@ -6940,74 +6817,99 @@ dependencies = [ { name = "scipy" }, { name = "threadpoolctl" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bf/8a/06e499bca463905000f50e461c9445e949aafdd33ea3b62024aa2238b83d/scikit_learn-1.5.0.tar.gz", hash = "sha256:789e3db01c750ed6d496fa2db7d50637857b451e57bcae863bff707c1247bef7", size = 7820839, upload-time = "2024-05-21T16:34:07.711Z" } -wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1e/21/fe8e90eb7dc796ed384daaf45a83e729a41fa7a9bf14bc1a0b69fd05b39a/scikit_learn-1.5.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:460806030c666addee1f074788b3978329a5bfdc9b7d63e7aad3f6d45c67a210", size = 12096541, upload-time = "2024-05-21T16:33:36.475Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f9/4b/c035ce6771dd56283cd587e941054ebb38a14868729e28a0f7c6c9ff9ebd/scikit_learn-1.5.0-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:1b94d6440603752b27842eda97f6395f570941857456c606eb1d638efdb38184", size = 11031507, upload-time = "2024-05-21T16:33:39.896Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/66/a1/e64f125382f2fc46dd1f3a3c2d390f02db896e3803a3e7898c4ca48390e0/scikit_learn-1.5.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d82c2e573f0f2f2f0be897e7a31fcf4e73869247738ab8c3ce7245549af58ab8", size = 12082985, upload-time = "2024-05-21T16:33:42.807Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ae/54/e70102a9c12d27d985ba659f336851732415e5a02864bef2ead36afaf15d/scikit_learn-1.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a3a10e1d9e834e84d05e468ec501a356226338778769317ee0b84043c0d8fb06", size = 13065320, upload-time = "2024-05-21T16:33:45.65Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/57/ed/f607ebf69f87bcce2e3fa329bd78da8cafd3d51190a19d58012d2d7f2252/scikit_learn-1.5.0-cp312-cp312-win_amd64.whl", hash = "sha256:855fc5fa8ed9e4f08291203af3d3e5fbdc4737bd617a371559aaa2088166046e", size = 10938084, upload-time = "2024-05-21T16:33:49.011Z" }, +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0e/d4/40988bf3b8e34feec1d0e6a051446b1f66225f8529b9309becaeef62b6c4/scikit_learn-1.8.0.tar.gz", hash = "sha256:9bccbb3b40e3de10351f8f5068e105d0f4083b1a65fa07b6634fbc401a6287fd", size = 7335585, upload-time = "2025-12-10T07:08:53.618Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/90/74/e6a7cc4b820e95cc38cf36cd74d5aa2b42e8ffc2d21fe5a9a9c45c1c7630/scikit_learn-1.8.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:5fb63362b5a7ddab88e52b6dbb47dac3fd7dafeee740dc6c8d8a446ddedade8e", size = 8548242, upload-time = "2025-12-10T07:07:51.568Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/49/d8/9be608c6024d021041c7f0b3928d4749a706f4e2c3832bbede4fb4f58c95/scikit_learn-1.8.0-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:5025ce924beccb28298246e589c691fe1b8c1c96507e6d27d12c5fadd85bfd76", size = 8079075, upload-time = "2025-12-10T07:07:53.697Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/dd/47/f187b4636ff80cc63f21cd40b7b2d177134acaa10f6bb73746130ee8c2e5/scikit_learn-1.8.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4496bb2cf7a43ce1a2d7524a79e40bc5da45cf598dbf9545b7e8316ccba47bb4", size = 8660492, upload-time = "2025-12-10T07:07:55.574Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/97/74/b7a304feb2b49df9fafa9382d4d09061a96ee9a9449a7cbea7988dda0828/scikit_learn-1.8.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a0bcfe4d0d14aec44921545fd2af2338c7471de9cb701f1da4c9d85906ab847a", size = 8931904, upload-time = "2025-12-10T07:07:57.666Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9f/c4/0ab22726a04ede56f689476b760f98f8f46607caecff993017ac1b64aa5d/scikit_learn-1.8.0-cp312-cp312-win_amd64.whl", hash = "sha256:35c007dedb2ffe38fe3ee7d201ebac4a2deccd2408e8621d53067733e3c74809", size = 8019359, upload-time = "2025-12-10T07:07:59.838Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/24/90/344a67811cfd561d7335c1b96ca21455e7e472d281c3c279c4d3f2300236/scikit_learn-1.8.0-cp312-cp312-win_arm64.whl", hash = "sha256:8c497fff237d7b4e07e9ef1a640887fa4fb765647f86fbe00f969ff6280ce2bb", size = 7641898, upload-time = "2025-12-10T07:08:01.36Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/03/aa/e22e0768512ce9255eba34775be2e85c2048da73da1193e841707f8f039c/scikit_learn-1.8.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:0d6ae97234d5d7079dc0040990a6f7aeb97cb7fa7e8945f1999a429b23569e0a", size = 8513770, upload-time = "2025-12-10T07:08:03.251Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/58/37/31b83b2594105f61a381fc74ca19e8780ee923be2d496fcd8d2e1147bd99/scikit_learn-1.8.0-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:edec98c5e7c128328124a029bceb09eda2d526997780fef8d65e9a69eead963e", size = 8044458, upload-time = "2025-12-10T07:08:05.336Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2d/5a/3f1caed8765f33eabb723596666da4ebbf43d11e96550fb18bdec42b467b/scikit_learn-1.8.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:74b66d8689d52ed04c271e1329f0c61635bcaf5b926db9b12d58914cdc01fe57", size = 8610341, upload-time = "2025-12-10T07:08:07.732Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/38/cf/06896db3f71c75902a8e9943b444a56e727418f6b4b4a90c98c934f51ed4/scikit_learn-1.8.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8fdf95767f989b0cfedb85f7ed8ca215d4be728031f56ff5a519ee1e3276dc2e", size = 8900022, upload-time = "2025-12-10T07:08:09.862Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1c/f9/9b7563caf3ec8873e17a31401858efab6b39a882daf6c1bfa88879c0aa11/scikit_learn-1.8.0-cp313-cp313-win_amd64.whl", hash = "sha256:2de443b9373b3b615aec1bb57f9baa6bb3a9bd093f1269ba95c17d870422b271", size = 7989409, upload-time = "2025-12-10T07:08:12.028Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/49/bd/1f4001503650e72c4f6009ac0c4413cb17d2d601cef6f71c0453da2732fc/scikit_learn-1.8.0-cp313-cp313-win_arm64.whl", hash = "sha256:eddde82a035681427cbedded4e6eff5e57fa59216c2e3e90b10b19ab1d0a65c3", size = 7619760, upload-time = "2025-12-10T07:08:13.688Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d2/7d/a630359fc9dcc95496588c8d8e3245cc8fd81980251079bc09c70d41d951/scikit_learn-1.8.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:7cc267b6108f0a1499a734167282c00c4ebf61328566b55ef262d48e9849c735", size = 8826045, upload-time = "2025-12-10T07:08:15.215Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cc/56/a0c86f6930cfcd1c7054a2bc417e26960bb88d32444fe7f71d5c2cfae891/scikit_learn-1.8.0-cp313-cp313t-macosx_12_0_arm64.whl", hash = "sha256:fe1c011a640a9f0791146011dfd3c7d9669785f9fed2b2a5f9e207536cf5c2fd", size = 8420324, upload-time = "2025-12-10T07:08:17.561Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/46/1e/05962ea1cebc1cf3876667ecb14c283ef755bf409993c5946ade3b77e303/scikit_learn-1.8.0-cp313-cp313t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:72358cce49465d140cc4e7792015bb1f0296a9742d5622c67e31399b75468b9e", size = 8680651, upload-time = "2025-12-10T07:08:19.952Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fe/56/a85473cd75f200c9759e3a5f0bcab2d116c92a8a02ee08ccd73b870f8bb4/scikit_learn-1.8.0-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:80832434a6cc114f5219211eec13dcbc16c2bac0e31ef64c6d346cde3cf054cb", size = 8925045, upload-time = "2025-12-10T07:08:22.11Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cc/b7/64d8cfa896c64435ae57f4917a548d7ac7a44762ff9802f75a79b77cb633/scikit_learn-1.8.0-cp313-cp313t-win_amd64.whl", hash = "sha256:ee787491dbfe082d9c3013f01f5991658b0f38aa8177e4cd4bf434c58f551702", size = 8507994, upload-time = "2025-12-10T07:08:23.943Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5e/37/e192ea709551799379958b4c4771ec507347027bb7c942662c7fbeba31cb/scikit_learn-1.8.0-cp313-cp313t-win_arm64.whl", hash = "sha256:bf97c10a3f5a7543f9b88cbf488d33d175e9146115a451ae34568597ba33dcde", size = 7869518, upload-time = "2025-12-10T07:08:25.71Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/24/05/1af2c186174cc92dcab2233f327336058c077d38f6fe2aceb08e6ab4d509/scikit_learn-1.8.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:c22a2da7a198c28dd1a6e1136f19c830beab7fdca5b3e5c8bba8394f8a5c45b3", size = 8528667, upload-time = "2025-12-10T07:08:27.541Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a8/25/01c0af38fe969473fb292bba9dc2b8f9b451f3112ff242c647fee3d0dfe7/scikit_learn-1.8.0-cp314-cp314-macosx_12_0_arm64.whl", hash = "sha256:6b595b07a03069a2b1740dc08c2299993850ea81cce4fe19b2421e0c970de6b7", size = 8066524, upload-time = "2025-12-10T07:08:29.822Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/be/ce/a0623350aa0b68647333940ee46fe45086c6060ec604874e38e9ab7d8e6c/scikit_learn-1.8.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:29ffc74089f3d5e87dfca4c2c8450f88bdc61b0fc6ed5d267f3988f19a1309f6", size = 8657133, upload-time = "2025-12-10T07:08:31.865Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b8/cb/861b41341d6f1245e6ca80b1c1a8c4dfce43255b03df034429089ca2a2c5/scikit_learn-1.8.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fb65db5d7531bccf3a4f6bec3462223bea71384e2cda41da0f10b7c292b9e7c4", size = 8923223, upload-time = "2025-12-10T07:08:34.166Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/76/18/a8def8f91b18cd1ba6e05dbe02540168cb24d47e8dcf69e8d00b7da42a08/scikit_learn-1.8.0-cp314-cp314-win_amd64.whl", hash = "sha256:56079a99c20d230e873ea40753102102734c5953366972a71d5cb39a32bc40c6", size = 8096518, upload-time = "2025-12-10T07:08:36.339Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d1/77/482076a678458307f0deb44e29891d6022617b2a64c840c725495bee343f/scikit_learn-1.8.0-cp314-cp314-win_arm64.whl", hash = "sha256:3bad7565bc9cf37ce19a7c0d107742b320c1285df7aab1a6e2d28780df167242", size = 7754546, upload-time = "2025-12-10T07:08:38.128Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2d/d1/ef294ca754826daa043b2a104e59960abfab4cf653891037d19dd5b6f3cf/scikit_learn-1.8.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:4511be56637e46c25721e83d1a9cea9614e7badc7040c4d573d75fbe257d6fd7", size = 8848305, upload-time = "2025-12-10T07:08:41.013Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5b/e2/b1f8b05138ee813b8e1a4149f2f0d289547e60851fd1bb268886915adbda/scikit_learn-1.8.0-cp314-cp314t-macosx_12_0_arm64.whl", hash = "sha256:a69525355a641bf8ef136a7fa447672fb54fe8d60cab5538d9eb7c6438543fb9", size = 8432257, upload-time = "2025-12-10T07:08:42.873Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/26/11/c32b2138a85dcb0c99f6afd13a70a951bfdff8a6ab42d8160522542fb647/scikit_learn-1.8.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c2656924ec73e5939c76ac4c8b026fc203b83d8900362eb2599d8aee80e4880f", size = 8678673, upload-time = "2025-12-10T07:08:45.362Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c7/57/51f2384575bdec454f4fe4e7a919d696c9ebce914590abf3e52d47607ab8/scikit_learn-1.8.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:15fc3b5d19cc2be65404786857f2e13c70c83dd4782676dd6814e3b89dc8f5b9", size = 8922467, upload-time = "2025-12-10T07:08:47.408Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/35/4d/748c9e2872637a57981a04adc038dacaa16ba8ca887b23e34953f0b3f742/scikit_learn-1.8.0-cp314-cp314t-win_amd64.whl", hash = "sha256:00d6f1d66fbcf4eba6e356e1420d33cc06c70a45bb1363cd6f6a8e4ebbbdece2", size = 8774395, upload-time = "2025-12-10T07:08:49.337Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/60/22/d7b2ebe4704a5e50790ba089d5c2ae308ab6bb852719e6c3bd4f04c3a363/scikit_learn-1.8.0-cp314-cp314t-win_arm64.whl", hash = "sha256:f28dd15c6bb0b66ba09728cf09fd8736c304be29409bd8445a080c1280619e8c", size = 8002647, upload-time = "2025-12-10T07:08:51.601Z" }, ] [[package]] name = "scipy" -version = "1.16.3" +version = "1.17.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "numpy" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0a/ca/d8ace4f98322d01abcd52d381134344bf7b431eba7ed8b42bdea5a3c2ac9/scipy-1.16.3.tar.gz", hash = "sha256:01e87659402762f43bd2fee13370553a17ada367d42e7487800bf2916535aecb", size = 30597883, upload-time = "2025-10-28T17:38:54.068Z" } -wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/40/41/5bf55c3f386b1643812f3a5674edf74b26184378ef0f3e7c7a09a7e2ca7f/scipy-1.16.3-cp312-cp312-macosx_10_14_x86_64.whl", hash = "sha256:81fc5827606858cf71446a5e98715ba0e11f0dbc83d71c7409d05486592a45d6", size = 36659043, upload-time = "2025-10-28T17:32:40.285Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1e/0f/65582071948cfc45d43e9870bf7ca5f0e0684e165d7c9ef4e50d783073eb/scipy-1.16.3-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:c97176013d404c7346bf57874eaac5187d969293bf40497140b0a2b2b7482e07", size = 28898986, upload-time = "2025-10-28T17:32:45.325Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/96/5e/36bf3f0ac298187d1ceadde9051177d6a4fe4d507e8f59067dc9dd39e650/scipy-1.16.3-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:2b71d93c8a9936046866acebc915e2af2e292b883ed6e2cbe5c34beb094b82d9", size = 20889814, upload-time = "2025-10-28T17:32:49.277Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/80/35/178d9d0c35394d5d5211bbff7ac4f2986c5488b59506fef9e1de13ea28d3/scipy-1.16.3-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:3d4a07a8e785d80289dfe66b7c27d8634a773020742ec7187b85ccc4b0e7b686", size = 23565795, upload-time = "2025-10-28T17:32:53.337Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fa/46/d1146ff536d034d02f83c8afc3c4bab2eddb634624d6529a8512f3afc9da/scipy-1.16.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:0553371015692a898e1aa858fed67a3576c34edefa6b7ebdb4e9dde49ce5c203", size = 33349476, upload-time = "2025-10-28T17:32:58.353Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/79/2e/415119c9ab3e62249e18c2b082c07aff907a273741b3f8160414b0e9193c/scipy-1.16.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:72d1717fd3b5e6ec747327ce9bda32d5463f472c9dce9f54499e81fbd50245a1", size = 35676692, upload-time = "2025-10-28T17:33:03.88Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/27/82/df26e44da78bf8d2aeaf7566082260cfa15955a5a6e96e6a29935b64132f/scipy-1.16.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:1fb2472e72e24d1530debe6ae078db70fb1605350c88a3d14bc401d6306dbffe", size = 36019345, upload-time = "2025-10-28T17:33:09.773Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/82/31/006cbb4b648ba379a95c87262c2855cd0d09453e500937f78b30f02fa1cd/scipy-1.16.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c5192722cffe15f9329a3948c4b1db789fbb1f05c97899187dcf009b283aea70", size = 38678975, upload-time = "2025-10-28T17:33:15.809Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c2/7f/acbd28c97e990b421af7d6d6cd416358c9c293fc958b8529e0bd5d2a2a19/scipy-1.16.3-cp312-cp312-win_amd64.whl", hash = "sha256:56edc65510d1331dae01ef9b658d428e33ed48b4f77b1d51caf479a0253f96dc", size = 38555926, upload-time = "2025-10-28T17:33:21.388Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ce/69/c5c7807fd007dad4f48e0a5f2153038dc96e8725d3345b9ee31b2b7bed46/scipy-1.16.3-cp312-cp312-win_arm64.whl", hash = "sha256:a8a26c78ef223d3e30920ef759e25625a0ecdd0d60e5a8818b7513c3e5384cf2", size = 25463014, upload-time = "2025-10-28T17:33:25.975Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/72/f1/57e8327ab1508272029e27eeef34f2302ffc156b69e7e233e906c2a5c379/scipy-1.16.3-cp313-cp313-macosx_10_14_x86_64.whl", hash = "sha256:d2ec56337675e61b312179a1ad124f5f570c00f920cc75e1000025451b88241c", size = 36617856, upload-time = "2025-10-28T17:33:31.375Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/44/13/7e63cfba8a7452eb756306aa2fd9b37a29a323b672b964b4fdeded9a3f21/scipy-1.16.3-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:16b8bc35a4cc24db80a0ec836a9286d0e31b2503cb2fd7ff7fb0e0374a97081d", size = 28874306, upload-time = "2025-10-28T17:33:36.516Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/15/65/3a9400efd0228a176e6ec3454b1fa998fbbb5a8defa1672c3f65706987db/scipy-1.16.3-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:5803c5fadd29de0cf27fa08ccbfe7a9e5d741bf63e4ab1085437266f12460ff9", size = 20865371, upload-time = "2025-10-28T17:33:42.094Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/33/d7/eda09adf009a9fb81827194d4dd02d2e4bc752cef16737cc4ef065234031/scipy-1.16.3-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:b81c27fc41954319a943d43b20e07c40bdcd3ff7cf013f4fb86286faefe546c4", size = 23524877, upload-time = "2025-10-28T17:33:48.483Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7d/6b/3f911e1ebc364cb81320223a3422aab7d26c9c7973109a9cd0f27c64c6c0/scipy-1.16.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:0c3b4dd3d9b08dbce0f3440032c52e9e2ab9f96ade2d3943313dfe51a7056959", size = 33342103, upload-time = "2025-10-28T17:33:56.495Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/21/f6/4bfb5695d8941e5c570a04d9fcd0d36bce7511b7d78e6e75c8f9791f82d0/scipy-1.16.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7dc1360c06535ea6116a2220f760ae572db9f661aba2d88074fe30ec2aa1ff88", size = 35697297, upload-time = "2025-10-28T17:34:04.722Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/04/e1/6496dadbc80d8d896ff72511ecfe2316b50313bfc3ebf07a3f580f08bd8c/scipy-1.16.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:663b8d66a8748051c3ee9c96465fb417509315b99c71550fda2591d7dd634234", size = 36021756, upload-time = "2025-10-28T17:34:13.482Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fe/bd/a8c7799e0136b987bda3e1b23d155bcb31aec68a4a472554df5f0937eef7/scipy-1.16.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:eab43fae33a0c39006a88096cd7b4f4ef545ea0447d250d5ac18202d40b6611d", size = 38696566, upload-time = "2025-10-28T17:34:22.384Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cd/01/1204382461fcbfeb05b6161b594f4007e78b6eba9b375382f79153172b4d/scipy-1.16.3-cp313-cp313-win_amd64.whl", hash = "sha256:062246acacbe9f8210de8e751b16fc37458213f124bef161a5a02c7a39284304", size = 38529877, upload-time = "2025-10-28T17:35:51.076Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7f/14/9d9fbcaa1260a94f4bb5b64ba9213ceb5d03cd88841fe9fd1ffd47a45b73/scipy-1.16.3-cp313-cp313-win_arm64.whl", hash = "sha256:50a3dbf286dbc7d84f176f9a1574c705f277cb6565069f88f60db9eafdbe3ee2", size = 25455366, upload-time = "2025-10-28T17:35:59.014Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e2/a3/9ec205bd49f42d45d77f1730dbad9ccf146244c1647605cf834b3a8c4f36/scipy-1.16.3-cp313-cp313t-macosx_10_14_x86_64.whl", hash = "sha256:fb4b29f4cf8cc5a8d628bc8d8e26d12d7278cd1f219f22698a378c3d67db5e4b", size = 37027931, upload-time = "2025-10-28T17:34:31.451Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/25/06/ca9fd1f3a4589cbd825b1447e5db3a8ebb969c1eaf22c8579bd286f51b6d/scipy-1.16.3-cp313-cp313t-macosx_12_0_arm64.whl", hash = "sha256:8d09d72dc92742988b0e7750bddb8060b0c7079606c0d24a8cc8e9c9c11f9079", size = 29400081, upload-time = "2025-10-28T17:34:39.087Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6a/56/933e68210d92657d93fb0e381683bc0e53a965048d7358ff5fbf9e6a1b17/scipy-1.16.3-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:03192a35e661470197556de24e7cb1330d84b35b94ead65c46ad6f16f6b28f2a", size = 21391244, upload-time = "2025-10-28T17:34:45.234Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a8/7e/779845db03dc1418e215726329674b40576879b91814568757ff0014ad65/scipy-1.16.3-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:57d01cb6f85e34f0946b33caa66e892aae072b64b034183f3d87c4025802a119", size = 23929753, upload-time = "2025-10-28T17:34:51.793Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4c/4b/f756cf8161d5365dcdef9e5f460ab226c068211030a175d2fc7f3f41ca64/scipy-1.16.3-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:96491a6a54e995f00a28a3c3badfff58fd093bf26cd5fb34a2188c8c756a3a2c", size = 33496912, upload-time = "2025-10-28T17:34:59.8Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/09/b5/222b1e49a58668f23839ca1542a6322bb095ab8d6590d4f71723869a6c2c/scipy-1.16.3-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:cd13e354df9938598af2be05822c323e97132d5e6306b83a3b4ee6724c6e522e", size = 35802371, upload-time = "2025-10-28T17:35:08.173Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c1/8d/5964ef68bb31829bde27611f8c9deeac13764589fe74a75390242b64ca44/scipy-1.16.3-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:63d3cdacb8a824a295191a723ee5e4ea7768ca5ca5f2838532d9f2e2b3ce2135", size = 36190477, upload-time = "2025-10-28T17:35:16.7Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ab/f2/b31d75cb9b5fa4dd39a0a931ee9b33e7f6f36f23be5ef560bf72e0f92f32/scipy-1.16.3-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:e7efa2681ea410b10dde31a52b18b0154d66f2485328830e45fdf183af5aefc6", size = 38796678, upload-time = "2025-10-28T17:35:26.354Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b4/1e/b3723d8ff64ab548c38d87055483714fefe6ee20e0189b62352b5e015bb1/scipy-1.16.3-cp313-cp313t-win_amd64.whl", hash = "sha256:2d1ae2cf0c350e7705168ff2429962a89ad90c2d49d1dd300686d8b2a5af22fc", size = 38640178, upload-time = "2025-10-28T17:35:35.304Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8e/f3/d854ff38789aca9b0cc23008d607ced9de4f7ab14fa1ca4329f86b3758ca/scipy-1.16.3-cp313-cp313t-win_arm64.whl", hash = "sha256:0c623a54f7b79dd88ef56da19bc2873afec9673a48f3b85b18e4d402bdd29a5a", size = 25803246, upload-time = "2025-10-28T17:35:42.155Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/99/f6/99b10fd70f2d864c1e29a28bbcaa0c6340f9d8518396542d9ea3b4aaae15/scipy-1.16.3-cp314-cp314-macosx_10_14_x86_64.whl", hash = "sha256:875555ce62743e1d54f06cdf22c1e0bc47b91130ac40fe5d783b6dfa114beeb6", size = 36606469, upload-time = "2025-10-28T17:36:08.741Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4d/74/043b54f2319f48ea940dd025779fa28ee360e6b95acb7cd188fad4391c6b/scipy-1.16.3-cp314-cp314-macosx_12_0_arm64.whl", hash = "sha256:bb61878c18a470021fb515a843dc7a76961a8daceaaaa8bad1332f1bf4b54657", size = 28872043, upload-time = "2025-10-28T17:36:16.599Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4d/e1/24b7e50cc1c4ee6ffbcb1f27fe9f4c8b40e7911675f6d2d20955f41c6348/scipy-1.16.3-cp314-cp314-macosx_14_0_arm64.whl", hash = "sha256:f2622206f5559784fa5c4b53a950c3c7c1cf3e84ca1b9c4b6c03f062f289ca26", size = 20862952, upload-time = "2025-10-28T17:36:22.966Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/dd/3a/3e8c01a4d742b730df368e063787c6808597ccb38636ed821d10b39ca51b/scipy-1.16.3-cp314-cp314-macosx_14_0_x86_64.whl", hash = "sha256:7f68154688c515cdb541a31ef8eb66d8cd1050605be9dcd74199cbd22ac739bc", size = 23508512, upload-time = "2025-10-28T17:36:29.731Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1f/60/c45a12b98ad591536bfe5330cb3cfe1850d7570259303563b1721564d458/scipy-1.16.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:8b3c820ddb80029fe9f43d61b81d8b488d3ef8ca010d15122b152db77dc94c22", size = 33413639, upload-time = "2025-10-28T17:36:37.982Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/71/bc/35957d88645476307e4839712642896689df442f3e53b0fa016ecf8a3357/scipy-1.16.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:d3837938ae715fc0fe3c39c0202de3a8853aff22ca66781ddc2ade7554b7e2cc", size = 35704729, upload-time = "2025-10-28T17:36:46.547Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3b/15/89105e659041b1ca11c386e9995aefacd513a78493656e57789f9d9eab61/scipy-1.16.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:aadd23f98f9cb069b3bd64ddc900c4d277778242e961751f77a8cb5c4b946fb0", size = 36086251, upload-time = "2025-10-28T17:36:55.161Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1a/87/c0ea673ac9c6cc50b3da2196d860273bc7389aa69b64efa8493bdd25b093/scipy-1.16.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:b7c5f1bda1354d6a19bc6af73a649f8285ca63ac6b52e64e658a5a11d4d69800", size = 38716681, upload-time = "2025-10-28T17:37:04.1Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/91/06/837893227b043fb9b0d13e4bd7586982d8136cb249ffb3492930dab905b8/scipy-1.16.3-cp314-cp314-win_amd64.whl", hash = "sha256:e5d42a9472e7579e473879a1990327830493a7047506d58d73fc429b84c1d49d", size = 39358423, upload-time = "2025-10-28T17:38:20.005Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/95/03/28bce0355e4d34a7c034727505a02d19548549e190bedd13a721e35380b7/scipy-1.16.3-cp314-cp314-win_arm64.whl", hash = "sha256:6020470b9d00245926f2d5bb93b119ca0340f0d564eb6fbaad843eaebf9d690f", size = 26135027, upload-time = "2025-10-28T17:38:24.966Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b2/6f/69f1e2b682efe9de8fe9f91040f0cd32f13cfccba690512ba4c582b0bc29/scipy-1.16.3-cp314-cp314t-macosx_10_14_x86_64.whl", hash = "sha256:e1d27cbcb4602680a49d787d90664fa4974063ac9d4134813332a8c53dbe667c", size = 37028379, upload-time = "2025-10-28T17:37:14.061Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7c/2d/e826f31624a5ebbab1cd93d30fd74349914753076ed0593e1d56a98c4fb4/scipy-1.16.3-cp314-cp314t-macosx_12_0_arm64.whl", hash = "sha256:9b9c9c07b6d56a35777a1b4cc8966118fb16cfd8daf6743867d17d36cfad2d40", size = 29400052, upload-time = "2025-10-28T17:37:21.709Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/69/27/d24feb80155f41fd1f156bf144e7e049b4e2b9dd06261a242905e3bc7a03/scipy-1.16.3-cp314-cp314t-macosx_14_0_arm64.whl", hash = "sha256:3a4c460301fb2cffb7f88528f30b3127742cff583603aa7dc964a52c463b385d", size = 21391183, upload-time = "2025-10-28T17:37:29.559Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f8/d3/1b229e433074c5738a24277eca520a2319aac7465eea7310ea6ae0e98ae2/scipy-1.16.3-cp314-cp314t-macosx_14_0_x86_64.whl", hash = "sha256:f667a4542cc8917af1db06366d3f78a5c8e83badd56409f94d1eac8d8d9133fa", size = 23930174, upload-time = "2025-10-28T17:37:36.306Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/16/9d/d9e148b0ec680c0f042581a2be79a28a7ab66c0c4946697f9e7553ead337/scipy-1.16.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:f379b54b77a597aa7ee5e697df0d66903e41b9c85a6dd7946159e356319158e8", size = 33497852, upload-time = "2025-10-28T17:37:42.228Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2f/22/4e5f7561e4f98b7bea63cf3fd7934bff1e3182e9f1626b089a679914d5c8/scipy-1.16.3-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:4aff59800a3b7f786b70bfd6ab551001cb553244988d7d6b8299cb1ea653b353", size = 35798595, upload-time = "2025-10-28T17:37:48.102Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/83/42/6644d714c179429fc7196857866f219fef25238319b650bb32dde7bf7a48/scipy-1.16.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:da7763f55885045036fabcebd80144b757d3db06ab0861415d1c3b7c69042146", size = 36186269, upload-time = "2025-10-28T17:37:53.72Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ac/70/64b4d7ca92f9cf2e6fc6aaa2eecf80bb9b6b985043a9583f32f8177ea122/scipy-1.16.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:ffa6eea95283b2b8079b821dc11f50a17d0571c92b43e2b5b12764dc5f9b285d", size = 38802779, upload-time = "2025-10-28T17:37:59.393Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/61/82/8d0e39f62764cce5ffd5284131e109f07cf8955aef9ab8ed4e3aa5e30539/scipy-1.16.3-cp314-cp314t-win_amd64.whl", hash = "sha256:d9f48cafc7ce94cf9b15c6bffdc443a81a27bf7075cf2dcd5c8b40f85d10c4e7", size = 39471128, upload-time = "2025-10-28T17:38:05.259Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/64/47/a494741db7280eae6dc033510c319e34d42dd41b7ac0c7ead39354d1a2b5/scipy-1.16.3-cp314-cp314t-win_arm64.whl", hash = "sha256:21d9d6b197227a12dcbf9633320a4e34c6b0e51c57268df255a0942983bac562", size = 26464127, upload-time = "2025-10-28T17:38:11.34Z" }, +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/56/3e/9cca699f3486ce6bc12ff46dc2031f1ec8eb9ccc9a320fdaf925f1417426/scipy-1.17.0.tar.gz", hash = "sha256:2591060c8e648d8b96439e111ac41fd8342fdeff1876be2e19dea3fe8930454e", size = 30396830, upload-time = "2026-01-10T21:34:23.009Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0b/11/7241a63e73ba5a516f1930ac8d5b44cbbfabd35ac73a2d08ca206df007c4/scipy-1.17.0-cp312-cp312-macosx_10_14_x86_64.whl", hash = "sha256:0d5018a57c24cb1dd828bcf51d7b10e65986d549f52ef5adb6b4d1ded3e32a57", size = 31364580, upload-time = "2026-01-10T21:25:25.717Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ed/1d/5057f812d4f6adc91a20a2d6f2ebcdb517fdbc87ae3acc5633c9b97c8ba5/scipy-1.17.0-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:88c22af9e5d5a4f9e027e26772cc7b5922fab8bcc839edb3ae33de404feebd9e", size = 27969012, upload-time = "2026-01-10T21:25:30.921Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e3/21/f6ec556c1e3b6ec4e088da667d9987bb77cc3ab3026511f427dc8451187d/scipy-1.17.0-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:f3cd947f20fe17013d401b64e857c6b2da83cae567adbb75b9dcba865abc66d8", size = 20140691, upload-time = "2026-01-10T21:25:34.802Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7a/fe/5e5ad04784964ba964a96f16c8d4676aa1b51357199014dce58ab7ec5670/scipy-1.17.0-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:e8c0b331c2c1f531eb51f1b4fc9ba709521a712cce58f1aa627bc007421a5306", size = 22463015, upload-time = "2026-01-10T21:25:39.277Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4a/69/7c347e857224fcaf32a34a05183b9d8a7aca25f8f2d10b8a698b8388561a/scipy-1.17.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5194c445d0a1c7a6c1a4a4681b6b7c71baad98ff66d96b949097e7513c9d6742", size = 32724197, upload-time = "2026-01-10T21:25:44.084Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d1/fe/66d73b76d378ba8cc2fe605920c0c75092e3a65ae746e1e767d9d020a75a/scipy-1.17.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9eeb9b5f5997f75507814ed9d298ab23f62cf79f5a3ef90031b1ee2506abdb5b", size = 35009148, upload-time = "2026-01-10T21:25:50.591Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/af/07/07dec27d9dc41c18d8c43c69e9e413431d20c53a0339c388bcf72f353c4b/scipy-1.17.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:40052543f7bbe921df4408f46003d6f01c6af109b9e2c8a66dd1cf6cf57f7d5d", size = 34798766, upload-time = "2026-01-10T21:25:59.41Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/81/61/0470810c8a093cdacd4ba7504b8a218fd49ca070d79eca23a615f5d9a0b0/scipy-1.17.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:0cf46c8013fec9d3694dc572f0b54100c28405d55d3e2cb15e2895b25057996e", size = 37405953, upload-time = "2026-01-10T21:26:07.75Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/92/ce/672ed546f96d5d41ae78c4b9b02006cedd0b3d6f2bf5bb76ea455c320c28/scipy-1.17.0-cp312-cp312-win_amd64.whl", hash = "sha256:0937a0b0d8d593a198cededd4c439a0ea216a3f36653901ea1f3e4be949056f8", size = 36328121, upload-time = "2026-01-10T21:26:16.509Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9d/21/38165845392cae67b61843a52c6455d47d0cc2a40dd495c89f4362944654/scipy-1.17.0-cp312-cp312-win_arm64.whl", hash = "sha256:f603d8a5518c7426414d1d8f82e253e454471de682ce5e39c29adb0df1efb86b", size = 24314368, upload-time = "2026-01-10T21:26:23.087Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0c/51/3468fdfd49387ddefee1636f5cf6d03ce603b75205bf439bbf0e62069bfd/scipy-1.17.0-cp313-cp313-macosx_10_14_x86_64.whl", hash = "sha256:65ec32f3d32dfc48c72df4291345dae4f048749bc8d5203ee0a3f347f96c5ce6", size = 31344101, upload-time = "2026-01-10T21:26:30.25Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b2/9a/9406aec58268d437636069419e6977af953d1e246df941d42d3720b7277b/scipy-1.17.0-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:1f9586a58039d7229ce77b52f8472c972448cded5736eaf102d5658bbac4c269", size = 27950385, upload-time = "2026-01-10T21:26:36.801Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4f/98/e7342709e17afdfd1b26b56ae499ef4939b45a23a00e471dfb5375eea205/scipy-1.17.0-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:9fad7d3578c877d606b1150135c2639e9de9cecd3705caa37b66862977cc3e72", size = 20122115, upload-time = "2026-01-10T21:26:42.107Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fd/0e/9eeeb5357a64fd157cbe0302c213517c541cc16b8486d82de251f3c68ede/scipy-1.17.0-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:423ca1f6584fc03936972b5f7c06961670dbba9f234e71676a7c7ccf938a0d61", size = 22442402, upload-time = "2026-01-10T21:26:48.029Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c9/10/be13397a0e434f98e0c79552b2b584ae5bb1c8b2be95db421533bbca5369/scipy-1.17.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:fe508b5690e9eaaa9467fc047f833af58f1152ae51a0d0aed67aa5801f4dd7d6", size = 32696338, upload-time = "2026-01-10T21:26:55.521Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/63/1e/12fbf2a3bb240161651c94bb5cdd0eae5d4e8cc6eaeceb74ab07b12a753d/scipy-1.17.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6680f2dfd4f6182e7d6db161344537da644d1cf85cf293f015c60a17ecf08752", size = 34977201, upload-time = "2026-01-10T21:27:03.501Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/19/5b/1a63923e23ccd20bd32156d7dd708af5bbde410daa993aa2500c847ab2d2/scipy-1.17.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:eec3842ec9ac9de5917899b277428886042a93db0b227ebbe3a333b64ec7643d", size = 34777384, upload-time = "2026-01-10T21:27:11.423Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/39/22/b5da95d74edcf81e540e467202a988c50fef41bd2011f46e05f72ba07df6/scipy-1.17.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:d7425fcafbc09a03731e1bc05581f5fad988e48c6a861f441b7ab729a49a55ea", size = 37379586, upload-time = "2026-01-10T21:27:20.171Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b9/b6/8ac583d6da79e7b9e520579f03007cb006f063642afd6b2eeb16b890bf93/scipy-1.17.0-cp313-cp313-win_amd64.whl", hash = "sha256:87b411e42b425b84777718cc41516b8a7e0795abfa8e8e1d573bf0ef014f0812", size = 36287211, upload-time = "2026-01-10T21:28:43.122Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/55/fb/7db19e0b3e52f882b420417644ec81dd57eeef1bd1705b6f689d8ff93541/scipy-1.17.0-cp313-cp313-win_arm64.whl", hash = "sha256:357ca001c6e37601066092e7c89cca2f1ce74e2a520ca78d063a6d2201101df2", size = 24312646, upload-time = "2026-01-10T21:28:49.893Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/20/b6/7feaa252c21cc7aff335c6c55e1b90ab3e3306da3f048109b8b639b94648/scipy-1.17.0-cp313-cp313t-macosx_10_14_x86_64.whl", hash = "sha256:ec0827aa4d36cb79ff1b81de898e948a51ac0b9b1c43e4a372c0508c38c0f9a3", size = 31693194, upload-time = "2026-01-10T21:27:27.454Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/76/bb/bbb392005abce039fb7e672cb78ac7d158700e826b0515cab6b5b60c26fb/scipy-1.17.0-cp313-cp313t-macosx_12_0_arm64.whl", hash = "sha256:819fc26862b4b3c73a60d486dbb919202f3d6d98c87cf20c223511429f2d1a97", size = 28365415, upload-time = "2026-01-10T21:27:34.26Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/37/da/9d33196ecc99fba16a409c691ed464a3a283ac454a34a13a3a57c0d66f3a/scipy-1.17.0-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:363ad4ae2853d88ebcde3ae6ec46ccca903ea9835ee8ba543f12f575e7b07e4e", size = 20537232, upload-time = "2026-01-10T21:27:40.306Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/56/9d/f4b184f6ddb28e9a5caea36a6f98e8ecd2a524f9127354087ce780885d83/scipy-1.17.0-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:979c3a0ff8e5ba254d45d59ebd38cde48fce4f10b5125c680c7a4bfe177aab07", size = 22791051, upload-time = "2026-01-10T21:27:46.539Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9b/9d/025cccdd738a72140efc582b1641d0dd4caf2e86c3fb127568dc80444e6e/scipy-1.17.0-cp313-cp313t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:130d12926ae34399d157de777472bf82e9061c60cc081372b3118edacafe1d00", size = 32815098, upload-time = "2026-01-10T21:27:54.389Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/48/5f/09b879619f8bca15ce392bfc1894bd9c54377e01d1b3f2f3b595a1b4d945/scipy-1.17.0-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6e886000eb4919eae3a44f035e63f0fd8b651234117e8f6f29bad1cd26e7bc45", size = 35031342, upload-time = "2026-01-10T21:28:03.012Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f2/9a/f0f0a9f0aa079d2f106555b984ff0fbb11a837df280f04f71f056ea9c6e4/scipy-1.17.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:13c4096ac6bc31d706018f06a49abe0485f96499deb82066b94d19b02f664209", size = 34893199, upload-time = "2026-01-10T21:28:10.832Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/90/b8/4f0f5cf0c5ea4d7548424e6533e6b17d164f34a6e2fb2e43ffebb6697b06/scipy-1.17.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:cacbaddd91fcffde703934897c5cd2c7cb0371fac195d383f4e1f1c5d3f3bd04", size = 37438061, upload-time = "2026-01-10T21:28:19.684Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f9/cc/2bd59140ed3b2fa2882fb15da0a9cb1b5a6443d67cfd0d98d4cec83a57ec/scipy-1.17.0-cp313-cp313t-win_amd64.whl", hash = "sha256:edce1a1cf66298cccdc48a1bdf8fb10a3bf58e8b58d6c3883dd1530e103f87c0", size = 36328593, upload-time = "2026-01-10T21:28:28.007Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/13/1b/c87cc44a0d2c7aaf0f003aef2904c3d097b422a96c7e7c07f5efd9073c1b/scipy-1.17.0-cp313-cp313t-win_arm64.whl", hash = "sha256:30509da9dbec1c2ed8f168b8d8aa853bc6723fede1dbc23c7d43a56f5ab72a67", size = 24625083, upload-time = "2026-01-10T21:28:35.188Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1a/2d/51006cd369b8e7879e1c630999a19d1fbf6f8b5ed3e33374f29dc87e53b3/scipy-1.17.0-cp314-cp314-macosx_10_14_x86_64.whl", hash = "sha256:c17514d11b78be8f7e6331b983a65a7f5ca1fd037b95e27b280921fe5606286a", size = 31346803, upload-time = "2026-01-10T21:28:57.24Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d6/2e/2349458c3ce445f53a6c93d4386b1c4c5c0c540917304c01222ff95ff317/scipy-1.17.0-cp314-cp314-macosx_12_0_arm64.whl", hash = "sha256:4e00562e519c09da34c31685f6acc3aa384d4d50604db0f245c14e1b4488bfa2", size = 27967182, upload-time = "2026-01-10T21:29:04.107Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5e/7c/df525fbfa77b878d1cfe625249529514dc02f4fd5f45f0f6295676a76528/scipy-1.17.0-cp314-cp314-macosx_14_0_arm64.whl", hash = "sha256:f7df7941d71314e60a481e02d5ebcb3f0185b8d799c70d03d8258f6c80f3d467", size = 20139125, upload-time = "2026-01-10T21:29:10.179Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/33/11/fcf9d43a7ed1234d31765ec643b0515a85a30b58eddccc5d5a4d12b5f194/scipy-1.17.0-cp314-cp314-macosx_14_0_x86_64.whl", hash = "sha256:aabf057c632798832f071a8dde013c2e26284043934f53b00489f1773b33527e", size = 22443554, upload-time = "2026-01-10T21:29:15.888Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/80/5c/ea5d239cda2dd3d31399424967a24d556cf409fbea7b5b21412b0fd0a44f/scipy-1.17.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a38c3337e00be6fd8a95b4ed66b5d988bac4ec888fd922c2ea9fe5fb1603dd67", size = 32757834, upload-time = "2026-01-10T21:29:23.406Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b8/7e/8c917cc573310e5dc91cbeead76f1b600d3fb17cf0969db02c9cf92e3cfa/scipy-1.17.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:00fb5f8ec8398ad90215008d8b6009c9db9fa924fd4c7d6be307c6f945f9cd73", size = 34995775, upload-time = "2026-01-10T21:29:31.915Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c5/43/176c0c3c07b3f7df324e7cdd933d3e2c4898ca202b090bd5ba122f9fe270/scipy-1.17.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:f2a4942b0f5f7c23c7cd641a0ca1955e2ae83dedcff537e3a0259096635e186b", size = 34841240, upload-time = "2026-01-10T21:29:39.995Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/44/8c/d1f5f4b491160592e7f084d997de53a8e896a3ac01cd07e59f43ca222744/scipy-1.17.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:dbf133ced83889583156566d2bdf7a07ff89228fe0c0cb727f777de92092ec6b", size = 37394463, upload-time = "2026-01-10T21:29:48.723Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9f/ec/42a6657f8d2d087e750e9a5dde0b481fd135657f09eaf1cf5688bb23c338/scipy-1.17.0-cp314-cp314-win_amd64.whl", hash = "sha256:3625c631a7acd7cfd929e4e31d2582cf00f42fcf06011f59281271746d77e061", size = 37053015, upload-time = "2026-01-10T21:30:51.418Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/27/58/6b89a6afd132787d89a362d443a7bddd511b8f41336a1ae47f9e4f000dc4/scipy-1.17.0-cp314-cp314-win_arm64.whl", hash = "sha256:9244608d27eafe02b20558523ba57f15c689357c85bdcfe920b1828750aa26eb", size = 24951312, upload-time = "2026-01-10T21:30:56.771Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e9/01/f58916b9d9ae0112b86d7c3b10b9e685625ce6e8248df139d0fcb17f7397/scipy-1.17.0-cp314-cp314t-macosx_10_14_x86_64.whl", hash = "sha256:2b531f57e09c946f56ad0b4a3b2abee778789097871fc541e267d2eca081cff1", size = 31706502, upload-time = "2026-01-10T21:29:56.326Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/59/8e/2912a87f94a7d1f8b38aabc0faf74b82d3b6c9e22be991c49979f0eceed8/scipy-1.17.0-cp314-cp314t-macosx_12_0_arm64.whl", hash = "sha256:13e861634a2c480bd237deb69333ac79ea1941b94568d4b0efa5db5e263d4fd1", size = 28380854, upload-time = "2026-01-10T21:30:01.554Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bd/1c/874137a52dddab7d5d595c1887089a2125d27d0601fce8c0026a24a92a0b/scipy-1.17.0-cp314-cp314t-macosx_14_0_arm64.whl", hash = "sha256:eb2651271135154aa24f6481cbae5cc8af1f0dd46e6533fb7b56aa9727b6a232", size = 20552752, upload-time = "2026-01-10T21:30:05.93Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3f/f0/7518d171cb735f6400f4576cf70f756d5b419a07fe1867da34e2c2c9c11b/scipy-1.17.0-cp314-cp314t-macosx_14_0_x86_64.whl", hash = "sha256:c5e8647f60679790c2f5c76be17e2e9247dc6b98ad0d3b065861e082c56e078d", size = 22803972, upload-time = "2026-01-10T21:30:10.651Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7c/74/3498563a2c619e8a3ebb4d75457486c249b19b5b04a30600dfd9af06bea5/scipy-1.17.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5fb10d17e649e1446410895639f3385fd2bf4c3c7dfc9bea937bddcbc3d7b9ba", size = 32829770, upload-time = "2026-01-10T21:30:16.359Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/48/d1/7b50cedd8c6c9d6f706b4b36fa8544d829c712a75e370f763b318e9638c1/scipy-1.17.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8547e7c57f932e7354a2319fab613981cde910631979f74c9b542bb167a8b9db", size = 35051093, upload-time = "2026-01-10T21:30:22.987Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e2/82/a2d684dfddb87ba1b3ea325df7c3293496ee9accb3a19abe9429bce94755/scipy-1.17.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:33af70d040e8af9d5e7a38b5ed3b772adddd281e3062ff23fec49e49681c38cf", size = 34909905, upload-time = "2026-01-10T21:30:28.704Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ef/5e/e565bd73991d42023eb82bb99e51c5b3d9e2c588ca9d4b3e2cc1d3ca62a6/scipy-1.17.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:f9eb55bb97d00f8b7ab95cb64f873eb0bf54d9446264d9f3609130381233483f", size = 37457743, upload-time = "2026-01-10T21:30:34.819Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/58/a8/a66a75c3d8f1fb2b83f66007d6455a06a6f6cf5618c3dc35bc9b69dd096e/scipy-1.17.0-cp314-cp314t-win_amd64.whl", hash = "sha256:1ff269abf702f6c7e67a4b7aad981d42871a11b9dd83c58d2d2ea624efbd1088", size = 37098574, upload-time = "2026-01-10T21:30:40.782Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/56/a5/df8f46ef7da168f1bc52cd86e09a9de5c6f19cc1da04454d51b7d4f43408/scipy-1.17.0-cp314-cp314t-win_arm64.whl", hash = "sha256:031121914e295d9791319a1875444d55079885bbae5bdc9c5e0f2ee5f09d34ff", size = 25246266, upload-time = "2026-01-10T21:30:45.923Z" }, ] [[package]] @@ -7026,7 +6928,7 @@ wheels = [ [[package]] name = "selenium" -version = "4.22.0" +version = "4.32.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "certifi" }, @@ -7036,9 +6938,9 @@ dependencies = [ { name = "urllib3", extra = ["socks"] }, { name = "websocket-client" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/04/93/fe0473c381dddce4db9527cf442d5949460fab4a92713fb5984386054323/selenium-4.22.0.tar.gz", hash = "sha256:903c8c9d61b3eea6fcc9809dc7d9377e04e2ac87709876542cc8f863e482c4ce", size = 9242392, upload-time = "2024-06-20T20:48:05.959Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/54/2d/fafffe946099033ccf22bf89e12eede14c1d3c5936110c5f6f2b9830722c/selenium-4.32.0.tar.gz", hash = "sha256:b9509bef4056f4083772abb1ae19ff57247d617a29255384b26be6956615b206", size = 870997, upload-time = "2025-05-02T20:35:27.325Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f2/7d/3a0b9c229d87a189b64c3b8e6d87a970a1ef7875995dc31bd18e65fa1c17/selenium-4.22.0-py3-none-any.whl", hash = "sha256:e424991196e9857e19bf04fe5c1c0a4aac076794ff5e74615b1124e729d93104", size = 9437133, upload-time = "2024-06-20T20:48:01.936Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ea/37/d07ed9d13e571b2115d4ed6956d156c66816ceec0b03b2e463e80d09f572/selenium-4.32.0-py3-none-any.whl", hash = "sha256:c4d9613f8a45693d61530c9660560fadb52db7d730237bc788ddedf442391f97", size = 9369668, upload-time = "2025-05-02T20:35:24.726Z" }, ] [[package]] @@ -7083,19 +6985,53 @@ sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9e/bd/3704a8c3e0942d [[package]] name = "shapely" -version = "2.0.5" +version = "2.1.2" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "numpy" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ad/99/c47247f4d688bbb5346df5ff1de5d9792b6d95cbbb2fd7b71f45901c1878/shapely-2.0.5.tar.gz", hash = "sha256:bff2366bc786bfa6cb353d6b47d0443c570c32776612e527ee47b6df63fcfe32", size = 282188, upload-time = "2024-07-13T10:52:59.762Z" } -wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/04/df/8062f14cb7aa502b8bda358103facedc80b87eec41e3391182655ff40615/shapely-2.0.5-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:03bd7b5fa5deb44795cc0a503999d10ae9d8a22df54ae8d4a4cd2e8a93466195", size = 1449608, upload-time = "2024-07-13T10:52:19.011Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5d/e7/719f384857c39aa51aa19d09d7cac84aeab1b25a7d0dab62433bf7b419e9/shapely-2.0.5-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2ff9521991ed9e201c2e923da014e766c1aa04771bc93e6fe97c27dcf0d40ace", size = 1284057, upload-time = "2024-07-13T10:52:21.008Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a4/77/c05e794a65263deb020d7e25623234975dd96881f9e8cde341810ca683e7/shapely-2.0.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1b65365cfbf657604e50d15161ffcc68de5cdb22a601bbf7823540ab4918a98d", size = 2440805, upload-time = "2024-07-13T19:44:15.317Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f0/32/b7687654b6e747ceae8f9fa4cc7489a8ebf275c64caf811f949d87e89f5d/shapely-2.0.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:21f64e647a025b61b19585d2247137b3a38a35314ea68c66aaf507a1c03ef6fe", size = 2524570, upload-time = "2024-07-13T10:52:23.25Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f9/9c/5b68b3cd484065c7d33d83168d2ecfebfeeaa6d88bc9cfd830de2df490ac/shapely-2.0.5-cp312-cp312-win32.whl", hash = "sha256:3ac7dc1350700c139c956b03d9c3df49a5b34aaf91d024d1510a09717ea39199", size = 1295383, upload-time = "2024-07-13T10:52:25.72Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d4/c3/e98e3eb9f06def32b8e2454ab718cafb99149f023dff023e257125132d6e/shapely-2.0.5-cp312-cp312-win_amd64.whl", hash = "sha256:30e8737983c9d954cd17feb49eb169f02f1da49e24e5171122cf2c2b62d65c95", size = 1442365, upload-time = "2024-07-13T10:52:27.433Z" }, +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4d/bc/0989043118a27cccb4e906a46b7565ce36ca7b57f5a18b78f4f1b0f72d9d/shapely-2.1.2.tar.gz", hash = "sha256:2ed4ecb28320a433db18a5bf029986aa8afcfd740745e78847e330d5d94922a9", size = 315489, upload-time = "2025-09-24T13:51:41.432Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/24/c0/f3b6453cf2dfa99adc0ba6675f9aaff9e526d2224cbd7ff9c1a879238693/shapely-2.1.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:fe2533caae6a91a543dec62e8360fe86ffcdc42a7c55f9dfd0128a977a896b94", size = 1833550, upload-time = "2025-09-24T13:50:30.019Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/86/07/59dee0bc4b913b7ab59ab1086225baca5b8f19865e6101db9ebb7243e132/shapely-2.1.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:ba4d1333cc0bc94381d6d4308d2e4e008e0bd128bdcff5573199742ee3634359", size = 1643556, upload-time = "2025-09-24T13:50:32.291Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/26/29/a5397e75b435b9895cd53e165083faed5d12fd9626eadec15a83a2411f0f/shapely-2.1.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:0bd308103340030feef6c111d3eb98d50dc13feea33affc8a6f9fa549e9458a3", size = 2988308, upload-time = "2025-09-24T13:50:33.862Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b9/37/e781683abac55dde9771e086b790e554811a71ed0b2b8a1e789b7430dd44/shapely-2.1.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:1e7d4d7ad262a48bb44277ca12c7c78cb1b0f56b32c10734ec9a1d30c0b0c54b", size = 3099844, upload-time = "2025-09-24T13:50:35.459Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d8/f3/9876b64d4a5a321b9dc482c92bb6f061f2fa42131cba643c699f39317cb9/shapely-2.1.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e9eddfe513096a71896441a7c37db72da0687b34752c4e193577a145c71736fc", size = 3988842, upload-time = "2025-09-24T13:50:37.478Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d1/a0/704c7292f7014c7e74ec84eddb7b109e1fbae74a16deae9c1504b1d15565/shapely-2.1.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:980c777c612514c0cf99bc8a9de6d286f5e186dcaf9091252fcd444e5638193d", size = 4152714, upload-time = "2025-09-24T13:50:39.9Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/53/46/319c9dc788884ad0785242543cdffac0e6530e4d0deb6c4862bc4143dcf3/shapely-2.1.2-cp312-cp312-win32.whl", hash = "sha256:9111274b88e4d7b54a95218e243282709b330ef52b7b86bc6aaf4f805306f454", size = 1542745, upload-time = "2025-09-24T13:50:41.414Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ec/bf/cb6c1c505cb31e818e900b9312d514f381fbfa5c4363edfce0fcc4f8c1a4/shapely-2.1.2-cp312-cp312-win_amd64.whl", hash = "sha256:743044b4cfb34f9a67205cee9279feaf60ba7d02e69febc2afc609047cb49179", size = 1722861, upload-time = "2025-09-24T13:50:43.35Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c3/90/98ef257c23c46425dc4d1d31005ad7c8d649fe423a38b917db02c30f1f5a/shapely-2.1.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:b510dda1a3672d6879beb319bc7c5fd302c6c354584690973c838f46ec3e0fa8", size = 1832644, upload-time = "2025-09-24T13:50:44.886Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6d/ab/0bee5a830d209adcd3a01f2d4b70e587cdd9fd7380d5198c064091005af8/shapely-2.1.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:8cff473e81017594d20ec55d86b54bc635544897e13a7cfc12e36909c5309a2a", size = 1642887, upload-time = "2025-09-24T13:50:46.735Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2d/5e/7d7f54ba960c13302584c73704d8c4d15404a51024631adb60b126a4ae88/shapely-2.1.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:fe7b77dc63d707c09726b7908f575fc04ff1d1ad0f3fb92aec212396bc6cfe5e", size = 2970931, upload-time = "2025-09-24T13:50:48.374Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f2/a2/83fc37e2a58090e3d2ff79175a95493c664bcd0b653dd75cb9134645a4e5/shapely-2.1.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7ed1a5bbfb386ee8332713bf7508bc24e32d24b74fc9a7b9f8529a55db9f4ee6", size = 3082855, upload-time = "2025-09-24T13:50:50.037Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/44/2b/578faf235a5b09f16b5f02833c53822294d7f21b242f8e2d0cf03fb64321/shapely-2.1.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a84e0582858d841d54355246ddfcbd1fce3179f185da7470f41ce39d001ee1af", size = 3979960, upload-time = "2025-09-24T13:50:51.74Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4d/04/167f096386120f692cc4ca02f75a17b961858997a95e67a3cb6a7bbd6b53/shapely-2.1.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:dc3487447a43d42adcdf52d7ac73804f2312cbfa5d433a7d2c506dcab0033dfd", size = 4142851, upload-time = "2025-09-24T13:50:53.49Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/48/74/fb402c5a6235d1c65a97348b48cdedb75fb19eca2b1d66d04969fc1c6091/shapely-2.1.2-cp313-cp313-win32.whl", hash = "sha256:9c3a3c648aedc9f99c09263b39f2d8252f199cb3ac154fadc173283d7d111350", size = 1541890, upload-time = "2025-09-24T13:50:55.337Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/41/47/3647fe7ad990af60ad98b889657a976042c9988c2807cf322a9d6685f462/shapely-2.1.2-cp313-cp313-win_amd64.whl", hash = "sha256:ca2591bff6645c216695bdf1614fca9c82ea1144d4a7591a466fef64f28f0715", size = 1722151, upload-time = "2025-09-24T13:50:57.153Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3c/49/63953754faa51ffe7d8189bfbe9ca34def29f8c0e34c67cbe2a2795f269d/shapely-2.1.2-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:2d93d23bdd2ed9dc157b46bc2f19b7da143ca8714464249bef6771c679d5ff40", size = 1834130, upload-time = "2025-09-24T13:50:58.49Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7f/ee/dce001c1984052970ff60eb4727164892fb2d08052c575042a47f5a9e88f/shapely-2.1.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:01d0d304b25634d60bd7cf291828119ab55a3bab87dc4af1e44b07fb225f188b", size = 1642802, upload-time = "2025-09-24T13:50:59.871Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/da/e7/fc4e9a19929522877fa602f705706b96e78376afb7fad09cad5b9af1553c/shapely-2.1.2-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:8d8382dd120d64b03698b7298b89611a6ea6f55ada9d39942838b79c9bc89801", size = 3018460, upload-time = "2025-09-24T13:51:02.08Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a1/18/7519a25db21847b525696883ddc8e6a0ecaa36159ea88e0fef11466384d0/shapely-2.1.2-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:19efa3611eef966e776183e338b2d7ea43569ae99ab34f8d17c2c054d3205cc0", size = 3095223, upload-time = "2025-09-24T13:51:04.472Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/48/de/b59a620b1f3a129c3fecc2737104a0a7e04e79335bd3b0a1f1609744cf17/shapely-2.1.2-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:346ec0c1a0fcd32f57f00e4134d1200e14bf3f5ae12af87ba83ca275c502498c", size = 4030760, upload-time = "2025-09-24T13:51:06.455Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/96/b3/c6655ee7232b417562bae192ae0d3ceaadb1cc0ffc2088a2ddf415456cc2/shapely-2.1.2-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:6305993a35989391bd3476ee538a5c9a845861462327efe00dd11a5c8c709a99", size = 4170078, upload-time = "2025-09-24T13:51:08.584Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a0/8e/605c76808d73503c9333af8f6cbe7e1354d2d238bda5f88eea36bfe0f42a/shapely-2.1.2-cp313-cp313t-win32.whl", hash = "sha256:c8876673449f3401f278c86eb33224c5764582f72b653a415d0e6672fde887bf", size = 1559178, upload-time = "2025-09-24T13:51:10.73Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/36/f7/d317eb232352a1f1444d11002d477e54514a4a6045536d49d0c59783c0da/shapely-2.1.2-cp313-cp313t-win_amd64.whl", hash = "sha256:4a44bc62a10d84c11a7a3d7c1c4fe857f7477c3506e24c9062da0db0ae0c449c", size = 1739756, upload-time = "2025-09-24T13:51:12.105Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fc/c4/3ce4c2d9b6aabd27d26ec988f08cb877ba9e6e96086eff81bfea93e688c7/shapely-2.1.2-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:9a522f460d28e2bf4e12396240a5fc1518788b2fcd73535166d748399ef0c223", size = 1831290, upload-time = "2025-09-24T13:51:13.56Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/17/b9/f6ab8918fc15429f79cb04afa9f9913546212d7fb5e5196132a2af46676b/shapely-2.1.2-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1ff629e00818033b8d71139565527ced7d776c269a49bd78c9df84e8f852190c", size = 1641463, upload-time = "2025-09-24T13:51:14.972Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a5/57/91d59ae525ca641e7ac5551c04c9503aee6f29b92b392f31790fcb1a4358/shapely-2.1.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:f67b34271dedc3c653eba4e3d7111aa421d5be9b4c4c7d38d30907f796cb30df", size = 2970145, upload-time = "2025-09-24T13:51:16.961Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8a/cb/4948be52ee1da6927831ab59e10d4c29baa2a714f599f1f0d1bc747f5777/shapely-2.1.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:21952dc00df38a2c28375659b07a3979d22641aeb104751e769c3ee825aadecf", size = 3073806, upload-time = "2025-09-24T13:51:18.712Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/03/83/f768a54af775eb41ef2e7bec8a0a0dbe7d2431c3e78c0a8bdba7ab17e446/shapely-2.1.2-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:1f2f33f486777456586948e333a56ae21f35ae273be99255a191f5c1fa302eb4", size = 3980803, upload-time = "2025-09-24T13:51:20.37Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9f/cb/559c7c195807c91c79d38a1f6901384a2878a76fbdf3f1048893a9b7534d/shapely-2.1.2-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:cf831a13e0d5a7eb519e96f58ec26e049b1fad411fc6fc23b162a7ce04d9cffc", size = 4133301, upload-time = "2025-09-24T13:51:21.887Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/80/cd/60d5ae203241c53ef3abd2ef27c6800e21afd6c94e39db5315ea0cbafb4a/shapely-2.1.2-cp314-cp314-win32.whl", hash = "sha256:61edcd8d0d17dd99075d320a1dd39c0cb9616f7572f10ef91b4b5b00c4aeb566", size = 1583247, upload-time = "2025-09-24T13:51:23.401Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/74/d4/135684f342e909330e50d31d441ace06bf83c7dc0777e11043f99167b123/shapely-2.1.2-cp314-cp314-win_amd64.whl", hash = "sha256:a444e7afccdb0999e203b976adb37ea633725333e5b119ad40b1ca291ecf311c", size = 1773019, upload-time = "2025-09-24T13:51:24.873Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a3/05/a44f3f9f695fa3ada22786dc9da33c933da1cbc4bfe876fe3a100bafe263/shapely-2.1.2-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:5ebe3f84c6112ad3d4632b1fd2290665aa75d4cef5f6c5d77c4c95b324527c6a", size = 1834137, upload-time = "2025-09-24T13:51:26.665Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/52/7e/4d57db45bf314573427b0a70dfca15d912d108e6023f623947fa69f39b72/shapely-2.1.2-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:5860eb9f00a1d49ebb14e881f5caf6c2cf472c7fd38bd7f253bbd34f934eb076", size = 1642884, upload-time = "2025-09-24T13:51:28.029Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5a/27/4e29c0a55d6d14ad7422bf86995d7ff3f54af0eba59617eb95caf84b9680/shapely-2.1.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:b705c99c76695702656327b819c9660768ec33f5ce01fa32b2af62b56ba400a1", size = 3018320, upload-time = "2025-09-24T13:51:29.903Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9f/bb/992e6a3c463f4d29d4cd6ab8963b75b1b1040199edbd72beada4af46bde5/shapely-2.1.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:a1fd0ea855b2cf7c9cddaf25543e914dd75af9de08785f20ca3085f2c9ca60b0", size = 3094931, upload-time = "2025-09-24T13:51:32.699Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9c/16/82e65e21070e473f0ed6451224ed9fa0be85033d17e0c6e7213a12f59d12/shapely-2.1.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:df90e2db118c3671a0754f38e36802db75fe0920d211a27481daf50a711fdf26", size = 4030406, upload-time = "2025-09-24T13:51:34.189Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7c/75/c24ed871c576d7e2b64b04b1fe3d075157f6eb54e59670d3f5ffb36e25c7/shapely-2.1.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:361b6d45030b4ac64ddd0a26046906c8202eb60d0f9f53085f5179f1d23021a0", size = 4169511, upload-time = "2025-09-24T13:51:36.297Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b1/f7/b3d1d6d18ebf55236eec1c681ce5e665742aab3c0b7b232720a7d43df7b6/shapely-2.1.2-cp314-cp314t-win32.whl", hash = "sha256:b54df60f1fbdecc8ebc2c5b11870461a6417b3d617f555e5033f1505d36e5735", size = 1602607, upload-time = "2025-09-24T13:51:37.757Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/9a/f6/f09272a71976dfc138129b8faf435d064a811ae2f708cb147dccdf7aacdb/shapely-2.1.2-cp314-cp314t-win_amd64.whl", hash = "sha256:0036ac886e0923417932c2e6369b6c52e38e0ff5d9120b90eef5cd9a5fc5cae9", size = 1796682, upload-time = "2025-09-24T13:51:39.233Z" }, ] [[package]] @@ -7109,11 +7045,11 @@ wheels = [ [[package]] name = "six" -version = "1.16.0" +version = "1.17.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/71/39/171f1c67cd00715f190ba0b100d606d440a28c93c7714febeca8b79af85e/six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", size = 34041, upload-time = "2021-05-05T14:18:18.379Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/94/e7/b2c673351809dca68a0e064b6af791aa332cf192da575fd474ed7d6f16a2/six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81", size = 34031, upload-time = "2024-12-04T17:35:28.174Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254", size = 11053, upload-time = "2021-05-05T14:18:17.237Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274", size = 11050, upload-time = "2024-12-04T17:35:26.475Z" }, ] [[package]] @@ -7175,11 +7111,11 @@ wheels = [ [[package]] name = "soupsieve" -version = "2.8" +version = "2.8.1" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6d/e6/21ccce3262dd4889aa3332e5a119a3491a95e8f60939870a3a035aabac0d/soupsieve-2.8.tar.gz", hash = "sha256:e2dd4a40a628cb5f28f6d4b0db8800b8f581b65bb380b97de22ba5ca8d72572f", size = 103472, upload-time = "2025-08-27T15:39:51.78Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/89/23/adf3796d740536d63a6fbda113d07e60c734b6ed5d3058d1e47fc0495e47/soupsieve-2.8.1.tar.gz", hash = "sha256:4cf733bc50fa805f5df4b8ef4740fc0e0fa6218cf3006269afd3f9d6d80fd350", size = 117856, upload-time = "2025-12-18T13:50:34.655Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/14/a0/bb38d3b76b8cae341dad93a2dd83ab7462e6dbcdd84d43f54ee60a8dc167/soupsieve-2.8-py3-none-any.whl", hash = "sha256:0cc76456a30e20f5d7f2e14a98a4ae2ee4e5abdc7c5ea0aafe795f344bc7984c", size = 36679, upload-time = "2025-08-27T15:39:50.179Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/48/f3/b67d6ea49ca9154453b6d70b34ea22f3996b9fa55da105a79d8732227adc/soupsieve-2.8.1-py3-none-any.whl", hash = "sha256:a11fe2a6f3d76ab3cf2de04eb339c1be5b506a8a47f2ceb6d139803177f85434", size = 36710, upload-time = "2025-12-18T13:50:33.267Z" }, ] [[package]] @@ -7327,11 +7263,11 @@ wheels = [ [[package]] name = "sqlglot" -version = "28.3.0" +version = "28.4.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/21/6c/c8d260522e4bc2e7b5f3e352a0a2b3162bfc596603031dfed6ebaef8e380/sqlglot-28.3.0.tar.gz", hash = "sha256:9425c239792d1ee2efdad9ccafc5d6138d2c9b03a55ff653ba99a4afeba71ccb", size = 5572546, upload-time = "2025-12-11T16:58:19.148Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/69/f1/a2b5174195448004f57092fb8d0e40466f9c650b9e660a7ee113d3de3e41/sqlglot-28.4.0.tar.gz", hash = "sha256:3ef93112e50a4427fbec2265a461595ee084a2fa80587d3b98be01d6a3699dfe", size = 5578321, upload-time = "2025-12-16T21:55:10.034Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d4/58/126aff17da74c9c9f949f09ee16d3ca5e073c8ec7516a8c342b6139251a6/sqlglot-28.3.0-py3-none-any.whl", hash = "sha256:477e98661b9b2934ba6d2621e600e42015c7daf62d7bc0979bb9587ebcf77824", size = 556449, upload-time = "2025-12-11T16:58:17.581Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2d/a0/f2127b17b21ad9272d33152f57a8e1475a611599266b26f5149afea5c6c0/sqlglot-28.4.0-py3-none-any.whl", hash = "sha256:7861023184284d81bd3c502046ec6efacf31d17eb335ad10788e8aa1a06e19f0", size = 560090, upload-time = "2025-12-16T21:55:07.956Z" }, ] [package.optional-dependencies] @@ -7379,14 +7315,15 @@ wheels = [ [[package]] name = "sse-starlette" -version = "3.0.3" +version = "3.1.2" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "anyio" }, + { name = "starlette" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/db/3c/fa6517610dc641262b77cc7bf994ecd17465812c1b0585fe33e11be758ab/sse_starlette-3.0.3.tar.gz", hash = "sha256:88cfb08747e16200ea990c8ca876b03910a23b547ab3bd764c0d8eb81019b971", size = 21943, upload-time = "2025-10-30T18:44:20.117Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/da/34/f5df66cb383efdbf4f2db23cabb27f51b1dcb737efaf8a558f6f1d195134/sse_starlette-3.1.2.tar.gz", hash = "sha256:55eff034207a83a0eb86de9a68099bd0157838f0b8b999a1b742005c71e33618", size = 26303, upload-time = "2025-12-31T08:02:20.023Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/23/a0/984525d19ca5c8a6c33911a0c164b11490dd0f90ff7fd689f704f84e9a11/sse_starlette-3.0.3-py3-none-any.whl", hash = "sha256:af5bf5a6f3933df1d9c7f8539633dc8444ca6a97ab2e2a7cd3b6e431ac03a431", size = 11765, upload-time = "2025-10-30T18:44:18.834Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b7/95/8c4b76eec9ae574474e5d2997557cebf764bcd3586458956c30631ae08f4/sse_starlette-3.1.2-py3-none-any.whl", hash = "sha256:cd800dd349f4521b317b9391d3796fa97b71748a4da9b9e00aafab32dda375c8", size = 12484, upload-time = "2025-12-31T08:02:18.894Z" }, ] [[package]] @@ -7405,15 +7342,15 @@ wheels = [ [[package]] name = "starlette" -version = "0.50.0" +version = "0.51.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "anyio" }, { name = "typing-extensions", marker = "python_full_version < '3.13'" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ba/b8/73a0e6a6e079a9d9cfa64113d771e421640b6f679a52eeb9b32f72d871a1/starlette-0.50.0.tar.gz", hash = "sha256:a2a17b22203254bcbc2e1f926d2d55f3f9497f769416b3190768befe598fa3ca", size = 2646985, upload-time = "2025-11-01T15:25:27.516Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e7/65/5a1fadcc40c5fdc7df421a7506b79633af8f5d5e3a95c3e72acacec644b9/starlette-0.51.0.tar.gz", hash = "sha256:4c4fda9b1bc67f84037d3d14a5112e523509c369d9d47b111b2f984b0cc5ba6c", size = 2647658, upload-time = "2026-01-10T20:23:15.043Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d9/52/1064f510b141bd54025f9b55105e26d1fa970b9be67ad766380a3c9b74b0/starlette-0.50.0-py3-none-any.whl", hash = "sha256:9e5391843ec9b6e472eed1365a78c8098cfceb7a74bfd4d6b1c0c0095efb3bca", size = 74033, upload-time = "2025-11-01T15:25:25.461Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/18/c4/09985a03dba389d4fe16a9014147a7b02fa76ef3519bf5846462a485876d/starlette-0.51.0-py3-none-any.whl", hash = "sha256:fb460a3d6fd3c958d729fdd96aee297f89a51b0181f16401fe8fd4cb6129165d", size = 74133, upload-time = "2026-01-10T20:23:13.445Z" }, ] [[package]] @@ -7567,65 +7504,94 @@ sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fd/b8/055ed37d6413fe [[package]] name = "tiktoken" -version = "0.7.0" +version = "0.12.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "regex" }, { name = "requests" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c4/4a/abaec53e93e3ef37224a4dd9e2fc6bb871e7a538c2b6b9d2a6397271daf4/tiktoken-0.7.0.tar.gz", hash = "sha256:1077266e949c24e0291f6c350433c6f0971365ece2b173a23bc3b9f9defef6b6", size = 33437, upload-time = "2024-05-13T18:03:28.793Z" } -wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1d/46/4cdda4186ce900608f522da34acf442363346688c71b938a90a52d7b84cc/tiktoken-0.7.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:71c55d066388c55a9c00f61d2c456a6086673ab7dec22dd739c23f77195b1908", size = 960446, upload-time = "2024-05-13T18:02:54.409Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b6/30/09ced367d280072d7a3e21f34263dfbbf6378661e7a0f6414e7c18971083/tiktoken-0.7.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:09ed925bccaa8043e34c519fbb2f99110bd07c6fd67714793c21ac298e449410", size = 906652, upload-time = "2024-05-13T18:02:56.25Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e6/7b/c949e4954441a879a67626963dff69096e3c774758b9f2bb0853f7b4e1e7/tiktoken-0.7.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:03c6c40ff1db0f48a7b4d2dafeae73a5607aacb472fa11f125e7baf9dce73704", size = 1047904, upload-time = "2024-05-13T18:02:57.707Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/50/81/1842a22f15586072280364c2ab1e40835adaf64e42fe80e52aff921ee021/tiktoken-0.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d20b5c6af30e621b4aca094ee61777a44118f52d886dbe4f02b70dfe05c15350", size = 1079836, upload-time = "2024-05-13T18:02:59.009Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6d/87/51a133a3d5307cf7ae3754249b0faaa91d3414b85c3d36f80b54d6817aa6/tiktoken-0.7.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:d427614c3e074004efa2f2411e16c826f9df427d3c70a54725cae860f09e4bf4", size = 1092472, upload-time = "2024-05-13T18:03:00.597Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a5/1f/c93517dc6d3b2c9e988b8e24f87a8b2d4a4ab28920a3a3f3ea338397ae0c/tiktoken-0.7.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:8c46d7af7b8c6987fac9b9f61041b452afe92eb087d29c9ce54951280f899a97", size = 1141881, upload-time = "2024-05-13T18:03:02.743Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bf/4b/48ca098cb580c099b5058bf62c4cb5e90ca6130fa43ef4df27088536245b/tiktoken-0.7.0-cp312-cp312-win_amd64.whl", hash = "sha256:0bc603c30b9e371e7c4c7935aba02af5994a909fc3c0fe66e7004070858d3f8f", size = 799281, upload-time = "2024-05-13T18:03:04.036Z" }, +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7d/ab/4d017d0f76ec3171d469d80fc03dfbb4e48a4bcaddaa831b31d526f05edc/tiktoken-0.12.0.tar.gz", hash = "sha256:b18ba7ee2b093863978fcb14f74b3707cdc8d4d4d3836853ce7ec60772139931", size = 37806, upload-time = "2025-10-06T20:22:45.419Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a4/85/be65d39d6b647c79800fd9d29241d081d4eeb06271f383bb87200d74cf76/tiktoken-0.12.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:b97f74aca0d78a1ff21b8cd9e9925714c15a9236d6ceacf5c7327c117e6e21e8", size = 1050728, upload-time = "2025-10-06T20:21:52.756Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4a/42/6573e9129bc55c9bf7300b3a35bef2c6b9117018acca0dc760ac2d93dffe/tiktoken-0.12.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2b90f5ad190a4bb7c3eb30c5fa32e1e182ca1ca79f05e49b448438c3e225a49b", size = 994049, upload-time = "2025-10-06T20:21:53.782Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/66/c5/ed88504d2f4a5fd6856990b230b56d85a777feab84e6129af0822f5d0f70/tiktoken-0.12.0-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:65b26c7a780e2139e73acc193e5c63ac754021f160df919add909c1492c0fb37", size = 1129008, upload-time = "2025-10-06T20:21:54.832Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f4/90/3dae6cc5436137ebd38944d396b5849e167896fc2073da643a49f372dc4f/tiktoken-0.12.0-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:edde1ec917dfd21c1f2f8046b86348b0f54a2c0547f68149d8600859598769ad", size = 1152665, upload-time = "2025-10-06T20:21:56.129Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a3/fe/26df24ce53ffde419a42f5f53d755b995c9318908288c17ec3f3448313a3/tiktoken-0.12.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:35a2f8ddd3824608b3d650a000c1ef71f730d0c56486845705a8248da00f9fe5", size = 1194230, upload-time = "2025-10-06T20:21:57.546Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/20/cc/b064cae1a0e9fac84b0d2c46b89f4e57051a5f41324e385d10225a984c24/tiktoken-0.12.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:83d16643edb7fa2c99eff2ab7733508aae1eebb03d5dfc46f5565862810f24e3", size = 1254688, upload-time = "2025-10-06T20:21:58.619Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/81/10/b8523105c590c5b8349f2587e2fdfe51a69544bd5a76295fc20f2374f470/tiktoken-0.12.0-cp312-cp312-win_amd64.whl", hash = "sha256:ffc5288f34a8bc02e1ea7047b8d041104791d2ddbf42d1e5fa07822cbffe16bd", size = 878694, upload-time = "2025-10-06T20:21:59.876Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/00/61/441588ee21e6b5cdf59d6870f86beb9789e532ee9718c251b391b70c68d6/tiktoken-0.12.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:775c2c55de2310cc1bc9a3ad8826761cbdc87770e586fd7b6da7d4589e13dab3", size = 1050802, upload-time = "2025-10-06T20:22:00.96Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1f/05/dcf94486d5c5c8d34496abe271ac76c5b785507c8eae71b3708f1ad9b45a/tiktoken-0.12.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:a01b12f69052fbe4b080a2cfb867c4de12c704b56178edf1d1d7b273561db160", size = 993995, upload-time = "2025-10-06T20:22:02.788Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a0/70/5163fe5359b943f8db9946b62f19be2305de8c3d78a16f629d4165e2f40e/tiktoken-0.12.0-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:01d99484dc93b129cd0964f9d34eee953f2737301f18b3c7257bf368d7615baa", size = 1128948, upload-time = "2025-10-06T20:22:03.814Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0c/da/c028aa0babf77315e1cef357d4d768800c5f8a6de04d0eac0f377cb619fa/tiktoken-0.12.0-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:4a1a4fcd021f022bfc81904a911d3df0f6543b9e7627b51411da75ff2fe7a1be", size = 1151986, upload-time = "2025-10-06T20:22:05.173Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a0/5a/886b108b766aa53e295f7216b509be95eb7d60b166049ce2c58416b25f2a/tiktoken-0.12.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:981a81e39812d57031efdc9ec59fa32b2a5a5524d20d4776574c4b4bd2e9014a", size = 1194222, upload-time = "2025-10-06T20:22:06.265Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f4/f8/4db272048397636ac7a078d22773dd2795b1becee7bc4922fe6207288d57/tiktoken-0.12.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:9baf52f84a3f42eef3ff4e754a0db79a13a27921b457ca9832cf944c6be4f8f3", size = 1255097, upload-time = "2025-10-06T20:22:07.403Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8e/32/45d02e2e0ea2be3a9ed22afc47d93741247e75018aac967b713b2941f8ea/tiktoken-0.12.0-cp313-cp313-win_amd64.whl", hash = "sha256:b8a0cd0c789a61f31bf44851defbd609e8dd1e2c8589c614cc1060940ef1f697", size = 879117, upload-time = "2025-10-06T20:22:08.418Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ce/76/994fc868f88e016e6d05b0da5ac24582a14c47893f4474c3e9744283f1d5/tiktoken-0.12.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:d5f89ea5680066b68bcb797ae85219c72916c922ef0fcdd3480c7d2315ffff16", size = 1050309, upload-time = "2025-10-06T20:22:10.939Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f6/b8/57ef1456504c43a849821920d582a738a461b76a047f352f18c0b26c6516/tiktoken-0.12.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:b4e7ed1c6a7a8a60a3230965bdedba8cc58f68926b835e519341413370e0399a", size = 993712, upload-time = "2025-10-06T20:22:12.115Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/72/90/13da56f664286ffbae9dbcfadcc625439142675845baa62715e49b87b68b/tiktoken-0.12.0-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:fc530a28591a2d74bce821d10b418b26a094bf33839e69042a6e86ddb7a7fb27", size = 1128725, upload-time = "2025-10-06T20:22:13.541Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/05/df/4f80030d44682235bdaecd7346c90f67ae87ec8f3df4a3442cb53834f7e4/tiktoken-0.12.0-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:06a9f4f49884139013b138920a4c393aa6556b2f8f536345f11819389c703ebb", size = 1151875, upload-time = "2025-10-06T20:22:14.559Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/22/1f/ae535223a8c4ef4c0c1192e3f9b82da660be9eb66b9279e95c99288e9dab/tiktoken-0.12.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:04f0e6a985d95913cabc96a741c5ffec525a2c72e9df086ff17ebe35985c800e", size = 1194451, upload-time = "2025-10-06T20:22:15.545Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/78/a7/f8ead382fce0243cb625c4f266e66c27f65ae65ee9e77f59ea1653b6d730/tiktoken-0.12.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:0ee8f9ae00c41770b5f9b0bb1235474768884ae157de3beb5439ca0fd70f3e25", size = 1253794, upload-time = "2025-10-06T20:22:16.624Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/93/e0/6cc82a562bc6365785a3ff0af27a2a092d57c47d7a81d9e2295d8c36f011/tiktoken-0.12.0-cp313-cp313t-win_amd64.whl", hash = "sha256:dc2dd125a62cb2b3d858484d6c614d136b5b848976794edfb63688d539b8b93f", size = 878777, upload-time = "2025-10-06T20:22:18.036Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/72/05/3abc1db5d2c9aadc4d2c76fa5640134e475e58d9fbb82b5c535dc0de9b01/tiktoken-0.12.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:a90388128df3b3abeb2bfd1895b0681412a8d7dc644142519e6f0a97c2111646", size = 1050188, upload-time = "2025-10-06T20:22:19.563Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e3/7b/50c2f060412202d6c95f32b20755c7a6273543b125c0985d6fa9465105af/tiktoken-0.12.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:da900aa0ad52247d8794e307d6446bd3cdea8e192769b56276695d34d2c9aa88", size = 993978, upload-time = "2025-10-06T20:22:20.702Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/14/27/bf795595a2b897e271771cd31cb847d479073497344c637966bdf2853da1/tiktoken-0.12.0-cp314-cp314-manylinux_2_28_aarch64.whl", hash = "sha256:285ba9d73ea0d6171e7f9407039a290ca77efcdb026be7769dccc01d2c8d7fff", size = 1129271, upload-time = "2025-10-06T20:22:22.06Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f5/de/9341a6d7a8f1b448573bbf3425fa57669ac58258a667eb48a25dfe916d70/tiktoken-0.12.0-cp314-cp314-manylinux_2_28_x86_64.whl", hash = "sha256:d186a5c60c6a0213f04a7a802264083dea1bbde92a2d4c7069e1a56630aef830", size = 1151216, upload-time = "2025-10-06T20:22:23.085Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/75/0d/881866647b8d1be4d67cb24e50d0c26f9f807f994aa1510cb9ba2fe5f612/tiktoken-0.12.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:604831189bd05480f2b885ecd2d1986dc7686f609de48208ebbbddeea071fc0b", size = 1194860, upload-time = "2025-10-06T20:22:24.602Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b3/1e/b651ec3059474dab649b8d5b69f5c65cd8fcd8918568c1935bd4136c9392/tiktoken-0.12.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:8f317e8530bb3a222547b85a58583238c8f74fd7a7408305f9f63246d1a0958b", size = 1254567, upload-time = "2025-10-06T20:22:25.671Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/80/57/ce64fd16ac390fafde001268c364d559447ba09b509181b2808622420eec/tiktoken-0.12.0-cp314-cp314-win_amd64.whl", hash = "sha256:399c3dd672a6406719d84442299a490420b458c44d3ae65516302a99675888f3", size = 921067, upload-time = "2025-10-06T20:22:26.753Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ac/a4/72eed53e8976a099539cdd5eb36f241987212c29629d0a52c305173e0a68/tiktoken-0.12.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:c2c714c72bc00a38ca969dae79e8266ddec999c7ceccd603cc4f0d04ccd76365", size = 1050473, upload-time = "2025-10-06T20:22:27.775Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e6/d7/0110b8f54c008466b19672c615f2168896b83706a6611ba6e47313dbc6e9/tiktoken-0.12.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:cbb9a3ba275165a2cb0f9a83f5d7025afe6b9d0ab01a22b50f0e74fee2ad253e", size = 993855, upload-time = "2025-10-06T20:22:28.799Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5f/77/4f268c41a3957c418b084dd576ea2fad2e95da0d8e1ab705372892c2ca22/tiktoken-0.12.0-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:dfdfaa5ffff8993a3af94d1125870b1d27aed7cb97aa7eb8c1cefdbc87dbee63", size = 1129022, upload-time = "2025-10-06T20:22:29.981Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4e/2b/fc46c90fe5028bd094cd6ee25a7db321cb91d45dc87531e2bdbb26b4867a/tiktoken-0.12.0-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:584c3ad3d0c74f5269906eb8a659c8bfc6144a52895d9261cdaf90a0ae5f4de0", size = 1150736, upload-time = "2025-10-06T20:22:30.996Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/28/c0/3c7a39ff68022ddfd7d93f3337ad90389a342f761c4d71de99a3ccc57857/tiktoken-0.12.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:54c891b416a0e36b8e2045b12b33dd66fb34a4fe7965565f1b482da50da3e86a", size = 1194908, upload-time = "2025-10-06T20:22:32.073Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ab/0d/c1ad6f4016a3968c048545f5d9b8ffebf577774b2ede3e2e352553b685fe/tiktoken-0.12.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:5edb8743b88d5be814b1a8a8854494719080c28faaa1ccbef02e87354fe71ef0", size = 1253706, upload-time = "2025-10-06T20:22:33.385Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/af/df/c7891ef9d2712ad774777271d39fdef63941ffba0a9d59b7ad1fd2765e57/tiktoken-0.12.0-cp314-cp314t-win_amd64.whl", hash = "sha256:f61c0aea5565ac82e2ec50a05e02a6c44734e91b51c10510b084ea1b8e633a71", size = 920667, upload-time = "2025-10-06T20:22:34.444Z" }, ] [[package]] name = "tokenizers" -version = "0.22.1" +version = "0.22.2" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "huggingface-hub" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1c/46/fb6854cec3278fbfa4a75b50232c77622bc517ac886156e6afbfa4d8fc6e/tokenizers-0.22.1.tar.gz", hash = "sha256:61de6522785310a309b3407bac22d99c4db5dba349935e99e4d15ea2226af2d9", size = 363123, upload-time = "2025-09-19T09:49:23.424Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/73/6f/f80cfef4a312e1fb34baf7d85c72d4411afde10978d4657f8cdd811d3ccc/tokenizers-0.22.2.tar.gz", hash = "sha256:473b83b915e547aa366d1eee11806deaf419e17be16310ac0a14077f1e28f917", size = 372115, upload-time = "2026-01-05T10:45:15.988Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bf/33/f4b2d94ada7ab297328fc671fed209368ddb82f965ec2224eb1892674c3a/tokenizers-0.22.1-cp39-abi3-macosx_10_12_x86_64.whl", hash = "sha256:59fdb013df17455e5f950b4b834a7b3ee2e0271e6378ccb33aa74d178b513c73", size = 3069318, upload-time = "2025-09-19T09:49:11.848Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1c/58/2aa8c874d02b974990e89ff95826a4852a8b2a273c7d1b4411cdd45a4565/tokenizers-0.22.1-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:8d4e484f7b0827021ac5f9f71d4794aaef62b979ab7608593da22b1d2e3c4edc", size = 2926478, upload-time = "2025-09-19T09:49:09.759Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1e/3b/55e64befa1e7bfea963cf4b787b2cea1011362c4193f5477047532ce127e/tokenizers-0.22.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:19d2962dd28bc67c1f205ab180578a78eef89ac60ca7ef7cbe9635a46a56422a", size = 3256994, upload-time = "2025-09-19T09:48:56.701Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/71/0b/fbfecf42f67d9b7b80fde4aabb2b3110a97fac6585c9470b5bff103a80cb/tokenizers-0.22.1-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:38201f15cdb1f8a6843e6563e6e79f4abd053394992b9bbdf5213ea3469b4ae7", size = 3153141, upload-time = "2025-09-19T09:48:59.749Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/17/a9/b38f4e74e0817af8f8ef925507c63c6ae8171e3c4cb2d5d4624bf58fca69/tokenizers-0.22.1-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d1cbe5454c9a15df1b3443c726063d930c16f047a3cc724b9e6e1a91140e5a21", size = 3508049, upload-time = "2025-09-19T09:49:05.868Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d2/48/dd2b3dac46bb9134a88e35d72e1aa4869579eacc1a27238f1577270773ff/tokenizers-0.22.1-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e7d094ae6312d69cc2a872b54b91b309f4f6fbce871ef28eb27b52a98e4d0214", size = 3710730, upload-time = "2025-09-19T09:49:01.832Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/93/0e/ccabc8d16ae4ba84a55d41345207c1e2ea88784651a5a487547d80851398/tokenizers-0.22.1-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:afd7594a56656ace95cdd6df4cca2e4059d294c5cfb1679c57824b605556cb2f", size = 3412560, upload-time = "2025-09-19T09:49:03.867Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d0/c6/dc3a0db5a6766416c32c034286d7c2d406da1f498e4de04ab1b8959edd00/tokenizers-0.22.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e2ef6063d7a84994129732b47e7915e8710f27f99f3a3260b8a38fc7ccd083f4", size = 3250221, upload-time = "2025-09-19T09:49:07.664Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d7/a6/2c8486eef79671601ff57b093889a345dd3d576713ef047776015dc66de7/tokenizers-0.22.1-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:ba0a64f450b9ef412c98f6bcd2a50c6df6e2443b560024a09fa6a03189726879", size = 9345569, upload-time = "2025-09-19T09:49:14.214Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6b/16/32ce667f14c35537f5f605fe9bea3e415ea1b0a646389d2295ec348d5657/tokenizers-0.22.1-cp39-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:331d6d149fa9c7d632cde4490fb8bbb12337fa3a0232e77892be656464f4b446", size = 9271599, upload-time = "2025-09-19T09:49:16.639Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/51/7c/a5f7898a3f6baa3fc2685c705e04c98c1094c523051c805cdd9306b8f87e/tokenizers-0.22.1-cp39-abi3-musllinux_1_2_i686.whl", hash = "sha256:607989f2ea68a46cb1dfbaf3e3aabdf3f21d8748312dbeb6263d1b3b66c5010a", size = 9533862, upload-time = "2025-09-19T09:49:19.146Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/36/65/7e75caea90bc73c1dd8d40438adf1a7bc26af3b8d0a6705ea190462506e1/tokenizers-0.22.1-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:a0f307d490295717726598ef6fa4f24af9d484809223bbc253b201c740a06390", size = 9681250, upload-time = "2025-09-19T09:49:21.501Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/30/2c/959dddef581b46e6209da82df3b78471e96260e2bc463f89d23b1bf0e52a/tokenizers-0.22.1-cp39-abi3-win32.whl", hash = "sha256:b5120eed1442765cd90b903bb6cfef781fd8fe64e34ccaecbae4c619b7b12a82", size = 2472003, upload-time = "2025-09-19T09:49:27.089Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b3/46/e33a8c93907b631a99377ef4c5f817ab453d0b34f93529421f42ff559671/tokenizers-0.22.1-cp39-abi3-win_amd64.whl", hash = "sha256:65fd6e3fb11ca1e78a6a93602490f134d1fdeb13bcef99389d5102ea318ed138", size = 2674684, upload-time = "2025-09-19T09:49:24.953Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/92/97/5dbfabf04c7e348e655e907ed27913e03db0923abb5dfdd120d7b25630e1/tokenizers-0.22.2-cp39-abi3-macosx_10_12_x86_64.whl", hash = "sha256:544dd704ae7238755d790de45ba8da072e9af3eea688f698b137915ae959281c", size = 3100275, upload-time = "2026-01-05T10:41:02.158Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2e/47/174dca0502ef88b28f1c9e06b73ce33500eedfac7a7692108aec220464e7/tokenizers-0.22.2-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:1e418a55456beedca4621dbab65a318981467a2b188e982a23e117f115ce5001", size = 2981472, upload-time = "2026-01-05T10:41:00.276Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d6/84/7990e799f1309a8b87af6b948f31edaa12a3ed22d11b352eaf4f4b2e5753/tokenizers-0.22.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2249487018adec45d6e3554c71d46eb39fa8ea67156c640f7513eb26f318cec7", size = 3290736, upload-time = "2026-01-05T10:40:32.165Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/78/59/09d0d9ba94dcd5f4f1368d4858d24546b4bdc0231c2354aa31d6199f0399/tokenizers-0.22.2-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:25b85325d0815e86e0bac263506dd114578953b7b53d7de09a6485e4a160a7dd", size = 3168835, upload-time = "2026-01-05T10:40:38.847Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/47/50/b3ebb4243e7160bda8d34b731e54dd8ab8b133e50775872e7a434e524c28/tokenizers-0.22.2-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bfb88f22a209ff7b40a576d5324bf8286b519d7358663db21d6246fb17eea2d5", size = 3521673, upload-time = "2026-01-05T10:40:56.614Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e0/fa/89f4cb9e08df770b57adb96f8cbb7e22695a4cb6c2bd5f0c4f0ebcf33b66/tokenizers-0.22.2-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1c774b1276f71e1ef716e5486f21e76333464f47bece56bbd554485982a9e03e", size = 3724818, upload-time = "2026-01-05T10:40:44.507Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/64/04/ca2363f0bfbe3b3d36e95bf67e56a4c88c8e3362b658e616d1ac185d47f2/tokenizers-0.22.2-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:df6c4265b289083bf710dff49bc51ef252f9d5be33a45ee2bed151114a56207b", size = 3379195, upload-time = "2026-01-05T10:40:51.139Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2e/76/932be4b50ef6ccedf9d3c6639b056a967a86258c6d9200643f01269211ca/tokenizers-0.22.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:369cc9fc8cc10cb24143873a0d95438bb8ee257bb80c71989e3ee290e8d72c67", size = 3274982, upload-time = "2026-01-05T10:40:58.331Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1d/28/5f9f5a4cc211b69e89420980e483831bcc29dade307955cc9dc858a40f01/tokenizers-0.22.2-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:29c30b83d8dcd061078b05ae0cb94d3c710555fbb44861139f9f83dcca3dc3e4", size = 9478245, upload-time = "2026-01-05T10:41:04.053Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6c/fb/66e2da4704d6aadebf8cb39f1d6d1957df667ab24cff2326b77cda0dcb85/tokenizers-0.22.2-cp39-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:37ae80a28c1d3265bb1f22464c856bd23c02a05bb211e56d0c5301a435be6c1a", size = 9560069, upload-time = "2026-01-05T10:45:10.673Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/16/04/fed398b05caa87ce9b1a1bb5166645e38196081b225059a6edaff6440fac/tokenizers-0.22.2-cp39-abi3-musllinux_1_2_i686.whl", hash = "sha256:791135ee325f2336f498590eb2f11dc5c295232f288e75c99a36c5dbce63088a", size = 9899263, upload-time = "2026-01-05T10:45:12.559Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/05/a1/d62dfe7376beaaf1394917e0f8e93ee5f67fea8fcf4107501db35996586b/tokenizers-0.22.2-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:38337540fbbddff8e999d59970f3c6f35a82de10053206a7562f1ea02d046fa5", size = 10033429, upload-time = "2026-01-05T10:45:14.333Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/fd/18/a545c4ea42af3df6effd7d13d250ba77a0a86fb20393143bbb9a92e434d4/tokenizers-0.22.2-cp39-abi3-win32.whl", hash = "sha256:a6bf3f88c554a2b653af81f3204491c818ae2ac6fbc09e76ef4773351292bc92", size = 2502363, upload-time = "2026-01-05T10:45:20.593Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/65/71/0670843133a43d43070abeb1949abfdef12a86d490bea9cd9e18e37c5ff7/tokenizers-0.22.2-cp39-abi3-win_amd64.whl", hash = "sha256:c9ea31edff2968b44a88f97d784c2f16dc0729b8b143ed004699ebca91f05c48", size = 2747786, upload-time = "2026-01-05T10:45:18.411Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/72/f4/0de46cfa12cdcbcd464cc59fde36912af405696f687e53a091fb432f694c/tokenizers-0.22.2-cp39-abi3-win_arm64.whl", hash = "sha256:9ce725d22864a1e965217204946f830c37876eee3b2ba6fc6255e8e903d5fcbc", size = 2612133, upload-time = "2026-01-05T10:45:17.232Z" }, ] [[package]] name = "tornado" -version = "6.5.3" +version = "6.5.4" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7f/2e/3d22d478f27cb4b41edd4db7f10cd7846d0a28ea443342de3dba97035166/tornado-6.5.3.tar.gz", hash = "sha256:16abdeb0211796ffc73765bc0a20119712d68afeeaf93d1a3f2edf6b3aee8d5a", size = 513348, upload-time = "2025-12-11T04:16:42.225Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/37/1d/0a336abf618272d53f62ebe274f712e213f5a03c0b2339575430b8362ef2/tornado-6.5.4.tar.gz", hash = "sha256:a22fa9047405d03260b483980635f0b041989d8bcc9a313f8fe18b411d84b1d7", size = 513632, upload-time = "2025-12-15T19:21:03.836Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d3/e9/bf22f66e1d5d112c0617974b5ce86666683b32c09b355dfcd59f8d5c8ef6/tornado-6.5.3-cp39-abi3-macosx_10_9_universal2.whl", hash = "sha256:2dd7d7e8d3e4635447a8afd4987951e3d4e8d1fb9ad1908c54c4002aabab0520", size = 443860, upload-time = "2025-12-11T04:16:26.638Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ca/9c/594b631f0b8dc5977080c7093d1e96f1377c10552577d2c31bb0208c9362/tornado-6.5.3-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:5977a396f83496657779f59a48c38096ef01edfe4f42f1c0634b791dde8165d0", size = 442118, upload-time = "2025-12-11T04:16:28.32Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/78/f6/685b869f5b5b9d9547571be838c6106172082751696355b60fc32a4988ed/tornado-6.5.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f72ac800be2ac73ddc1504f7aa21069a4137e8d70c387172c063d363d04f2208", size = 445700, upload-time = "2025-12-11T04:16:29.64Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/91/4c/f0d19edf24912b7f21ae5e941f7798d132ad4d9b71441c1e70917a297265/tornado-6.5.3-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c43c4fc4f5419c6561cfb8b884a8f6db7b142787d47821e1a0e1296253458265", size = 445041, upload-time = "2025-12-11T04:16:30.799Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/eb/2b/e02da94f4a4aef2bb3b923c838ef284a77548a5f06bac2a8682b36b4eead/tornado-6.5.3-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:de8b3fed4b3afb65d542d7702ac8767b567e240f6a43020be8eaef59328f117b", size = 445270, upload-time = "2025-12-11T04:16:32.316Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/58/e2/7a7535d23133443552719dba526dacbb7415f980157da9f14950ddb88ad6/tornado-6.5.3-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:dbc4b4c32245b952566e17a20d5c1648fbed0e16aec3fc7e19f3974b36e0e47c", size = 445957, upload-time = "2025-12-11T04:16:33.913Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a0/1f/9ff92eca81ff17a86286ec440dcd5eab0400326eb81761aa9a4eecb1ffb9/tornado-6.5.3-cp39-abi3-musllinux_1_2_i686.whl", hash = "sha256:db238e8a174b4bfd0d0238b8cfcff1c14aebb4e2fcdafbf0ea5da3b81caceb4c", size = 445371, upload-time = "2025-12-11T04:16:35.093Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/70/b1/1d03ae4526a393b0b839472a844397337f03c7f3a1e6b5c82241f0e18281/tornado-6.5.3-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:892595c100cd9b53a768cbfc109dfc55dec884afe2de5290611a566078d9692d", size = 445348, upload-time = "2025-12-11T04:16:36.679Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4b/7d/7c181feadc8941f418d0d26c3790ee34ffa4bd0a294bc5201d44ebd19c1e/tornado-6.5.3-cp39-abi3-win32.whl", hash = "sha256:88141456525fe291e47bbe1ba3ffb7982549329f09b4299a56813923af2bd197", size = 446433, upload-time = "2025-12-11T04:16:38.332Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/34/98/4f7f938606e21d0baea8c6c39a7c8e95bdf8e50b0595b1bb6f0de2af7a6e/tornado-6.5.3-cp39-abi3-win_amd64.whl", hash = "sha256:ba4b513d221cc7f795a532c1e296f36bcf6a60e54b15efd3f092889458c69af1", size = 446842, upload-time = "2025-12-11T04:16:39.867Z" }, - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/7a/27/0e3fca4c4edf33fb6ee079e784c63961cd816971a45e5e4cacebe794158d/tornado-6.5.3-cp39-abi3-win_arm64.whl", hash = "sha256:278c54d262911365075dd45e0b6314308c74badd6ff9a54490e7daccdd5ed0ea", size = 445863, upload-time = "2025-12-11T04:16:41.099Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ab/a9/e94a9d5224107d7ce3cc1fab8d5dc97f5ea351ccc6322ee4fb661da94e35/tornado-6.5.4-cp39-abi3-macosx_10_9_universal2.whl", hash = "sha256:d6241c1a16b1c9e4cc28148b1cda97dd1c6cb4fb7068ac1bedc610768dff0ba9", size = 443909, upload-time = "2025-12-15T19:20:48.382Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/db/7e/f7b8d8c4453f305a51f80dbb49014257bb7d28ccb4bbb8dd328ea995ecad/tornado-6.5.4-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:2d50f63dda1d2cac3ae1fa23d254e16b5e38153758470e9956cbc3d813d40843", size = 442163, upload-time = "2025-12-15T19:20:49.791Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ba/b5/206f82d51e1bfa940ba366a8d2f83904b15942c45a78dd978b599870ab44/tornado-6.5.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d1cf66105dc6acb5af613c054955b8137e34a03698aa53272dbda4afe252be17", size = 445746, upload-time = "2025-12-15T19:20:51.491Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8e/9d/1a3338e0bd30ada6ad4356c13a0a6c35fbc859063fa7eddb309183364ac1/tornado-6.5.4-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:50ff0a58b0dc97939d29da29cd624da010e7f804746621c78d14b80238669335", size = 445083, upload-time = "2025-12-15T19:20:52.778Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/50/d4/e51d52047e7eb9a582da59f32125d17c0482d065afd5d3bc435ff2120dc5/tornado-6.5.4-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e5fb5e04efa54cf0baabdd10061eb4148e0be137166146fff835745f59ab9f7f", size = 445315, upload-time = "2025-12-15T19:20:53.996Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/27/07/2273972f69ca63dbc139694a3fc4684edec3ea3f9efabf77ed32483b875c/tornado-6.5.4-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:9c86b1643b33a4cd415f8d0fe53045f913bf07b4a3ef646b735a6a86047dda84", size = 446003, upload-time = "2025-12-15T19:20:56.101Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d1/83/41c52e47502bf7260044413b6770d1a48dda2f0246f95ee1384a3cd9c44a/tornado-6.5.4-cp39-abi3-musllinux_1_2_i686.whl", hash = "sha256:6eb82872335a53dd063a4f10917b3efd28270b56a33db69009606a0312660a6f", size = 445412, upload-time = "2025-12-15T19:20:57.398Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/10/c7/bc96917f06cbee182d44735d4ecde9c432e25b84f4c2086143013e7b9e52/tornado-6.5.4-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:6076d5dda368c9328ff41ab5d9dd3608e695e8225d1cd0fd1e006f05da3635a8", size = 445392, upload-time = "2025-12-15T19:20:58.692Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0c/1a/d7592328d037d36f2d2462f4bc1fbb383eec9278bc786c1b111cbbd44cfa/tornado-6.5.4-cp39-abi3-win32.whl", hash = "sha256:1768110f2411d5cd281bac0a090f707223ce77fd110424361092859e089b38d1", size = 446481, upload-time = "2025-12-15T19:21:00.008Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d6/6d/c69be695a0a64fd37a97db12355a035a6d90f79067a3cf936ec2b1dc38cd/tornado-6.5.4-cp39-abi3-win_amd64.whl", hash = "sha256:fa07d31e0cd85c60713f2b995da613588aa03e1303d75705dca6af8babc18ddc", size = 446886, upload-time = "2025-12-15T19:21:01.287Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/50/49/8dc3fd90902f70084bd2cd059d576ddb4f8bb44c2c7c0e33a11422acb17e/tornado-6.5.4-cp39-abi3-win_arm64.whl", hash = "sha256:053e6e16701eb6cbe641f308f4c1a9541f91b6261991160391bfc342e8a551a1", size = 445910, upload-time = "2025-12-15T19:21:02.571Z" }, ] [[package]] @@ -7695,7 +7661,7 @@ wheels = [ [[package]] name = "typer" -version = "0.20.0" +version = "0.21.1" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "click" }, @@ -7703,21 +7669,34 @@ dependencies = [ { name = "shellingham" }, { name = "typing-extensions" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8f/28/7c85c8032b91dbe79725b6f17d2fffc595dff06a35c7a30a37bef73a1ab4/typer-0.20.0.tar.gz", hash = "sha256:1aaf6494031793e4876fb0bacfa6a912b551cf43c1e63c800df8b1a866720c37", size = 106492, upload-time = "2025-10-20T17:03:49.445Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/36/bf/8825b5929afd84d0dabd606c67cd57b8388cb3ec385f7ef19c5cc2202069/typer-0.21.1.tar.gz", hash = "sha256:ea835607cd752343b6b2b7ce676893e5a0324082268b48f27aa058bdb7d2145d", size = 110371, upload-time = "2026-01-06T11:21:10.989Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/78/64/7713ffe4b5983314e9d436a90d5bd4f63b6054e2aca783a3cfc44cb95bbf/typer-0.20.0-py3-none-any.whl", hash = "sha256:5b463df6793ec1dca6213a3cf4c0f03bc6e322ac5e16e13ddd622a889489784a", size = 47028, upload-time = "2025-10-20T17:03:47.617Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a0/1d/d9257dd49ff2ca23ea5f132edf1281a0c4f9de8a762b9ae399b670a59235/typer-0.21.1-py3-none-any.whl", hash = "sha256:7985e89081c636b88d172c2ee0cfe33c253160994d47bdfdc302defd7d1f1d01", size = 47381, upload-time = "2026-01-06T11:21:09.824Z" }, +] + +[[package]] +name = "typer-slim" +version = "0.21.1" +source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } +dependencies = [ + { name = "click" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/17/d4/064570dec6358aa9049d4708e4a10407d74c99258f8b2136bb8702303f1a/typer_slim-0.21.1.tar.gz", hash = "sha256:73495dd08c2d0940d611c5a8c04e91c2a0a98600cbd4ee19192255a233b6dbfd", size = 110478, upload-time = "2026-01-06T11:21:11.176Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c8/0a/4aca634faf693e33004796b6cee0ae2e1dba375a800c16ab8d3eff4bb800/typer_slim-0.21.1-py3-none-any.whl", hash = "sha256:6e6c31047f171ac93cc5a973c9e617dbc5ab2bddc4d0a3135dc161b4e2020e0d", size = 47444, upload-time = "2026-01-06T11:21:12.441Z" }, ] [[package]] name = "types-requests" -version = "2.32.4.20250913" +version = "2.32.4.20260107" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "urllib3" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/36/27/489922f4505975b11de2b5ad07b4fe1dca0bca9be81a703f26c5f3acfce5/types_requests-2.32.4.20250913.tar.gz", hash = "sha256:abd6d4f9ce3a9383f269775a9835a4c24e5cd6b9f647d64f88aa4613c33def5d", size = 23113, upload-time = "2025-09-13T02:40:02.309Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0f/f3/a0663907082280664d745929205a89d41dffb29e89a50f753af7d57d0a96/types_requests-2.32.4.20260107.tar.gz", hash = "sha256:018a11ac158f801bfa84857ddec1650750e393df8a004a8a9ae2a9bec6fcb24f", size = 23165, upload-time = "2026-01-07T03:20:54.091Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2a/20/9a227ea57c1285986c4cf78400d0a91615d25b24e257fd9e2969606bdfae/types_requests-2.32.4.20250913-py3-none-any.whl", hash = "sha256:78c9c1fffebbe0fa487a418e0fa5252017e9c60d1a2da394077f1780f655d7e1", size = 20658, upload-time = "2025-09-13T02:40:01.115Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1c/12/709ea261f2bf91ef0a26a9eed20f2623227a8ed85610c1e54c5805692ecb/types_requests-2.32.4.20260107-py3-none-any.whl", hash = "sha256:b703fe72f8ce5b31ef031264fe9395cac8f46a04661a79f7ed31a80fb308730d", size = 20676, upload-time = "2026-01-07T03:20:52.929Z" }, ] [[package]] @@ -7743,11 +7722,11 @@ wheels = [ [[package]] name = "tzdata" -version = "2025.2" +version = "2025.3" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/95/32/1a225d6164441be760d75c2c42e2780dc0873fe382da3e98a2e1e48361e5/tzdata-2025.2.tar.gz", hash = "sha256:b60a638fcc0daffadf82fe0f57e53d06bdec2f36c4df66280ae79bce6bd6f2b9", size = 196380, upload-time = "2025-03-23T13:54:43.652Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5e/a7/c202b344c5ca7daf398f3b8a477eeb205cf3b6f32e7ec3a6bac0629ca975/tzdata-2025.3.tar.gz", hash = "sha256:de39c2ca5dc7b0344f2eba86f49d614019d29f060fc4ebc8a417896a620b56a7", size = 196772, upload-time = "2025-12-13T17:45:35.667Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5c/23/c7abc0ca0a1526a0774eca151daeb8de62ec457e77262b66b359c3c7679e/tzdata-2025.2-py2.py3-none-any.whl", hash = "sha256:1a403fada01ff9221ca8044d701868fa132215d84beb92242d9acd2147f667a8", size = 347839, upload-time = "2025-03-23T13:54:41.845Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c7/b0/003792df09decd6849a5e39c28b513c06e84436a54440380862b5aeff25d/tzdata-2025.3-py2.py3-none-any.whl", hash = "sha256:06a47e5700f3081aab02b2e513160914ff0694bce9947d6b76ebd6bf57cfc5d1", size = 348521, upload-time = "2025-12-13T17:45:33.889Z" }, ] [[package]] @@ -7764,7 +7743,7 @@ wheels = [ [[package]] name = "umap-learn" -version = "0.5.6" +version = "0.5.9.post2" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "numba" }, @@ -7774,9 +7753,9 @@ dependencies = [ { name = "scipy" }, { name = "tqdm" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/36/c0/a21f7e83dc471cb4bdb7bfb10244eb63a0c0b68ee2939b6698add0377eee/umap-learn-0.5.6.tar.gz", hash = "sha256:5b3917a862c23ba0fc83bfcd67a7b719dec85b3d9c01fdc7d894cce455df4e03", size = 89627, upload-time = "2024-04-03T16:53:18.592Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5f/ee/6bc65bd375c812026a7af63fe9d09d409382120aff25f2152f1ba12af5ec/umap_learn-0.5.9.post2.tar.gz", hash = "sha256:bdf60462d779bd074ce177a0714ced17e6d161285590fa487f3f9548dd3c31c9", size = 95441, upload-time = "2025-07-03T00:18:02.479Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d1/1b/46802a050b1c55d10c4f59fc6afd2b45ac9b4f62b2e12092d3f599286f14/umap_learn-0.5.6-py3-none-any.whl", hash = "sha256:881cc0c2ee845b790bf0455aa1664f9f68b838d9d0fe12a1291b85c5a559c913", size = 85712, upload-time = "2024-04-03T16:53:16.834Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6b/b1/c24deeda9baf1fd491aaad941ed89e0fed6c583a117fd7b79e0a33a1e6c0/umap_learn-0.5.9.post2-py3-none-any.whl", hash = "sha256:fbe51166561e0e7fab00ef3d516ac2621243b8d15cf4bef9f656d701736b16a0", size = 90146, upload-time = "2025-07-03T00:18:01.042Z" }, ] [[package]] @@ -7799,11 +7778,11 @@ wheels = [ [[package]] name = "urllib3" -version = "2.6.2" +version = "2.6.3" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/1e/24/a2a2ed9addd907787d7aa0355ba36a6cadf1768b934c652ea78acbd59dcd/urllib3-2.6.2.tar.gz", hash = "sha256:016f9c98bb7e98085cb2b4b17b87d2c702975664e4f060c6532e64d1c1a5e797", size = 432930, upload-time = "2025-12-11T15:56:40.252Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c7/24/5f1b3bdffd70275f6661c76461e25f024d5a38a46f04aaca912426a2b1d3/urllib3-2.6.3.tar.gz", hash = "sha256:1b62b6884944a57dbe321509ab94fd4d3b307075e0c2eae991ac71ee15ad38ed", size = 435556, upload-time = "2026-01-07T16:24:43.925Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6d/b9/4095b668ea3678bf6a0af005527f39de12fb026516fb3df17495a733b7f8/urllib3-2.6.2-py3-none-any.whl", hash = "sha256:ec21cddfe7724fc7cb4ba4bea7aa8e2ef36f607a4bab81aa6ce42a13dc3f03dd", size = 131182, upload-time = "2025-12-11T15:56:38.584Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/39/08/aaaad47bc4e9dc8c725e68f9d04865dbcb2052843ff09c97b08904852d84/urllib3-2.6.3-py3-none-any.whl", hash = "sha256:bf272323e553dfb2e87d9bfd225ca7b0f467b919d7bbd355436d3fd37cb0acd4", size = 131584, upload-time = "2026-01-07T16:24:42.685Z" }, ] [package.optional-dependencies] @@ -7813,15 +7792,15 @@ socks = [ [[package]] name = "uvicorn" -version = "0.38.0" +version = "0.40.0" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "click" }, { name = "h11" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/cb/ce/f06b84e2697fef4688ca63bdb2fdf113ca0a3be33f94488f2cadb690b0cf/uvicorn-0.38.0.tar.gz", hash = "sha256:fd97093bdd120a2609fc0d3afe931d4d4ad688b6e75f0f929fde1bc36fe0e91d", size = 80605, upload-time = "2025-10-18T13:46:44.63Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c3/d1/8f3c683c9561a4e6689dd3b1d345c815f10f86acd044ee1fb9a4dcd0b8c5/uvicorn-0.40.0.tar.gz", hash = "sha256:839676675e87e73694518b5574fd0f24c9d97b46bea16df7b8c05ea1a51071ea", size = 81761, upload-time = "2025-12-21T14:16:22.45Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ee/d9/d88e73ca598f4f6ff671fb5fde8a32925c2e08a637303a1d12883c7305fa/uvicorn-0.38.0-py3-none-any.whl", hash = "sha256:48c0afd214ceb59340075b4a052ea1ee91c16fbc2a9b1469cca0e54566977b02", size = 68109, upload-time = "2025-10-18T13:46:42.958Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3d/d8/2083a1daa7439a66f3a48589a57d576aa117726762618f6bb09fe3798796/uvicorn-0.40.0-py3-none-any.whl", hash = "sha256:c6c8f55bc8bf13eb6fa9ff87ad62308bbbc33d0b67f84293151efe87e0d5f2ee", size = 68502, upload-time = "2025-12-21T14:16:21.041Z" }, ] [[package]] @@ -7978,14 +7957,14 @@ wheels = [ [[package]] name = "werkzeug" -version = "3.0.6" +version = "3.1.5" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "markupsafe" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d4/f9/0ba83eaa0df9b9e9d1efeb2ea351d0677c37d41ee5d0f91e98423c7281c9/werkzeug-3.0.6.tar.gz", hash = "sha256:a8dd59d4de28ca70471a34cba79bed5f7ef2e036a76b3ab0835474246eb41f8d", size = 805170, upload-time = "2024-10-25T18:52:31.688Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5a/70/1469ef1d3542ae7c2c7b72bd5e3a4e6ee69d7978fa8a3af05a38eca5becf/werkzeug-3.1.5.tar.gz", hash = "sha256:6a548b0e88955dd07ccb25539d7d0cc97417ee9e179677d22c7041c8f078ce67", size = 864754, upload-time = "2026-01-08T17:49:23.247Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6c/69/05837f91dfe42109203ffa3e488214ff86a6d68b2ed6c167da6cdc42349b/werkzeug-3.0.6-py3-none-any.whl", hash = "sha256:1bc0c2310d2fbb07b1dd1105eba2f7af72f322e1e455f2f93c993bee8c8a5f17", size = 227979, upload-time = "2024-10-25T18:52:30.129Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/ad/e4/8d97cca767bcc1be76d16fb76951608305561c6e056811587f36cb1316a8/werkzeug-3.1.5-py3-none-any.whl", hash = "sha256:5111e36e91086ece91f93268bb39b4a35c1e6f1feac762c9c822ded0a4e322dc", size = 225025, upload-time = "2026-01-08T17:49:21.859Z" }, ] [[package]] From 4fe3c2419885d8c59a2e365bf2ec22537f20327e Mon Sep 17 00:00:00 2001 From: Lin Manhui Date: Tue, 13 Jan 2026 09:51:08 +0800 Subject: [PATCH 089/335] feat: PaddleOCR PDF parser supports thumnails and positions (#12565) ### What problem does this PR solve? 1. PaddleOCR PDF parser supports thumnails and positions. 2. Add FAQ documentation for PaddleOCR PDF parser. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- deepdoc/parser/paddleocr_parser.py | 192 ++++++++++++++++-- docs/faq.mdx | 79 +++++++ rag/flow/parser/parser.py | 46 +---- .../modal/paddleocr-modal/index.tsx | 2 +- 4 files changed, 259 insertions(+), 60 deletions(-) diff --git a/deepdoc/parser/paddleocr_parser.py b/deepdoc/parser/paddleocr_parser.py index fca69da792a..f6611e0c47f 100644 --- a/deepdoc/parser/paddleocr_parser.py +++ b/deepdoc/parser/paddleocr_parser.py @@ -24,7 +24,10 @@ from pathlib import Path from typing import Any, Callable, ClassVar, Literal, Optional, Union, Tuple, List +import numpy as np +import pdfplumber import requests +from PIL import Image try: from deepdoc.parser.pdf_parser import RAGFlowPdfParser @@ -60,8 +63,8 @@ def _remove_images_from_markdown(markdown: str) -> str: class PaddleOCRVLConfig: """Configuration for PaddleOCR-VL algorithm.""" - use_doc_orientation_classify: Optional[bool] = None - use_doc_unwarping: Optional[bool] = None + use_doc_orientation_classify: Optional[bool] = False + use_doc_unwarping: Optional[bool] = False use_layout_detection: Optional[bool] = None use_polygon_points: Optional[bool] = None use_chart_recognition: Optional[bool] = None @@ -79,7 +82,7 @@ class PaddleOCRVLConfig: min_pixels: Optional[int] = None max_pixels: Optional[int] = None max_new_tokens: Optional[int] = None - merge_layout_blocks: Optional[bool] = None + merge_layout_blocks: Optional[bool] = False markdown_ignore_labels: Optional[List[str]] = None vlm_extra_args: Optional[dict] = None @@ -116,14 +119,12 @@ def from_dict(cls, config: Optional[dict[str, Any]]) -> "PaddleOCRConfig": if algorithm == "PaddleOCR-VL": # Create default PaddleOCRVLConfig object and convert to dict algorithm_config = asdict(PaddleOCRVLConfig()) - - # Apply user-provided VL config - vl_config = cfg.get("vl") - if isinstance(vl_config, dict): - algorithm_config.update({k: v for k, v in vl_config.items() if v is not None}) + algorithm_config_user = cfg.get("algorithm_config") + if isinstance(algorithm_config_user, dict): + algorithm_config.update({k: v for k, v in algorithm_config_user.items() if v is not None}) # Remove processed keys - cfg.pop("vl", None) + cfg.pop("algorithm_config", None) # Prepare initialization arguments field_names = {field.name for field in fields(cls)} @@ -146,6 +147,8 @@ def from_kwargs(cls, **kwargs: Any) -> "PaddleOCRConfig": class PaddleOCRParser(RAGFlowPdfParser): """Parser for PDF documents using PaddleOCR API.""" + _ZOOMIN = 2 + _COMMON_FIELD_MAPPING: ClassVar[dict[str, str]] = { "prettify_markdown": "prettifyMarkdown", "show_formula_number": "showFormulaNumber", @@ -188,6 +191,8 @@ def __init__( request_timeout: int = 600, ): """Initialize PaddleOCR parser.""" + super().__init__() + self.api_url = api_url.rstrip("/") if api_url else os.getenv("PADDLEOCR_API_URL", "") self.access_token = access_token or os.getenv("PADDLEOCR_ACCESS_TOKEN") self.algorithm = algorithm @@ -197,6 +202,10 @@ def __init__( # Force PDF file type self.file_type = 0 + # Initialize page images for cropping + self.page_images: list[Image.Image] = [] + self.page_from = 0 + # Public methods def check_installation(self) -> tuple[bool, str]: """Check if the parser is properly installed and configured.""" @@ -222,7 +231,7 @@ def parse_pdf( show_formula_number: Optional[bool] = None, visualize: Optional[bool] = None, additional_params: Optional[dict[str, Any]] = None, - vl_config: Optional[dict[str, Any]] = None, + algorithm_config: Optional[dict[str, Any]] = None, **kwargs: Any, ) -> ParseResult: """Parse PDF document using PaddleOCR API.""" @@ -241,22 +250,24 @@ def parse_pdf( config_dict["visualize"] = visualize if additional_params is not None: config_dict["additional_params"] = additional_params - if vl_config is not None: - config_dict["vl"] = vl_config - - # Add any VL config parameters from kwargs - for key, value in kwargs.items(): - if key in {field.name for field in fields(PaddleOCRVLConfig)}: - config_dict[key] = value + if algorithm_config is not None: + config_dict["algorithm_config"] = algorithm_config cfg = PaddleOCRConfig.from_dict(config_dict) if not cfg.api_url: raise RuntimeError("[PaddleOCR] API URL missing") - # Prepare file data + # Prepare file data and generate page images for cropping data_bytes = self._prepare_file_data(filepath, binary) + # Generate page images for cropping functionality + input_source = filepath if binary is None else binary + try: + self.__images__(input_source, callback=callback) + except Exception as e: + self.logger.warning(f"[PaddleOCR] Failed to generate page images for cropping: {e}") + # Build and send request result = self._send_request(data_bytes, cfg, callback) @@ -377,7 +388,7 @@ def _transfer_to_sections(self, result: dict[str, Any], algorithm: AlgorithmType label = block.get("block_label", "") block_bbox = block.get("block_bbox", [0, 0, 0, 0]) - tag = f"@@{page_idx + 1}\t{block_bbox[0]}\t{block_bbox[2]}\t{block_bbox[1]}\t{block_bbox[3]}##" + tag = f"@@{page_idx + 1}\t{block_bbox[0] // self._ZOOMIN}\t{block_bbox[2] // self._ZOOMIN}\t{block_bbox[1] // self._ZOOMIN}\t{block_bbox[3] // self._ZOOMIN}##" if parse_method == "manual": sections.append((block_content, label, tag)) @@ -392,6 +403,149 @@ def _transfer_to_tables(self, result: dict[str, Any]) -> list[TableTuple]: """Convert API response to table tuples.""" return [] + def __images__(self, fnm, page_from=0, page_to=100, callback=None): + """Generate page images from PDF for cropping.""" + self.page_from = page_from + self.page_to = page_to + try: + with pdfplumber.open(fnm) if isinstance(fnm, (str, PathLike)) else pdfplumber.open(BytesIO(fnm)) as pdf: + self.pdf = pdf + self.page_images = [p.to_image(resolution=72, antialias=True).original for i, p in enumerate(self.pdf.pages[page_from:page_to])] + except Exception as e: + self.page_images = None + self.logger.exception(e) + + @staticmethod + def extract_positions(txt: str): + """Extract position information from text tags.""" + poss = [] + for tag in re.findall(r"@@[0-9-]+\t[0-9.\t]+##", txt): + pn, left, right, top, bottom = tag.strip("#").strip("@").split("\t") + left, right, top, bottom = float(left), float(right), float(top), float(bottom) + poss.append(([int(p) - 1 for p in pn.split("-")], left, right, top, bottom)) + return poss + + def crop(self, text: str, need_position: bool = False): + """Crop images from PDF based on position tags in text.""" + imgs = [] + poss = self.extract_positions(text) + + if not poss: + if need_position: + return None, None + return + + if not getattr(self, "page_images", None): + self.logger.warning("[PaddleOCR] crop called without page images; skipping image generation.") + if need_position: + return None, None + return + + page_count = len(self.page_images) + + filtered_poss = [] + for pns, left, right, top, bottom in poss: + if not pns: + self.logger.warning("[PaddleOCR] Empty page index list in crop; skipping this position.") + continue + valid_pns = [p for p in pns if 0 <= p < page_count] + if not valid_pns: + self.logger.warning(f"[PaddleOCR] All page indices {pns} out of range for {page_count} pages; skipping.") + continue + filtered_poss.append((valid_pns, left, right, top, bottom)) + + poss = filtered_poss + if not poss: + self.logger.warning("[PaddleOCR] No valid positions after filtering; skip cropping.") + if need_position: + return None, None + return + + max_width = max(np.max([right - left for (_, left, right, _, _) in poss]), 6) + GAP = 6 + pos = poss[0] + first_page_idx = pos[0][0] + poss.insert(0, ([first_page_idx], pos[1], pos[2], max(0, pos[3] - 120), max(pos[3] - GAP, 0))) + pos = poss[-1] + last_page_idx = pos[0][-1] + if not (0 <= last_page_idx < page_count): + self.logger.warning(f"[PaddleOCR] Last page index {last_page_idx} out of range for {page_count} pages; skipping crop.") + if need_position: + return None, None + return + last_page_height = self.page_images[last_page_idx].size[1] + poss.append( + ( + [last_page_idx], + pos[1], + pos[2], + min(last_page_height, pos[4] + GAP), + min(last_page_height, pos[4] + 120), + ) + ) + + positions = [] + for ii, (pns, left, right, top, bottom) in enumerate(poss): + right = left + max_width + + if bottom <= top: + bottom = top + 2 + + for pn in pns[1:]: + if 0 <= pn - 1 < page_count: + bottom += self.page_images[pn - 1].size[1] + else: + self.logger.warning(f"[PaddleOCR] Page index {pn}-1 out of range for {page_count} pages during crop; skipping height accumulation.") + + if not (0 <= pns[0] < page_count): + self.logger.warning(f"[PaddleOCR] Base page index {pns[0]} out of range for {page_count} pages during crop; skipping this segment.") + continue + + img0 = self.page_images[pns[0]] + x0, y0, x1, y1 = int(left), int(top), int(right), int(min(bottom, img0.size[1])) + crop0 = img0.crop((x0, y0, x1, y1)) + imgs.append(crop0) + if 0 < ii < len(poss) - 1: + positions.append((pns[0] + self.page_from, x0, x1, y0, y1)) + + bottom -= img0.size[1] + for pn in pns[1:]: + if not (0 <= pn < page_count): + self.logger.warning(f"[PaddleOCR] Page index {pn} out of range for {page_count} pages during crop; skipping this page.") + continue + page = self.page_images[pn] + x0, y0, x1, y1 = int(left), 0, int(right), int(min(bottom, page.size[1])) + cimgp = page.crop((x0, y0, x1, y1)) + imgs.append(cimgp) + if 0 < ii < len(poss) - 1: + positions.append((pn + self.page_from, x0, x1, y0, y1)) + bottom -= page.size[1] + + if not imgs: + if need_position: + return None, None + return + + height = 0 + for img in imgs: + height += img.size[1] + GAP + height = int(height) + width = int(np.max([i.size[0] for i in imgs])) + pic = Image.new("RGB", (width, height), (245, 245, 245)) + height = 0 + for ii, img in enumerate(imgs): + if ii == 0 or ii + 1 == len(imgs): + img = img.convert("RGBA") + overlay = Image.new("RGBA", img.size, (0, 0, 0, 0)) + overlay.putalpha(128) + img = Image.alpha_composite(img, overlay).convert("RGB") + pic.paste(img, (0, int(height))) + height += img.size[1] + GAP + + if need_position: + return pic, positions + return pic + if __name__ == "__main__": logging.basicConfig(level=logging.INFO) diff --git a/docs/faq.mdx b/docs/faq.mdx index dc685d37ae7..d08bb9361f5 100644 --- a/docs/faq.mdx +++ b/docs/faq.mdx @@ -566,3 +566,82 @@ RAGFlow supports MinerU's `vlm-http-client` backend, enabling you to delegate do :::tip NOTE When using the `vlm-http-client` backend, the RAGFlow server requires no GPU, only network connectivity. This enables cost-effective distributed deployment with multiple RAGFlow instances sharing one remote vLLM server. ::: + +### How to use PaddleOCR for document parsing? + +From v0.24.0 onwards, RAGFlow includes PaddleOCR as an optional PDF parser. Please note that RAGFlow acts only as a *remote client* for PaddleOCR, calling the PaddleOCR API to parse PDFs and reading the returned files. + +There are two main ways to configure and use PaddleOCR in RAGFlow: + +#### 1. Using PaddleOCR Official API + +This method uses PaddleOCR's official API service with an access token. + +**Step 1: Configure RAGFlow** +- **Via Environment Variables:** + ```bash + # In your docker/.env file: + PADDLEOCR_API_URL=https://your-paddleocr-api-endpoint + PADDLEOCR_ALGORITHM=PaddleOCR-VL + PADDLEOCR_ACCESS_TOKEN=your-access-token-here + ``` + +- **Via UI:** + - Navigate to **Model providers** page + - Add a new OCR model with factory type "PaddleOCR" + - Configure the following fields: + - **PaddleOCR API URL**: Your PaddleOCR API endpoint + - **PaddleOCR Algorithm**: Select the algorithm corresponding to the API endpoint + - **AI Studio Access Token**: Your access token for the PaddleOCR API + +**Step 2: Usage in Dataset Configuration** +- In your dataset's **Configuration** page, find the **Ingestion pipeline** section +- If using built-in chunking methods that support PDF parsing, select **PaddleOCR** from the **PDF parser** dropdown +- If using custom ingestion pipeline, select **PaddleOCR** in the **Parser** component + +**Notes:** +- To obtain the API URL, visit the [PaddleOCR official website](https://aistudio.baidu.com/paddleocr/task), click the **API** button in the upper-left corner, choose the example code for the specific algorithm you want to use (e.g., PaddleOCR-VL), and copy the `API_URL`. +- Access tokens can be obtained from the [AI Studio platform](https://aistudio.baidu.com/account/accessToken). +- This method requires internet connectivity to reach the official PaddleOCR API. + +#### 2. Using Self-Hosted PaddleOCR Service + +This method allows you to deploy your own PaddleOCR service and use it without an access token. + +**Step 1: Deploy PaddleOCR Service** +Follow the [PaddleOCR serving documentation](https://www.paddleocr.ai/latest/en/version3.x/deployment/serving.html) to deploy your own service. For layout parsing, you can use an endpoint like: + +```bash +http://localhost:8080/layout-parsing +``` + +**Step 2: Configure RAGFlow** +- **Via Environment Variables:** + ```bash + PADDLEOCR_API_URL=http://localhost:8080/layout-parsing + PADDLEOCR_ALGORITHM=PaddleOCR-VL + # No access token required for self-hosted service + ``` + +- **Via UI:** + - Navigate to **Model providers** page + - Add a new OCR model with factory type "PaddleOCR" + - Configure the following fields: + - **PaddleOCR API URL**: The endpoint of your deployed service + - **PaddleOCR Algorithm**: Select the algorithm corresponding to the deployed service + - **AI Studio Access Token**: Leave empty + +**Step 3: Usage in Dataset Configuration** +- In your dataset's **Configuration** page, find the **Ingestion pipeline** section +- If using built-in chunking methods that support PDF parsing, select **PaddleOCR** from the **PDF parser** dropdown +- If using custom ingestion pipeline, select **PaddleOCR** in the **Parser** component + +#### Environment Variables Summary + +| Environment Variable | Description | Default | Required | +|---------------------|-------------|---------|----------| +| `PADDLEOCR_API_URL` | PaddleOCR API endpoint URL | `""` | Yes, when using environment variables | +| `PADDLEOCR_ALGORITHM` | Algorithm to use for parsing | `"PaddleOCR-VL"` | No | +| `PADDLEOCR_ACCESS_TOKEN` | Access token for official API | `None` | Only when using official API | + +Environment variables can be used for auto-provisioning, but are not required if configuring via UI. When environment variables are set, these values are used to auto-provision a PaddleOCR model for the tenant on first use. diff --git a/rag/flow/parser/parser.py b/rag/flow/parser/parser.py index 2cc941b7270..b681e5d5dc4 100644 --- a/rag/flow/parser/parser.py +++ b/rag/flow/parser/parser.py @@ -358,48 +358,14 @@ def resolve_paddleocr_llm_name(): parse_method=conf.get("paddleocr_parse_method", "raw"), ) bboxes = [] - for section in lines: - # PaddleOCRParser returns sections as tuple, different formats based on parse_method: - # - "raw": (text, position_tag) - # - "manual": (text, label, position_tag) - # - "paper": (text_with_tag, label) - text = section[0] - - # Parse position tag if exists - position_tag = "" - if len(section) > 1: - if len(section) == 2: # raw format: (text, tag) - position_tag = section[1] - elif len(section) == 3: # manual format: (text, label, tag) - position_tag = section[2] - elif "paper" in conf.get("paddleocr_parse_method", "") and len(section) == 2: - # paper format: text may contain tag - text_with_tag = text - import re - - tag_match = re.search(r"(@@[0-9-]+\t[0-9.\t]+##)", text_with_tag) - if tag_match: - position_tag = tag_match.group(1) - text = text_with_tag.replace(position_tag, "").strip() - - # Extract coordinate information from position tag - page_number, x0, x1, top, bottom = 1, 0, 0, 0, 0 - if position_tag: - import re - - tag_match = re.match(r"@@([0-9-]+)\t([0-9.]+)\t([0-9.]+)\t([0-9.]+)\t([0-9.]+)##", position_tag) - if tag_match: - pn, x0_str, x1_str, top_str, bottom_str = tag_match.groups() - page_number = int(pn.split("-")[0]) # Take first page number - x0, x1, top, bottom = float(x0_str), float(x1_str), float(top_str), float(bottom_str) + for t, poss in lines: + # Get cropped image and positions + cropped_image, positions = pdf_parser.crop(poss, need_position=True) box = { - "text": text, - "page_number": page_number, - "x0": x0, - "x1": x1, - "top": top, - "bottom": bottom, + "text": t, + "image": cropped_image, + "positions": positions, } bboxes.append(box) else: diff --git a/web/src/pages/user-setting/setting-model/modal/paddleocr-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/paddleocr-modal/index.tsx index 2df23c3de5a..5c4fcbfef5c 100644 --- a/web/src/pages/user-setting/setting-model/modal/paddleocr-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/paddleocr-modal/index.tsx @@ -122,7 +122,7 @@ const PaddleOCRModal = ({ disabled={loading} className="btn btn-primary" > - {loading ? t('common.adding') : t('common.add')} + {t('common.add')} From d76912ab15e7ece478cd25089f0e29bcad011055 Mon Sep 17 00:00:00 2001 From: LGRY <48902505+LGRY@users.noreply.github.com> Date: Tue, 13 Jan 2026 11:48:42 +0800 Subject: [PATCH 090/335] Fix: Use uv pip install for Docling installation (#12567) Fixes #12440 ### What problem does this PR solve? The current implementation uses `python3 -m pip` which can fail in certain environments. This change leverages `uv pip install` instead, which aligns with the project's existing tooling. ### Type of change - Removed the ensurepip line (not needed since uv manages pip) - Changed python3 to "$PY" for consistency with the rest of the script - Changed python3 -m pip install to uv pip install Co-authored-by: Gongzi --- docker/entrypoint.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 62e0ed84801..7770ab8d0d1 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -195,10 +195,9 @@ function start_mcp_server() { function ensure_docling() { [[ "${USE_DOCLING}" == "true" ]] || { echo "[docling] disabled by USE_DOCLING"; return 0; } - python3 -c 'import pip' >/dev/null 2>&1 || python3 -m ensurepip --upgrade || true DOCLING_PIN="${DOCLING_VERSION:-==2.58.0}" - python3 -c "import importlib.util,sys; sys.exit(0 if importlib.util.find_spec('docling') else 1)" \ - || python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --extra-index-url https://pypi.org/simple --no-cache-dir "docling${DOCLING_PIN}" + "$PY" -c "import importlib.util,sys; sys.exit(0 if importlib.util.find_spec('docling') else 1)" \ + || uv pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --extra-index-url https://pypi.org/simple --no-cache-dir "docling${DOCLING_PIN}" } # ----------------------------------------------------------------------------- From 41c84fd78fa0ad9d08f1b105bab2cc6bcbae1037 Mon Sep 17 00:00:00 2001 From: LIRUI YU <128563231+LiruiYu33@users.noreply.github.com> Date: Tue, 13 Jan 2026 12:17:49 +0800 Subject: [PATCH 091/335] Add MIME types for PPT and PPTX files (#12562) Otherwise, slide files cannot be opened in Chat module ### What problem does this PR solve? Backend Reason (API): In the api/utils/web_utils.py file of the backend, the CONTENT_TYPE_MAP dictionary is missing ppt and pptx. MIME type mapping. This means that when the frontend requests a PPTX file, the backend cannot correctly inform the browser that it is a PPTX file, resulting in the file being displayed incorrectly. Type identification error. ### Type of change - Bug Fix (non-breaking change which fixes an issue) --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- api/utils/web_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/utils/web_utils.py b/api/utils/web_utils.py index 11e8428b77c..c13889be23d 100644 --- a/api/utils/web_utils.py +++ b/api/utils/web_utils.py @@ -86,6 +86,9 @@ "ico": "image/x-icon", "avif": "image/avif", "heic": "image/heic", + # PPTX + "ppt": "application/vnd.ms-powerpoint", + "pptx": "application/vnd.openxmLformats-officedocument.presentationml.presentation", } @@ -239,4 +242,4 @@ def hash_code(code: str, salt: bytes) -> str: def captcha_key(email: str) -> str: return f"captcha:{email}" - \ No newline at end of file + From 64c75d558e4a17a4a48953b4c201526431d8338f Mon Sep 17 00:00:00 2001 From: Yongteng Lei Date: Tue, 13 Jan 2026 12:24:50 +0800 Subject: [PATCH 092/335] Fix: zip extraction vulnerabilities in MinerU and TCADP (#12527) ### What problem does this PR solve? Fix zip extraction vulnerabilities: - Block symlink entries in zip files. - Reject encrypted zip entries. - Prevent absolute path attacks (including Windows paths). - Block path traversal attempts (../). - Stop zip slip exploits (directory escape). - Use streaming for memory-safe file handling. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- deepdoc/parser/mineru_parser.py | 115 ++++++++++++++++++++------------ deepdoc/parser/tcadp_parser.py | 112 ++++++++++++++++++------------- 2 files changed, 137 insertions(+), 90 deletions(-) diff --git a/deepdoc/parser/mineru_parser.py b/deepdoc/parser/mineru_parser.py index aba237dd1b2..cc4c99c76b8 100644 --- a/deepdoc/parser/mineru_parser.py +++ b/deepdoc/parser/mineru_parser.py @@ -17,6 +17,7 @@ import logging import os import re +import shutil import sys import tempfile import threading @@ -138,39 +139,58 @@ def __init__(self, mineru_path: str = "mineru", mineru_api: str = "", mineru_ser self.outlines = [] self.logger = logging.getLogger(self.__class__.__name__) + @staticmethod + def _is_zipinfo_symlink(member: zipfile.ZipInfo) -> bool: + return (member.external_attr >> 16) & 0o170000 == 0o120000 + def _extract_zip_no_root(self, zip_path, extract_to, root_dir): self.logger.info(f"[MinerU] Extract zip: zip_path={zip_path}, extract_to={extract_to}, root_hint={root_dir}") + base_dir = Path(extract_to).resolve() with zipfile.ZipFile(zip_path, "r") as zip_ref: + members = zip_ref.infolist() if not root_dir: - files = zip_ref.namelist() - if files and files[0].endswith("/"): - root_dir = files[0] + if members and members[0].filename.endswith("/"): + root_dir = members[0].filename else: root_dir = None - - if not root_dir or not root_dir.endswith("/"): - self.logger.info(f"[MinerU] No root directory found, extracting all (root_hint={root_dir})") - zip_ref.extractall(extract_to) - return - - root_len = len(root_dir) - for member in zip_ref.infolist(): - filename = member.filename - if filename == root_dir: + if root_dir: + root_dir = root_dir.replace("\\", "/") + if not root_dir.endswith("/"): + root_dir += "/" + + for member in members: + if member.flag_bits & 0x1: + raise RuntimeError(f"[MinerU] Encrypted zip entry not supported: {member.filename}") + if self._is_zipinfo_symlink(member): + raise RuntimeError(f"[MinerU] Symlink zip entry not supported: {member.filename}") + + name = member.filename.replace("\\", "/") + if root_dir and name == root_dir: self.logger.info("[MinerU] Ignore root folder...") continue + if root_dir and name.startswith(root_dir): + name = name[len(root_dir) :] + if not name: + continue + if name.startswith("/") or name.startswith("//") or re.match(r"^[A-Za-z]:", name): + raise RuntimeError(f"[MinerU] Unsafe zip path (absolute): {member.filename}") - path = filename - if path.startswith(root_dir): - path = path[root_len:] + parts = [p for p in name.split("/") if p not in ("", ".")] + if any(p == ".." for p in parts): + raise RuntimeError(f"[MinerU] Unsafe zip path (traversal): {member.filename}") + + rel_path = os.path.join(*parts) if parts else "" + dest_path = (Path(extract_to) / rel_path).resolve(strict=False) + if dest_path != base_dir and base_dir not in dest_path.parents: + raise RuntimeError(f"[MinerU] Unsafe zip path (escape): {member.filename}") - full_path = os.path.join(extract_to, path) if member.is_dir(): - os.makedirs(full_path, exist_ok=True) - else: - os.makedirs(os.path.dirname(full_path), exist_ok=True) - with open(full_path, "wb") as f: - f.write(zip_ref.read(filename)) + os.makedirs(dest_path, exist_ok=True) + continue + + os.makedirs(dest_path.parent, exist_ok=True) + with zip_ref.open(member) as src, open(dest_path, "wb") as dst: + shutil.copyfileobj(src, dst) @staticmethod def _is_http_endpoint_valid(url, timeout=5): @@ -237,8 +257,6 @@ def _run_mineru_api( output_path = tempfile.mkdtemp(prefix=f"{pdf_file_name}_{options.method}_", dir=str(output_dir)) output_zip_path = os.path.join(str(output_dir), f"{Path(output_path).name}.zip") - files = {"files": (pdf_file_name + ".pdf", open(pdf_file_path, "rb"), "application/pdf")} - data = { "output_dir": "./output", "lang_list": options.lang, @@ -270,26 +288,35 @@ def _run_mineru_api( self.logger.info(f"[MinerU] invoke api: {self.mineru_api}/file_parse backend={options.backend} server_url={data.get('server_url')}") if callback: callback(0.20, f"[MinerU] invoke api: {self.mineru_api}/file_parse") - response = requests.post(url=f"{self.mineru_api}/file_parse", files=files, data=data, headers=headers, - timeout=1800) - - response.raise_for_status() - if response.headers.get("Content-Type") == "application/zip": - self.logger.info(f"[MinerU] zip file returned, saving to {output_zip_path}...") - - if callback: - callback(0.30, f"[MinerU] zip file returned, saving to {output_zip_path}...") - - with open(output_zip_path, "wb") as f: - f.write(response.content) - - self.logger.info(f"[MinerU] Unzip to {output_path}...") - self._extract_zip_no_root(output_zip_path, output_path, pdf_file_name + "/") - - if callback: - callback(0.40, f"[MinerU] Unzip to {output_path}...") - else: - self.logger.warning(f"[MinerU] not zip returned from api: {response.headers.get('Content-Type')}") + with open(pdf_file_path, "rb") as pdf_file: + files = {"files": (pdf_file_name + ".pdf", pdf_file, "application/pdf")} + with requests.post( + url=f"{self.mineru_api}/file_parse", + files=files, + data=data, + headers=headers, + timeout=1800, + stream=True, + ) as response: + response.raise_for_status() + content_type = response.headers.get("Content-Type", "") + if content_type.startswith("application/zip"): + self.logger.info(f"[MinerU] zip file returned, saving to {output_zip_path}...") + + if callback: + callback(0.30, f"[MinerU] zip file returned, saving to {output_zip_path}...") + + with open(output_zip_path, "wb") as f: + response.raw.decode_content = True + shutil.copyfileobj(response.raw, f) + + self.logger.info(f"[MinerU] Unzip to {output_path}...") + self._extract_zip_no_root(output_zip_path, output_path, pdf_file_name + "/") + + if callback: + callback(0.40, f"[MinerU] Unzip to {output_path}...") + else: + self.logger.warning(f"[MinerU] not zip returned from api: {content_type}") except Exception as e: raise RuntimeError(f"[MinerU] api failed with exception {e}") self.logger.info("[MinerU] Api completed successfully.") diff --git a/deepdoc/parser/tcadp_parser.py b/deepdoc/parser/tcadp_parser.py index 8d704baed29..af1c9034895 100644 --- a/deepdoc/parser/tcadp_parser.py +++ b/deepdoc/parser/tcadp_parser.py @@ -17,6 +17,7 @@ import json import logging import os +import re import shutil import tempfile import time @@ -48,10 +49,10 @@ def __init__(self, secret_id, secret_key, region): self.secret_key = secret_key self.region = region self.outlines = [] - + # Create credentials self.cred = credential.Credential(secret_id, secret_key) - + # Instantiate an http option, optional, can be skipped if no special requirements self.httpProfile = HttpProfile() self.httpProfile.endpoint = "lkeap.tencentcloudapi.com" @@ -59,7 +60,7 @@ def __init__(self, secret_id, secret_key, region): # Instantiate a client option, optional, can be skipped if no special requirements self.clientProfile = ClientProfile() self.clientProfile.httpProfile = self.httpProfile - + # Instantiate the client object for the product to be requested, clientProfile is optional self.client = lkeap_client.LkeapClient(self.cred, region, self.clientProfile) @@ -68,14 +69,14 @@ def reconstruct_document_sse(self, file_type, file_url=None, file_base64=None, f try: # Instantiate a request object, each interface corresponds to a request object req = models.ReconstructDocumentSSERequest() - + # Build request parameters params = { "FileType": file_type, "FileStartPageNumber": file_start_page, "FileEndPageNumber": file_end_page, } - + # According to Tencent Cloud API documentation, either FileUrl or FileBase64 parameter must be provided, if both are provided only FileUrl will be used if file_url: params["FileUrl"] = file_url @@ -94,7 +95,7 @@ def reconstruct_document_sse(self, file_type, file_url=None, file_base64=None, f # The returned resp is an instance of ReconstructDocumentSSEResponse, corresponding to the request object resp = self.client.ReconstructDocumentSSE(req) parser_result = {} - + # Output json format string response if isinstance(resp, types.GeneratorType): # Streaming response logging.info("[TCADP] Detected streaming response") @@ -104,7 +105,7 @@ def reconstruct_document_sse(self, file_type, file_url=None, file_base64=None, f try: data_dict = json.loads(event['data']) logging.info(f"[TCADP] Parsed data: {data_dict}") - + if data_dict.get('Progress') == "100": parser_result = data_dict logging.info("[TCADP] Document parsing completed!") @@ -118,14 +119,14 @@ def reconstruct_document_sse(self, file_type, file_url=None, file_base64=None, f logging.warning("[TCADP] Failed parsing pages:") for page in failed_pages: logging.warning(f"[TCADP] Page number: {page.get('PageNumber')}, Error: {page.get('ErrorMsg')}") - + # Check if there is a download link download_url = data_dict.get("DocumentRecognizeResultUrl") if download_url: logging.info(f"[TCADP] Got download link: {download_url}") else: logging.warning("[TCADP] No download link obtained") - + break # Found final result, exit loop else: # Print progress information @@ -168,9 +169,6 @@ def download_result_file(self, download_url, output_dir): return None try: - response = requests.get(download_url) - response.raise_for_status() - # Ensure output directory exists os.makedirs(output_dir, exist_ok=True) @@ -179,29 +177,36 @@ def download_result_file(self, download_url, output_dir): filename = f"tcadp_result_{timestamp}.zip" file_path = os.path.join(output_dir, filename) - # Save file - with open(file_path, "wb") as f: - f.write(response.content) + with requests.get(download_url, stream=True) as response: + response.raise_for_status() + with open(file_path, "wb") as f: + response.raw.decode_content = True + shutil.copyfileobj(response.raw, f) logging.info(f"[TCADP] Document parsing result downloaded to: {os.path.basename(file_path)}") return file_path - except requests.exceptions.RequestException as e: + except Exception as e: logging.error(f"[TCADP] Failed to download file: {e}") + try: + if "file_path" in locals() and os.path.exists(file_path): + os.unlink(file_path) + except Exception: + pass return None class TCADPParser(RAGFlowPdfParser): - def __init__(self, secret_id: str = None, secret_key: str = None, region: str = "ap-guangzhou", + def __init__(self, secret_id: str = None, secret_key: str = None, region: str = "ap-guangzhou", table_result_type: str = None, markdown_image_response_type: str = None): super().__init__() - + # First initialize logger self.logger = logging.getLogger(self.__class__.__name__) - + # Log received parameters self.logger.info(f"[TCADP] Initializing with parameters - table_result_type: {table_result_type}, markdown_image_response_type: {markdown_image_response_type}") - + # Priority: read configuration from RAGFlow configuration system (service_conf.yaml) try: tcadp_parser = get_base_config("tcadp_config", {}) @@ -212,7 +217,7 @@ def __init__(self, secret_id: str = None, secret_key: str = None, region: str = # Set table_result_type and markdown_image_response_type from config or parameters self.table_result_type = table_result_type if table_result_type is not None else tcadp_parser.get("table_result_type", "1") self.markdown_image_response_type = markdown_image_response_type if markdown_image_response_type is not None else tcadp_parser.get("markdown_image_response_type", "1") - + else: self.logger.error("[TCADP] Please configure tcadp_config in service_conf.yaml first") # If config file is empty, use provided parameters or defaults @@ -237,6 +242,10 @@ def __init__(self, secret_id: str = None, secret_key: str = None, region: str = if not self.secret_id or not self.secret_key: raise ValueError("[TCADP] Please set Tencent Cloud API keys, configure tcadp_config in service_conf.yaml") + @staticmethod + def _is_zipinfo_symlink(member: zipfile.ZipInfo) -> bool: + return (member.external_attr >> 16) & 0o170000 == 0o120000 + def check_installation(self) -> bool: """Check if Tencent Cloud API configuration is correct""" try: @@ -255,7 +264,7 @@ def check_installation(self) -> bool: def _file_to_base64(self, file_path: str, binary: bytes = None) -> str: """Convert file to Base64 format""" - + if binary: # If binary data is directly available, convert directly return base64.b64encode(binary).decode('utf-8') @@ -271,23 +280,34 @@ def _extract_content_from_zip(self, zip_path: str) -> list[dict[str, Any]]: try: with zipfile.ZipFile(zip_path, "r") as zip_file: - # Find JSON result files - json_files = [f for f in zip_file.namelist() if f.endswith(".json")] - - for json_file in json_files: - with zip_file.open(json_file) as f: - data = json.load(f) - if isinstance(data, list): - results.extend(data) + members = zip_file.infolist() + for member in members: + name = member.filename.replace("\\", "/") + if member.is_dir(): + continue + if member.flag_bits & 0x1: + raise RuntimeError(f"[TCADP] Encrypted zip entry not supported: {member.filename}") + if self._is_zipinfo_symlink(member): + raise RuntimeError(f"[TCADP] Symlink zip entry not supported: {member.filename}") + if name.startswith("/") or name.startswith("//") or re.match(r"^[A-Za-z]:", name): + raise RuntimeError(f"[TCADP] Unsafe zip path (absolute): {member.filename}") + parts = [p for p in name.split("/") if p not in ("", ".")] + if any(p == ".." for p in parts): + raise RuntimeError(f"[TCADP] Unsafe zip path (traversal): {member.filename}") + + if not (name.endswith(".json") or name.endswith(".md")): + continue + + with zip_file.open(member) as f: + if name.endswith(".json"): + data = json.load(f) + if isinstance(data, list): + results.extend(data) + else: + results.append(data) else: - results.append(data) - - # Find Markdown files - md_files = [f for f in zip_file.namelist() if f.endswith(".md")] - for md_file in md_files: - with zip_file.open(md_file) as f: - content = f.read().decode("utf-8") - results.append({"type": "text", "content": content, "file": md_file}) + content = f.read().decode("utf-8") + results.append({"type": "text", "content": content, "file": name}) except Exception as e: self.logger.error(f"[TCADP] Failed to extract ZIP file content: {e}") @@ -395,7 +415,7 @@ def parse_pdf( # Convert file to Base64 format if callback: callback(0.2, "[TCADP] Converting file to Base64 format") - + file_base64 = self._file_to_base64(file_path, binary) if callback: callback(0.25, f"[TCADP] File converted to Base64, size: {len(file_base64)} characters") @@ -420,23 +440,23 @@ def parse_pdf( "TableResultType": self.table_result_type, "MarkdownImageResponseType": self.markdown_image_response_type } - + self.logger.info(f"[TCADP] API request config - TableResultType: {self.table_result_type}, MarkdownImageResponseType: {self.markdown_image_response_type}") result = client.reconstruct_document_sse( - file_type=file_type, - file_base64=file_base64, - file_start_page=file_start_page, - file_end_page=file_end_page, + file_type=file_type, + file_base64=file_base64, + file_start_page=file_start_page, + file_end_page=file_end_page, config=config ) - + if result: self.logger.info(f"[TCADP] Attempt {attempt + 1} successful") break else: self.logger.warning(f"[TCADP] Attempt {attempt + 1} failed, result is None") - + except Exception as e: self.logger.error(f"[TCADP] Attempt {attempt + 1} exception: {e}") if attempt == max_retries - 1: From 68e5c86e9c13ec06622c5221526c9132c786f929 Mon Sep 17 00:00:00 2001 From: Yongteng Lei Date: Tue, 13 Jan 2026 12:54:13 +0800 Subject: [PATCH 093/335] Fix: image not displaying thumbnails when using pipeline (#12574) ### What problem does this PR solve? Fix image not displaying thumbnails when using pipeline. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/flow/parser/parser.py | 11 ++++++++--- rag/svr/task_executor.py | 5 +++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/rag/flow/parser/parser.py b/rag/flow/parser/parser.py index b681e5d5dc4..a88443b7e49 100644 --- a/rag/flow/parser/parser.py +++ b/rag/flow/parser/parser.py @@ -61,7 +61,7 @@ def __init__(self): "json", ], "image": [ - "text", + "json", ], "email": [ "text", @@ -120,7 +120,7 @@ def __init__(self): "lang": "Chinese", "system_prompt": "", "suffix": ["jpg", "jpeg", "png", "gif"], - "output_format": "text", + "output_format": "json", }, "email": { "suffix": [ @@ -642,7 +642,12 @@ def _image(self, name, blob): else: txt = cv_model.describe(img_binary.read()) - self.set_output("text", txt) + json_result = [{ + "text": txt, + "image": img, + "doc_type_kwd": "image", + }] + self.set_output("json", json_result) def _audio(self, name, blob): import os diff --git a/rag/svr/task_executor.py b/rag/svr/task_executor.py index 7e2352a9bd5..622da383405 100644 --- a/rag/svr/task_executor.py +++ b/rag/svr/task_executor.py @@ -300,6 +300,11 @@ async def upload_to_minio(document, chunk): (chunk["content_with_weight"] + str(d["doc_id"])).encode("utf-8", "surrogatepass")).hexdigest() d["create_time"] = str(datetime.now()).replace("T", " ")[:19] d["create_timestamp_flt"] = datetime.now().timestamp() + + if d.get("img_id"): + docs.append(d) + return + if not d.get("image"): _ = d.pop("image", None) d["img_id"] = "" From accae951263ab46ce0e9c4e4b4f51cd0ae6adf9a Mon Sep 17 00:00:00 2001 From: balibabu Date: Tue, 13 Jan 2026 15:35:45 +0800 Subject: [PATCH 094/335] Feat: Exported Agent JSON Should Include Conversation Variables Configuration #11796 (#12579) ### What problem does this PR solve? Feat: Exported Agent JSON Should Include Conversation Variables Configuration #11796 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- web/src/hooks/use-agent-request.ts | 1 + web/src/pages/agent/hooks/use-export-json.ts | 4 ++- .../pages/agents/hooks/use-create-agent.ts | 1 + web/src/pages/agents/use-import-json.ts | 36 ++++++++++++------- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/web/src/hooks/use-agent-request.ts b/web/src/hooks/use-agent-request.ts index 4ac0abc7c3f..482677acd3e 100644 --- a/web/src/hooks/use-agent-request.ts +++ b/web/src/hooks/use-agent-request.ts @@ -97,6 +97,7 @@ export const EmptyDsl = { retrieval: [], // reference history: [], path: [], + variables: [], globals: { [AgentGlobals.SysQuery]: '', [AgentGlobals.SysUserId]: '', diff --git a/web/src/pages/agent/hooks/use-export-json.ts b/web/src/pages/agent/hooks/use-export-json.ts index 2f2e9242e8a..ef7d27ef0bc 100644 --- a/web/src/pages/agent/hooks/use-export-json.ts +++ b/web/src/pages/agent/hooks/use-export-json.ts @@ -1,5 +1,6 @@ import { useFetchAgent } from '@/hooks/use-agent-request'; import { downloadJsonFile } from '@/utils/file-util'; +import { pick } from 'lodash'; import { useCallback } from 'react'; import { useBuildDslData } from './use-build-dsl'; @@ -8,7 +9,8 @@ export const useHandleExportJsonFile = () => { const { data } = useFetchAgent(); const handleExportJson = useCallback(() => { - downloadJsonFile(buildDslData().graph, `${data.title}.json`); + const dsl = pick(buildDslData(), ['graph', 'globals', 'variables']); + downloadJsonFile(dsl, `${data.title}.json`); }, [buildDslData, data.title]); return { diff --git a/web/src/pages/agents/hooks/use-create-agent.ts b/web/src/pages/agents/hooks/use-create-agent.ts index 7f3c61c3573..74506964cae 100644 --- a/web/src/pages/agents/hooks/use-create-agent.ts +++ b/web/src/pages/agents/hooks/use-create-agent.ts @@ -71,6 +71,7 @@ export const DataflowEmptyDsl = { history: [], path: [], globals: {}, + variables: [], }; export function useCreateAgentOrPipeline() { diff --git a/web/src/pages/agents/use-import-json.ts b/web/src/pages/agents/use-import-json.ts index e402475951f..4fcac200c96 100644 --- a/web/src/pages/agents/use-import-json.ts +++ b/web/src/pages/agents/use-import-json.ts @@ -34,25 +34,36 @@ export const useHandleImportJsonFile = () => { return; } - const graphStr = await file.text(); + const graphOrDslStr = await file.text(); const errorMessage = t('flow.jsonUploadContentErrorMessage'); try { - const graph = JSON.parse(graphStr); - if (graphStr && !isEmpty(graph) && Array.isArray(graph?.nodes)) { - const nodes: Node[] = graph.nodes; - + const graphOrDsl = JSON.parse(graphOrDslStr); + if (graphOrDslStr && !isEmpty(graphOrDsl)) { let isAgent = true; + // Compatible with older versions + const graph = graphOrDsl?.graph ? graphOrDsl.graph : graphOrDsl; + if (Array.isArray(graph?.nodes)) { + const nodes: Node[] = graph.nodes; - if ( - hasNode(nodes, DataflowOperator.Begin) && - hasNode(nodes, DataflowOperator.Parser) - ) { - isAgent = false; + if ( + hasNode(nodes, DataflowOperator.Begin) && + hasNode(nodes, DataflowOperator.Parser) + ) { + isAgent = false; + } } const dsl = isAgent - ? { ...EmptyDsl, graph } - : { ...DataflowEmptyDsl, graph }; + ? { ...EmptyDsl, graph: graph } + : { ...DataflowEmptyDsl, graph: graph }; + + if (graphOrDsl.globals) { + dsl.globals = graphOrDsl.globals; + } + + if (graphOrDsl.variables) { + dsl.variables = graphOrDsl.variables; + } setAgent({ title: name, @@ -66,6 +77,7 @@ export const useHandleImportJsonFile = () => { message.error(errorMessage); } } catch (error) { + console.log('🚀 ~ useHandleImportJsonFile ~ error:', error); message.error(errorMessage); } } From 34d74d99280a4ab6c58bb377105fdd7de11b6d33 Mon Sep 17 00:00:00 2001 From: He Wang Date: Tue, 13 Jan 2026 15:37:32 +0800 Subject: [PATCH 095/335] fix: add uv-aarch64-unknown-linux-gnu.tar.gz to deps image (#12516) ### What problem does this PR solve? Add uv-aarch64-unknown-linux-gnu.tar.gz to support building ARM64 Docker images. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) Co-authored-by: Liu An --- Dockerfile | 8 +++++--- Dockerfile.deps | 2 +- download_deps.py | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index a1eb2433932..48a3e687d70 100644 --- a/Dockerfile +++ b/Dockerfile @@ -64,9 +64,11 @@ RUN --mount=type=bind,from=infiniflow/ragflow_deps:latest,source=/,target=/deps echo 'url = "https://pypi.tuna.tsinghua.edu.cn/simple"' >> /etc/uv/uv.toml && \ echo 'default = true' >> /etc/uv/uv.toml; \ fi; \ - tar xzf /deps/uv-x86_64-unknown-linux-gnu.tar.gz \ - && cp uv-x86_64-unknown-linux-gnu/* /usr/local/bin/ \ - && rm -rf uv-x86_64-unknown-linux-gnu \ + arch="$(uname -m)"; \ + if [ "$arch" = "x86_64" ]; then uv_arch="x86_64"; else uv_arch="aarch64"; fi; \ + tar xzf "/deps/uv-${uv_arch}-unknown-linux-gnu.tar.gz" \ + && cp "uv-${uv_arch}-unknown-linux-gnu/"* /usr/local/bin/ \ + && rm -rf "uv-${uv_arch}-unknown-linux-gnu" \ && uv python install 3.12 ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 diff --git a/Dockerfile.deps b/Dockerfile.deps index 0405519d813..591b99eb83e 100644 --- a/Dockerfile.deps +++ b/Dockerfile.deps @@ -3,7 +3,7 @@ FROM scratch # Copy resources downloaded via download_deps.py -COPY chromedriver-linux64-121-0-6167-85 chrome-linux64-121-0-6167-85 cl100k_base.tiktoken libssl1.1_1.1.1f-1ubuntu2_amd64.deb libssl1.1_1.1.1f-1ubuntu2_arm64.deb tika-server-standard-3.2.3.jar tika-server-standard-3.2.3.jar.md5 libssl*.deb uv-x86_64-unknown-linux-gnu.tar.gz / +COPY chromedriver-linux64-121-0-6167-85 chrome-linux64-121-0-6167-85 cl100k_base.tiktoken libssl1.1_1.1.1f-1ubuntu2_amd64.deb libssl1.1_1.1.1f-1ubuntu2_arm64.deb tika-server-standard-3.2.3.jar tika-server-standard-3.2.3.jar.md5 libssl*.deb uv-x86_64-unknown-linux-gnu.tar.gz uv-aarch64-unknown-linux-gnu.tar.gz / COPY nltk_data /nltk_data diff --git a/download_deps.py b/download_deps.py index 06de7349d32..cbaf0a6373d 100644 --- a/download_deps.py +++ b/download_deps.py @@ -29,6 +29,7 @@ def get_urls(use_china_mirrors=False) -> list[Union[str, list[str]]]: ["https://registry.npmmirror.com/-/binary/chrome-for-testing/121.0.6167.85/linux64/chrome-linux64.zip", "chrome-linux64-121-0-6167-85"], ["https://registry.npmmirror.com/-/binary/chrome-for-testing/121.0.6167.85/linux64/chromedriver-linux64.zip", "chromedriver-linux64-121-0-6167-85"], "https://github.com/astral-sh/uv/releases/download/0.9.16/uv-x86_64-unknown-linux-gnu.tar.gz", + "https://github.com/astral-sh/uv/releases/download/0.9.16/uv-aarch64-unknown-linux-gnu.tar.gz", ] else: return [ @@ -40,6 +41,7 @@ def get_urls(use_china_mirrors=False) -> list[Union[str, list[str]]]: ["https://storage.googleapis.com/chrome-for-testing-public/121.0.6167.85/linux64/chrome-linux64.zip", "chrome-linux64-121-0-6167-85"], ["https://storage.googleapis.com/chrome-for-testing-public/121.0.6167.85/linux64/chromedriver-linux64.zip", "chromedriver-linux64-121-0-6167-85"], "https://github.com/astral-sh/uv/releases/download/0.9.16/uv-x86_64-unknown-linux-gnu.tar.gz", + "https://github.com/astral-sh/uv/releases/download/0.9.16/uv-aarch64-unknown-linux-gnu.tar.gz", ] From 947e63ca14f437379d3ef3dc35122831480e6e9e Mon Sep 17 00:00:00 2001 From: LIRUI YU <128563231+LiruiYu33@users.noreply.github.com> Date: Tue, 13 Jan 2026 17:02:36 +0800 Subject: [PATCH 096/335] Fixed typos and added pptx preview for frontend (#12577) ### What problem does this PR solve? Previously, we added support for previewing PPT and PPTX files in the backend. Now, we are adding it to the frontend, so when the slides in the chat interface are referenced, they will no longer be blank. ### Type of change - Bug Fix (non-breaking change which fixes an issue) --- api/utils/web_utils.py | 2 +- web/src/components/document-preview/index.tsx | 2 +- web/src/pages/document-viewer/index.tsx | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/api/utils/web_utils.py b/api/utils/web_utils.py index c13889be23d..2d262293115 100644 --- a/api/utils/web_utils.py +++ b/api/utils/web_utils.py @@ -88,7 +88,7 @@ "heic": "image/heic", # PPTX "ppt": "application/vnd.ms-powerpoint", - "pptx": "application/vnd.openxmLformats-officedocument.presentationml.presentation", + "pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation", } diff --git a/web/src/components/document-preview/index.tsx b/web/src/components/document-preview/index.tsx index 968dba3c8a0..334cae4511e 100644 --- a/web/src/components/document-preview/index.tsx +++ b/web/src/components/document-preview/index.tsx @@ -67,7 +67,7 @@ const Preview = ({ )} - {['pptx'].indexOf(fileType) > -1 && ( + {['ppt', 'pptx'].indexOf(fileType) > -1 && (
    diff --git a/web/src/pages/document-viewer/index.tsx b/web/src/pages/document-viewer/index.tsx index 3a01ea55545..9bcd60c0f98 100644 --- a/web/src/pages/document-viewer/index.tsx +++ b/web/src/pages/document-viewer/index.tsx @@ -13,6 +13,7 @@ import { ExcelCsvPreviewer } from '@/components/document-preview/excel-preview'; import { ImagePreviewer } from '@/components/document-preview/image-preview'; import Md from '@/components/document-preview/md'; import PdfPreview from '@/components/document-preview/pdf-preview'; +import { PptPreviewer } from '@/components/document-preview/ppt-preview'; import { TxtPreviewer } from '@/components/document-preview/txt-preview'; import { previewHtmlFile } from '@/utils/file-util'; // import styles from './index.less'; @@ -53,6 +54,10 @@ const DocumentViewer = () => { )} {ext === 'docx' && } + + {(ext === 'ppt' || ext === 'pptx') && ( + + )} ); }; From ffedb2c6d344ede0c1a0427dfb9421824b3f921c Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Tue, 13 Jan 2026 17:03:25 +0800 Subject: [PATCH 097/335] =?UTF-8?q?Feat:=20The=20MetadataFilterConditions?= =?UTF-8?q?=20component=20supports=20adding=20values=20=E2=80=8B=E2=80=8Bv?= =?UTF-8?q?ia=20search.=20(#12585)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What problem does this PR solve? Feat: The MetadataFilterConditions component supports adding values ​​via search. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- .../metadata-filter-conditions.tsx | 159 +++++---- web/src/components/ui/input-select.tsx | 303 ++++++++++++++++++ .../modal/paddleocr-modal/index.tsx | 26 +- 3 files changed, 411 insertions(+), 77 deletions(-) create mode 100644 web/src/components/ui/input-select.tsx diff --git a/web/src/components/metadata-filter/metadata-filter-conditions.tsx b/web/src/components/metadata-filter/metadata-filter-conditions.tsx index 599a6ed805c..1ddf90acf99 100644 --- a/web/src/components/metadata-filter/metadata-filter-conditions.tsx +++ b/web/src/components/metadata-filter/metadata-filter-conditions.tsx @@ -20,10 +20,11 @@ import { useBuildSwitchOperatorOptions } from '@/hooks/logic-hooks/use-build-ope import { useFetchKnowledgeMetadata } from '@/hooks/use-knowledge-request'; import { PromptEditor } from '@/pages/agent/form/components/prompt-editor'; import { Plus, X } from 'lucide-react'; -import { useCallback } from 'react'; -import { useFieldArray, useFormContext } from 'react-hook-form'; +import { useCallback, useMemo } from 'react'; +import { useFieldArray, useFormContext, useWatch } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import { LogicalOperator } from '../logical-operator'; +import { InputSelect } from '../ui/input-select'; export function MetadataFilterConditions({ kbIds, @@ -61,6 +62,94 @@ export function MetadataFilterConditions({ [append, fields.length, form, logic], ); + const RenderField = ({ + fieldName, + index, + }: { + fieldName: string; + index: number; + }) => { + const form = useFormContext(); + const key = useWatch({ name: fieldName }); + const valueOptions = useMemo(() => { + if (!key || !metadata?.data || !metadata?.data[key]) return []; + if (typeof metadata?.data[key] === 'object') { + return Object.keys(metadata?.data[key]).map((item: string) => ({ + value: item, + label: item, + })); + } + return []; + }, [key]); + + return ( +
    +
    +
    + ( + + + + + + + )} + /> + + ( + + + + + + + )} + /> +
    + ( + + + {canReference ? ( + + ) : ( + + )} + + + + )} + /> +
    + +
    + ); + }; return (
    @@ -84,73 +173,11 @@ export function MetadataFilterConditions({
    {fields.length > 1 && } -
    +
    {fields.map((field, index) => { const typeField = `${name}.${index}.key`; return ( -
    -
    -
    - ( - - - - - - - )} - /> - - ( - - - - - - - )} - /> -
    - ( - - - {canReference ? ( - - ) : ( - - )} - - - - )} - /> -
    - -
    + ); })}
    diff --git a/web/src/components/ui/input-select.tsx b/web/src/components/ui/input-select.tsx new file mode 100644 index 00000000000..9c70999444a --- /dev/null +++ b/web/src/components/ui/input-select.tsx @@ -0,0 +1,303 @@ +import { Input } from '@/components/ui/input'; +import { cn } from '@/lib/utils'; +import { X } from 'lucide-react'; +import * as React from 'react'; +import { useTranslation } from 'react-i18next'; +import { Popover, PopoverContent, PopoverTrigger } from './popover'; + +/** Interface for tag select options */ +export interface InputSelectOption { + /** Value of the option */ + value: string; + /** Display label of the option */ + label: string; +} + +/** Properties for the InputSelect component */ +export interface InputSelectProps { + /** Options for the select component */ + options?: InputSelectOption[]; + /** Selected values - string for single select, array for multi select */ + value?: string | string[]; + /** Callback when value changes */ + onChange?: (value: string | string[]) => void; + /** Placeholder text */ + placeholder?: string; + /** Additional class names */ + className?: string; + /** Style object */ + style?: React.CSSProperties; + /** Whether to allow multiple selections */ + multi?: boolean; +} + +const InputSelect = React.forwardRef( + ( + { + options = [], + value = [], + onChange, + placeholder = 'Select tags...', + className, + style, + multi = false, + }, + ref, + ) => { + const [inputValue, setInputValue] = React.useState(''); + const [open, setOpen] = React.useState(false); + const [isFocused, setIsFocused] = React.useState(false); + const inputRef = React.useRef(null); + const { t } = useTranslation(); + + // Normalize value to array for consistent handling + const normalizedValue = Array.isArray(value) ? value : value ? [value] : []; + + /** + * Removes a tag from the selected values + * @param tagValue - The value of the tag to remove + */ + const handleRemoveTag = (tagValue: string) => { + const newValue = normalizedValue.filter((v) => v !== tagValue); + // Return single value if not multi-select, otherwise return array + onChange?.(multi ? newValue : newValue[0] || ''); + }; + + /** + * Adds a tag to the selected values + * @param optionValue - The value of the tag to add + */ + const handleAddTag = (optionValue: string) => { + let newValue: string[]; + + if (multi) { + // For multi-select, add to array if not already included + if (!normalizedValue.includes(optionValue)) { + newValue = [...normalizedValue, optionValue]; + onChange?.(newValue); + } + } else { + // For single-select, replace the value + newValue = [optionValue]; + onChange?.(optionValue); + } + + setInputValue(''); + setOpen(false); // Close the popover after adding a tag + }; + + const handleInputChange = (e: React.ChangeEvent) => { + const newValue = e.target.value; + setInputValue(newValue); + setOpen(newValue.length > 0); // Open popover when there's input + + // If input matches an option exactly, add it + const matchedOption = options.find( + (opt) => opt.label.toLowerCase() === newValue.toLowerCase(), + ); + + if (matchedOption && !normalizedValue.includes(matchedOption.value)) { + handleAddTag(matchedOption.value); + } + }; + + const handleKeyDown = (e: React.KeyboardEvent) => { + if ( + e.key === 'Backspace' && + inputValue === '' && + normalizedValue.length > 0 + ) { + // Remove last tag when pressing backspace on empty input + const newValue = [...normalizedValue]; + newValue.pop(); + // Return single value if not multi-select, otherwise return array + onChange?.(multi ? newValue : newValue[0] || ''); + } else if (e.key === 'Enter' && inputValue.trim() !== '') { + e.preventDefault(); + // Add input value as a new tag if it doesn't exist in options + const matchedOption = options.find( + (opt) => opt.label.toLowerCase() === inputValue.toLowerCase(), + ); + + if (matchedOption) { + handleAddTag(matchedOption.value); + } else { + // If not in options, create a new tag with the input value + if ( + !normalizedValue.includes(inputValue) && + inputValue.trim() !== '' + ) { + handleAddTag(inputValue); + } + } + } else if (e.key === 'Escape') { + inputRef.current?.blur(); + setOpen(false); + } else if (e.key === 'ArrowDown' || e.key === 'ArrowUp') { + // Allow navigation in the dropdown + return; + } + }; + + const handleContainerClick = () => { + inputRef.current?.focus(); + setOpen(true); + setIsFocused(true); + }; + + const handleInputFocus = () => { + setOpen(true); + setIsFocused(true); + }; + + const handleInputBlur = () => { + // Delay closing to allow click on options + setTimeout(() => { + setOpen(false); + setIsFocused(false); + }, 150); + }; + + // Filter options to exclude already selected ones (only for multi-select) + const availableOptions = multi + ? options.filter((option) => !normalizedValue.includes(option.value)) + : options; + + const filteredOptions = availableOptions.filter( + (option) => + !inputValue || + option.label.toLowerCase().includes(inputValue.toLowerCase()), + ); + + // If there are no matching options but there is an input value, create a new option with the input value + const hasMatchingOptions = filteredOptions.length > 0; + const showInputAsOption = + inputValue && + !hasMatchingOptions && + !normalizedValue.includes(inputValue); + + const triggerElement = ( +
    + {/* Render selected tags - only show tags if multi is true or if single select has a value */} + {multi && + normalizedValue.map((tagValue) => { + const option = options.find((opt) => opt.value === tagValue) || { + value: tagValue, + label: tagValue, + }; + return ( +
    + {option.label} + +
    + ); + })} + + {/* For single select, show the selected value as text instead of a tag */} + {!multi && normalizedValue[0] && ( +
    +
    + {options.find((opt) => opt.value === normalizedValue[0])?.label || + normalizedValue[0]} +
    + +
    + )} + + {/* Input field for adding new tags - hide if single select and value is already selected, or in multi select when not focused */} + {(multi ? isFocused : multi || !normalizedValue[0]) && ( + e.stopPropagation()} + onFocus={handleInputFocus} + onBlur={handleInputBlur} + /> + )} +
    + ); + + return ( + + {triggerElement} + e.preventDefault()} // Prevent auto focus on content + > +
    + {filteredOptions.length > 0 && + filteredOptions.map((option) => ( +
    handleAddTag(option.value)} + > + {option.label} +
    + ))} + {showInputAsOption && ( +
    handleAddTag(inputValue)} + > + {t('common.add')} "{inputValue}" +
    + )} + {filteredOptions.length === 0 && !showInputAsOption && ( +
    + {t('common.noResults')} +
    + )} +
    +
    +
    + ); + }, +); + +InputSelect.displayName = 'InputSelect'; + +export { InputSelect }; diff --git a/web/src/pages/user-setting/setting-model/modal/paddleocr-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/paddleocr-modal/index.tsx index 5c4fcbfef5c..2aab764af10 100644 --- a/web/src/pages/user-setting/setting-model/modal/paddleocr-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/modal/paddleocr-modal/index.tsx @@ -1,20 +1,20 @@ -import { useForm } from 'react-hook-form'; -import { useTranslation } from 'react-i18next'; -import { z } from 'zod'; -import { zodResolver } from '@hookform/resolvers/zod'; -import { t } from 'i18next'; +import { RAGFlowFormItem } from '@/components/ragflow-form'; import { Dialog, DialogContent, DialogHeader, DialogTitle, } from '@/components/ui/dialog'; -import { RAGFlowFormItem } from '@/components/ragflow-form'; -import { RAGFlowSelect, RAGFlowSelectOptionType } from '@/components/ui/select'; -import { Input } from '@/components/ui/input'; import { Form } from '@/components/ui/form'; -import { LLMHeader } from '../../components/llm-header'; +import { Input } from '@/components/ui/input'; +import { RAGFlowSelect, RAGFlowSelectOptionType } from '@/components/ui/select'; import { LLMFactory } from '@/constants/llm'; +import { zodResolver } from '@hookform/resolvers/zod'; +import { t } from 'i18next'; +import { useForm } from 'react-hook-form'; +import { useTranslation } from 'react-i18next'; +import { z } from 'zod'; +import { LLMHeader } from '../../components/llm-header'; const FormSchema = z.object({ llm_name: z.string().min(1, { @@ -81,7 +81,9 @@ const PaddleOCRModal = ({ label={t('setting.modelName')} required > - + - + Date: Tue, 13 Jan 2026 17:39:20 +0800 Subject: [PATCH 098/335] fix(ob_conn): avoid reusing SQLAlchemy Column objects in DDL (#12588) ### What problem does this PR solve? When there are multiple users, parsing a document for a new user can trigger the reuse of column objects, leading to the error `sqlalchemy.exc.ArgumentError: Column object 'id' already assigned to Table xxx`. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/utils/ob_conn.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rag/utils/ob_conn.py b/rag/utils/ob_conn.py index d0099a81b8e..6f6457cda9b 100644 --- a/rag/utils/ob_conn.py +++ b/rag/utils/ob_conn.py @@ -658,7 +658,7 @@ def _create_table(self, table_name: str): self.client.create_table( table_name=table_name, - columns=column_definitions, + columns=[c.copy() for c in column_definitions], **table_options, ) logger.info(f"Created table '{table_name}'.") @@ -711,7 +711,7 @@ def _add_column(self, table_name: str, column: Column): try: self.client.add_columns( table_name=table_name, - columns=[column], + columns=[column.copy()], ) logger.info(f"Added column '{column.name}' to table '{table_name}'.") except Exception as e: From 941651a16fd69de67b642d2b1bc5052f9a15d4d3 Mon Sep 17 00:00:00 2001 From: Yongteng Lei Date: Tue, 13 Jan 2026 17:54:57 +0800 Subject: [PATCH 099/335] Fix: wrong input trace in Category component (#12590) ### What problem does this PR solve? Wrong input trace in Category component ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- agent/component/categorize.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/agent/component/categorize.py b/agent/component/categorize.py index 27cffb91c88..0804ca64a0c 100644 --- a/agent/component/categorize.py +++ b/agent/component/categorize.py @@ -97,6 +97,13 @@ def update_prompt(self): class Categorize(LLM, ABC): component_name = "Categorize" + def get_input_elements(self) -> dict[str, dict]: + query_key = self._param.query or "sys.query" + elements = self.get_input_elements_from_text(f"{{{query_key}}}") + if not elements: + logging.warning(f"[Categorize] input element not detected for query key: {query_key}") + return elements + @timeout(int(os.environ.get("COMPONENT_EXEC_TIMEOUT", 10*60))) async def _invoke_async(self, **kwargs): if self.check_if_canceled("Categorize processing"): @@ -105,12 +112,15 @@ async def _invoke_async(self, **kwargs): msg = self._canvas.get_history(self._param.message_history_window_size) if not msg: msg = [{"role": "user", "content": ""}] - if kwargs.get("sys.query"): - msg[-1]["content"] = kwargs["sys.query"] - self.set_input_value("sys.query", kwargs["sys.query"]) + query_key = self._param.query or "sys.query" + if query_key in kwargs: + query_value = kwargs[query_key] else: - msg[-1]["content"] = self._canvas.get_variable_value(self._param.query) - self.set_input_value(self._param.query, msg[-1]["content"]) + query_value = self._canvas.get_variable_value(query_key) + if query_value is None: + query_value = "" + msg[-1]["content"] = query_value + self.set_input_value(query_key, msg[-1]["content"]) self._param.update_prompt() chat_mdl = LLMBundle(self._canvas.get_tenant_id(), LLMType.CHAT, self._param.llm_id) From 0795616b34128b117034596cb26d98415fb3b147 Mon Sep 17 00:00:00 2001 From: 6ba3i <112825897+6ba3i@users.noreply.github.com> Date: Tue, 13 Jan 2026 19:22:47 +0800 Subject: [PATCH 100/335] Align p3 HTTP/SDK tests with current backend behavior (#12563) ### What problem does this PR solve? Updates pre-existing HTTP API and SDK tests to align with current backend behavior (validation errors, 404s, and schema defaults). This ensures p3 regression coverage is accurate without changing production code. ### Type of change - [x] Other (please describe): align p3 HTTP/SDK tests with current backend behavior --------- Co-authored-by: Liu An --- api/apps/__init__.py | 1 - api/apps/sdk/chat.py | 2 +- api/utils/validation_utils.py | 2 ++ test/testcases/configs.py | 1 + .../test_add_chunk.py | 14 +++------ .../test_delete_chunks.py | 12 ++------ .../test_list_chunks.py | 14 +++------ .../test_update_chunk.py | 17 +++++------ .../test_update_dataset.py | 21 ++++++++++++-- .../test_download_document.py | 11 ++++--- .../test_update_document.py | 8 ++--- .../test_upload_documents.py | 17 ++++++----- .../test_http_api/test_router_errors.py | 29 +++++++++++++++++++ ...test_update_session_with_chat_assistant.py | 5 ++-- .../test_update_dataset.py | 6 ++++ 15 files changed, 94 insertions(+), 66 deletions(-) create mode 100644 test/testcases/test_http_api/test_router_errors.py diff --git a/api/apps/__init__.py b/api/apps/__init__.py index 6e0f89c67bc..98882a58a0a 100644 --- a/api/apps/__init__.py +++ b/api/apps/__init__.py @@ -265,7 +265,6 @@ async def not_found(error): "message": error_msg, }, 404 - @app.teardown_request def _db_close(exception): if exception: diff --git a/api/apps/sdk/chat.py b/api/apps/sdk/chat.py index 4321d736619..786d1a733f7 100644 --- a/api/apps/sdk/chat.py +++ b/api/apps/sdk/chat.py @@ -176,7 +176,7 @@ async def update(tenant_id, chat_id): req["llm_id"] = llm.pop("model_name") if req.get("llm_id") is not None: llm_name, llm_factory = TenantLLMService.split_model_name_and_factory(req["llm_id"]) - model_type = llm.pop("model_type") + model_type = llm.get("model_type") model_type = model_type if model_type in ["chat", "image2text"] else "chat" if not TenantLLMService.query(tenant_id=tenant_id, llm_name=llm_name, llm_factory=llm_factory, model_type=model_type): return get_error_data_result(f"`model_name` {req.get('llm_id')} doesn't exist") diff --git a/api/utils/validation_utils.py b/api/utils/validation_utils.py index 2dcace53fe9..d6178e641f4 100644 --- a/api/utils/validation_utils.py +++ b/api/utils/validation_utils.py @@ -82,6 +82,8 @@ async def validate_and_parse_json_request(request: Request, validator: type[Base 2. Extra fields added via `extras` parameter are automatically removed from the final output after validation """ + if request.mimetype != "application/json": + return None, f"Unsupported content type: Expected application/json, got {request.content_type}" try: payload = await request.get_json() or {} except UnsupportedMediaType: diff --git a/test/testcases/configs.py b/test/testcases/configs.py index 54fa56657b3..9700da23f2e 100644 --- a/test/testcases/configs.py +++ b/test/testcases/configs.py @@ -30,6 +30,7 @@ X8f7fp9c7vUsfOCkM+gHY3PadG+QHa7KI7mzTKgUTZImK6BZtfRBATDTthEUbbaTewY4H0MnWiCeeDhcbeQao6cFy1To8pE3RpmxnGnS8BsBn8w==""" INVALID_API_TOKEN = "invalid_key_123" +INVALID_ID_32 = "0" * 32 DATASET_NAME_LIMIT = 128 DOCUMENT_NAME_LIMIT = 255 CHAT_ASSISTANT_NAME_LIMIT = 255 diff --git a/test/testcases/test_http_api/test_chunk_management_within_dataset/test_add_chunk.py b/test/testcases/test_http_api/test_chunk_management_within_dataset/test_add_chunk.py index d46469d91cb..cc2a00d624b 100644 --- a/test/testcases/test_http_api/test_chunk_management_within_dataset/test_add_chunk.py +++ b/test/testcases/test_http_api/test_chunk_management_within_dataset/test_add_chunk.py @@ -17,7 +17,7 @@ import pytest from common import add_chunk, delete_documents, list_chunks -from configs import INVALID_API_TOKEN +from configs import INVALID_API_TOKEN, INVALID_ID_32 from libs.auth import RAGFlowHttpApiAuth @@ -152,12 +152,7 @@ def test_questions(self, HttpApiAuth, add_document, payload, expected_code, expe @pytest.mark.parametrize( "dataset_id, expected_code, expected_message", [ - ("", 100, ""), - ( - "invalid_dataset_id", - 102, - "You don't own the dataset invalid_dataset_id.", - ), + (INVALID_ID_32, 102, f"You don't own the dataset {INVALID_ID_32}."), ], ) def test_invalid_dataset_id( @@ -177,11 +172,10 @@ def test_invalid_dataset_id( @pytest.mark.parametrize( "document_id, expected_code, expected_message", [ - ("", 100, ""), ( - "invalid_document_id", + INVALID_ID_32, 102, - "You don't own the document invalid_document_id.", + f"You don't own the document {INVALID_ID_32}.", ), ], ) diff --git a/test/testcases/test_http_api/test_chunk_management_within_dataset/test_delete_chunks.py b/test/testcases/test_http_api/test_chunk_management_within_dataset/test_delete_chunks.py index 69f1744e288..580a2974c26 100644 --- a/test/testcases/test_http_api/test_chunk_management_within_dataset/test_delete_chunks.py +++ b/test/testcases/test_http_api/test_chunk_management_within_dataset/test_delete_chunks.py @@ -17,7 +17,7 @@ import pytest from common import batch_add_chunks, delete_chunks, list_chunks -from configs import INVALID_API_TOKEN +from configs import INVALID_API_TOKEN, INVALID_ID_32 from libs.auth import RAGFlowHttpApiAuth @@ -45,12 +45,7 @@ class TestChunksDeletion: @pytest.mark.parametrize( "dataset_id, expected_code, expected_message", [ - ("", 100, ""), - ( - "invalid_dataset_id", - 102, - "You don't own the dataset invalid_dataset_id.", - ), + (INVALID_ID_32, 102, f"You don't own the dataset {INVALID_ID_32}."), ], ) def test_invalid_dataset_id(self, HttpApiAuth, add_chunks_func, dataset_id, expected_code, expected_message): @@ -63,8 +58,7 @@ def test_invalid_dataset_id(self, HttpApiAuth, add_chunks_func, dataset_id, expe @pytest.mark.parametrize( "document_id, expected_code, expected_message", [ - ("", 100, ""), - ("invalid_document_id", 100, """LookupError("Can't find the document with ID invalid_document_id!")"""), + (INVALID_ID_32, 100, f"""LookupError("Can't find the document with ID {INVALID_ID_32}!")"""), ], ) def test_invalid_document_id(self, HttpApiAuth, add_chunks_func, document_id, expected_code, expected_message): diff --git a/test/testcases/test_http_api/test_chunk_management_within_dataset/test_list_chunks.py b/test/testcases/test_http_api/test_chunk_management_within_dataset/test_list_chunks.py index 3c8603c72fc..4605f12218b 100644 --- a/test/testcases/test_http_api/test_chunk_management_within_dataset/test_list_chunks.py +++ b/test/testcases/test_http_api/test_chunk_management_within_dataset/test_list_chunks.py @@ -18,7 +18,7 @@ import pytest from common import batch_add_chunks, list_chunks -from configs import INVALID_API_TOKEN +from configs import INVALID_API_TOKEN, INVALID_ID_32 from libs.auth import RAGFlowHttpApiAuth @@ -177,12 +177,7 @@ def test_default(self, HttpApiAuth, add_document): @pytest.mark.parametrize( "dataset_id, expected_code, expected_message", [ - ("", 100, ""), - ( - "invalid_dataset_id", - 102, - "You don't own the dataset invalid_dataset_id.", - ), + (INVALID_ID_32, 102, f"You don't own the dataset {INVALID_ID_32}."), ], ) def test_invalid_dataset_id(self, HttpApiAuth, add_chunks, dataset_id, expected_code, expected_message): @@ -195,11 +190,10 @@ def test_invalid_dataset_id(self, HttpApiAuth, add_chunks, dataset_id, expected_ @pytest.mark.parametrize( "document_id, expected_code, expected_message", [ - ("", 102, "The dataset not own the document chunks."), ( - "invalid_document_id", + INVALID_ID_32, 102, - "You don't own the document invalid_document_id.", + f"You don't own the document {INVALID_ID_32}.", ), ], ) diff --git a/test/testcases/test_http_api/test_chunk_management_within_dataset/test_update_chunk.py b/test/testcases/test_http_api/test_chunk_management_within_dataset/test_update_chunk.py index 3ac445df64a..76d73b4bd5b 100644 --- a/test/testcases/test_http_api/test_chunk_management_within_dataset/test_update_chunk.py +++ b/test/testcases/test_http_api/test_chunk_management_within_dataset/test_update_chunk.py @@ -19,7 +19,7 @@ import pytest from common import delete_documents, update_chunk -from configs import INVALID_API_TOKEN +from configs import INVALID_API_TOKEN, INVALID_ID_32 from libs.auth import RAGFlowHttpApiAuth @@ -145,9 +145,8 @@ def test_available( @pytest.mark.parametrize( "dataset_id, expected_code, expected_message", [ - ("", 100, ""), - pytest.param("invalid_dataset_id", 102, "You don't own the dataset invalid_dataset_id.", marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") == "infinity", reason="infinity")), - pytest.param("invalid_dataset_id", 102, "Can't find this chunk", marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") in [None, "opensearch", "elasticsearch"], reason="elasticsearch")), + pytest.param(INVALID_ID_32, 102, f"You don't own the dataset {INVALID_ID_32}.", marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") == "infinity", reason="infinity")), + pytest.param(INVALID_ID_32, 102, "Can't find this chunk", marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") in [None, "opensearch", "elasticsearch"], reason="elasticsearch")), ], ) def test_invalid_dataset_id(self, HttpApiAuth, add_chunks, dataset_id, expected_code, expected_message): @@ -160,11 +159,10 @@ def test_invalid_dataset_id(self, HttpApiAuth, add_chunks, dataset_id, expected_ @pytest.mark.parametrize( "document_id, expected_code, expected_message", [ - ("", 100, ""), ( - "invalid_document_id", + INVALID_ID_32, 102, - "You don't own the document invalid_document_id.", + f"You don't own the document {INVALID_ID_32}.", ), ], ) @@ -178,11 +176,10 @@ def test_invalid_document_id(self, HttpApiAuth, add_chunks, document_id, expecte @pytest.mark.parametrize( "chunk_id, expected_code, expected_message", [ - ("", 100, ""), ( - "invalid_document_id", + INVALID_ID_32, 102, - "Can't find this chunk invalid_document_id", + f"Can't find this chunk {INVALID_ID_32}", ), ], ) diff --git a/test/testcases/test_http_api/test_dataset_management/test_update_dataset.py b/test/testcases/test_http_api/test_dataset_management/test_update_dataset.py index e3d0d86a460..8f84cf02504 100644 --- a/test/testcases/test_http_api/test_dataset_management/test_update_dataset.py +++ b/test/testcases/test_http_api/test_dataset_management/test_update_dataset.py @@ -770,7 +770,12 @@ def test_parser_config_empty_with_chunk_method_change(self, HttpApiAuth, add_dat res = list_datasets(HttpApiAuth) assert res["code"] == 0, res - assert res["data"][0]["parser_config"] == {"raptor": {"use_raptor": False}, "graphrag": {"use_graphrag": False}}, res + assert res["data"][0]["parser_config"] == { + "raptor": {"use_raptor": False}, + "graphrag": {"use_graphrag": False}, + "image_context_size": 0, + "table_context_size": 0, + }, res @pytest.mark.p3 def test_parser_config_unset_with_chunk_method_change(self, HttpApiAuth, add_dataset_func): @@ -781,7 +786,12 @@ def test_parser_config_unset_with_chunk_method_change(self, HttpApiAuth, add_dat res = list_datasets(HttpApiAuth) assert res["code"] == 0, res - assert res["data"][0]["parser_config"] == {"raptor": {"use_raptor": False}, "graphrag": {"use_graphrag": False}}, res + assert res["data"][0]["parser_config"] == { + "raptor": {"use_raptor": False}, + "graphrag": {"use_graphrag": False}, + "image_context_size": 0, + "table_context_size": 0, + }, res @pytest.mark.p3 def test_parser_config_none_with_chunk_method_change(self, HttpApiAuth, add_dataset_func): @@ -792,7 +802,12 @@ def test_parser_config_none_with_chunk_method_change(self, HttpApiAuth, add_data res = list_datasets(HttpApiAuth, {"id": dataset_id}) assert res["code"] == 0, res - assert res["data"][0]["parser_config"] == {"raptor": {"use_raptor": False}, "graphrag": {"use_graphrag": False}}, res + assert res["data"][0]["parser_config"] == { + "raptor": {"use_raptor": False}, + "graphrag": {"use_graphrag": False}, + "image_context_size": 0, + "table_context_size": 0, + }, res @pytest.mark.p2 @pytest.mark.parametrize( diff --git a/test/testcases/test_http_api/test_file_management_within_dataset/test_download_document.py b/test/testcases/test_http_api/test_file_management_within_dataset/test_download_document.py index 2d04ae53192..4cbc9e19bd9 100644 --- a/test/testcases/test_http_api/test_file_management_within_dataset/test_download_document.py +++ b/test/testcases/test_http_api/test_file_management_within_dataset/test_download_document.py @@ -19,7 +19,7 @@ import pytest from common import bulk_upload_documents, download_document, upload_documents -from configs import INVALID_API_TOKEN +from configs import INVALID_API_TOKEN, INVALID_ID_32 from libs.auth import RAGFlowHttpApiAuth from requests import codes from utils import compare_by_hash @@ -89,9 +89,9 @@ class TestDocumentDownload: "document_id, expected_code, expected_message", [ ( - "invalid_document_id", + INVALID_ID_32, 102, - "The dataset not own the document invalid_document_id.", + f"The dataset not own the document {INVALID_ID_32}.", ), ], ) @@ -113,11 +113,10 @@ def test_invalid_document_id(self, HttpApiAuth, add_documents, tmp_path, documen @pytest.mark.parametrize( "dataset_id, expected_code, expected_message", [ - ("", 100, ""), ( - "invalid_dataset_id", + INVALID_ID_32, 102, - "You do not own the dataset invalid_dataset_id.", + f"You do not own the dataset {INVALID_ID_32}.", ), ], ) diff --git a/test/testcases/test_http_api/test_file_management_within_dataset/test_update_document.py b/test/testcases/test_http_api/test_file_management_within_dataset/test_update_document.py index c6110167260..cde8d36f7f5 100644 --- a/test/testcases/test_http_api/test_file_management_within_dataset/test_update_document.py +++ b/test/testcases/test_http_api/test_file_management_within_dataset/test_update_document.py @@ -17,7 +17,7 @@ import pytest from common import list_documents, update_document -from configs import DOCUMENT_NAME_LIMIT, INVALID_API_TOKEN +from configs import DOCUMENT_NAME_LIMIT, INVALID_API_TOKEN, INVALID_ID_32 from libs.auth import RAGFlowHttpApiAuth from configs import DEFAULT_PARSER_CONFIG @@ -97,9 +97,8 @@ def test_name(self, HttpApiAuth, add_documents, name, expected_code, expected_me @pytest.mark.parametrize( "document_id, expected_code, expected_message", [ - ("", 100, ""), ( - "invalid_document_id", + INVALID_ID_32, 102, "The dataset doesn't own the document.", ), @@ -115,9 +114,8 @@ def test_invalid_document_id(self, HttpApiAuth, add_documents, document_id, expe @pytest.mark.parametrize( "dataset_id, expected_code, expected_message", [ - ("", 100, ""), ( - "invalid_dataset_id", + INVALID_ID_32, 102, "You don't own the dataset.", ), diff --git a/test/testcases/test_http_api/test_file_management_within_dataset/test_upload_documents.py b/test/testcases/test_http_api/test_file_management_within_dataset/test_upload_documents.py index 27f47472901..d5b6bd2b6d2 100644 --- a/test/testcases/test_http_api/test_file_management_within_dataset/test_upload_documents.py +++ b/test/testcases/test_http_api/test_file_management_within_dataset/test_upload_documents.py @@ -115,14 +115,15 @@ def test_filename_empty(self, HttpApiAuth, add_dataset_func, tmp_path): dataset_id = add_dataset_func fp = create_txt_file(tmp_path / "ragflow_test.txt") url = f"{HOST_ADDRESS}{FILE_API_URL}".format(dataset_id=dataset_id) - fields = (("file", ("", fp.open("rb"))),) - m = MultipartEncoder(fields=fields) - res = requests.post( - url=url, - headers={"Content-Type": m.content_type}, - auth=HttpApiAuth, - data=m, - ) + with fp.open("rb") as file_obj: + fields = (("file", ("", file_obj)),) + m = MultipartEncoder(fields=fields) + res = requests.post( + url=url, + headers={"Content-Type": m.content_type}, + auth=HttpApiAuth, + data=m, + ) assert res.json()["code"] == 101 assert res.json()["message"] == "No file selected!" diff --git a/test/testcases/test_http_api/test_router_errors.py b/test/testcases/test_http_api/test_router_errors.py new file mode 100644 index 00000000000..98007d4e52a --- /dev/null +++ b/test/testcases/test_http_api/test_router_errors.py @@ -0,0 +1,29 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import pytest +import requests + +from configs import HOST_ADDRESS, VERSION + + +@pytest.mark.p3 +def test_route_not_found_returns_json(): + url = f"{HOST_ADDRESS}/api/{VERSION}/__missing_route__" + res = requests.get(url) + assert res.status_code == 404 + payload = res.json() + assert payload["error"] == "Not Found" + assert f"/api/{VERSION}/__missing_route__" in payload["message"] diff --git a/test/testcases/test_http_api/test_session_management/test_update_session_with_chat_assistant.py b/test/testcases/test_http_api/test_session_management/test_update_session_with_chat_assistant.py index e035e876b54..fa22b27aa44 100644 --- a/test/testcases/test_http_api/test_session_management/test_update_session_with_chat_assistant.py +++ b/test/testcases/test_http_api/test_session_management/test_update_session_with_chat_assistant.py @@ -18,7 +18,7 @@ import pytest from common import delete_chat_assistants, list_session_with_chat_assistants, update_session_with_chat_assistant -from configs import INVALID_API_TOKEN, SESSION_WITH_CHAT_NAME_LIMIT +from configs import INVALID_API_TOKEN, INVALID_ID_32, SESSION_WITH_CHAT_NAME_LIMIT from libs.auth import RAGFlowHttpApiAuth @@ -72,8 +72,7 @@ def test_name(self, HttpApiAuth, add_sessions_with_chat_assistant_func, payload, @pytest.mark.parametrize( "chat_assistant_id, expected_code, expected_message", [ - ("", 100, ""), - pytest.param("invalid_chat_assistant_id", 102, "Session does not exist", marks=pytest.mark.skip(reason="issues/")), + (INVALID_ID_32, 102, "Session does not exist"), ], ) def test_invalid_chat_assistant_id(self, HttpApiAuth, add_sessions_with_chat_assistant_func, chat_assistant_id, expected_code, expected_message): diff --git a/test/testcases/test_sdk_api/test_dataset_mangement/test_update_dataset.py b/test/testcases/test_sdk_api/test_dataset_mangement/test_update_dataset.py index e0c27c9f11f..cdbf1777754 100644 --- a/test/testcases/test_sdk_api/test_dataset_mangement/test_update_dataset.py +++ b/test/testcases/test_sdk_api/test_dataset_mangement/test_update_dataset.py @@ -663,6 +663,8 @@ def test_parser_config_empty_with_chunk_method_change(self, client, add_dataset_ { "raptor": {"use_raptor": False}, "graphrag": {"use_graphrag": False}, + "image_context_size": 0, + "table_context_size": 0, }, ) dataset.update({"chunk_method": "qa", "parser_config": {}}) @@ -679,6 +681,8 @@ def test_parser_config_unset_with_chunk_method_change(self, client, add_dataset_ { "raptor": {"use_raptor": False}, "graphrag": {"use_graphrag": False}, + "image_context_size": 0, + "table_context_size": 0, }, ) dataset.update({"chunk_method": "qa"}) @@ -695,6 +699,8 @@ def test_parser_config_none_with_chunk_method_change(self, client, add_dataset_f { "raptor": {"use_raptor": False}, "graphrag": {"use_graphrag": False}, + "image_context_size": 0, + "table_context_size": 0, }, ) dataset.update({"chunk_method": "qa", "parser_config": None}) From 36b0835740a1d1c32437f04f154a455c9e35baaa Mon Sep 17 00:00:00 2001 From: writinwaters <93570324+writinwaters@users.noreply.github.com> Date: Wed, 14 Jan 2026 09:40:31 +0800 Subject: [PATCH 101/335] Docs: Use memory (#12599) ### What problem does this PR solve? ### Type of change - [x] Documentation Update --- .../agent_component_reference/message.mdx | 6 ++ .../agent_component_reference/retrieval.mdx | 6 +- docs/guides/memory/use_memory.md | 58 +++++++++++++++++++ 3 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 docs/guides/memory/use_memory.md diff --git a/docs/guides/agent/agent_component_reference/message.mdx b/docs/guides/agent/agent_component_reference/message.mdx index 295bd72cc84..7f51029f123 100644 --- a/docs/guides/agent/agent_component_reference/message.mdx +++ b/docs/guides/agent/agent_component_reference/message.mdx @@ -21,3 +21,9 @@ The message to send out. Click `(x)` or type `/` to quickly insert variables. Click **+ Add message** to add message options. When multiple messages are supplied, the **Message** component randomly selects one to send. +### Save to memory + +Select the corresponding Memory in the **Message** component under **Save to Memory**: + + +![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/save_to_memory.png) \ No newline at end of file diff --git a/docs/guides/agent/agent_component_reference/retrieval.mdx b/docs/guides/agent/agent_component_reference/retrieval.mdx index 0c6728d99f8..5179f6524bc 100644 --- a/docs/guides/agent/agent_component_reference/retrieval.mdx +++ b/docs/guides/agent/agent_component_reference/retrieval.mdx @@ -76,13 +76,15 @@ Select the query source for retrieval. Defaults to `sys.query`, which is the def The **Retrieval** component relies on query variables to specify its queries. All global variables defined before the **Retrieval** component can also be used as queries. Use the `(x)` button or type `/` to show all the available query variables. -### Knowledge bases +### Retrieval from -Select the dataset(s) to retrieve data from. +Select the dataset(s) and memory to retrieve data from. - If no dataset is selected, meaning conversations with the agent will not be based on any dataset, ensure that the **Empty response** field is left blank to avoid an error. - If you select multiple datasets, you must ensure that the datasets you select use the same embedding model; otherwise, an error message would occur. +![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/retrieve_from_memory.PNG) + ### Similarity threshold RAGFlow employs a combination of weighted keyword similarity and weighted vector cosine similarity during retrieval. This parameter sets the threshold for similarities between the user query and chunks stored in the datasets. Any chunk with a similarity score below this threshold will be excluded from the results. diff --git a/docs/guides/memory/use_memory.md b/docs/guides/memory/use_memory.md new file mode 100644 index 00000000000..05ffd0be3ba --- /dev/null +++ b/docs/guides/memory/use_memory.md @@ -0,0 +1,58 @@ +--- +sidebar_position: 1 +slug: /use_memory +sidebar_custom_props: { + categoryIcon: LucideMonitorCog +} +--- + +# Use memory + +RAGFlow's Memory module is built to save everything, including conversation that happens while an Agent is working. It keeps the raw logs of conversations, like what a user says and what the AI says back. It also saves extra information created during the chat, like summaries or notes the AI makes about the interaction. Its main jobs are to make conversations flow smoothly from one to the next, to allow the AI to remember personal details about a user, and to let the AI learn from all its past talks. + +This module does more than just store the raw data. It is smart enough to sort information into different useful types. It can pull out key facts and meanings (semantic memory), remember specific events and stories from past chats (episodic memory), and hold details needed for the current task (working memory). This turns a simple log into an organized library of past experiences. + +Because of this, users can easily bring back any saved information into a new conversation. This past context helps the AI stay on topic and avoid repeating itself, making chats feel more connected and natural. More importantly, it gives the AI a reliable history to think from, which makes its answers more accurate and useful. + +## Create memory + +The Memory module offers streamlined, centralized management of all memories. + +When creating a Memory, users can precisely define which types of information to extract, helping ensure that only relevant data is captured and organized. From the navigation path Overview >> Memory, users can then perform key management actions, including renaming memories, organizing them, and sharing them with team members to support collaborative workflows. + + +![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/memory_interface.PNG) + + +## Manage memory + +Within an individual Memory page, you can fine-tune how saved entries are used during Agent calls. Each entry can be selectively enabled or disabled, allowing you to control which pieces of information remain active without permanently removing anything. + +When certain details are no longer relevant, you can also choose to forget specific memory entries entirely. This keeps the Memory clean, focused, and easier to maintain over time, ensuring that Agents rely only on up‑to‑date and useful information. + +![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/memory_interface.PNG) + +Manually forgotten memory entries are completely excluded from the results returned by Agent calls, ensuring they no longer influence downstream behavior. This helps keep responses focused on the most relevant and intentionally retained information. + +When the Memory reaches its storage limit and the automatic forgetting policy is applied, entries that were previously forgotten manually are also prioritized for removal. This allows the system to reclaim capacity more intelligently while respecting earlier user curation decisions. + +## Enhance Agent context + +Under **Retrieval** and **Message** component settings, a new Memory invocation capability is available. In the Message component, users can configure the Agent to write selected data into a designated Memory, while the Retrieval component can be set to read from that same Memory to answer future queries. This enables a simple Q&A bot Agent to accumulate context over time and respond with richer, memory-aware answers. + +### Retrieve from memory + +For any Agent configuration that uses Memory, a **Retrieval** component is required to bring stored information back into the conversation. By including Retrieval alongside Memory-aware components, the Agent can consistently recall and apply relevant past data whenever it is needed. + +![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/retrieve_from_memory.PNG) + +### Save to memory + +At the same time you have finished **Retrieval** component settings, select the corresponding Memory in the **Message** component under **Save to Memory**: + + +![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/save_to_memory.png) + + + + From ea619dba3b26e406c17d9e2b6b5ee9e2a5872b96 Mon Sep 17 00:00:00 2001 From: 6ba3i <112825897+6ba3i@users.noreply.github.com> Date: Wed, 14 Jan 2026 10:02:30 +0800 Subject: [PATCH 102/335] Added to the HTTP API test suite (#12556) ### What problem does this PR solve? This PR adds missing HTTP API test coverage for dataset graph/GraphRAG/RAPTOR tasks, metadata summary, chat completions, agent sessions/completions, and related questions. It also introduces minimal HTTP test helpers to exercise these endpoints consistently with the existing suite. ### Type of change - [x] Other (please describe): Test coverage (HTTP API tests) --------- Co-authored-by: Liu An --- test/testcases/test_http_api/common.py | 110 +++++++++++++++- .../test_graphrag_tasks.py | 89 +++++++++++++ .../test_knowledge_graph.py | 53 ++++++++ .../test_raptor_tasks.py | 89 +++++++++++++ .../test_metadata_summary.py | 52 ++++++++ .../test_agent_completions.py | 96 ++++++++++++++ .../test_agent_sessions.py | 89 +++++++++++++ .../test_chat_completions.py | 122 ++++++++++++++++++ .../test_related_questions.py | 39 ++++++ 9 files changed, 738 insertions(+), 1 deletion(-) create mode 100644 test/testcases/test_http_api/test_dataset_management/test_graphrag_tasks.py create mode 100644 test/testcases/test_http_api/test_dataset_management/test_knowledge_graph.py create mode 100644 test/testcases/test_http_api/test_dataset_management/test_raptor_tasks.py create mode 100644 test/testcases/test_http_api/test_file_management_within_dataset/test_metadata_summary.py create mode 100644 test/testcases/test_http_api/test_session_management/test_agent_completions.py create mode 100644 test/testcases/test_http_api/test_session_management/test_agent_sessions.py create mode 100644 test/testcases/test_http_api/test_session_management/test_chat_completions.py create mode 100644 test/testcases/test_http_api/test_session_management/test_related_questions.py diff --git a/test/testcases/test_http_api/common.py b/test/testcases/test_http_api/common.py index dba320d981d..6810ca64768 100644 --- a/test/testcases/test_http_api/common.py +++ b/test/testcases/test_http_api/common.py @@ -28,6 +28,8 @@ CHAT_ASSISTANT_API_URL = f"/api/{VERSION}/chats" SESSION_WITH_CHAT_ASSISTANT_API_URL = f"/api/{VERSION}/chats/{{chat_id}}/sessions" SESSION_WITH_AGENT_API_URL = f"/api/{VERSION}/agents/{{agent_id}}/sessions" +AGENT_API_URL = f"/api/{VERSION}/agents" +RETRIEVAL_API_URL = f"/api/{VERSION}/retrieval" # DATASET MANAGEMENT @@ -170,7 +172,7 @@ def delete_chunks(auth, dataset_id, document_id, payload=None): def retrieval_chunks(auth, payload=None): - url = f"{HOST_ADDRESS}/api/v1/retrieval" + url = f"{HOST_ADDRESS}{RETRIEVAL_API_URL}" res = requests.post(url=url, headers=HEADERS, auth=auth, json=payload) return res.json() @@ -237,6 +239,8 @@ def update_session_with_chat_assistant(auth, chat_assistant_id, session_id, payl def delete_session_with_chat_assistants(auth, chat_assistant_id, payload=None): url = f"{HOST_ADDRESS}{SESSION_WITH_CHAT_ASSISTANT_API_URL}".format(chat_id=chat_assistant_id) + if payload is None: + payload = {} res = requests.delete(url=url, headers=HEADERS, auth=auth, json=payload) return res.json() @@ -247,3 +251,107 @@ def batch_add_sessions_with_chat_assistant(auth, chat_assistant_id, num): res = create_session_with_chat_assistant(auth, chat_assistant_id, {"name": f"session_with_chat_assistant_{i}"}) session_ids.append(res["data"]["id"]) return session_ids + + +# DATASET GRAPH AND TASKS +def knowledge_graph(auth, dataset_id, params=None): + url = f"{HOST_ADDRESS}{DATASETS_API_URL}/{dataset_id}/knowledge_graph" + res = requests.get(url=url, headers=HEADERS, auth=auth, params=params) + return res.json() + + +def delete_knowledge_graph(auth, dataset_id, payload=None): + url = f"{HOST_ADDRESS}{DATASETS_API_URL}/{dataset_id}/knowledge_graph" + if payload is None: + res = requests.delete(url=url, headers=HEADERS, auth=auth) + else: + res = requests.delete(url=url, headers=HEADERS, auth=auth, json=payload) + return res.json() + + +def run_graphrag(auth, dataset_id, payload=None): + url = f"{HOST_ADDRESS}{DATASETS_API_URL}/{dataset_id}/run_graphrag" + res = requests.post(url=url, headers=HEADERS, auth=auth, json=payload) + return res.json() + + +def trace_graphrag(auth, dataset_id, params=None): + url = f"{HOST_ADDRESS}{DATASETS_API_URL}/{dataset_id}/trace_graphrag" + res = requests.get(url=url, headers=HEADERS, auth=auth, params=params) + return res.json() + + +def run_raptor(auth, dataset_id, payload=None): + url = f"{HOST_ADDRESS}{DATASETS_API_URL}/{dataset_id}/run_raptor" + res = requests.post(url=url, headers=HEADERS, auth=auth, json=payload) + return res.json() + + +def trace_raptor(auth, dataset_id, params=None): + url = f"{HOST_ADDRESS}{DATASETS_API_URL}/{dataset_id}/trace_raptor" + res = requests.get(url=url, headers=HEADERS, auth=auth, params=params) + return res.json() + + +def metadata_summary(auth, dataset_id, params=None): + url = f"{HOST_ADDRESS}{DATASETS_API_URL}/{dataset_id}/metadata/summary" + res = requests.get(url=url, headers=HEADERS, auth=auth, params=params) + return res.json() + + +# CHAT COMPLETIONS AND RELATED QUESTIONS +def chat_completions(auth, chat_assistant_id, payload=None): + url = f"{HOST_ADDRESS}{CHAT_ASSISTANT_API_URL}/{chat_assistant_id}/completions" + res = requests.post(url=url, headers=HEADERS, auth=auth, json=payload) + return res.json() + + +def related_questions(auth, payload=None): + url = f"{HOST_ADDRESS}/api/{VERSION}/sessions/related_questions" + res = requests.post(url=url, headers=HEADERS, auth=auth, json=payload) + return res.json() + + +# AGENT MANAGEMENT AND SESSIONS +def create_agent(auth, payload=None): + url = f"{HOST_ADDRESS}{AGENT_API_URL}" + res = requests.post(url=url, headers=HEADERS, auth=auth, json=payload) + return res.json() + + +def list_agents(auth, params=None): + url = f"{HOST_ADDRESS}{AGENT_API_URL}" + res = requests.get(url=url, headers=HEADERS, auth=auth, params=params) + return res.json() + + +def delete_agent(auth, agent_id): + url = f"{HOST_ADDRESS}{AGENT_API_URL}/{agent_id}" + res = requests.delete(url=url, headers=HEADERS, auth=auth) + return res.json() + + +def create_agent_session(auth, agent_id, payload=None, params=None): + url = f"{HOST_ADDRESS}{SESSION_WITH_AGENT_API_URL}".format(agent_id=agent_id) + res = requests.post(url=url, headers=HEADERS, auth=auth, json=payload, params=params) + return res.json() + + +def list_agent_sessions(auth, agent_id, params=None): + url = f"{HOST_ADDRESS}{SESSION_WITH_AGENT_API_URL}".format(agent_id=agent_id) + res = requests.get(url=url, headers=HEADERS, auth=auth, params=params) + return res.json() + + +def delete_agent_sessions(auth, agent_id, payload=None): + url = f"{HOST_ADDRESS}{SESSION_WITH_AGENT_API_URL}".format(agent_id=agent_id) + if payload is None: + payload = {} + res = requests.delete(url=url, headers=HEADERS, auth=auth, json=payload) + return res.json() + + +def agent_completions(auth, agent_id, payload=None): + url = f"{HOST_ADDRESS}{AGENT_API_URL}/{agent_id}/completions" + res = requests.post(url=url, headers=HEADERS, auth=auth, json=payload) + return res.json() diff --git a/test/testcases/test_http_api/test_dataset_management/test_graphrag_tasks.py b/test/testcases/test_http_api/test_dataset_management/test_graphrag_tasks.py new file mode 100644 index 00000000000..a805be9a6d0 --- /dev/null +++ b/test/testcases/test_http_api/test_dataset_management/test_graphrag_tasks.py @@ -0,0 +1,89 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import pytest +from common import bulk_upload_documents, list_documents, parse_documents, run_graphrag, trace_graphrag +from utils import wait_for + + +@wait_for(200, 1, "Document parsing timeout") +def _parse_done(auth, dataset_id, document_ids=None): + res = list_documents(auth, dataset_id) + target_docs = res["data"]["docs"] + if document_ids is None: + return all(doc.get("run") == "DONE" for doc in target_docs) + target_ids = set(document_ids) + for doc in target_docs: + if doc.get("id") in target_ids and doc.get("run") != "DONE": + return False + return True + + +class TestGraphRAGTasks: + @pytest.mark.p2 + def test_trace_graphrag_before_run(self, HttpApiAuth, add_dataset_func): + dataset_id = add_dataset_func + res = trace_graphrag(HttpApiAuth, dataset_id) + assert res["code"] == 0, res + assert res["data"] == {}, res + + @pytest.mark.p2 + def test_run_graphrag_no_documents(self, HttpApiAuth, add_dataset_func): + dataset_id = add_dataset_func + res = run_graphrag(HttpApiAuth, dataset_id) + assert res["code"] == 102, res + assert "No documents in Dataset" in res.get("message", ""), res + + @pytest.mark.p3 + def test_run_graphrag_returns_task_id(self, HttpApiAuth, add_dataset_func, tmp_path): + dataset_id = add_dataset_func + bulk_upload_documents(HttpApiAuth, dataset_id, 1, tmp_path) + res = run_graphrag(HttpApiAuth, dataset_id) + assert res["code"] == 0, res + assert res["data"].get("graphrag_task_id"), res + + @pytest.mark.p3 + def test_trace_graphrag_until_complete(self, HttpApiAuth, add_dataset_func, tmp_path): + dataset_id = add_dataset_func + document_ids = bulk_upload_documents(HttpApiAuth, dataset_id, 1, tmp_path) + res = parse_documents(HttpApiAuth, dataset_id, {"document_ids": document_ids}) + assert res["code"] == 0, res + _parse_done(HttpApiAuth, dataset_id, document_ids) + + res = run_graphrag(HttpApiAuth, dataset_id) + assert res["code"] == 0, res + + last_res = {} + + @wait_for(200, 1, "GraphRAG task timeout") + def condition(): + res = trace_graphrag(HttpApiAuth, dataset_id) + if res["code"] != 0: + return False + data = res.get("data") or {} + if not data: + return False + if data.get("task_type") != "graphrag": + return False + progress = data.get("progress") + if progress in (-1, 1, -1.0, 1.0): + last_res["res"] = res + return True + return False + + condition() + res = last_res["res"] + assert res["data"]["task_type"] == "graphrag", res + assert res["data"].get("progress") in (-1, 1, -1.0, 1.0), res diff --git a/test/testcases/test_http_api/test_dataset_management/test_knowledge_graph.py b/test/testcases/test_http_api/test_dataset_management/test_knowledge_graph.py new file mode 100644 index 00000000000..61be5881def --- /dev/null +++ b/test/testcases/test_http_api/test_dataset_management/test_knowledge_graph.py @@ -0,0 +1,53 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import pytest +from common import delete_knowledge_graph, knowledge_graph +from configs import INVALID_API_TOKEN +from libs.auth import RAGFlowHttpApiAuth + + +@pytest.mark.p1 +class TestAuthorization: + @pytest.mark.parametrize( + "invalid_auth, expected_code, expected_message", + [ + (None, 0, "Authorization"), + (RAGFlowHttpApiAuth(INVALID_API_TOKEN), 109, "API key is invalid"), + ], + ) + def test_invalid_auth(self, invalid_auth, expected_code, expected_message): + res = knowledge_graph(invalid_auth, "dataset_id") + assert res["code"] == expected_code + assert expected_message in res.get("message", "") + + +class TestKnowledgeGraph: + @pytest.mark.p2 + def test_get_knowledge_graph_empty(self, HttpApiAuth, add_dataset_func): + dataset_id = add_dataset_func + res = knowledge_graph(HttpApiAuth, dataset_id) + assert res["code"] == 0, res + assert "graph" in res["data"], res + assert "mind_map" in res["data"], res + assert isinstance(res["data"]["graph"], dict), res + assert isinstance(res["data"]["mind_map"], dict), res + + @pytest.mark.p2 + def test_delete_knowledge_graph(self, HttpApiAuth, add_dataset_func): + dataset_id = add_dataset_func + res = delete_knowledge_graph(HttpApiAuth, dataset_id) + assert res["code"] == 0, res + assert res["data"] is True, res diff --git a/test/testcases/test_http_api/test_dataset_management/test_raptor_tasks.py b/test/testcases/test_http_api/test_dataset_management/test_raptor_tasks.py new file mode 100644 index 00000000000..6358fc26605 --- /dev/null +++ b/test/testcases/test_http_api/test_dataset_management/test_raptor_tasks.py @@ -0,0 +1,89 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import pytest +from common import bulk_upload_documents, list_documents, parse_documents, run_raptor, trace_raptor +from utils import wait_for + + +@wait_for(200, 1, "Document parsing timeout") +def _parse_done(auth, dataset_id, document_ids=None): + res = list_documents(auth, dataset_id) + target_docs = res["data"]["docs"] + if document_ids is None: + return all(doc.get("run") == "DONE" for doc in target_docs) + target_ids = set(document_ids) + for doc in target_docs: + if doc.get("id") in target_ids and doc.get("run") != "DONE": + return False + return True + + +class TestRaptorTasks: + @pytest.mark.p2 + def test_trace_raptor_before_run(self, HttpApiAuth, add_dataset_func): + dataset_id = add_dataset_func + res = trace_raptor(HttpApiAuth, dataset_id) + assert res["code"] == 0, res + assert res["data"] == {}, res + + @pytest.mark.p2 + def test_run_raptor_no_documents(self, HttpApiAuth, add_dataset_func): + dataset_id = add_dataset_func + res = run_raptor(HttpApiAuth, dataset_id) + assert res["code"] == 102, res + assert "No documents in Dataset" in res.get("message", ""), res + + @pytest.mark.p3 + def test_run_raptor_returns_task_id(self, HttpApiAuth, add_dataset_func, tmp_path): + dataset_id = add_dataset_func + bulk_upload_documents(HttpApiAuth, dataset_id, 1, tmp_path) + res = run_raptor(HttpApiAuth, dataset_id) + assert res["code"] == 0, res + assert res["data"].get("raptor_task_id"), res + + @pytest.mark.p3 + def test_trace_raptor_until_complete(self, HttpApiAuth, add_dataset_func, tmp_path): + dataset_id = add_dataset_func + document_ids = bulk_upload_documents(HttpApiAuth, dataset_id, 1, tmp_path) + res = parse_documents(HttpApiAuth, dataset_id, {"document_ids": document_ids}) + assert res["code"] == 0, res + _parse_done(HttpApiAuth, dataset_id, document_ids) + + res = run_raptor(HttpApiAuth, dataset_id) + assert res["code"] == 0, res + + last_res = {} + + @wait_for(200, 1, "RAPTOR task timeout") + def condition(): + res = trace_raptor(HttpApiAuth, dataset_id) + if res["code"] != 0: + return False + data = res.get("data") or {} + if not data: + return False + if data.get("task_type") != "raptor": + return False + progress = data.get("progress") + if progress in (-1, 1, -1.0, 1.0): + last_res["res"] = res + return True + return False + + condition() + res = last_res["res"] + assert res["data"]["task_type"] == "raptor", res + assert res["data"].get("progress") in (-1, 1, -1.0, 1.0), res diff --git a/test/testcases/test_http_api/test_file_management_within_dataset/test_metadata_summary.py b/test/testcases/test_http_api/test_file_management_within_dataset/test_metadata_summary.py new file mode 100644 index 00000000000..6466c24ce0f --- /dev/null +++ b/test/testcases/test_http_api/test_file_management_within_dataset/test_metadata_summary.py @@ -0,0 +1,52 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Although the docs group this under "chunk management," the backend aggregates +# Document.meta_fields via document_service#get_metadata_summary and the test +# uses update_document, so it belongs with file/document management tests. +import pytest +from common import metadata_summary, update_document + + +def _summary_to_counts(summary): + counts = {} + for key, pairs in summary.items(): + counts[key] = {str(k): v for k, v in pairs} + return counts + + +class TestMetadataSummary: + @pytest.mark.p2 + def test_metadata_summary_counts(self, HttpApiAuth, add_documents_func): + dataset_id, document_ids = add_documents_func + payloads = [ + {"tags": ["foo", "bar"], "author": "alice"}, + {"tags": ["foo"], "author": "bob"}, + {"tags": ["bar", "baz"], "author": None}, + ] + for doc_id, meta_fields in zip(document_ids, payloads): + res = update_document(HttpApiAuth, dataset_id, doc_id, {"meta_fields": meta_fields}) + assert res["code"] == 0, res + + res = metadata_summary(HttpApiAuth, dataset_id) + assert res["code"] == 0, res + summary = res["data"]["summary"] + counts = _summary_to_counts(summary) + assert counts["tags"]["foo"] == 2, counts + assert counts["tags"]["bar"] == 2, counts + assert counts["tags"]["baz"] == 1, counts + assert counts["author"]["alice"] == 1, counts + assert counts["author"]["bob"] == 1, counts + assert "None" not in counts["author"], counts diff --git a/test/testcases/test_http_api/test_session_management/test_agent_completions.py b/test/testcases/test_http_api/test_session_management/test_agent_completions.py new file mode 100644 index 00000000000..e34cc21eca6 --- /dev/null +++ b/test/testcases/test_http_api/test_session_management/test_agent_completions.py @@ -0,0 +1,96 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import pytest +from common import ( + agent_completions, + create_agent, + create_agent_session, + delete_agent, + delete_agent_sessions, + list_agents, +) + +AGENT_TITLE = "test_agent_http" +MINIMAL_DSL = { + "components": { + "begin": { + "obj": {"component_name": "Begin", "params": {}}, + "downstream": ["message"], + "upstream": [], + }, + "message": { + "obj": {"component_name": "Message", "params": {"content": ["{sys.query}"]}}, + "downstream": [], + "upstream": ["begin"], + }, + }, + "history": [], + "retrieval": [], + "path": [], + "globals": { + "sys.query": "", + "sys.user_id": "", + "sys.conversation_turns": 0, + "sys.files": [], + }, + "variables": {}, +} + +@pytest.fixture(scope="function") +def agent_id(HttpApiAuth, request): + res = list_agents(HttpApiAuth, {"page_size": 1000}) + assert res["code"] == 0, res + for agent in res.get("data", []): + if agent.get("title") == AGENT_TITLE: + delete_agent(HttpApiAuth, agent["id"]) + + res = create_agent(HttpApiAuth, {"title": AGENT_TITLE, "dsl": MINIMAL_DSL}) + assert res["code"] == 0, res + res = list_agents(HttpApiAuth, {"title": AGENT_TITLE}) + assert res["code"] == 0, res + assert res.get("data"), res + agent_id = res["data"][0]["id"] + + def cleanup(): + delete_agent_sessions(HttpApiAuth, agent_id) + delete_agent(HttpApiAuth, agent_id) + + request.addfinalizer(cleanup) + return agent_id + + +class TestAgentCompletions: + @pytest.mark.p2 + def test_agent_completion_stream_false(self, HttpApiAuth, agent_id): + res = create_agent_session(HttpApiAuth, agent_id, payload={}) + assert res["code"] == 0, res + session_id = res["data"]["id"] + + res = agent_completions( + HttpApiAuth, + agent_id, + {"question": "hello", "stream": False, "session_id": session_id}, + ) + assert res["code"] == 0, res + if isinstance(res["data"], dict): + assert isinstance(res["data"].get("data"), dict), res + content = res["data"]["data"].get("content", "") + assert content, res + assert "hello" in content, res + assert res["data"].get("session_id") == session_id, res + else: + assert isinstance(res["data"], str), res + assert res["data"].startswith("**ERROR**"), res diff --git a/test/testcases/test_http_api/test_session_management/test_agent_sessions.py b/test/testcases/test_http_api/test_session_management/test_agent_sessions.py new file mode 100644 index 00000000000..6f1d65fa5ea --- /dev/null +++ b/test/testcases/test_http_api/test_session_management/test_agent_sessions.py @@ -0,0 +1,89 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import pytest +from common import ( + create_agent, + create_agent_session, + delete_agent, + delete_agent_sessions, + list_agent_sessions, + list_agents, +) + +AGENT_TITLE = "test_agent_http" +MINIMAL_DSL = { + "components": { + "begin": { + "obj": {"component_name": "Begin", "params": {}}, + "downstream": ["message"], + "upstream": [], + }, + "message": { + "obj": {"component_name": "Message", "params": {"content": ["{sys.query}"]}}, + "downstream": [], + "upstream": ["begin"], + }, + }, + "history": [], + "retrieval": [], + "path": [], + "globals": { + "sys.query": "", + "sys.user_id": "", + "sys.conversation_turns": 0, + "sys.files": [], + }, + "variables": {}, +} + +@pytest.fixture(scope="function") +def agent_id(HttpApiAuth, request): + res = list_agents(HttpApiAuth, {"page_size": 1000}) + assert res["code"] == 0, res + for agent in res.get("data", []): + if agent.get("title") == AGENT_TITLE: + delete_agent(HttpApiAuth, agent["id"]) + + res = create_agent(HttpApiAuth, {"title": AGENT_TITLE, "dsl": MINIMAL_DSL}) + assert res["code"] == 0, res + res = list_agents(HttpApiAuth, {"title": AGENT_TITLE}) + assert res["code"] == 0, res + assert res.get("data"), res + agent_id = res["data"][0]["id"] + + def cleanup(): + delete_agent_sessions(HttpApiAuth, agent_id) + delete_agent(HttpApiAuth, agent_id) + + request.addfinalizer(cleanup) + return agent_id + + +class TestAgentSessions: + @pytest.mark.p2 + def test_create_list_delete_agent_sessions(self, HttpApiAuth, agent_id): + res = create_agent_session(HttpApiAuth, agent_id, payload={}) + assert res["code"] == 0, res + session_id = res["data"]["id"] + assert res["data"]["agent_id"] == agent_id, res + + res = list_agent_sessions(HttpApiAuth, agent_id, params={"id": session_id}) + assert res["code"] == 0, res + assert len(res["data"]) == 1, res + assert res["data"][0]["id"] == session_id, res + + res = delete_agent_sessions(HttpApiAuth, agent_id, {"ids": [session_id]}) + assert res["code"] == 0, res diff --git a/test/testcases/test_http_api/test_session_management/test_chat_completions.py b/test/testcases/test_http_api/test_session_management/test_chat_completions.py new file mode 100644 index 00000000000..fa2e225ca6f --- /dev/null +++ b/test/testcases/test_http_api/test_session_management/test_chat_completions.py @@ -0,0 +1,122 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import pytest +from common import ( + bulk_upload_documents, + chat_completions, + create_chat_assistant, + create_session_with_chat_assistant, + delete_chat_assistants, + delete_session_with_chat_assistants, + list_documents, + parse_documents, +) +from utils import wait_for + + +@wait_for(200, 1, "Document parsing timeout") +def _parse_done(auth, dataset_id, document_ids=None): + res = list_documents(auth, dataset_id) + target_docs = res["data"]["docs"] + if document_ids is None: + return all(doc.get("run") == "DONE" for doc in target_docs) + target_ids = set(document_ids) + for doc in target_docs: + if doc.get("id") in target_ids and doc.get("run") != "DONE": + return False + return True + + +class TestChatCompletions: + @pytest.mark.p3 + def test_chat_completion_stream_false_with_session(self, HttpApiAuth, add_dataset_func, tmp_path, request): + dataset_id = add_dataset_func + document_ids = bulk_upload_documents(HttpApiAuth, dataset_id, 1, tmp_path) + res = parse_documents(HttpApiAuth, dataset_id, {"document_ids": document_ids}) + assert res["code"] == 0, res + _parse_done(HttpApiAuth, dataset_id, document_ids) + + res = create_chat_assistant(HttpApiAuth, {"name": "chat_completion_test", "dataset_ids": [dataset_id]}) + assert res["code"] == 0, res + chat_id = res["data"]["id"] + request.addfinalizer(lambda: delete_session_with_chat_assistants(HttpApiAuth, chat_id)) + request.addfinalizer(lambda: delete_chat_assistants(HttpApiAuth)) + + res = create_session_with_chat_assistant(HttpApiAuth, chat_id, {"name": "session_for_completion"}) + assert res["code"] == 0, res + session_id = res["data"]["id"] + + res = chat_completions( + HttpApiAuth, + chat_id, + {"question": "hello", "stream": False, "session_id": session_id}, + ) + assert res["code"] == 0, res + assert isinstance(res["data"], dict), res + for key in ["answer", "reference", "audio_binary", "id", "session_id"]: + assert key in res["data"], res + assert res["data"]["session_id"] == session_id, res + + @pytest.mark.p2 + def test_chat_completion_invalid_chat(self, HttpApiAuth): + res = chat_completions( + HttpApiAuth, + "invalid_chat_id", + {"question": "hello", "stream": False, "session_id": "invalid_session"}, + ) + assert res["code"] == 102, res + assert "You don't own the chat" in res.get("message", ""), res + + @pytest.mark.p2 + def test_chat_completion_invalid_session(self, HttpApiAuth, request): + res = create_chat_assistant(HttpApiAuth, {"name": "chat_completion_invalid_session", "dataset_ids": []}) + assert res["code"] == 0, res + chat_id = res["data"]["id"] + request.addfinalizer(lambda: delete_session_with_chat_assistants(HttpApiAuth, chat_id)) + request.addfinalizer(lambda: delete_chat_assistants(HttpApiAuth)) + + res = chat_completions( + HttpApiAuth, + chat_id, + {"question": "hello", "stream": False, "session_id": "invalid_session"}, + ) + assert res["code"] == 102, res + assert "You don't own the session" in res.get("message", ""), res + + @pytest.mark.p2 + def test_chat_completion_invalid_metadata_condition(self, HttpApiAuth, request): + res = create_chat_assistant(HttpApiAuth, {"name": "chat_completion_invalid_meta", "dataset_ids": []}) + assert res["code"] == 0, res + chat_id = res["data"]["id"] + request.addfinalizer(lambda: delete_session_with_chat_assistants(HttpApiAuth, chat_id)) + request.addfinalizer(lambda: delete_chat_assistants(HttpApiAuth)) + + res = create_session_with_chat_assistant(HttpApiAuth, chat_id, {"name": "session_for_meta"}) + assert res["code"] == 0, res + session_id = res["data"]["id"] + + res = chat_completions( + HttpApiAuth, + chat_id, + { + "question": "hello", + "stream": False, + "session_id": session_id, + "metadata_condition": "invalid", + }, + ) + assert res["code"] == 102, res + assert "metadata_condition" in res.get("message", ""), res diff --git a/test/testcases/test_http_api/test_session_management/test_related_questions.py b/test/testcases/test_http_api/test_session_management/test_related_questions.py new file mode 100644 index 00000000000..427708b27fa --- /dev/null +++ b/test/testcases/test_http_api/test_session_management/test_related_questions.py @@ -0,0 +1,39 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import pytest +from common import related_questions +from configs import INVALID_API_TOKEN +from libs.auth import RAGFlowHttpApiAuth + + +class TestRelatedQuestions: + @pytest.mark.p3 + def test_related_questions_success(self, HttpApiAuth): + res = related_questions(HttpApiAuth, {"question": "ragflow", "industry": "search"}) + assert res["code"] == 0, res + assert isinstance(res.get("data"), list), res + + @pytest.mark.p2 + def test_related_questions_missing_question(self, HttpApiAuth): + res = related_questions(HttpApiAuth, {"industry": "search"}) + assert res["code"] == 102, res + assert "question" in res.get("message", ""), res + + @pytest.mark.p2 + def test_related_questions_invalid_auth(self): + res = related_questions(RAGFlowHttpApiAuth(INVALID_API_TOKEN), {"question": "ragflow", "industry": "search"}) + assert res["code"] == 109, res + assert "API key is invalid" in res.get("message", ""), res From f72a35188dc72941322b57c83d4ce0218d5b1249 Mon Sep 17 00:00:00 2001 From: lys1313013 Date: Wed, 14 Jan 2026 10:05:34 +0800 Subject: [PATCH 103/335] refactor: remove debug print statements (#12598) ### What problem does this PR solve? This PR eliminates unnecessary debug print statements that were left in hot paths of the codebase. ### Type of change - [x] Refactoring --- api/db/services/task_service.py | 7 ------- rag/flow/hierarchical_merger/hierarchical_merger.py | 2 -- web/src/locales/zh-traditional.ts | 8 ++++++-- web/src/locales/zh.ts | 7 +++++-- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/api/db/services/task_service.py b/api/db/services/task_service.py index c8202dd4fe3..3975c0ec3fc 100644 --- a/api/db/services/task_service.py +++ b/api/db/services/task_service.py @@ -121,13 +121,6 @@ def get_task(cls, task_id, doc_ids=[]): .where(cls.model.id == task_id) ) docs = list(docs.dicts()) - # Assuming docs = list(docs.dicts()) - if docs: - kb_config = docs[0]['kb_parser_config'] # Dict from Knowledgebase.parser_config - mineru_method = kb_config.get('mineru_parse_method', 'auto') - mineru_formula = kb_config.get('mineru_formula_enable', True) - mineru_table = kb_config.get('mineru_table_enable', True) - print(mineru_method, mineru_formula, mineru_table) if not docs: return None diff --git a/rag/flow/hierarchical_merger/hierarchical_merger.py b/rag/flow/hierarchical_merger/hierarchical_merger.py index 34e20ed0e67..f7216183bc1 100644 --- a/rag/flow/hierarchical_merger/hierarchical_merger.py +++ b/rag/flow/hierarchical_merger/hierarchical_merger.py @@ -143,8 +143,6 @@ def dfs(n, path, depth): if depth == self._param.hierarchy: all_pathes.append(_path) - for i in range(len(lines)): - print(i, lines[i]) dfs(root, [], 0) if root["texts"]: diff --git a/web/src/locales/zh-traditional.ts b/web/src/locales/zh-traditional.ts index 8113ca5496d..30dcde85d47 100644 --- a/web/src/locales/zh-traditional.ts +++ b/web/src/locales/zh-traditional.ts @@ -202,6 +202,9 @@ export default { theDocumentBeingParsedCannotBeDeleted: '正在解析的文檔不能被刪除', }, knowledgeConfiguration: { + settings: '設置', + autoMetadataTip: + '自動生成元數據。適用於解析新文件。現有文件需要重新解析才能更新( chunk 將保留)。請注意,配置中指定的索引模型將消耗額外的 Token。', titleDescription: '在這裡更新您的知識庫詳細信息,尤其是切片方法。', imageTableContextWindow: '影像與表格上下文視窗', imageTableContextWindowTip: @@ -370,7 +373,8 @@ export default { paddleocrOptions: 'PaddleOCR 選項', paddleocrApiUrl: 'PaddleOCR API URL', paddleocrApiUrlTip: 'PaddleOCR 服務的 API 端點 URL', - paddleocrApiUrlPlaceholder: '例如:https://paddleocr-server.com/layout-parsing', + paddleocrApiUrlPlaceholder: + '例如:https://paddleocr-server.com/layout-parsing', paddleocrAccessToken: 'AI Studio 訪問令牌', paddleocrAccessTokenTip: 'PaddleOCR API 的訪問令牌(可選)', paddleocrAccessTokenPlaceholder: '您的 AI Studio 令牌(可選)', @@ -664,7 +668,7 @@ export default { selectAlgorithm: '選擇演算法', modelNamePlaceholder: '例如:paddleocr-from-env-1', modelNameRequired: '模型名稱為必填項目', - apiUrlRequired: 'PaddleOCR API URL 為必填項目' + apiUrlRequired: 'PaddleOCR API URL 為必填項目', }, ollamaLink: '如何集成 {{name}}', FishAudioLink: '如何使用Fish Audio', diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts index 9abca9ded8f..a9229436170 100644 --- a/web/src/locales/zh.ts +++ b/web/src/locales/zh.ts @@ -377,6 +377,8 @@ export default { }, knowledgeConfiguration: { settings: '设置', + autoMetadataTip: + '自动生成元数据。适用于解析新文件。现有文件需要重新解析才能更新(chunk将保留)。请注意,配置中指定的索引模型将消耗额外的 Token。', imageTableContextWindow: '图像与表格上下文窗口', imageTableContextWindowTip: '抓取图像与表格上下方的 N 个 token,为该 chunk 提供更丰富的背景上下文。', @@ -393,7 +395,8 @@ export default { paddleocrOptions: 'PaddleOCR 选项', paddleocrApiUrl: 'PaddleOCR API URL', paddleocrApiUrlTip: 'PaddleOCR 服务的 API 端点 URL', - paddleocrApiUrlPlaceholder: '例如:https://paddleocr-server.com/layout-parsing', + paddleocrApiUrlPlaceholder: + '例如:https://paddleocr-server.com/layout-parsing', paddleocrAccessToken: 'AI Studio 访问令牌', paddleocrAccessTokenTip: 'PaddleOCR API 的访问令牌(可选)', paddleocrAccessTokenPlaceholder: '您的 AI Studio 令牌(可选)', @@ -1133,7 +1136,7 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于 selectAlgorithm: '选择算法', modelNamePlaceholder: '例如:paddleocr-from-env-1', modelNameRequired: '模型名称为必填项', - apiUrlRequired: 'PaddleOCR API URL 为必填项' + apiUrlRequired: 'PaddleOCR API URL 为必填项', }, }, message: { From d32fa02d9781645c5252e38b75d4c0317c224574 Mon Sep 17 00:00:00 2001 From: balibabu Date: Wed, 14 Jan 2026 11:45:31 +0800 Subject: [PATCH 104/335] Fix: Unable to copy category node. #12607 (#12609) ### What problem does this PR solve? Fix: Unable to copy category node. #12607 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/pages/agent/utils.ts | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/web/src/pages/agent/utils.ts b/web/src/pages/agent/utils.ts index 1837ed218c0..68938982b30 100644 --- a/web/src/pages/agent/utils.ts +++ b/web/src/pages/agent/utils.ts @@ -362,14 +362,30 @@ function transformRequestSchemaToJsonschema( function transformBeginParams(params: BeginFormSchemaType) { if (params.mode === AgentDialogueMode.Webhook) { - const nextSecurity: Record = { - ...params.security, + const security = params.security; + const nextSecurity: Omit< + NonNullable, + 'ip_whitelist' | 'jwt' + > & { + ip_whitelist?: string[]; + jwt?: Omit< + NonNullable['jwt'], + 'required_claims' + > & { + required_claims?: string[]; + }; + } = { + ...((security ?? {}) as Omit< + NonNullable, + 'ip_whitelist' | 'jwt' + >), ip_whitelist: params.security?.ip_whitelist.map((x) => x.value), }; + if (params.security?.auth_type === WebhookSecurityAuthType.Jwt) { nextSecurity.jwt = { - ...nextSecurity.jwt, - required_claims: nextSecurity.jwt?.required_claims.map((x) => x.value), + ...security?.jwt, + required_claims: security?.jwt?.required_claims.map((x) => x.value), }; } return { @@ -463,8 +479,8 @@ export const buildDslGlobalVariables = ( return { globals: dsl.globals, variables: dsl.variables || {} }; } - let globalVariablesTemp: Record = {}; - let globalSystem: Record = {}; + const globalVariablesTemp: Record = {}; + const globalSystem: Record = {}; Object.keys(dsl.globals)?.forEach((key) => { if (key.indexOf('sys') > -1) { globalSystem[key] = dsl.globals[key]; @@ -633,9 +649,9 @@ export const duplicateNodeForm = (nodeData?: RAGFlowNodeType['data']) => { // Delete the downstream node corresponding to the to field of the Categorize operator if (nodeData?.label === Operator.Categorize) { - form.category_description = Object.keys(form.category_description).reduce< - Record> - >((pre, cur) => { + form.category_description = Object.keys( + form?.category_description ?? {}, + ).reduce>>((pre, cur) => { pre[cur] = { ...form.category_description[cur], to: undefined, From a7671583b32380e726c48d62dfd941f0de9b6f3b Mon Sep 17 00:00:00 2001 From: Yongteng Lei Date: Wed, 14 Jan 2026 12:34:55 +0800 Subject: [PATCH 105/335] Feat: add CN regions for AWS (#12610) ### What problem does this PR solve? Add CN regions for AWS. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- web/src/pages/user-setting/setting-model/constant.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/src/pages/user-setting/setting-model/constant.ts b/web/src/pages/user-setting/setting-model/constant.ts index cea65e755bd..1e2141911a0 100644 --- a/web/src/pages/user-setting/setting-model/constant.ts +++ b/web/src/pages/user-setting/setting-model/constant.ts @@ -19,6 +19,8 @@ export const BedrockRegionList = [ 'ap-northeast-1', 'ca-central-1', 'ca-west-1', + 'cn-north-1', + 'cn-northwest-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', From 5b22f9450214bf847515281adff458218d5c95ad Mon Sep 17 00:00:00 2001 From: 6ba3i <112825897+6ba3i@users.noreply.github.com> Date: Wed, 14 Jan 2026 13:49:16 +0800 Subject: [PATCH 106/335] Feat: Benchmark CLI additions and documentation (#12536) ### What problem does this PR solve? This PR adds a dedicated HTTP benchmark CLI for RAGFlow chat and retrieval endpoints so we can measure latency/QPS. ### Type of change - [x] Documentation Update - [x] Other (please describe): Adds a CLI benchmarking tool for chat/retrieval latency/QPS --------- Co-authored-by: Liu An --- pyproject.toml | 1 + test/benchmark/README.md | 285 +++++++++++++ test/benchmark/__init__.py | 1 + test/benchmark/__main__.py | 5 + test/benchmark/auth.py | 88 ++++ test/benchmark/chat.py | 138 +++++++ test/benchmark/cli.py | 575 +++++++++++++++++++++++++++ test/benchmark/dataset.py | 146 +++++++ test/benchmark/http_client.py | 112 ++++++ test/benchmark/metrics.py | 67 ++++ test/benchmark/report.py | 105 +++++ test/benchmark/retrieval.py | 39 ++ test/benchmark/run_chat.sh | 28 ++ test/benchmark/run_retrieval.sh | 25 ++ test/benchmark/run_retrieval_chat.sh | 98 +++++ test/benchmark/test_docs/Doc1.pdf | Bin 0 -> 2654 bytes test/benchmark/test_docs/Doc2.pdf | Bin 0 -> 2709 bytes test/benchmark/test_docs/Doc3.pdf | Bin 0 -> 2733 bytes test/benchmark/utils.py | 41 ++ uv.lock | 2 + 20 files changed, 1756 insertions(+) create mode 100644 test/benchmark/README.md create mode 100644 test/benchmark/__init__.py create mode 100644 test/benchmark/__main__.py create mode 100644 test/benchmark/auth.py create mode 100644 test/benchmark/chat.py create mode 100644 test/benchmark/cli.py create mode 100644 test/benchmark/dataset.py create mode 100644 test/benchmark/http_client.py create mode 100644 test/benchmark/metrics.py create mode 100644 test/benchmark/report.py create mode 100644 test/benchmark/retrieval.py create mode 100755 test/benchmark/run_chat.sh create mode 100755 test/benchmark/run_retrieval.sh create mode 100755 test/benchmark/run_retrieval_chat.sh create mode 100644 test/benchmark/test_docs/Doc1.pdf create mode 100644 test/benchmark/test_docs/Doc2.pdf create mode 100644 test/benchmark/test_docs/Doc3.pdf create mode 100644 test/benchmark/utils.py diff --git a/pyproject.toml b/pyproject.toml index f8e5338f605..4ba8a8b78f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -169,6 +169,7 @@ test = [ "reportlab>=4.4.1", "requests>=2.32.2", "requests-toolbelt>=1.0.0", + "pycryptodomex==3.20.0", ] [[tool.uv.index]] diff --git a/test/benchmark/README.md b/test/benchmark/README.md new file mode 100644 index 00000000000..847ae457bb2 --- /dev/null +++ b/test/benchmark/README.md @@ -0,0 +1,285 @@ +# RAGFlow HTTP Benchmark CLI + +Run (from repo root): +``` + PYTHONPATH=./test uv run -m benchmark [global flags] [command flags] + Global flags can be placed before or after the command. +``` + +If you run from another directory: +``` + PYTHONPATH=/Directory_name/ragflow/test uv run -m benchmark [global flags] [command flags] +``` + +JSON args: + For --dataset-payload, --chat-payload, --messages-json, --extra-body, --payload + - Pass inline JSON: '{"key": "value"}' + - Or use a file: '@/path/to/file.json' + +Global flags +``` + --base-url + Base server URL. + Env: RAGFLOW_BASE_URL or HOST_ADDRESS + --api-version + API version string (default: v1). + Env: RAGFLOW_API_VERSION + --api-key + API key for Authorization: Bearer . + --connect-timeout + Connect timeout seconds (default: 5.0). + --read-timeout + Read timeout seconds (default: 60.0). + --no-verify-ssl + Disable SSL verification. + --iterations + Iterations per benchmark (default: 1). + --concurrency + Number of concurrent requests (default: 1). Uses multiprocessing. + --json + Output JSON report (plain stdout). + --print-response + Print response content per iteration (stdout). With --json, responses are included in the JSON output. + --response-max-chars + Truncate printed responses to N chars (0 = no limit). +``` + +Auth and bootstrap flags (used when --api-key is not provided) +``` + --login-email + Login email. + Env: RAGFLOW_EMAIL + --login-nickname + Nickname for registration. If omitted, defaults to email prefix when registering. + Env: RAGFLOW_NICKNAME + --login-password + Login password (encrypted client-side). Requires pycryptodomex in the test group. + --allow-register + Attempt /user/register before login (best effort). + --token-name + Optional API token name for /system/new_token. + --bootstrap-llm + Ensure LLM factory API key is configured via /llm/set_api_key. + --llm-factory + LLM factory name for bootstrap. + Env: RAGFLOW_LLM_FACTORY + --llm-api-key + LLM API key for bootstrap. + Env: ZHIPU_AI_API_KEY + --llm-api-base + Optional LLM API base URL. + Env: RAGFLOW_LLM_API_BASE + --set-tenant-info + Set tenant defaults via /user/set_tenant_info. + --tenant-llm-id + Tenant chat model ID. + Env: RAGFLOW_TENANT_LLM_ID + --tenant-embd-id + Tenant embedding model ID. + Env: RAGFLOW_TENANT_EMBD_ID + --tenant-img2txt-id + Tenant image2text model ID. + Env: RAGFLOW_TENANT_IMG2TXT_ID + --tenant-asr-id + Tenant ASR model ID (default empty). + Env: RAGFLOW_TENANT_ASR_ID + --tenant-tts-id + Tenant TTS model ID. + Env: RAGFLOW_TENANT_TTS_ID +``` + +Dataset/document flags (shared by chat and retrieval) +``` + --dataset-id + Existing dataset ID. + --dataset-ids + Comma-separated dataset IDs. + --dataset-name + Dataset name when creating a new dataset. + Env: RAGFLOW_DATASET_NAME + --dataset-payload + JSON body for dataset creation (see API docs). + --document-path + Document path to upload (repeatable). + --document-paths-file + File containing document paths, one per line. + --parse-timeout + Document parse timeout seconds (default: 120.0). + --parse-interval + Document parse poll interval seconds (default: 1.0). + --teardown + Delete created resources after run. +``` + +Chat command flags +``` + --chat-id + Existing chat ID. If omitted, a chat is created. + --chat-name + Chat name when creating a new chat. + Env: RAGFLOW_CHAT_NAME + --chat-payload + JSON body for chat creation (see API docs). + --model + Model field for OpenAI-compatible completion request. + Env: RAGFLOW_CHAT_MODEL + --message + Single user message (required unless --messages-json is provided). + --messages-json + JSON list of OpenAI-format messages (required unless --message is provided). + --extra-body + JSON extra_body for OpenAI-compatible request. +``` + +Retrieval command flags +``` + --question + Retrieval question (required unless provided in --payload). + --payload + JSON body for /api/v1/retrieval (see API docs). + --document-ids + Comma-separated document IDs for retrieval. +``` + +Model selection guidance + - Embedding model is tied to the dataset. + Set during dataset creation using --dataset-payload: +``` + {"name": "...", "embedding_model": "@"} +``` + Or set tenant defaults via --set-tenant-info with --tenant-embd-id. + - Chat model is tied to the chat assistant. + Set during chat creation using --chat-payload: +``` + {"name": "...", "llm": {"model_name": "@"}} +``` + Or set tenant defaults via --set-tenant-info with --tenant-llm-id. + - --model is required by the OpenAI-compatible endpoint but does not override + the chat assistant's configured model on the server. + +What this CLI can do + - This is a benchmark CLI. It always runs either a chat or retrieval benchmark + and prints a report. + - It can create datasets, upload documents, trigger parsing, and create chats + as part of a benchmark run (setup for the benchmark). + - It is not a general admin CLI; there are no standalone "create-only" or + "manage" commands. Use the reports to capture created IDs for reuse. + +Do I need the dataset ID? + - If the CLI creates a dataset, it uses the returned dataset ID internally. + You do not need to supply it for that same run. + - The report prints "Created Dataset ID" so you can reuse it later with + --dataset-id or --dataset-ids. + - Dataset name is only used at creation time. Selection is always by ID. + +Examples + +Example: chat benchmark creating dataset + upload + parse + chat (login + register) +``` + PYTHONPATH=./test uv run -m benchmark chat \ + --base-url http://127.0.0.1:9380 \ + --allow-register \ + --login-email "qa@infiniflow.org" \ + --login-password "123" \ + --bootstrap-llm \ + --llm-factory ZHIPU-AI \ + --llm-api-key $ZHIPU_AI_API_KEY \ + --dataset-name "bench_dataset" \ + --dataset-payload '{"name":"bench_dataset","embedding_model":"BAAI/bge-small-en-v1.5@Builtin"}' \ + --document-path test/benchmark/test_docs/Doc1.pdf \ + --document-path test/benchmark/test_docs/Doc2.pdf \ + --document-path test/benchmark/test_docs/Doc3.pdf \ + --chat-name "bench_chat" \ + --chat-payload '{"name":"bench_chat","llm":{"model_name":"glm-4-flash@ZHIPU-AI"}}' \ + --message "What is the purpose of RAGFlow?" \ + --model "glm-4-flash@ZHIPU-AI" +``` + +Example: chat benchmark with existing dataset + chat id (no creation) +``` + PYTHONPATH=./test uv run -m benchmark chat \ + --base-url http://127.0.0.1:9380 \ + --chat-id \ + --login-email "qa@infiniflow.org" \ + --login-password "123" \ + --message "What is the purpose of RAGFlow?" \ + --model "glm-4-flash@ZHIPU-AI" +``` + +Example: retrieval benchmark creating dataset + upload + parse +``` + PYTHONPATH=./test uv run -m benchmark retrieval \ + --base-url http://127.0.0.1:9380 \ + --allow-register \ + --login-email "qa@infiniflow.org" \ + --login-password "123" \ + --bootstrap-llm \ + --llm-factory ZHIPU-AI \ + --llm-api-key $ZHIPU_AI_API_KEY \ + --dataset-name "bench_dataset" \ + --dataset-payload '{"name":"bench_dataset","embedding_model":"BAAI/bge-small-en-v1.5@Builtin"}' \ + --document-path test/benchmark/test_docs/Doc1.pdf \ + --document-path test/benchmark/test_docs/Doc2.pdf \ + --document-path test/benchmark/test_docs/Doc3.pdf \ + --question "What does RAG mean?" +``` + +Example: retrieval benchmark with existing dataset IDs +``` + PYTHONPATH=./test uv run -m benchmark retrieval \ + --base-url http://127.0.0.1:9380 \ + --login-email "qa@infiniflow.org" \ + --login-password "123" \ + --dataset-ids "," \ + --question "What does RAG mean?" +``` + +Example: retrieval benchmark with existing dataset IDs and document IDs +``` + PYTHONPATH=./test uv run -m benchmark retrieval \ + --base-url http://127.0.0.1:9380 \ + --login-email "qa@infiniflow.org" \ + --login-password "123" \ + --dataset-id "" \ + --document-ids "," \ + --question "What does RAG mean?" +``` + +Quick scripts + +These scripts create a dataset, +upload/parse docs from test/benchmark/test_docs, run the benchmark, and clean up. +The both script runs retrieval then chat on the same dataset, then deletes it. + +- Make sure to run ```uv sync --python 3.12 --group test ``` before running the commands. +- It is also necessary to run these commands prior to initializing your containers if you plan on using the built-in embedded model: ```echo -e "TEI_MODEL=BAAI/bge-small-en-v1.5" >> docker/.env``` + and ```echo -e "COMPOSE_PROFILES=\${COMPOSE_PROFILES},tei-cpu" >> docker/.env``` + +Chat only: +``` + ./test/benchmark/run_chat.sh +``` + +Retrieval only: +``` + ./test/benchmark/run_retrieval.sh +``` + +Both (retrieval then chat on the same dataset): +``` + ./test/benchmark/run_retrieval_chat.sh +``` + +Requires: + - ZHIPU_AI_API_KEY exported in your shell. + +Defaults used: + - Base URL: http://127.0.0.1:9380 + - Login: qa@infiniflow.org / 123 (with allow-register) + - LLM bootstrap: ZHIPU-AI with $ZHIPU_AI_API_KEY + - Dataset: bench_dataset (BAAI/bge-small-en-v1.5@Builtin) + - Chat: bench_chat (glm-4-flash@ZHIPU-AI) + - Chat message: "What is the purpose of RAGFlow?" + - Retrieval question: "What does RAG mean?" + - Iterations: 1 + - concurrency:f 4 diff --git a/test/benchmark/__init__.py b/test/benchmark/__init__.py new file mode 100644 index 00000000000..06603ac0525 --- /dev/null +++ b/test/benchmark/__init__.py @@ -0,0 +1 @@ +"""RAGFlow HTTP API benchmark package.""" diff --git a/test/benchmark/__main__.py b/test/benchmark/__main__.py new file mode 100644 index 00000000000..2f05ddc2255 --- /dev/null +++ b/test/benchmark/__main__.py @@ -0,0 +1,5 @@ +from .cli import main + + +if __name__ == "__main__": + main() diff --git a/test/benchmark/auth.py b/test/benchmark/auth.py new file mode 100644 index 00000000000..307dd4ed82c --- /dev/null +++ b/test/benchmark/auth.py @@ -0,0 +1,88 @@ +from typing import Any, Dict, Optional + +from .http_client import HttpClient + + +class AuthError(RuntimeError): + pass + + +def encrypt_password(password_plain: str) -> str: + try: + from api.utils.crypt import crypt + except Exception as exc: + raise AuthError( + "Password encryption unavailable; install pycryptodomex (uv sync --python 3.12 --group test)." + ) from exc + return crypt(password_plain) + +def register_user(client: HttpClient, email: str, nickname: str, password_enc: str) -> None: + payload = {"email": email, "nickname": nickname, "password": password_enc} + res = client.request_json("POST", "/user/register", use_api_base=False, auth_kind=None, json_body=payload) + if res.get("code") == 0: + return + msg = res.get("message", "") + if "has already registered" in msg: + return + raise AuthError(f"Register failed: {msg}") + + +def login_user(client: HttpClient, email: str, password_enc: str) -> str: + payload = {"email": email, "password": password_enc} + response = client.request("POST", "/user/login", use_api_base=False, auth_kind=None, json_body=payload) + try: + res = response.json() + except Exception as exc: + raise AuthError(f"Login failed: invalid JSON response ({exc})") from exc + if res.get("code") != 0: + raise AuthError(f"Login failed: {res.get('message')}") + token = response.headers.get("Authorization") + if not token: + raise AuthError("Login failed: missing Authorization header") + return token + + +def create_api_token(client: HttpClient, login_token: str, token_name: Optional[str] = None) -> str: + client.login_token = login_token + params = {"name": token_name} if token_name else None + res = client.request_json("POST", "/system/new_token", use_api_base=False, auth_kind="login", params=params) + if res.get("code") != 0: + raise AuthError(f"API token creation failed: {res.get('message')}") + token = res.get("data", {}).get("token") + if not token: + raise AuthError("API token creation failed: missing token in response") + return token + + +def get_my_llms(client: HttpClient) -> Dict[str, Any]: + res = client.request_json("GET", "/llm/my_llms", use_api_base=False, auth_kind="login") + if res.get("code") != 0: + raise AuthError(f"Failed to list LLMs: {res.get('message')}") + return res.get("data", {}) + + +def set_llm_api_key( + client: HttpClient, + llm_factory: str, + api_key: str, + base_url: Optional[str] = None, +) -> None: + payload = {"llm_factory": llm_factory, "api_key": api_key} + if base_url: + payload["base_url"] = base_url + res = client.request_json("POST", "/llm/set_api_key", use_api_base=False, auth_kind="login", json_body=payload) + if res.get("code") != 0: + raise AuthError(f"Failed to set LLM API key: {res.get('message')}") + + +def get_tenant_info(client: HttpClient) -> Dict[str, Any]: + res = client.request_json("GET", "/user/tenant_info", use_api_base=False, auth_kind="login") + if res.get("code") != 0: + raise AuthError(f"Failed to get tenant info: {res.get('message')}") + return res.get("data", {}) + + +def set_tenant_info(client: HttpClient, payload: Dict[str, Any]) -> None: + res = client.request_json("POST", "/user/set_tenant_info", use_api_base=False, auth_kind="login", json_body=payload) + if res.get("code") != 0: + raise AuthError(f"Failed to set tenant info: {res.get('message')}") diff --git a/test/benchmark/chat.py b/test/benchmark/chat.py new file mode 100644 index 00000000000..52146314c69 --- /dev/null +++ b/test/benchmark/chat.py @@ -0,0 +1,138 @@ +import json +import time +from typing import Any, Dict, List, Optional + +from .http_client import HttpClient +from .metrics import ChatSample + + +class ChatError(RuntimeError): + pass + + +def delete_chat(client: HttpClient, chat_id: str) -> None: + payload = {"ids": [chat_id]} + res = client.request_json("DELETE", "/chats", json_body=payload) + if res.get("code") != 0: + raise ChatError(f"Delete chat failed: {res.get('message')}") + + +def create_chat( + client: HttpClient, + name: str, + dataset_ids: Optional[List[str]] = None, + payload: Optional[Dict[str, Any]] = None, +) -> Dict[str, Any]: + body = dict(payload or {}) + if "name" not in body: + body["name"] = name + if dataset_ids is not None and "dataset_ids" not in body: + body["dataset_ids"] = dataset_ids + res = client.request_json("POST", "/chats", json_body=body) + if res.get("code") != 0: + raise ChatError(f"Create chat failed: {res.get('message')}") + return res.get("data", {}) + + +def get_chat(client: HttpClient, chat_id: str) -> Dict[str, Any]: + res = client.request_json("GET", "/chats", params={"id": chat_id}) + if res.get("code") != 0: + raise ChatError(f"Get chat failed: {res.get('message')}") + data = res.get("data", []) + if not data: + raise ChatError("Chat not found") + return data[0] + + +def resolve_model(model: Optional[str], chat_data: Optional[Dict[str, Any]]) -> str: + if model: + return model + if chat_data: + llm = chat_data.get("llm") or {} + llm_name = llm.get("model_name") + if llm_name: + return llm_name + raise ChatError("Model name is required; provide --model or use a chat with llm.model_name.") + + +def _parse_stream_error(response) -> Optional[str]: + content_type = response.headers.get("Content-Type", "") + if "text/event-stream" in content_type: + return None + try: + payload = response.json() + except Exception: + return f"Unexpected non-stream response (status {response.status_code})" + if payload.get("code") not in (0, None): + return payload.get("message", "Unknown error") + return f"Unexpected non-stream response (status {response.status_code})" + + +def stream_chat_completion( + client: HttpClient, + chat_id: str, + model: str, + messages: List[Dict[str, Any]], + extra_body: Optional[Dict[str, Any]] = None, +) -> ChatSample: + payload: Dict[str, Any] = {"model": model, "messages": messages, "stream": True} + if extra_body: + payload["extra_body"] = extra_body + t0 = time.perf_counter() + response = client.request( + "POST", + f"/chats_openai/{chat_id}/chat/completions", + json_body=payload, + stream=True, + ) + error = _parse_stream_error(response) + if error: + response.close() + return ChatSample(t0=t0, t1=None, t2=None, error=error) + + t1: Optional[float] = None + t2: Optional[float] = None + stream_error: Optional[str] = None + content_parts: List[str] = [] + try: + for raw_line in response.iter_lines(decode_unicode=True): + if raw_line is None: + continue + line = raw_line.strip() + if not line or not line.startswith("data:"): + continue + data = line[5:].strip() + if not data: + continue + if data == "[DONE]": + t2 = time.perf_counter() + break + try: + chunk = json.loads(data) + except Exception as exc: + stream_error = f"Invalid JSON chunk: {exc}" + t2 = time.perf_counter() + break + choices = chunk.get("choices") or [] + choice = choices[0] if choices else {} + delta = choice.get("delta") or {} + content = delta.get("content") + if t1 is None and isinstance(content, str) and content != "": + t1 = time.perf_counter() + if isinstance(content, str) and content: + content_parts.append(content) + finish_reason = choice.get("finish_reason") + if finish_reason: + t2 = time.perf_counter() + break + finally: + response.close() + + if t2 is None: + t2 = time.perf_counter() + response_text = "".join(content_parts) if content_parts else None + if stream_error: + return ChatSample(t0=t0, t1=t1, t2=t2, error=stream_error, response_text=response_text) + if t1 is None: + return ChatSample(t0=t0, t1=None, t2=t2, error="No assistant content received", response_text=response_text) + return ChatSample(t0=t0, t1=t1, t2=t2, error=None, response_text=response_text) diff --git a/test/benchmark/cli.py b/test/benchmark/cli.py new file mode 100644 index 00000000000..53a04321b66 --- /dev/null +++ b/test/benchmark/cli.py @@ -0,0 +1,575 @@ +import argparse +import json +import os +import multiprocessing as mp +import time +from concurrent.futures import ProcessPoolExecutor, as_completed +from pathlib import Path +from typing import Any, Dict, List, Optional + +from . import auth +from .auth import AuthError +from .chat import ChatError, create_chat, delete_chat, get_chat, resolve_model, stream_chat_completion +from .dataset import ( + DatasetError, + create_dataset, + dataset_has_chunks, + delete_dataset, + extract_document_ids, + list_datasets, + parse_documents, + upload_documents, + wait_for_parse_done, +) +from .http_client import HttpClient +from .metrics import ChatSample, RetrievalSample, summarize +from .report import chat_report, retrieval_report +from .retrieval import RetrievalError, build_payload, run_retrieval as run_retrieval_request +from .utils import eprint, load_json_arg, split_csv + + +def _parse_args() -> argparse.Namespace: + base_parser = argparse.ArgumentParser(add_help=False) + base_parser.add_argument( + "--base-url", + default=os.getenv("RAGFLOW_BASE_URL") or os.getenv("HOST_ADDRESS"), + help="Base URL (env: RAGFLOW_BASE_URL or HOST_ADDRESS)", + ) + base_parser.add_argument( + "--api-version", + default=os.getenv("RAGFLOW_API_VERSION", "v1"), + help="API version (default: v1)", + ) + base_parser.add_argument("--api-key", help="API key (Bearer token)") + base_parser.add_argument("--connect-timeout", type=float, default=5.0, help="Connect timeout seconds") + base_parser.add_argument("--read-timeout", type=float, default=60.0, help="Read timeout seconds") + base_parser.add_argument("--no-verify-ssl", action="store_false", dest="verify_ssl", help="Disable SSL verification") + base_parser.add_argument("--iterations", type=int, default=1, help="Number of iterations") + base_parser.add_argument("--concurrency", type=int, default=1, help="Concurrency") + base_parser.add_argument("--json", action="store_true", help="Print JSON report (optional)") + base_parser.add_argument("--print-response", action="store_true", help="Print response content per iteration") + base_parser.add_argument( + "--response-max-chars", + type=int, + default=0, + help="Truncate printed response to N chars (0 = no limit)", + ) + + # Auth/login options + base_parser.add_argument("--login-email", default=os.getenv("RAGFLOW_EMAIL"), help="Login email") + base_parser.add_argument("--login-nickname", default=os.getenv("RAGFLOW_NICKNAME"), help="Nickname for registration") + base_parser.add_argument("--login-password", help="Login password (encrypted client-side)") + base_parser.add_argument("--allow-register", action="store_true", help="Attempt /user/register before login") + base_parser.add_argument("--token-name", help="Optional API token name") + base_parser.add_argument("--bootstrap-llm", action="store_true", help="Ensure LLM factory API key is configured") + base_parser.add_argument("--llm-factory", default=os.getenv("RAGFLOW_LLM_FACTORY"), help="LLM factory name") + base_parser.add_argument("--llm-api-key", default=os.getenv("ZHIPU_AI_API_KEY"), help="LLM API key") + base_parser.add_argument("--llm-api-base", default=os.getenv("RAGFLOW_LLM_API_BASE"), help="LLM API base URL") + base_parser.add_argument("--set-tenant-info", action="store_true", help="Set tenant default model IDs") + base_parser.add_argument("--tenant-llm-id", default=os.getenv("RAGFLOW_TENANT_LLM_ID"), help="Tenant chat model ID") + base_parser.add_argument("--tenant-embd-id", default=os.getenv("RAGFLOW_TENANT_EMBD_ID"), help="Tenant embedding model ID") + base_parser.add_argument("--tenant-img2txt-id", default=os.getenv("RAGFLOW_TENANT_IMG2TXT_ID"), help="Tenant image2text model ID") + base_parser.add_argument("--tenant-asr-id", default=os.getenv("RAGFLOW_TENANT_ASR_ID", ""), help="Tenant ASR model ID") + base_parser.add_argument("--tenant-tts-id", default=os.getenv("RAGFLOW_TENANT_TTS_ID"), help="Tenant TTS model ID") + + # Dataset/doc options + base_parser.add_argument("--dataset-id", help="Existing dataset ID") + base_parser.add_argument("--dataset-ids", help="Comma-separated dataset IDs") + base_parser.add_argument("--dataset-name", default=os.getenv("RAGFLOW_DATASET_NAME"), help="Dataset name when creating") + base_parser.add_argument("--dataset-payload", help="Dataset payload JSON or @file") + base_parser.add_argument("--document-path", action="append", help="Document path (repeatable)") + base_parser.add_argument("--document-paths-file", help="File with document paths, one per line") + base_parser.add_argument("--parse-timeout", type=float, default=120.0, help="Parse timeout seconds") + base_parser.add_argument("--parse-interval", type=float, default=1.0, help="Parse poll interval seconds") + base_parser.add_argument("--teardown", action="store_true", help="Delete created resources after run") + + parser = argparse.ArgumentParser(description="RAGFlow HTTP API benchmark", parents=[base_parser]) + subparsers = parser.add_subparsers(dest="command", required=True) + + chat_parser = subparsers.add_parser( + "chat", + help="Chat streaming latency benchmark", + parents=[base_parser], + add_help=False, + ) + chat_parser.add_argument("--chat-id", help="Existing chat ID") + chat_parser.add_argument("--chat-name", default=os.getenv("RAGFLOW_CHAT_NAME"), help="Chat name when creating") + chat_parser.add_argument("--chat-payload", help="Chat payload JSON or @file") + chat_parser.add_argument("--model", default=os.getenv("RAGFLOW_CHAT_MODEL"), help="Model name for OpenAI endpoint") + chat_parser.add_argument("--message", help="User message") + chat_parser.add_argument("--messages-json", help="Messages JSON or @file") + chat_parser.add_argument("--extra-body", help="extra_body JSON or @file") + + retrieval_parser = subparsers.add_parser( + "retrieval", + help="Retrieval latency benchmark", + parents=[base_parser], + add_help=False, + ) + retrieval_parser.add_argument("--question", help="Retrieval question") + retrieval_parser.add_argument("--payload", help="Retrieval payload JSON or @file") + retrieval_parser.add_argument("--document-ids", help="Comma-separated document IDs") + + return parser.parse_args() + + +def _load_paths(args: argparse.Namespace) -> List[str]: + paths = [] + if args.document_path: + paths.extend(args.document_path) + if args.document_paths_file: + file_path = Path(args.document_paths_file) + for line in file_path.read_text(encoding="utf-8").splitlines(): + line = line.strip() + if line: + paths.append(line) + return paths + + +def _truncate_text(text: str, max_chars: int) -> str: + if max_chars and len(text) > max_chars: + return f"{text[:max_chars]}...[truncated]" + return text + + +def _format_chat_response(sample: ChatSample, max_chars: int) -> str: + if sample.error: + text = f"[error] {sample.error}" + if sample.response_text: + text = f"{text} | {sample.response_text}" + else: + text = sample.response_text or "" + if not text: + text = "(empty)" + return _truncate_text(text, max_chars) + + +def _format_retrieval_response(sample: RetrievalSample, max_chars: int) -> str: + if sample.response is not None: + text = json.dumps(sample.response, ensure_ascii=False, sort_keys=True) + if sample.error: + text = f"[error] {sample.error} | {text}" + elif sample.error: + text = f"[error] {sample.error}" + else: + text = "(empty)" + return _truncate_text(text, max_chars) + + +def _chat_worker( + base_url: str, + api_version: str, + api_key: str, + connect_timeout: float, + read_timeout: float, + verify_ssl: bool, + chat_id: str, + model: str, + messages: List[Dict[str, Any]], + extra_body: Optional[Dict[str, Any]], +) -> ChatSample: + client = HttpClient( + base_url=base_url, + api_version=api_version, + api_key=api_key, + connect_timeout=connect_timeout, + read_timeout=read_timeout, + verify_ssl=verify_ssl, + ) + return stream_chat_completion(client, chat_id, model, messages, extra_body) + + +def _retrieval_worker( + base_url: str, + api_version: str, + api_key: str, + connect_timeout: float, + read_timeout: float, + verify_ssl: bool, + payload: Dict[str, Any], +) -> RetrievalSample: + client = HttpClient( + base_url=base_url, + api_version=api_version, + api_key=api_key, + connect_timeout=connect_timeout, + read_timeout=read_timeout, + verify_ssl=verify_ssl, + ) + return run_retrieval_request(client, payload) + + +def _ensure_auth(client: HttpClient, args: argparse.Namespace) -> None: + if args.api_key: + client.api_key = args.api_key + return + if not args.login_email: + raise AuthError("Missing API key and login email") + if not args.login_password: + raise AuthError("Missing login password") + + password_enc = auth.encrypt_password(args.login_password) + + if args.allow_register: + nickname = args.login_nickname or args.login_email.split("@")[0] + try: + auth.register_user(client, args.login_email, nickname, password_enc) + except AuthError as exc: + eprint(f"Register warning: {exc}") + + login_token = auth.login_user(client, args.login_email, password_enc) + client.login_token = login_token + + if args.bootstrap_llm: + if not args.llm_factory: + raise AuthError("Missing --llm-factory for bootstrap") + if not args.llm_api_key: + raise AuthError("Missing --llm-api-key for bootstrap") + existing = auth.get_my_llms(client) + if args.llm_factory not in existing: + auth.set_llm_api_key(client, args.llm_factory, args.llm_api_key, args.llm_api_base) + + if args.set_tenant_info: + if not args.tenant_llm_id or not args.tenant_embd_id: + raise AuthError("Missing --tenant-llm-id or --tenant-embd-id for tenant setup") + tenant = auth.get_tenant_info(client) + tenant_id = tenant.get("tenant_id") + if not tenant_id: + raise AuthError("Tenant info missing tenant_id") + payload = { + "tenant_id": tenant_id, + "llm_id": args.tenant_llm_id, + "embd_id": args.tenant_embd_id, + "img2txt_id": args.tenant_img2txt_id or "", + "asr_id": args.tenant_asr_id or "", + "tts_id": args.tenant_tts_id, + } + auth.set_tenant_info(client, payload) + + api_key = auth.create_api_token(client, login_token, args.token_name) + client.api_key = api_key + + +def _prepare_dataset( + client: HttpClient, + args: argparse.Namespace, + needs_dataset: bool, + document_paths: List[str], +) -> Dict[str, Any]: + created = {} + dataset_ids = split_csv(args.dataset_ids) or [] + dataset_id = args.dataset_id + dataset_payload = load_json_arg(args.dataset_payload, "dataset-payload") if args.dataset_payload else None + + if dataset_id: + dataset_ids = [dataset_id] + elif dataset_ids: + dataset_id = dataset_ids[0] + elif needs_dataset or document_paths: + if not args.dataset_name and not (dataset_payload and dataset_payload.get("name")): + raise DatasetError("Missing --dataset-name or dataset payload name") + name = args.dataset_name or dataset_payload.get("name") + data = create_dataset(client, name, dataset_payload) + dataset_id = data.get("id") + if not dataset_id: + raise DatasetError("Dataset creation did not return id") + dataset_ids = [dataset_id] + created["Created Dataset ID"] = dataset_id + return { + "dataset_id": dataset_id, + "dataset_ids": dataset_ids, + "dataset_payload": dataset_payload, + "created": created, + } + + +def _maybe_upload_and_parse( + client: HttpClient, + dataset_id: str, + document_paths: List[str], + parse_timeout: float, + parse_interval: float, +) -> List[str]: + if not document_paths: + return [] + docs = upload_documents(client, dataset_id, document_paths) + doc_ids = extract_document_ids(docs) + if not doc_ids: + raise DatasetError("No document IDs returned after upload") + parse_documents(client, dataset_id, doc_ids) + wait_for_parse_done(client, dataset_id, doc_ids, parse_timeout, parse_interval) + return doc_ids + + +def _ensure_dataset_has_chunks(client: HttpClient, dataset_id: str) -> None: + datasets = list_datasets(client, dataset_id=dataset_id) + if not datasets: + raise DatasetError("Dataset not found") + if not dataset_has_chunks(datasets[0]): + raise DatasetError("Dataset has no parsed chunks; upload and parse documents first.") + + +def _cleanup(client: HttpClient, created: Dict[str, str], teardown: bool) -> None: + if not teardown: + return + chat_id = created.get("Created Chat ID") + if chat_id: + try: + delete_chat(client, chat_id) + except Exception as exc: + eprint(f"Cleanup warning: failed to delete chat {chat_id}: {exc}") + dataset_id = created.get("Created Dataset ID") + if dataset_id: + try: + delete_dataset(client, dataset_id) + except Exception as exc: + eprint(f"Cleanup warning: failed to delete dataset {dataset_id}: {exc}") + + +def run_chat(client: HttpClient, args: argparse.Namespace) -> int: + document_paths = _load_paths(args) + needs_dataset = bool(document_paths) + dataset_info = _prepare_dataset(client, args, needs_dataset, document_paths) + created = dict(dataset_info["created"]) + dataset_id = dataset_info["dataset_id"] + dataset_ids = dataset_info["dataset_ids"] + doc_ids = [] + if dataset_id and document_paths: + doc_ids = _maybe_upload_and_parse(client, dataset_id, document_paths, args.parse_timeout, args.parse_interval) + created["Created Document IDs"] = ",".join(doc_ids) + if dataset_id and not document_paths: + _ensure_dataset_has_chunks(client, dataset_id) + if dataset_id and not document_paths and dataset_ids: + _ensure_dataset_has_chunks(client, dataset_id) + + chat_payload = load_json_arg(args.chat_payload, "chat-payload") if args.chat_payload else None + chat_id = args.chat_id + if not chat_id: + if not args.chat_name and not (chat_payload and chat_payload.get("name")): + raise ChatError("Missing --chat-name or chat payload name") + chat_name = args.chat_name or chat_payload.get("name") + chat_data = create_chat(client, chat_name, dataset_ids or [], chat_payload) + chat_id = chat_data.get("id") + if not chat_id: + raise ChatError("Chat creation did not return id") + created["Created Chat ID"] = chat_id + chat_data = get_chat(client, chat_id) + model = resolve_model(args.model, chat_data) + + messages = None + if args.messages_json: + messages = load_json_arg(args.messages_json, "messages-json") + if not messages: + if not args.message: + raise ChatError("Missing --message or --messages-json") + messages = [{"role": "user", "content": args.message}] + extra_body = load_json_arg(args.extra_body, "extra-body") if args.extra_body else None + + samples: List[ChatSample] = [] + responses: List[str] = [] + start_time = time.perf_counter() + if args.concurrency <= 1: + for _ in range(args.iterations): + samples.append(stream_chat_completion(client, chat_id, model, messages, extra_body)) + else: + results: List[Optional[ChatSample]] = [None] * args.iterations + mp_context = mp.get_context("spawn") + with ProcessPoolExecutor(max_workers=args.concurrency, mp_context=mp_context) as executor: + future_map = { + executor.submit( + _chat_worker, + client.base_url, + client.api_version, + client.api_key or "", + client.connect_timeout, + client.read_timeout, + client.verify_ssl, + chat_id, + model, + messages, + extra_body, + ): idx + for idx in range(args.iterations) + } + for future in as_completed(future_map): + idx = future_map[future] + results[idx] = future.result() + samples = [sample for sample in results if sample is not None] + total_duration = time.perf_counter() - start_time + if args.print_response: + for idx, sample in enumerate(samples, start=1): + rendered = _format_chat_response(sample, args.response_max_chars) + if args.json: + responses.append(rendered) + else: + print(f"Response[{idx}]: {rendered}") + + total_latencies = [s.total_latency for s in samples if s.total_latency is not None and s.error is None] + first_latencies = [s.first_token_latency for s in samples if s.first_token_latency is not None and s.error is None] + success = len(total_latencies) + failure = len(samples) - success + errors = [s.error for s in samples if s.error] + + total_stats = summarize(total_latencies) + first_stats = summarize(first_latencies) + if args.json: + payload = { + "interface": "chat", + "concurrency": args.concurrency, + "iterations": args.iterations, + "success": success, + "failure": failure, + "model": model, + "total_latency": total_stats, + "first_token_latency": first_stats, + "errors": [e for e in errors if e], + "created": created, + "total_duration_s": total_duration, + "qps": (args.iterations / total_duration) if total_duration > 0 else None, + } + if args.print_response: + payload["responses"] = responses + print(json.dumps(payload, sort_keys=True)) + else: + report = chat_report( + interface="chat", + concurrency=args.concurrency, + total_duration_s=total_duration, + iterations=args.iterations, + success=success, + failure=failure, + model=model, + total_stats=total_stats, + first_token_stats=first_stats, + errors=[e for e in errors if e], + created=created, + ) + print(report, end="") + _cleanup(client, created, args.teardown) + return 0 if failure == 0 else 1 + + +def run_retrieval(client: HttpClient, args: argparse.Namespace) -> int: + document_paths = _load_paths(args) + needs_dataset = True + dataset_info = _prepare_dataset(client, args, needs_dataset, document_paths) + created = dict(dataset_info["created"]) + dataset_id = dataset_info["dataset_id"] + dataset_ids = dataset_info["dataset_ids"] + if not dataset_ids: + raise RetrievalError("dataset_ids required for retrieval") + + doc_ids = [] + if dataset_id and document_paths: + doc_ids = _maybe_upload_and_parse(client, dataset_id, document_paths, args.parse_timeout, args.parse_interval) + created["Created Document IDs"] = ",".join(doc_ids) + + payload_override = load_json_arg(args.payload, "payload") if args.payload else None + question = args.question + if not question and (payload_override is None or "question" not in payload_override): + raise RetrievalError("Missing --question or retrieval payload question") + document_ids = split_csv(args.document_ids) if args.document_ids else None + + payload = build_payload(question, dataset_ids, document_ids, payload_override) + + samples: List[RetrievalSample] = [] + responses: List[str] = [] + start_time = time.perf_counter() + if args.concurrency <= 1: + for _ in range(args.iterations): + samples.append(run_retrieval_request(client, payload)) + else: + results: List[Optional[RetrievalSample]] = [None] * args.iterations + mp_context = mp.get_context("spawn") + with ProcessPoolExecutor(max_workers=args.concurrency, mp_context=mp_context) as executor: + future_map = { + executor.submit( + _retrieval_worker, + client.base_url, + client.api_version, + client.api_key or "", + client.connect_timeout, + client.read_timeout, + client.verify_ssl, + payload, + ): idx + for idx in range(args.iterations) + } + for future in as_completed(future_map): + idx = future_map[future] + results[idx] = future.result() + samples = [sample for sample in results if sample is not None] + total_duration = time.perf_counter() - start_time + if args.print_response: + for idx, sample in enumerate(samples, start=1): + rendered = _format_retrieval_response(sample, args.response_max_chars) + if args.json: + responses.append(rendered) + else: + print(f"Response[{idx}]: {rendered}") + + latencies = [s.latency for s in samples if s.latency is not None and s.error is None] + success = len(latencies) + failure = len(samples) - success + errors = [s.error for s in samples if s.error] + + stats = summarize(latencies) + if args.json: + payload = { + "interface": "retrieval", + "concurrency": args.concurrency, + "iterations": args.iterations, + "success": success, + "failure": failure, + "latency": stats, + "errors": [e for e in errors if e], + "created": created, + "total_duration_s": total_duration, + "qps": (args.iterations / total_duration) if total_duration > 0 else None, + } + if args.print_response: + payload["responses"] = responses + print(json.dumps(payload, sort_keys=True)) + else: + report = retrieval_report( + interface="retrieval", + concurrency=args.concurrency, + total_duration_s=total_duration, + iterations=args.iterations, + success=success, + failure=failure, + stats=stats, + errors=[e for e in errors if e], + created=created, + ) + print(report, end="") + _cleanup(client, created, args.teardown) + return 0 if failure == 0 else 1 + + +def main() -> None: + args = _parse_args() + if not args.base_url: + raise SystemExit("Missing --base-url or HOST_ADDRESS") + if args.iterations < 1: + raise SystemExit("--iterations must be >= 1") + if args.concurrency < 1: + raise SystemExit("--concurrency must be >= 1") + client = HttpClient( + base_url=args.base_url, + api_version=args.api_version, + api_key=args.api_key, + connect_timeout=args.connect_timeout, + read_timeout=args.read_timeout, + verify_ssl=args.verify_ssl, + ) + try: + _ensure_auth(client, args) + if args.command == "chat": + raise SystemExit(run_chat(client, args)) + if args.command == "retrieval": + raise SystemExit(run_retrieval(client, args)) + raise SystemExit("Unknown command") + except (AuthError, DatasetError, ChatError, RetrievalError) as exc: + eprint(f"Error: {exc}") + raise SystemExit(2) diff --git a/test/benchmark/dataset.py b/test/benchmark/dataset.py new file mode 100644 index 00000000000..e349bddfbf7 --- /dev/null +++ b/test/benchmark/dataset.py @@ -0,0 +1,146 @@ +from pathlib import Path +from typing import Any, Dict, Iterable, List, Optional + +from .http_client import HttpClient + +try: + from requests_toolbelt import MultipartEncoder +except Exception: # pragma: no cover - fallback without toolbelt + MultipartEncoder = None + + +class DatasetError(RuntimeError): + pass + + +def create_dataset(client: HttpClient, name: str, payload: Optional[Dict[str, Any]] = None) -> Dict[str, Any]: + body = dict(payload or {}) + if "name" not in body: + body["name"] = name + res = client.request_json("POST", "/datasets", json_body=body) + if res.get("code") != 0: + raise DatasetError(f"Create dataset failed: {res.get('message')}") + return res.get("data", {}) + + +def list_datasets(client: HttpClient, dataset_id: Optional[str] = None, name: Optional[str] = None) -> List[Dict[str, Any]]: + params = {} + if dataset_id is not None: + params["id"] = dataset_id + if name is not None: + params["name"] = name + res = client.request_json("GET", "/datasets", params=params or None) + if res.get("code") != 0: + raise DatasetError(f"List datasets failed: {res.get('message')}") + return res.get("data", []) + + +def delete_dataset(client: HttpClient, dataset_id: str) -> None: + payload = {"ids": [dataset_id]} + res = client.request_json("DELETE", "/datasets", json_body=payload) + if res.get("code") != 0: + raise DatasetError(f"Delete dataset failed: {res.get('message')}") + + +def upload_documents(client: HttpClient, dataset_id: str, file_paths: Iterable[str]) -> List[Dict[str, Any]]: + paths = [Path(p) for p in file_paths] + if MultipartEncoder is None: + files = [("file", (p.name, p.open("rb"))) for p in paths] + try: + response = client.request( + "POST", + f"/datasets/{dataset_id}/documents", + headers=None, + data=None, + json_body=None, + files=files, + params=None, + stream=False, + auth_kind="api", + ) + finally: + for _, (_, fh) in files: + fh.close() + res = response.json() + else: + fields = [] + file_handles = [] + try: + for path in paths: + fh = path.open("rb") + fields.append(("file", (path.name, fh))) + file_handles.append(fh) + encoder = MultipartEncoder(fields=fields) + headers = {"Content-Type": encoder.content_type} + response = client.request( + "POST", + f"/datasets/{dataset_id}/documents", + headers=headers, + data=encoder, + json_body=None, + params=None, + stream=False, + auth_kind="api", + ) + res = response.json() + finally: + for fh in file_handles: + fh.close() + if res.get("code") != 0: + raise DatasetError(f"Upload documents failed: {res.get('message')}") + return res.get("data", []) + + +def parse_documents(client: HttpClient, dataset_id: str, document_ids: List[str]) -> Dict[str, Any]: + payload = {"document_ids": document_ids} + res = client.request_json("POST", f"/datasets/{dataset_id}/chunks", json_body=payload) + if res.get("code") != 0: + raise DatasetError(f"Parse documents failed: {res.get('message')}") + return res + + +def list_documents(client: HttpClient, dataset_id: str, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]: + res = client.request_json("GET", f"/datasets/{dataset_id}/documents", params=params) + if res.get("code") != 0: + raise DatasetError(f"List documents failed: {res.get('message')}") + return res.get("data", {}) + + +def wait_for_parse_done( + client: HttpClient, + dataset_id: str, + document_ids: Optional[List[str]], + timeout: float, + interval: float, +) -> None: + import time + + start = time.monotonic() + while True: + data = list_documents(client, dataset_id) + docs = data.get("docs", []) + target_ids = set(document_ids or []) + all_done = True + for doc in docs: + if target_ids and doc.get("id") not in target_ids: + continue + if doc.get("run") != "DONE": + all_done = False + break + if all_done: + return + if time.monotonic() - start > timeout: + raise DatasetError("Document parsing timeout") + time.sleep(max(interval, 0.1)) + + +def extract_document_ids(documents: Iterable[Dict[str, Any]]) -> List[str]: + return [doc["id"] for doc in documents if "id" in doc] + + +def dataset_has_chunks(dataset_info: Dict[str, Any]) -> bool: + for key in ("chunk_count", "chunk_num"): + value = dataset_info.get(key) + if isinstance(value, int) and value > 0: + return True + return False diff --git a/test/benchmark/http_client.py b/test/benchmark/http_client.py new file mode 100644 index 00000000000..c8b1a91a785 --- /dev/null +++ b/test/benchmark/http_client.py @@ -0,0 +1,112 @@ +import json +from typing import Any, Dict, Optional, Tuple + +import requests + + +class HttpClient: + def __init__( + self, + base_url: str, + api_version: str = "v1", + api_key: Optional[str] = None, + login_token: Optional[str] = None, + connect_timeout: float = 5.0, + read_timeout: float = 60.0, + verify_ssl: bool = True, + ) -> None: + self.base_url = base_url.rstrip("/") + self.api_version = api_version + self.api_key = api_key + self.login_token = login_token + self.connect_timeout = connect_timeout + self.read_timeout = read_timeout + self.verify_ssl = verify_ssl + + def api_base(self) -> str: + return f"{self.base_url}/api/{self.api_version}" + + def non_api_base(self) -> str: + return f"{self.base_url}/{self.api_version}" + + def build_url(self, path: str, use_api_base: bool = True) -> str: + base = self.api_base() if use_api_base else self.non_api_base() + return f"{base}/{path.lstrip('/')}" + + def _headers(self, auth_kind: Optional[str], extra: Optional[Dict[str, str]]) -> Dict[str, str]: + headers = {} + if auth_kind == "api" and self.api_key: + headers["Authorization"] = f"Bearer {self.api_key}" + elif auth_kind == "login" and self.login_token: + headers["Authorization"] = self.login_token + if extra: + headers.update(extra) + return headers + + def request( + self, + method: str, + path: str, + *, + use_api_base: bool = True, + auth_kind: Optional[str] = "api", + headers: Optional[Dict[str, str]] = None, + json_body: Optional[Dict[str, Any]] = None, + data: Any = None, + files: Any = None, + params: Optional[Dict[str, Any]] = None, + stream: bool = False, + ) -> requests.Response: + url = self.build_url(path, use_api_base=use_api_base) + merged_headers = self._headers(auth_kind, headers) + timeout: Tuple[float, float] = (self.connect_timeout, self.read_timeout) + return requests.request( + method=method, + url=url, + headers=merged_headers, + json=json_body, + data=data, + files=files, + params=params, + timeout=timeout, + stream=stream, + verify=self.verify_ssl, + ) + + def request_json( + self, + method: str, + path: str, + *, + use_api_base: bool = True, + auth_kind: Optional[str] = "api", + headers: Optional[Dict[str, str]] = None, + json_body: Optional[Dict[str, Any]] = None, + data: Any = None, + files: Any = None, + params: Optional[Dict[str, Any]] = None, + stream: bool = False, + ) -> Dict[str, Any]: + response = self.request( + method, + path, + use_api_base=use_api_base, + auth_kind=auth_kind, + headers=headers, + json_body=json_body, + data=data, + files=files, + params=params, + stream=stream, + ) + try: + return response.json() + except Exception as exc: + raise ValueError(f"Non-JSON response from {path}: {exc}") from exc + + @staticmethod + def parse_json_bytes(raw: bytes) -> Dict[str, Any]: + try: + return json.loads(raw.decode("utf-8")) + except Exception as exc: + raise ValueError(f"Invalid JSON payload: {exc}") from exc diff --git a/test/benchmark/metrics.py b/test/benchmark/metrics.py new file mode 100644 index 00000000000..02183ec493d --- /dev/null +++ b/test/benchmark/metrics.py @@ -0,0 +1,67 @@ +import math +from dataclasses import dataclass +from typing import Any, List, Optional + + +@dataclass +class ChatSample: + t0: float + t1: Optional[float] + t2: Optional[float] + error: Optional[str] = None + response_text: Optional[str] = None + + @property + def first_token_latency(self) -> Optional[float]: + if self.t1 is None: + return None + return self.t1 - self.t0 + + @property + def total_latency(self) -> Optional[float]: + if self.t2 is None: + return None + return self.t2 - self.t0 + + +@dataclass +class RetrievalSample: + t0: float + t1: Optional[float] + error: Optional[str] = None + response: Optional[Any] = None + + @property + def latency(self) -> Optional[float]: + if self.t1 is None: + return None + return self.t1 - self.t0 + + +def _percentile(sorted_values: List[float], p: float) -> Optional[float]: + if not sorted_values: + return None + n = len(sorted_values) + k = max(0, math.ceil((p / 100.0) * n) - 1) + return sorted_values[k] + + +def summarize(values: List[float]) -> dict: + if not values: + return { + "count": 0, + "avg": None, + "min": None, + "p50": None, + "p90": None, + "p95": None, + } + sorted_vals = sorted(values) + return { + "count": len(values), + "avg": sum(values) / len(values), + "min": sorted_vals[0], + "p50": _percentile(sorted_vals, 50), + "p90": _percentile(sorted_vals, 90), + "p95": _percentile(sorted_vals, 95), + } diff --git a/test/benchmark/report.py b/test/benchmark/report.py new file mode 100644 index 00000000000..64008deb26b --- /dev/null +++ b/test/benchmark/report.py @@ -0,0 +1,105 @@ +from typing import Dict, List, Optional + + +def _fmt_seconds(value: Optional[float]) -> str: + if value is None: + return "n/a" + return f"{value:.4f}s" + + +def _fmt_ms(value: Optional[float]) -> str: + if value is None: + return "n/a" + return f"{value * 1000.0:.2f}ms" + + +def _fmt_qps(qps: Optional[float]) -> str: + if qps is None or qps <= 0: + return "n/a" + return f"{qps:.2f}" + + +def _calc_qps(total_duration_s: Optional[float], total_requests: int) -> Optional[float]: + if total_duration_s is None or total_duration_s <= 0: + return None + return total_requests / total_duration_s + + +def render_report(lines: List[str]) -> str: + return "\n".join(lines).strip() + "\n" + + +def chat_report( + *, + interface: str, + concurrency: int, + total_duration_s: Optional[float], + iterations: int, + success: int, + failure: int, + model: str, + total_stats: Dict[str, Optional[float]], + first_token_stats: Dict[str, Optional[float]], + errors: List[str], + created: Dict[str, str], +) -> str: + lines = [ + f"Interface: {interface}", + f"Concurrency: {concurrency}", + f"Iterations: {iterations}", + f"Success: {success}", + f"Failure: {failure}", + f"Model: {model}", + ] + for key, value in created.items(): + lines.append(f"{key}: {value}") + lines.extend( + [ + "Latency (total): " + f"avg={_fmt_ms(total_stats['avg'])}, min={_fmt_ms(total_stats['min'])}, " + f"p50={_fmt_ms(total_stats['p50'])}, p90={_fmt_ms(total_stats['p90'])}, p95={_fmt_ms(total_stats['p95'])}", + "Latency (first token): " + f"avg={_fmt_ms(first_token_stats['avg'])}, min={_fmt_ms(first_token_stats['min'])}, " + f"p50={_fmt_ms(first_token_stats['p50'])}, p90={_fmt_ms(first_token_stats['p90'])}, p95={_fmt_ms(first_token_stats['p95'])}", + f"Total Duration: {_fmt_seconds(total_duration_s)}", + f"QPS (requests / total duration): {_fmt_qps(_calc_qps(total_duration_s, iterations))}", + ] + ) + if errors: + lines.append("Errors: " + "; ".join(errors[:5])) + return render_report(lines) + + +def retrieval_report( + *, + interface: str, + concurrency: int, + total_duration_s: Optional[float], + iterations: int, + success: int, + failure: int, + stats: Dict[str, Optional[float]], + errors: List[str], + created: Dict[str, str], +) -> str: + lines = [ + f"Interface: {interface}", + f"Concurrency: {concurrency}", + f"Iterations: {iterations}", + f"Success: {success}", + f"Failure: {failure}", + ] + for key, value in created.items(): + lines.append(f"{key}: {value}") + lines.extend( + [ + "Latency: " + f"avg={_fmt_ms(stats['avg'])}, min={_fmt_ms(stats['min'])}, " + f"p50={_fmt_ms(stats['p50'])}, p90={_fmt_ms(stats['p90'])}, p95={_fmt_ms(stats['p95'])}", + f"Total Duration: {_fmt_seconds(total_duration_s)}", + f"QPS (requests / total duration): {_fmt_qps(_calc_qps(total_duration_s, iterations))}", + ] + ) + if errors: + lines.append("Errors: " + "; ".join(errors[:5])) + return render_report(lines) diff --git a/test/benchmark/retrieval.py b/test/benchmark/retrieval.py new file mode 100644 index 00000000000..c2a48800415 --- /dev/null +++ b/test/benchmark/retrieval.py @@ -0,0 +1,39 @@ +import time +from typing import Any, Dict, List, Optional + +from .http_client import HttpClient +from .metrics import RetrievalSample + + +class RetrievalError(RuntimeError): + pass + + +def build_payload( + question: str, + dataset_ids: List[str], + document_ids: Optional[List[str]] = None, + payload: Optional[Dict[str, Any]] = None, +) -> Dict[str, Any]: + body = dict(payload or {}) + if "question" not in body: + body["question"] = question + if "dataset_ids" not in body: + body["dataset_ids"] = dataset_ids + if document_ids is not None and "document_ids" not in body: + body["document_ids"] = document_ids + return body + + +def run_retrieval(client: HttpClient, payload: Dict[str, Any]) -> RetrievalSample: + t0 = time.perf_counter() + response = client.request("POST", "/retrieval", json_body=payload, stream=False) + raw = response.content + t1 = time.perf_counter() + try: + res = client.parse_json_bytes(raw) + except Exception as exc: + return RetrievalSample(t0=t0, t1=t1, error=f"Invalid JSON response: {exc}") + if res.get("code") != 0: + return RetrievalSample(t0=t0, t1=t1, error=res.get("message"), response=res) + return RetrievalSample(t0=t0, t1=t1, error=None, response=res) diff --git a/test/benchmark/run_chat.sh b/test/benchmark/run_chat.sh new file mode 100755 index 00000000000..54c23274857 --- /dev/null +++ b/test/benchmark/run_chat.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" + +: "${ZHIPU_AI_API_KEY:?ZHIPU_AI_API_KEY is required}" + +PYTHONPATH="${REPO_ROOT}/test" uv run -m benchmark chat \ + --base-url http://127.0.0.1:9380 \ + --allow-register \ + --login-email "qa@infiniflow.org" \ + --login-password "123" \ + --bootstrap-llm \ + --llm-factory ZHIPU-AI \ + --llm-api-key "$ZHIPU_AI_API_KEY" \ + --dataset-name "bench_dataset" \ + --dataset-payload '{"name":"bench_dataset","embedding_model":"BAAI/bge-small-en-v1.5@Builtin"}' \ + --document-path "${SCRIPT_DIR}/test_docs/Doc1.pdf" \ + --document-path "${SCRIPT_DIR}/test_docs/Doc2.pdf" \ + --document-path "${SCRIPT_DIR}/test_docs/Doc3.pdf" \ + --chat-name "bench_chat" \ + --chat-payload '{"name":"bench_chat","llm":{"model_name":"glm-4-flash@ZHIPU-AI"}}' \ + --message "What is the purpose of RAGFlow?" \ + --model "glm-4-flash@ZHIPU-AI" \ + --iterations 10 \ + --concurrency 8 \ + --teardown diff --git a/test/benchmark/run_retrieval.sh b/test/benchmark/run_retrieval.sh new file mode 100755 index 00000000000..238cd039c05 --- /dev/null +++ b/test/benchmark/run_retrieval.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" + +: "${ZHIPU_AI_API_KEY:?ZHIPU_AI_API_KEY is required}" + +PYTHONPATH="${REPO_ROOT}/test" uv run -m benchmark retrieval \ + --base-url http://127.0.0.1:9380 \ + --allow-register \ + --login-email "qa@infiniflow.org" \ + --login-password "123" \ + --bootstrap-llm \ + --llm-factory ZHIPU-AI \ + --llm-api-key "$ZHIPU_AI_API_KEY" \ + --dataset-name "bench_dataset" \ + --dataset-payload '{"name":"bench_dataset","embedding_model":"BAAI/bge-small-en-v1.5@Builtin"}' \ + --document-path "${SCRIPT_DIR}/test_docs/Doc1.pdf" \ + --document-path "${SCRIPT_DIR}/test_docs/Doc2.pdf" \ + --document-path "${SCRIPT_DIR}/test_docs/Doc3.pdf" \ + --question "What does RAG mean?" \ + --iterations 10 \ + --concurrency 8 \ + --teardown diff --git a/test/benchmark/run_retrieval_chat.sh b/test/benchmark/run_retrieval_chat.sh new file mode 100755 index 00000000000..9cd53180301 --- /dev/null +++ b/test/benchmark/run_retrieval_chat.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" + +: "${ZHIPU_AI_API_KEY:?ZHIPU_AI_API_KEY is required}" + +BASE_URL="http://127.0.0.1:9380" +LOGIN_EMAIL="qa@infiniflow.org" +LOGIN_PASSWORD="123" +DATASET_PAYLOAD='{"name":"bench_dataset","embedding_model":"BAAI/bge-small-en-v1.5@Builtin"}' +CHAT_PAYLOAD='{"name":"bench_chat","llm":{"model_name":"glm-4-flash@ZHIPU-AI"}}' +DATASET_ID="" + +cleanup_dataset() { + if [[ -z "${DATASET_ID}" ]]; then + return + fi + set +e + BENCH_BASE_URL="${BASE_URL}" \ + BENCH_LOGIN_EMAIL="${LOGIN_EMAIL}" \ + BENCH_LOGIN_PASSWORD="${LOGIN_PASSWORD}" \ + BENCH_DATASET_ID="${DATASET_ID}" \ + PYTHONPATH="${REPO_ROOT}/test" uv run python - <<'PY' +import os +import sys + +from benchmark import auth +from benchmark.auth import AuthError +from benchmark.dataset import delete_dataset +from benchmark.http_client import HttpClient + +base_url = os.environ["BENCH_BASE_URL"] +email = os.environ["BENCH_LOGIN_EMAIL"] +password = os.environ["BENCH_LOGIN_PASSWORD"] +dataset_id = os.environ["BENCH_DATASET_ID"] + +client = HttpClient(base_url=base_url, api_version="v1") + +try: + password_enc = auth.encrypt_password(password) + nickname = email.split("@")[0] + try: + auth.register_user(client, email, nickname, password_enc) + except AuthError as exc: + print(f"Register warning: {exc}", file=sys.stderr) + login_token = auth.login_user(client, email, password_enc) + client.login_token = login_token + client.api_key = auth.create_api_token(client, login_token, None) + delete_dataset(client, dataset_id) +except Exception as exc: + print(f"Cleanup warning: failed to delete dataset {dataset_id}: {exc}", file=sys.stderr) +PY +} + +trap cleanup_dataset EXIT + +retrieval_output="$(PYTHONPATH="${REPO_ROOT}/test" uv run -m benchmark retrieval \ + --base-url "${BASE_URL}" \ + --allow-register \ + --login-email "${LOGIN_EMAIL}" \ + --login-password "${LOGIN_PASSWORD}" \ + --bootstrap-llm \ + --llm-factory ZHIPU-AI \ + --llm-api-key "${ZHIPU_AI_API_KEY}" \ + --dataset-name "bench_dataset" \ + --dataset-payload "${DATASET_PAYLOAD}" \ + --document-path "${SCRIPT_DIR}/test_docs/Doc1.pdf" \ + --document-path "${SCRIPT_DIR}/test_docs/Doc2.pdf" \ + --document-path "${SCRIPT_DIR}/test_docs/Doc3.pdf" \ + --iterations 10 \ + --concurrency 8 \ + --question "What does RAG mean?")" +printf '%s\n' "${retrieval_output}" + +DATASET_ID="$(printf '%s\n' "${retrieval_output}" | sed -n 's/^Created Dataset ID: //p' | head -n 1)" +if [[ -z "${DATASET_ID}" ]]; then + echo "Failed to parse Created Dataset ID from retrieval output." >&2 + exit 1 +fi + +PYTHONPATH="${REPO_ROOT}/test" uv run -m benchmark chat \ + --base-url "${BASE_URL}" \ + --allow-register \ + --login-email "${LOGIN_EMAIL}" \ + --login-password "${LOGIN_PASSWORD}" \ + --bootstrap-llm \ + --llm-factory ZHIPU-AI \ + --llm-api-key "${ZHIPU_AI_API_KEY}" \ + --dataset-id "${DATASET_ID}" \ + --chat-name "bench_chat" \ + --chat-payload "${CHAT_PAYLOAD}" \ + --message "What is the purpose of RAGFlow?" \ + --model "glm-4-flash@ZHIPU-AI" \ + --iterations 10 \ + --concurrency 8 \ + --teardown diff --git a/test/benchmark/test_docs/Doc1.pdf b/test/benchmark/test_docs/Doc1.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2bc4232fb31c578a8e0c25cb18d32d3139b63577 GIT binary patch literal 2654 zcma)8*_Prs5`E_@1j%MLFJN{^z+g7BnteC6Y;25eymVI0!~DR^T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5Q zH9tFtW1Vy{otW*%&DMr8f*ZY;6;H7zrzJY~TBMI#346b6RcVIaRWm9)zsQ!wE&J#? zJen?_@)}k3l0NCv~KL zSsKXThpd1q0{;WX4;e|K*Y+nFMWK}YlPsJ4buCSyWcQOEUHTQTSSN73cy25GYBY2`FX@uvikQ`d@1t1CdYlobuo6xpW#x zD$438zx}V$4hsbEz9E~y&+PL6Dk@AD_>}_c^Xfk!;`}|M2)6s~1d7U)0+C2(!Up~W DL~#6@ literal 0 HcmV?d00001 diff --git a/test/benchmark/test_docs/Doc2.pdf b/test/benchmark/test_docs/Doc2.pdf new file mode 100644 index 0000000000000000000000000000000000000000..1bf0c3e4b6789b741b7039767a7c275652a4aa14 GIT binary patch literal 2709 zcma)8S+}A{5`OnrB$i%x*#s4L#07ChTyaA-Q3NkwSJgbsADDUT_x`Pu+^SoBPu0wH zb3A5dWaJl-Uqog`e9Comc)k#c|NifP{Q*S%;d;SPIfI_==$;bj8h{!=bJgcvcLHz; zf(L`5pFe-jdvCh7a?Y#nJ%R%axaVu6T8*Gx91w6Q0<=p2GVDd_^@#3hp+Y$GuE;9B z-gO}?+Sl#h^uSUTfOZ_!)hx#Z=*n_hj&J=b7%O)jg5m(3KhMF}2OLQ7ACAKY&OodW zrb5&I$5f7WZSC*aBmSnn!Uub8=n5pv2c>ZT03GR?rLgW7Aj2^RXq*7WG6D7gohn|) zZ1J0(sQd2IQ*|G_F&UB*QVS8Lo~zFF00N+4NKi@t0*T}Aim9{T+xGXC2YW~ZKt(rz zA%x3O$y1y+$WR^u?}Sa^;tzyTQ1zX#aBAdgkky5+k6j0LLXrRO=r_jON}$-T`2mCe zfYEve7uN&HT~cve=j+{l`nyyLplwfA0?T!{(7PnZ5EwyYI8I_XMd3sS!xHfKuJ;Y# z>G%&_wG2zw-XH}1>u1-~e2|2C(9geug6wHeRfo>}nd2diL+k7*-dB(VzvOi4jVPFD zS6vOlP5kVGWCb?#KZGF|!0CqNSmCySYXGs;gN{Mk9}jqj(5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q&i!o(U~WTym%NJ<&Kub#0oxebdERIC4O7j)}{Eh(DmBtkT3D2;mh#4$y6&n zpcr?eKfo5%WoPo(n`Lb=$5O(q-=o?7HmQn@encATP5u%dX2n2t#S}Z_AW_z%X*P~cmujzYjkl>VcUJg)*RP#4-n%E2aikcDP9|de=obq7Gj&++ z7=F5wU(yM?osPyA>s^{}zqY|>?w%@yOYRJc^trb2T~#17nT+o;)6dLFZdSlT*1FZSlhZ3*7(H0Zl> zIaIK9q}r(4WnDHoSk`S-$w1C&Do~tf~|_*}4{emSv(_-%OHg5!IawEsP2ci+9V|W8=B$ z)q2T^k!URaGQn#cAWY31NV#3>enijmjmnSX#l4e1jh(SDOpC+o_-;gSa1687xIF7P zlR2had9J>35?ezu@QtH(ydH=|UTJNTYS%ZtWNvd;=CNrOB>&05-sJnI@Ozi?)m79G ziIhU*j|a)KEW;uy@ Date: Wed, 14 Jan 2026 03:35:46 -0500 Subject: [PATCH 107/335] Fix enable_thinking parameter for Qwen3 models (#12603) ### Issue When using Qwen3 models (`qwen3-32b`, `qwen3-max`) through the Tongyi-Qianwen provider for non-streaming calls (e.g., knowledge graph generation), the API fails with: Closes #12424 ``` parameter.enable_thinking must be set to false for non-streaming calls ``` ### Root Cause In `LiteLLMBase.async_chat()`, the `extra_body={"enable_thinking": False}` was set in `kwargs` but never forwarded to `_construct_completion_args()`. ### What problem does this PR solve? Pass merged kwargs to `_construct_completion_args()` using `**{**gen_conf, **kwargs}` to safely handle potential duplicate parameters. ### Changes - `rag/llm/chat_model.py`: Forward kwargs containing `extra_body` to `_construct_completion_args()` in `async_chat()` _Briefly describe what this PR aims to solve. Include background context that will help reviewers understand the purpose of the PR._ ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=42954461 --- rag/llm/chat_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py index dc59e1fb8be..eb1a0f82612 100644 --- a/rag/llm/chat_model.py +++ b/rag/llm/chat_model.py @@ -1263,7 +1263,7 @@ async def async_chat(self, system, history, gen_conf, **kwargs): if self.model_name.lower().find("qwen3") >= 0: kwargs["extra_body"] = {"enable_thinking": False} - completion_args = self._construct_completion_args(history=hist, stream=False, tools=False, **gen_conf) + completion_args = self._construct_completion_args(history=hist, stream=False, tools=False, **{**gen_conf, **kwargs}) for attempt in range(self.max_retries + 1): try: From 15a8bb2e9c3c8f80256ec2f5fe9e34257a099c65 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Wed, 14 Jan 2026 17:32:07 +0800 Subject: [PATCH 108/335] Fix: chunk list async issue. (#12615) ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/chunk_app.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/api/apps/chunk_app.py b/api/apps/chunk_app.py index d902fa2612d..731506404e6 100644 --- a/api/apps/chunk_app.py +++ b/api/apps/chunk_app.py @@ -371,14 +371,21 @@ async def _retrieval(): _question += await keyword_extraction(chat_mdl, _question) labels = label_question(_question, [kb]) - ranks = settings.retriever.retrieval(_question, embd_mdl, tenant_ids, kb_ids, page, size, - float(req.get("similarity_threshold", 0.0)), - float(req.get("vector_similarity_weight", 0.3)), - top, - local_doc_ids, rerank_mdl=rerank_mdl, - highlight=req.get("highlight", False), - rank_feature=labels - ) + ranks = await asyncio.to_thread(settings.retriever.retrieval, + _question, + embd_mdl, + tenant_ids, + kb_ids, + page, + size, + float(req.get("similarity_threshold", 0.0)), + float(req.get("vector_similarity_weight", 0.3)), + doc_ids=local_doc_ids, + top=top, + rerank_mdl=rerank_mdl, + rank_feature=labels, + ) + if use_kg: ck = await settings.kg_retriever.retrieval(_question, tenant_ids, From 678a4f959cd2c6a8aa5e76f270b682875e638d4a Mon Sep 17 00:00:00 2001 From: MkDev11 Date: Wed, 14 Jan 2026 06:08:46 -0500 Subject: [PATCH 109/335] Fix: skip internal bookmark references in DOCX parsing (#12604) (#12611) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What problem does this PR solve? Fixes #12604 - DOCX files containing hyperlinks to internal bookmarks (e.g., `#_文档目录`) cause a `KeyError` during parsing: ``` KeyError: "There is no item named 'word/#_文档目录' in the archive" ``` This happens because python-docx incorrectly tries to read internal bookmark references as files from the ZIP archive. Internal bookmarks are relationship targets starting with `#` and are not actual files. This PR extends the existing `load_from_xml_v2` workaround (which already handles `NULL` targets) to also skip relationship targets starting with `#`. Related upstream issue: https://github.com/python-openxml/python-docx/issues/902 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=94194147 --- rag/app/naive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rag/app/naive.py b/rag/app/naive.py index 86ac85bc8ec..b793b9fdcff 100644 --- a/rag/app/naive.py +++ b/rag/app/naive.py @@ -727,7 +727,7 @@ def load_from_xml_v2(baseURI, rels_item_xml): if rels_item_xml is not None: rels_elm = parse_xml(rels_item_xml) for rel_elm in rels_elm.Relationship_lst: - if rel_elm.target_ref in ("../NULL", "NULL"): + if rel_elm.target_ref in ("../NULL", "NULL") or rel_elm.target_ref.startswith("#"): continue srels._srels.append(_SerializedRelationship(baseURI, rel_elm)) return srels From 7af98328f565ffd9521ae92afefd93596282abfc Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Thu, 15 Jan 2026 10:53:18 +0800 Subject: [PATCH 110/335] Fix: the styles of the multi-select component and the filter pop-up. (#12628) ### What problem does this PR solve? Fix: Fix the styles of the multi-select component and the filter pop-up. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- .../list-filter-bar/filter-popover.tsx | 32 ++++++++++--------- web/src/components/ui/multi-select.tsx | 5 +-- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/web/src/components/list-filter-bar/filter-popover.tsx b/web/src/components/list-filter-bar/filter-popover.tsx index 45657a81dfb..500be93bdd3 100644 --- a/web/src/components/list-filter-bar/filter-popover.tsx +++ b/web/src/components/list-filter-bar/filter-popover.tsx @@ -194,7 +194,7 @@ function CheckboxFormMultiple({
    form.reset()} >
    @@ -265,20 +265,22 @@ function CheckboxFormMultiple({ )}
    - {!!filteredItem.list?.length && - filteredItem.list.map((item) => { - return ( - - ); - })} +
    + {!!filteredItem.list?.length && + filteredItem.list.map((item) => { + return ( + + ); + })} +
    ); diff --git a/web/src/components/ui/multi-select.tsx b/web/src/components/ui/multi-select.tsx index bf9e2374b79..42bb1843eff 100644 --- a/web/src/components/ui/multi-select.tsx +++ b/web/src/components/ui/multi-select.tsx @@ -124,7 +124,8 @@ const multiSelectVariants = cva( * Props for MultiSelect component */ interface MultiSelectProps - extends React.ButtonHTMLAttributes, + extends + React.ButtonHTMLAttributes, VariantProps { /** * An array of option objects to be displayed in the multi-select component. @@ -289,7 +290,7 @@ export const MultiSelect = React.forwardRef< {...props} onClick={handleTogglePopover} className={cn( - 'flex w-full p-1 rounded-md border border-border-button min-h-10 h-auto placeholder:text-text-disabled items-center justify-between bg-bg-input hover:bg-bg-input [&_svg]:pointer-events-auto', + 'flex w-full p-1 rounded-md border border-border-button min-h-10 h-auto placeholder:text-text-disabled items-center justify-between bg-bg-input focus-visible:bg-bg-input hover:bg-bg-input [&_svg]:pointer-events-auto', className, )} > From f82628c40c7ba68276d08b2719504b3c18850343 Mon Sep 17 00:00:00 2001 From: SID <158349177+0xsid0703@users.noreply.github.com> Date: Wed, 14 Jan 2026 19:23:15 -0800 Subject: [PATCH 111/335] Fix: langfuse connection error handling #12621 (#12626) ## Description Fixes connection error handling when langfuse service is unavailable. The application now gracefully handles connection failures instead of crashing. ## Changes - Wrapped `langfuse.auth_check()` calls in try-except blocks in: - `api/db/services/dialog_service.py` - `api/db/services/tenant_llm_service.py` ## Problem When langfuse service is unavailable or connection is refused, `langfuse.auth_check()` throws `httpx.ConnectError: [Errno 111] Connection refused`, causing the application to crash during document parsing or dialog operations. ## Solution Added try-except blocks around `langfuse.auth_check()` calls to catch connection errors and gracefully skip langfuse tracing instead of crashing. The application continues functioning normally even when langfuse is unavailable. ## Related Issue Fixes #12621 --- Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=158349177 --- api/db/services/dialog_service.py | 12 ++++++++---- api/db/services/tenant_llm_service.py | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/api/db/services/dialog_service.py b/api/db/services/dialog_service.py index ed178434d5d..9935827be86 100644 --- a/api/db/services/dialog_service.py +++ b/api/db/services/dialog_service.py @@ -296,10 +296,14 @@ async def async_chat(dialog, messages, stream=True, **kwargs): langfuse_keys = TenantLangfuseService.filter_by_tenant(tenant_id=dialog.tenant_id) if langfuse_keys: langfuse = Langfuse(public_key=langfuse_keys.public_key, secret_key=langfuse_keys.secret_key, host=langfuse_keys.host) - if langfuse.auth_check(): - langfuse_tracer = langfuse - trace_id = langfuse_tracer.create_trace_id() - trace_context = {"trace_id": trace_id} + try: + if langfuse.auth_check(): + langfuse_tracer = langfuse + trace_id = langfuse_tracer.create_trace_id() + trace_context = {"trace_id": trace_id} + except Exception: + # Skip langfuse tracing if connection fails + pass check_langfuse_tracer_ts = timer() kbs, embd_mdl, rerank_mdl, chat_mdl, tts_mdl = get_models(dialog) diff --git a/api/db/services/tenant_llm_service.py b/api/db/services/tenant_llm_service.py index 43f9107b296..5bd663734a8 100644 --- a/api/db/services/tenant_llm_service.py +++ b/api/db/services/tenant_llm_service.py @@ -392,7 +392,11 @@ def __init__(self, tenant_id, llm_type, llm_name=None, lang="Chinese", **kwargs) self.langfuse = None if langfuse_keys: langfuse = Langfuse(public_key=langfuse_keys.public_key, secret_key=langfuse_keys.secret_key, host=langfuse_keys.host) - if langfuse.auth_check(): - self.langfuse = langfuse - trace_id = self.langfuse.create_trace_id() - self.trace_context = {"trace_id": trace_id} + try: + if langfuse.auth_check(): + self.langfuse = langfuse + trace_id = self.langfuse.create_trace_id() + self.trace_context = {"trace_id": trace_id} + except Exception: + # Skip langfuse tracing if connection fails + pass From 9a10558f8013c2ef50a1d30dd1dccb489eb3fccc Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Thu, 15 Jan 2026 12:28:49 +0800 Subject: [PATCH 112/335] Refa: async retrieval process. (#12629) ### Type of change - [x] Refactoring - [x] Performance Improvement --- agent/tools/retrieval.py | 2 +- api/apps/chunk_app.py | 34 +++++++++---------- api/apps/kb_app.py | 4 +-- api/apps/sdk/dataset.py | 4 +-- api/apps/sdk/dify_retrieval.py | 2 +- api/apps/sdk/doc.py | 6 ++-- api/apps/sdk/session.py | 2 +- api/db/services/dialog_service.py | 15 +++----- ...tructured_query_decomposition_retrieval.py | 14 ++++---- rag/benchmark.py | 5 +-- rag/nlp/search.py | 21 ++++++------ 11 files changed, 52 insertions(+), 57 deletions(-) diff --git a/agent/tools/retrieval.py b/agent/tools/retrieval.py index 77a39b73100..2a19b74ef13 100644 --- a/agent/tools/retrieval.py +++ b/agent/tools/retrieval.py @@ -174,7 +174,7 @@ def _resolve_manual_filter(flt: dict) -> dict: if kbs: query = re.sub(r"^user[::\s]*", "", query, flags=re.IGNORECASE) - kbinfos = settings.retriever.retrieval( + kbinfos = await settings.retriever.retrieval( query, embd_mdl, [kb.tenant_id for kb in kbs], diff --git a/api/apps/chunk_app.py b/api/apps/chunk_app.py index 731506404e6..20891033a74 100644 --- a/api/apps/chunk_app.py +++ b/api/apps/chunk_app.py @@ -61,7 +61,7 @@ async def list_chunk(): } if "available_int" in req: query["available_int"] = int(req["available_int"]) - sres = settings.retriever.search(query, search.index_name(tenant_id), kb_ids, highlight=["content_ltks"]) + sres = await settings.retriever.search(query, search.index_name(tenant_id), kb_ids, highlight=["content_ltks"]) res = {"total": sres.total, "chunks": [], "doc": doc.to_dict()} for id in sres.ids: d = { @@ -371,20 +371,20 @@ async def _retrieval(): _question += await keyword_extraction(chat_mdl, _question) labels = label_question(_question, [kb]) - ranks = await asyncio.to_thread(settings.retriever.retrieval, - _question, - embd_mdl, - tenant_ids, - kb_ids, - page, - size, - float(req.get("similarity_threshold", 0.0)), - float(req.get("vector_similarity_weight", 0.3)), - doc_ids=local_doc_ids, - top=top, - rerank_mdl=rerank_mdl, - rank_feature=labels, - ) + ranks = await settings.retriever.retrieval( + _question, + embd_mdl, + tenant_ids, + kb_ids, + page, + size, + float(req.get("similarity_threshold", 0.0)), + float(req.get("vector_similarity_weight", 0.3)), + doc_ids=local_doc_ids, + top=top, + rerank_mdl=rerank_mdl, + rank_feature=labels + ) if use_kg: ck = await settings.kg_retriever.retrieval(_question, @@ -413,7 +413,7 @@ async def _retrieval(): @manager.route('/knowledge_graph', methods=['GET']) # noqa: F821 @login_required -def knowledge_graph(): +async def knowledge_graph(): doc_id = request.args["doc_id"] tenant_id = DocumentService.get_tenant_id(doc_id) kb_ids = KnowledgebaseService.get_kb_ids(tenant_id) @@ -421,7 +421,7 @@ def knowledge_graph(): "doc_ids": [doc_id], "knowledge_graph_kwd": ["graph", "mind_map"] } - sres = settings.retriever.search(req, search.index_name(tenant_id), kb_ids) + sres = await settings.retriever.search(req, search.index_name(tenant_id), kb_ids) obj = {"graph": {}, "mind_map": {}} for id in sres.ids[:2]: ty = sres.field[id]["knowledge_graph_kwd"] diff --git a/api/apps/kb_app.py b/api/apps/kb_app.py index 26ea12f9626..5ffc3040eee 100644 --- a/api/apps/kb_app.py +++ b/api/apps/kb_app.py @@ -373,7 +373,7 @@ async def rename_tags(kb_id): @manager.route('//knowledge_graph', methods=['GET']) # noqa: F821 @login_required -def knowledge_graph(kb_id): +async def knowledge_graph(kb_id): if not KnowledgebaseService.accessible(kb_id, current_user.id): return get_json_result( data=False, @@ -389,7 +389,7 @@ def knowledge_graph(kb_id): obj = {"graph": {}, "mind_map": {}} if not settings.docStoreConn.index_exist(search.index_name(kb.tenant_id), kb_id): return get_json_result(data=obj) - sres = settings.retriever.search(req, search.index_name(kb.tenant_id), [kb_id]) + sres = await settings.retriever.search(req, search.index_name(kb.tenant_id), [kb_id]) if not len(sres.ids): return get_json_result(data=obj) diff --git a/api/apps/sdk/dataset.py b/api/apps/sdk/dataset.py index 7d52c3fec50..f98705de0b9 100644 --- a/api/apps/sdk/dataset.py +++ b/api/apps/sdk/dataset.py @@ -481,7 +481,7 @@ def list_datasets(tenant_id): @manager.route('/datasets//knowledge_graph', methods=['GET']) # noqa: F821 @token_required -def knowledge_graph(tenant_id, dataset_id): +async def knowledge_graph(tenant_id, dataset_id): if not KnowledgebaseService.accessible(dataset_id, tenant_id): return get_result( data=False, @@ -497,7 +497,7 @@ def knowledge_graph(tenant_id, dataset_id): obj = {"graph": {}, "mind_map": {}} if not settings.docStoreConn.index_exist(search.index_name(kb.tenant_id), dataset_id): return get_result(data=obj) - sres = settings.retriever.search(req, search.index_name(kb.tenant_id), [dataset_id]) + sres = await settings.retriever.search(req, search.index_name(kb.tenant_id), [dataset_id]) if not len(sres.ids): return get_result(data=obj) diff --git a/api/apps/sdk/dify_retrieval.py b/api/apps/sdk/dify_retrieval.py index 91f1c9a8fb7..0841bf7bd23 100644 --- a/api/apps/sdk/dify_retrieval.py +++ b/api/apps/sdk/dify_retrieval.py @@ -135,7 +135,7 @@ async def retrieval(tenant_id): doc_ids.extend(meta_filter(metas, convert_conditions(metadata_condition), metadata_condition.get("logic", "and"))) if not doc_ids and metadata_condition: doc_ids = ["-999"] - ranks = settings.retriever.retrieval( + ranks = await settings.retriever.retrieval( question, embd_mdl, kb.tenant_id, diff --git a/api/apps/sdk/doc.py b/api/apps/sdk/doc.py index d8afe5f27ca..b27f972b996 100644 --- a/api/apps/sdk/doc.py +++ b/api/apps/sdk/doc.py @@ -935,7 +935,7 @@ async def stop_parsing(tenant_id, dataset_id): @manager.route("/datasets//documents//chunks", methods=["GET"]) # noqa: F821 @token_required -def list_chunks(tenant_id, dataset_id, document_id): +async def list_chunks(tenant_id, dataset_id, document_id): """ List chunks of a document. --- @@ -1081,7 +1081,7 @@ def list_chunks(tenant_id, dataset_id, document_id): _ = Chunk(**final_chunk) elif settings.docStoreConn.index_exist(search.index_name(tenant_id), dataset_id): - sres = settings.retriever.search(query, search.index_name(tenant_id), [dataset_id], emb_mdl=None, highlight=True) + sres = await settings.retriever.search(query, search.index_name(tenant_id), [dataset_id], emb_mdl=None, highlight=True) res["total"] = sres.total for id in sres.ids: d = { @@ -1559,7 +1559,7 @@ async def retrieval_test(tenant_id): chat_mdl = LLMBundle(kb.tenant_id, LLMType.CHAT) question += await keyword_extraction(chat_mdl, question) - ranks = settings.retriever.retrieval( + ranks = await settings.retriever.retrieval( question, embd_mdl, tenant_ids, diff --git a/api/apps/sdk/session.py b/api/apps/sdk/session.py index 03140b60b7c..80f8229bee0 100644 --- a/api/apps/sdk/session.py +++ b/api/apps/sdk/session.py @@ -1098,7 +1098,7 @@ async def _retrieval(): _question += await keyword_extraction(chat_mdl, _question) labels = label_question(_question, [kb]) - ranks = settings.retriever.retrieval( + ranks = await settings.retriever.retrieval( _question, embd_mdl, tenant_ids, kb_ids, page, size, similarity_threshold, vector_similarity_weight, top, local_doc_ids, rerank_mdl=rerank_mdl, highlight=req.get("highlight"), rank_feature=labels ) diff --git a/api/db/services/dialog_service.py b/api/db/services/dialog_service.py index 9935827be86..ccf8474b6ab 100644 --- a/api/db/services/dialog_service.py +++ b/api/db/services/dialog_service.py @@ -403,17 +403,10 @@ async def callback(msg:str): yield {"answer": msg, "reference": {}, "audio_binary": None, "final": False} await task - ''' - async for think in reasoner.thinking(kbinfos, attachments_ + " ".join(questions)): - if isinstance(think, str): - thought = think - knowledges = [t for t in think.split("\n") if t] - elif stream: - yield think - ''' + else: if embd_mdl: - kbinfos = await asyncio.to_thread(retriever.retrieval, + kbinfos = await retriever.retrieval( " ".join(questions), embd_mdl, tenant_ids, @@ -853,7 +846,7 @@ async def async_ask(question, kb_ids, tenant_id, chat_llm_name=None, search_conf metas = DocumentService.get_meta_by_kbs(kb_ids) doc_ids = await apply_meta_data_filter(meta_data_filter, metas, question, chat_mdl, doc_ids) - kbinfos = retriever.retrieval( + kbinfos = await retriever.retrieval( question=question, embd_mdl=embd_mdl, tenant_ids=tenant_ids, @@ -929,7 +922,7 @@ async def gen_mindmap(question, kb_ids, tenant_id, search_config={}): metas = DocumentService.get_meta_by_kbs(kb_ids) doc_ids = await apply_meta_data_filter(meta_data_filter, metas, question, chat_mdl, doc_ids) - ranks = settings.retriever.retrieval( + ranks = await settings.retriever.retrieval( question=question, embd_mdl=embd_mdl, tenant_ids=tenant_ids, diff --git a/rag/advanced_rag/tree_structured_query_decomposition_retrieval.py b/rag/advanced_rag/tree_structured_query_decomposition_retrieval.py index 77689cab064..214485c3b0e 100644 --- a/rag/advanced_rag/tree_structured_query_decomposition_retrieval.py +++ b/rag/advanced_rag/tree_structured_query_decomposition_retrieval.py @@ -36,12 +36,12 @@ def __init__(self, self._kg_retrieve = kg_retrieve self._lock = asyncio.Lock() - def _retrieve_information(self, search_query): + async def _retrieve_information(self, search_query): """Retrieve information from different sources""" # 1. Knowledge base retrieval kbinfos = [] try: - kbinfos = self._kb_retrieve(question=search_query) if self._kb_retrieve else {"chunks": [], "doc_aggs": []} + kbinfos = await self._kb_retrieve(question=search_query) if self._kb_retrieve else {"chunks": [], "doc_aggs": []} except Exception as e: logging.error(f"Knowledge base retrieval error: {e}") @@ -58,7 +58,7 @@ def _retrieve_information(self, search_query): # 3. Knowledge graph retrieval (if configured) try: if self.prompt_config.get("use_kg") and self._kg_retrieve: - ck = self._kg_retrieve(question=search_query) + ck = await self._kg_retrieve(question=search_query) if ck["content_with_weight"]: kbinfos["chunks"].insert(0, ck) except Exception as e: @@ -100,9 +100,9 @@ async def _research(self, chunk_info, question, query, depth=3, callback=None): if callback: await callback(f"Searching by `{query}`...") st = timer() - ret = self._retrieve_information(query) + ret = await self._retrieve_information(query) if callback: - await callback("Retrieval %d results by %.1fms"%(len(ret["chunks"]), (timer()-st)*1000)) + await callback("Retrieval %d results in %.1fms"%(len(ret["chunks"]), (timer()-st)*1000)) await self._async_update_chunk_info(chunk_info, ret) ret = kb_prompt(ret, self.chat_mdl.max_length*0.5) @@ -111,14 +111,14 @@ async def _research(self, chunk_info, question, query, depth=3, callback=None): suff = await sufficiency_check(self.chat_mdl, question, ret) if suff["is_sufficient"]: if callback: - await callback("Yes, it's sufficient.") + await callback(f"Yes, the retrieved information is sufficient for '{question}'.") return ret #if callback: # await callback("The retrieved information is not sufficient. Planing next steps...") succ_question_info = await multi_queries_gen(self.chat_mdl, question, query, suff["missing_information"], ret) if callback: - await callback("Next step is to search for the following questions:\n" + "\n - ".join(step["question"] for step in succ_question_info["questions"])) + await callback("Next step is to search for the following questions:
    - " + "
    - ".join(step["question"] for step in succ_question_info["questions"])) steps = [] for step in succ_question_info["questions"]: steps.append(asyncio.create_task(self._research(chunk_info, step["question"], step["query"], depth-1, callback))) diff --git a/rag/benchmark.py b/rag/benchmark.py index c19785db3d4..93b93adcf3e 100644 --- a/rag/benchmark.py +++ b/rag/benchmark.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import asyncio import json import os import sys @@ -52,8 +53,8 @@ def _get_retrieval(self, qrels): run = defaultdict(dict) query_list = list(qrels.keys()) for query in query_list: - ranks = settings.retriever.retrieval(query, self.embd_mdl, self.tenant_id, [self.kb.id], 1, 30, - 0.0, self.vector_similarity_weight) + ranks = asyncio.run(settings.retriever.retrieval(query, self.embd_mdl, self.tenant_id, [self.kb.id], 1, 30, + 0.0, self.vector_similarity_weight)) if len(ranks["chunks"]) == 0: print(f"deleted query: {query}") del qrels[query] diff --git a/rag/nlp/search.py b/rag/nlp/search.py index 46b8b5b0a2b..54d46b9c801 100644 --- a/rag/nlp/search.py +++ b/rag/nlp/search.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import asyncio import json import logging import re @@ -49,8 +50,8 @@ class SearchResult: keywords: list[str] | None = None group_docs: list[list] | None = None - def get_vector(self, txt, emb_mdl, topk=10, similarity=0.1): - qv, _ = emb_mdl.encode_queries(txt) + async def get_vector(self, txt, emb_mdl, topk=10, similarity=0.1): + qv, _ = await asyncio.to_thread(emb_mdl.encode_queries, txt) shape = np.array(qv).shape if len(shape) > 1: raise Exception( @@ -71,7 +72,7 @@ def get_filters(self, req): condition[key] = req[key] return condition - def search(self, req, idx_names: str | list[str], + async def search(self, req, idx_names: str | list[str], kb_ids: list[str], emb_mdl=None, highlight: bool | list | None = None, @@ -114,12 +115,12 @@ def search(self, req, idx_names: str | list[str], matchText, keywords = self.qryr.question(qst, min_match=0.3) if emb_mdl is None: matchExprs = [matchText] - res = self.dataStore.search(src, highlightFields, filters, matchExprs, orderBy, offset, limit, + res = await asyncio.to_thread(self.dataStore.search, src, highlightFields, filters, matchExprs, orderBy, offset, limit, idx_names, kb_ids, rank_feature=rank_feature) total = self.dataStore.get_total(res) logging.debug("Dealer.search TOTAL: {}".format(total)) else: - matchDense = self.get_vector(qst, emb_mdl, topk, req.get("similarity", 0.1)) + matchDense = await self.get_vector(qst, emb_mdl, topk, req.get("similarity", 0.1)) q_vec = matchDense.embedding_data if not settings.DOC_ENGINE_INFINITY: src.append(f"q_{len(q_vec)}_vec") @@ -127,7 +128,7 @@ def search(self, req, idx_names: str | list[str], fusionExpr = FusionExpr("weighted_sum", topk, {"weights": "0.05,0.95"}) matchExprs = [matchText, matchDense, fusionExpr] - res = self.dataStore.search(src, highlightFields, filters, matchExprs, orderBy, offset, limit, + res = await asyncio.to_thread(self.dataStore.search, src, highlightFields, filters, matchExprs, orderBy, offset, limit, idx_names, kb_ids, rank_feature=rank_feature) total = self.dataStore.get_total(res) logging.debug("Dealer.search TOTAL: {}".format(total)) @@ -135,12 +136,12 @@ def search(self, req, idx_names: str | list[str], # If result is empty, try again with lower min_match if total == 0: if filters.get("doc_id"): - res = self.dataStore.search(src, [], filters, [], orderBy, offset, limit, idx_names, kb_ids) + res = await asyncio.to_thread(self.dataStore.search, src, [], filters, [], orderBy, offset, limit, idx_names, kb_ids) total = self.dataStore.get_total(res) else: matchText, _ = self.qryr.question(qst, min_match=0.1) matchDense.extra_options["similarity"] = 0.17 - res = self.dataStore.search(src, highlightFields, filters, [matchText, matchDense, fusionExpr], + res = await asyncio.to_thread(self.dataStore.search, src, highlightFields, filters, [matchText, matchDense, fusionExpr], orderBy, offset, limit, idx_names, kb_ids, rank_feature=rank_feature) total = self.dataStore.get_total(res) @@ -359,7 +360,7 @@ def hybrid_similarity(self, ans_embd, ins_embd, ans, inst): rag_tokenizer.tokenize(ans).split(), rag_tokenizer.tokenize(inst).split()) - def retrieval( + async def retrieval( self, question, embd_mdl, @@ -398,7 +399,7 @@ def retrieval( if isinstance(tenant_ids, str): tenant_ids = tenant_ids.split(",") - sres = self.search(req, [index_name(tid) for tid in tenant_ids], kb_ids, embd_mdl, highlight, + sres = await self.search(req, [index_name(tid) for tid in tenant_ids], kb_ids, embd_mdl, highlight, rank_feature=rank_feature) if rerank_mdl and sres.total > 0: From b40a7b2e7d7a9500a3993c6bcbe344ba29bbb8f4 Mon Sep 17 00:00:00 2001 From: Magicbook1108 Date: Thu, 15 Jan 2026 14:02:15 +0800 Subject: [PATCH 113/335] Feat: Hash doc id to avoid duplicate name. (#12573) ### What problem does this PR solve? Feat: Hash doc id to avoid duplicate name. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- api/db/services/connector_service.py | 4 ++-- api/db/services/file_service.py | 10 +++++++++- api/utils/common.py | 5 +++++ rag/svr/sync_data_source.py | 3 ++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/api/db/services/connector_service.py b/api/db/services/connector_service.py index 660530c824b..0a7b5cb7182 100644 --- a/api/db/services/connector_service.py +++ b/api/db/services/connector_service.py @@ -29,7 +29,6 @@ from common.constants import TaskStatus from common.time_utils import current_timestamp, timestamp_to_date - class ConnectorService(CommonService): model = Connector @@ -202,6 +201,7 @@ def duplicate_and_parse(cls, kb, docs, tenant_id, src, auto_parse=True): return None class FileObj(BaseModel): + id: str filename: str blob: bytes @@ -209,7 +209,7 @@ def read(self) -> bytes: return self.blob errs = [] - files = [FileObj(filename=d["semantic_identifier"]+(f"{d['extension']}" if d["semantic_identifier"][::-1].find(d['extension'][::-1])<0 else ""), blob=d["blob"]) for d in docs] + files = [FileObj(id=d["id"], filename=d["semantic_identifier"]+(f"{d['extension']}" if d["semantic_identifier"][::-1].find(d['extension'][::-1])<0 else ""), blob=d["blob"]) for d in docs] doc_ids = [] err, doc_blob_pairs = FileService.upload_document(kb, files, tenant_id, src) errs.extend(err) diff --git a/api/db/services/file_service.py b/api/db/services/file_service.py index d6a157b2d1e..eba59a3cf22 100644 --- a/api/db/services/file_service.py +++ b/api/db/services/file_service.py @@ -439,6 +439,15 @@ def upload_document(self, kb, file_objs, user_id, src="local", parent_path: str err, files = [], [] for file in file_objs: + doc_id = file.id if hasattr(file, "id") else get_uuid() + e, doc = DocumentService.get_by_id(doc_id) + if e: + blob = file.read() + settings.STORAGE_IMPL.put(kb.id, doc.location, blob, kb.tenant_id) + doc.size = len(blob) + doc = doc.to_dict() + DocumentService.update_by_id(doc["id"], doc) + continue try: DocumentService.check_doc_health(kb.tenant_id, file.filename) filename = duplicate_name(DocumentService.query, name=file.filename, kb_id=kb.id) @@ -455,7 +464,6 @@ def upload_document(self, kb, file_objs, user_id, src="local", parent_path: str blob = read_potential_broken_pdf(blob) settings.STORAGE_IMPL.put(kb.id, location, blob) - doc_id = get_uuid() img = thumbnail_img(filename, blob) thumbnail_location = "" diff --git a/api/utils/common.py b/api/utils/common.py index 958cf20ffc2..4d38c40d218 100644 --- a/api/utils/common.py +++ b/api/utils/common.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import xxhash + def string_to_bytes(string): return string if isinstance( @@ -22,3 +24,6 @@ def string_to_bytes(string): def bytes_to_string(byte): return byte.decode(encoding="utf-8") +# 128 bit = 32 character +def hash128(data: str) -> str: + return xxhash.xxh128(data).hexdigest() diff --git a/rag/svr/sync_data_source.py b/rag/svr/sync_data_source.py index 764bee83079..aae977891df 100644 --- a/rag/svr/sync_data_source.py +++ b/rag/svr/sync_data_source.py @@ -36,6 +36,7 @@ from flask import json +from api.utils.common import hash128 from api.db.services.connector_service import ConnectorService, SyncLogsService from api.db.services.knowledgebase_service import KnowledgebaseService from common import settings @@ -126,7 +127,7 @@ async def _run_task_logic(self, task: dict): docs = [] for doc in document_batch: d = { - "id": doc.id, + "id": hash128(doc.id), "connector_id": task["connector_id"], "source": self.SOURCE_NAME, "semantic_identifier": doc.semantic_identifier, From 97b983fd0bc2636c1f64735e67a1c72d193062cb Mon Sep 17 00:00:00 2001 From: MkDev11 Date: Thu, 15 Jan 2026 01:05:25 -0500 Subject: [PATCH 114/335] fix: add fallback parser list for empty parser_ids (#12632) ### What problem does this PR solve? Fixes #12570 - The slicing method dropdown was empty when deploying RAGFlow v0.23.1 from source code. The issue occurred because `parser_ids` from the tenant info was empty or undefined, causing `useSelectParserList` to return an empty array. This PR adds a fallback to a default parser list when `parser_ids` is empty, ensuring the dropdown always has options. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=94194147 --- web/src/hooks/use-user-setting-request.tsx | 25 +++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/web/src/hooks/use-user-setting-request.tsx b/web/src/hooks/use-user-setting-request.tsx index c0a048d1aa2..7322b5d970b 100644 --- a/web/src/hooks/use-user-setting-request.tsx +++ b/web/src/hooks/use-user-setting-request.tsx @@ -112,6 +112,23 @@ export const useFetchTenantInfo = ( return { data, loading }; }; +const DEFAULT_PARSERS = [ + { value: 'naive', label: 'General' }, + { value: 'qa', label: 'Q&A' }, + { value: 'resume', label: 'Resume' }, + { value: 'manual', label: 'Manual' }, + { value: 'table', label: 'Table' }, + { value: 'paper', label: 'Paper' }, + { value: 'book', label: 'Book' }, + { value: 'laws', label: 'Laws' }, + { value: 'presentation', label: 'Presentation' }, + { value: 'picture', label: 'Picture' }, + { value: 'one', label: 'One' }, + { value: 'audio', label: 'Audio' }, + { value: 'email', label: 'Email' }, + { value: 'tag', label: 'Tag' }, +]; + export const useSelectParserList = (): Array<{ value: string; label: string; @@ -120,7 +137,13 @@ export const useSelectParserList = (): Array<{ const parserList = useMemo(() => { const parserArray: Array = tenantInfo?.parser_ids?.split(',') ?? []; - return parserArray.map((x) => { + const filteredArray = parserArray.filter((x) => x.trim() !== ''); + + if (filteredArray.length === 0) { + return DEFAULT_PARSERS; + } + + return filteredArray.map((x) => { const arr = x.split(':'); return { value: arr[0], label: arr[1] }; }); From eb35e2b89f860d42a1a29ab0fd5020cae64939c7 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Thu, 15 Jan 2026 14:22:16 +0800 Subject: [PATCH 115/335] Fix: async invocation isssue. (#12634) ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- graphrag/search.py | 4 ++-- graphrag/utils.py | 22 ++++++---------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/graphrag/search.py b/graphrag/search.py index 728588b8731..64abfd68a11 100644 --- a/graphrag/search.py +++ b/graphrag/search.py @@ -44,7 +44,7 @@ async def _chat(self, llm_bdl, system, history, gen_conf): return response async def query_rewrite(self, llm, question, idxnms, kb_ids): - ty2ents = get_entity_type2samples(idxnms, kb_ids) + ty2ents = await get_entity_type2samples(idxnms, kb_ids) hint_prompt = PROMPTS["minirag_query2kwd"].format(query=question, TYPE_POOL=json.dumps(ty2ents, ensure_ascii=False, indent=2)) result = await self._chat(llm, hint_prompt, [{"role": "user", "content": "Output:"}], {}) @@ -242,7 +242,7 @@ async def retrieval(self, question: str, for (f, t), rel in rels_from_txt: if not rel.get("description"): for tid in tenant_ids: - rela = get_relation(tid, kb_ids, f, t) + rela = await get_relation(tid, kb_ids, f, t) if rela: break else: diff --git a/graphrag/utils.py b/graphrag/utils.py index 89dbfad75fb..118e5ccf67c 100644 --- a/graphrag/utils.py +++ b/graphrag/utils.py @@ -327,7 +327,7 @@ async def graph_node_to_chunk(kb_id, embd_mdl, ent_name, meta, chunks): @timeout(3, 3) -def get_relation(tenant_id, kb_id, from_ent_name, to_ent_name, size=1): +async def get_relation(tenant_id, kb_id, from_ent_name, to_ent_name, size=1): ents = from_ent_name if isinstance(ents, str): ents = [from_ent_name] @@ -337,7 +337,7 @@ def get_relation(tenant_id, kb_id, from_ent_name, to_ent_name, size=1): ents = list(set(ents)) conds = {"fields": ["content_with_weight"], "size": size, "from_entity_kwd": ents, "to_entity_kwd": ents, "knowledge_graph_kwd": ["relation"]} res = [] - es_res = settings.retriever.search(conds, search.index_name(tenant_id), [kb_id] if isinstance(kb_id, str) else kb_id) + es_res = await settings.retriever.search(conds, search.index_name(tenant_id), [kb_id] if isinstance(kb_id, str) else kb_id) for id in es_res.ids: try: if size == 1: @@ -404,12 +404,7 @@ async def does_graph_contains(tenant_id, kb_id, doc_id): async def get_graph_doc_ids(tenant_id, kb_id) -> list[str]: conds = {"fields": ["source_id"], "removed_kwd": "N", "size": 1, "knowledge_graph_kwd": ["graph"]} - res = await asyncio.to_thread( - settings.retriever.search, - conds, - search.index_name(tenant_id), - [kb_id] - ) + res = await settings.retriever.search(conds, search.index_name(tenant_id), [kb_id]) doc_ids = [] if res.total == 0: return doc_ids @@ -420,12 +415,7 @@ async def get_graph_doc_ids(tenant_id, kb_id) -> list[str]: async def get_graph(tenant_id, kb_id, exclude_rebuild=None): conds = {"fields": ["content_with_weight", "removed_kwd", "source_id"], "size": 1, "knowledge_graph_kwd": ["graph"]} - res = await asyncio.to_thread( - settings.retriever.search, - conds, - search.index_name(tenant_id), - [kb_id] - ) + res = await settings.retriever.search(conds, search.index_name(tenant_id), [kb_id]) if not res.total == 0: for id in res.ids: try: @@ -626,8 +616,8 @@ def merge_tuples(list1, list2): return result -def get_entity_type2samples(idxnms, kb_ids: list): - es_res = settings.retriever.search({"knowledge_graph_kwd": "ty2ents", "kb_id": kb_ids, "size": 10000, "fields": ["content_with_weight"]},idxnms,kb_ids) +async def get_entity_type2samples(idxnms, kb_ids: list): + es_res = await settings.retriever.search({"knowledge_graph_kwd": "ty2ents", "kb_id": kb_ids, "size": 10000, "fields": ["content_with_weight"]},idxnms,kb_ids) res = defaultdict(list) for id in es_res.ids: From d8192f8f1736e2a01db50e68d947a1f3b74e4a1c Mon Sep 17 00:00:00 2001 From: Pegasus <42954461+leonace924@users.noreply.github.com> Date: Thu, 15 Jan 2026 01:24:51 -0500 Subject: [PATCH 116/335] Fix: validate regex pattern in split_with_pattern to prevent crash (#12633) ### What problem does this PR solve? Fix regex pattern validation in split_with_pattern (#12605) - Add try-except block to validate user-provided regex patterns before use - Gracefully fallback to single chunk when invalid regex is provided - Prevent server crash during DOCX parsing with malformed delimiters ## Problem Parsing DOCX files with custom regex delimiters crashes with `re.error: nothing to repeat at position 9` when users provide invalid regex patterns. Closes #12605 ## Solution Validate and compile regex pattern before use. On invalid pattern, log warning and return content as single chunk instead of crashing. ## Changes - `rag/nlp/__init__.py`: Add regex validation in `split_with_pattern()` function ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=42954461 --- rag/nlp/__init__.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rag/nlp/__init__.py b/rag/nlp/__init__.py index e4cefd993f6..bc033dac4c3 100644 --- a/rag/nlp/__init__.py +++ b/rag/nlp/__init__.py @@ -275,7 +275,18 @@ def tokenize(d, txt, eng): def split_with_pattern(d, pattern: str, content: str, eng) -> list: docs = [] - txts = [txt for txt in re.split(r"(%s)" % pattern, content, flags=re.DOTALL)] + + # Validate and compile regex pattern before use + try: + compiled_pattern = re.compile(r"(%s)" % pattern, flags=re.DOTALL) + except re.error as e: + logging.warning(f"Invalid delimiter regex pattern '{pattern}': {e}. Falling back to no split.") + # Fallback: return content as single chunk + dd = copy.deepcopy(d) + tokenize(dd, content, eng) + return [dd] + + txts = [txt for txt in compiled_pattern.split(content)] for j in range(0, len(txts), 2): txt = txts[j] if not txt: From ac936005e64ea4029026ad66ac550f9995b0fed2 Mon Sep 17 00:00:00 2001 From: Vedant Madane <6527493+VedantMadane@users.noreply.github.com> Date: Thu, 15 Jan 2026 12:15:55 +0530 Subject: [PATCH 117/335] fix: ensure deleted chunks are not returned in retrieval (#12520) (#12546) ## Summary Fixes #12520 - Deleted chunks should not appear in retrieval/reference results. ## Changes ### Core Fix - **api/apps/chunk_app.py**: Include \doc_id\ in delete condition to properly scope the delete operation ### Improved Error Handling - **api/db/services/document_service.py**: Better separation of concerns with individual try-catch blocks and proper logging for each cleanup operation ### Doc Store Updates - **rag/utils/es_conn.py**: Updated delete query construction to support compound conditions - **rag/utils/opensearch_conn.py**: Same updates for OpenSearch compatibility ### Tests - **test/testcases/.../test_retrieval_chunks.py**: Added \TestDeletedChunksNotRetrievable\ class with regression tests - **test/unit/test_delete_query_construction.py**: Unit tests for delete query construction ## Testing - Added regression tests that verify deleted chunks are not returned by retrieval API - Tests cover single chunk deletion and batch deletion scenarios --- api/apps/chunk_app.py | 4 +- api/db/services/document_service.py | 26 +- rag/utils/es_conn.py | 51 +-- rag/utils/opensearch_conn.py | 55 ++-- .../test_retrieval_chunks.py | 89 +++++- test/unit/test_delete_query_construction.py | 291 ++++++++++++++++++ 6 files changed, 470 insertions(+), 46 deletions(-) create mode 100644 test/unit/test_delete_query_construction.py diff --git a/api/apps/chunk_app.py b/api/apps/chunk_app.py index 20891033a74..e900d0bffbb 100644 --- a/api/apps/chunk_app.py +++ b/api/apps/chunk_app.py @@ -223,7 +223,9 @@ def _rm_sync(): e, doc = DocumentService.get_by_id(req["doc_id"]) if not e: return get_data_error_result(message="Document not found!") - if not settings.docStoreConn.delete({"id": req["chunk_ids"]}, + # Include doc_id in condition to properly scope the delete + condition = {"id": req["chunk_ids"], "doc_id": req["doc_id"]} + if not settings.docStoreConn.delete(condition, search.index_name(DocumentService.get_tenant_id(req["doc_id"])), doc.kb_id): return get_data_error_result(message="Chunk deleting failure") diff --git a/api/db/services/document_service.py b/api/db/services/document_service.py index a05d1783d9e..262a43bc51f 100644 --- a/api/db/services/document_service.py +++ b/api/db/services/document_service.py @@ -340,14 +340,35 @@ def insert(cls, doc): def remove_document(cls, doc, tenant_id): from api.db.services.task_service import TaskService cls.clear_chunk_num(doc.id) + + # Delete tasks first try: TaskService.filter_delete([Task.doc_id == doc.id]) + except Exception as e: + logging.warning(f"Failed to delete tasks for document {doc.id}: {e}") + + # Delete chunk images (non-critical, log and continue) + try: cls.delete_chunk_images(doc, tenant_id) + except Exception as e: + logging.warning(f"Failed to delete chunk images for document {doc.id}: {e}") + + # Delete thumbnail (non-critical, log and continue) + try: if doc.thumbnail and not doc.thumbnail.startswith(IMG_BASE64_PREFIX): if settings.STORAGE_IMPL.obj_exist(doc.kb_id, doc.thumbnail): settings.STORAGE_IMPL.rm(doc.kb_id, doc.thumbnail) + except Exception as e: + logging.warning(f"Failed to delete thumbnail for document {doc.id}: {e}") + + # Delete chunks from doc store - this is critical, log errors + try: settings.docStoreConn.delete({"doc_id": doc.id}, search.index_name(tenant_id), doc.kb_id) + except Exception as e: + logging.error(f"Failed to delete chunks from doc store for document {doc.id}: {e}") + # Cleanup knowledge graph references (non-critical, log and continue) + try: graph_source = settings.docStoreConn.get_fields( settings.docStoreConn.search(["source_id"], [], {"kb_id": doc.kb_id, "knowledge_graph_kwd": ["graph"]}, [], OrderByExpr(), 0, 1, search.index_name(tenant_id), [doc.kb_id]), ["source_id"] ) @@ -360,8 +381,9 @@ def remove_document(cls, doc, tenant_id): search.index_name(tenant_id), doc.kb_id) settings.docStoreConn.delete({"kb_id": doc.kb_id, "knowledge_graph_kwd": ["entity", "relation", "graph", "subgraph", "community_report"], "must_not": {"exists": "source_id"}}, search.index_name(tenant_id), doc.kb_id) - except Exception: - pass + except Exception as e: + logging.warning(f"Failed to cleanup knowledge graph for document {doc.id}: {e}") + return cls.delete_by_id(doc.id) @classmethod diff --git a/rag/utils/es_conn.py b/rag/utils/es_conn.py index 1d7b02e3680..d873a5af573 100644 --- a/rag/utils/es_conn.py +++ b/rag/utils/es_conn.py @@ -303,32 +303,43 @@ def update(self, condition: dict, new_value: dict, index_name: str, knowledgebas def delete(self, condition: dict, index_name: str, knowledgebase_id: str) -> int: assert "_id" not in condition condition["kb_id"] = knowledgebase_id + + # Build a bool query that combines id filter with other conditions + bool_query = Q("bool") + + # Handle chunk IDs if present if "id" in condition: chunk_ids = condition["id"] if not isinstance(chunk_ids, list): chunk_ids = [chunk_ids] - if not chunk_ids: # when chunk_ids is empty, delete all - qry = Q("match_all") - else: - qry = Q("ids", values=chunk_ids) - else: - qry = Q("bool") - for k, v in condition.items(): - if k == "exists": - qry.filter.append(Q("exists", field=v)) + if chunk_ids: + # Filter by specific chunk IDs + bool_query.filter.append(Q("ids", values=chunk_ids)) + # If chunk_ids is empty, we don't add an ids filter - rely on other conditions - elif k == "must_not": - if isinstance(v, dict): - for kk, vv in v.items(): - if kk == "exists": - qry.must_not.append(Q("exists", field=vv)) + # Add all other conditions as filters + for k, v in condition.items(): + if k == "id": + continue # Already handled above + if k == "exists": + bool_query.filter.append(Q("exists", field=v)) + elif k == "must_not": + if isinstance(v, dict): + for kk, vv in v.items(): + if kk == "exists": + bool_query.must_not.append(Q("exists", field=vv)) + elif isinstance(v, list): + bool_query.must.append(Q("terms", **{k: v})) + elif isinstance(v, str) or isinstance(v, int): + bool_query.must.append(Q("term", **{k: v})) + elif v is not None: + raise Exception("Condition value must be int, str or list.") - elif isinstance(v, list): - qry.must.append(Q("terms", **{k: v})) - elif isinstance(v, str) or isinstance(v, int): - qry.must.append(Q("term", **{k: v})) - else: - raise Exception("Condition value must be int, str or list.") + # If no filters were added, use match_all (for tenant-wide operations) + if not bool_query.filter and not bool_query.must and not bool_query.must_not: + qry = Q("match_all") + else: + qry = bool_query self.logger.debug("ESConnection.delete query: " + json.dumps(qry.to_dict())) for _ in range(ATTEMPT_TIME): try: diff --git a/rag/utils/opensearch_conn.py b/rag/utils/opensearch_conn.py index 67e7364fe51..2e730829b33 100644 --- a/rag/utils/opensearch_conn.py +++ b/rag/utils/opensearch_conn.py @@ -405,34 +405,45 @@ def update(self, condition: dict, newValue: dict, indexName: str, knowledgebaseI return False def delete(self, condition: dict, indexName: str, knowledgebaseId: str) -> int: - qry = None assert "_id" not in condition + condition["kb_id"] = knowledgebaseId + + # Build a bool query that combines id filter with other conditions + bool_query = Q("bool") + + # Handle chunk IDs if present if "id" in condition: chunk_ids = condition["id"] if not isinstance(chunk_ids, list): chunk_ids = [chunk_ids] - if not chunk_ids: # when chunk_ids is empty, delete all - qry = Q("match_all") - else: - qry = Q("ids", values=chunk_ids) + if chunk_ids: + # Filter by specific chunk IDs + bool_query.filter.append(Q("ids", values=chunk_ids)) + # If chunk_ids is empty, we don't add an ids filter - rely on other conditions + + # Add all other conditions as filters + for k, v in condition.items(): + if k == "id": + continue # Already handled above + if k == "exists": + bool_query.filter.append(Q("exists", field=v)) + elif k == "must_not": + if isinstance(v, dict): + for kk, vv in v.items(): + if kk == "exists": + bool_query.must_not.append(Q("exists", field=vv)) + elif isinstance(v, list): + bool_query.must.append(Q("terms", **{k: v})) + elif isinstance(v, str) or isinstance(v, int): + bool_query.must.append(Q("term", **{k: v})) + elif v is not None: + raise Exception("Condition value must be int, str or list.") + + # If no filters were added, use match_all (for tenant-wide operations) + if not bool_query.filter and not bool_query.must and not bool_query.must_not: + qry = Q("match_all") else: - qry = Q("bool") - for k, v in condition.items(): - if k == "exists": - qry.filter.append(Q("exists", field=v)) - - elif k == "must_not": - if isinstance(v, dict): - for kk, vv in v.items(): - if kk == "exists": - qry.must_not.append(Q("exists", field=vv)) - - elif isinstance(v, list): - qry.must.append(Q("terms", **{k: v})) - elif isinstance(v, str) or isinstance(v, int): - qry.must.append(Q("term", **{k: v})) - else: - raise Exception("Condition value must be int, str or list.") + qry = bool_query logger.debug("OSConnection.delete query: " + json.dumps(qry.to_dict())) for _ in range(ATTEMPT_TIME): try: diff --git a/test/testcases/test_http_api/test_chunk_management_within_dataset/test_retrieval_chunks.py b/test/testcases/test_http_api/test_chunk_management_within_dataset/test_retrieval_chunks.py index 3bdd06b0580..1b1e621fd3f 100644 --- a/test/testcases/test_http_api/test_chunk_management_within_dataset/test_retrieval_chunks.py +++ b/test/testcases/test_http_api/test_chunk_management_within_dataset/test_retrieval_chunks.py @@ -15,9 +15,10 @@ # import os from concurrent.futures import ThreadPoolExecutor, as_completed +from time import sleep import pytest -from common import retrieval_chunks +from common import add_chunk, delete_chunks, retrieval_chunks from configs import INVALID_API_TOKEN from libs.auth import RAGFlowHttpApiAuth @@ -310,3 +311,89 @@ def test_concurrent_retrieval(self, HttpApiAuth, add_chunks): responses = list(as_completed(futures)) assert len(responses) == count, responses assert all(future.result()["code"] == 0 for future in futures) + + +class TestDeletedChunksNotRetrievable: + """Regression tests for issue #12520: deleted slices should not appear in retrieval/reference.""" + + @pytest.mark.p1 + def test_deleted_chunk_not_in_retrieval(self, HttpApiAuth, add_document): + """ + Test that a deleted chunk is not returned by the retrieval API. + + Steps: + 1. Add a chunk with unique content + 2. Verify the chunk is retrievable + 3. Delete the chunk + 4. Verify the chunk is no longer retrievable + """ + dataset_id, document_id = add_document + + # Add a chunk with unique content that we can search for + unique_content = "UNIQUE_TEST_CONTENT_12520_REGRESSION" + res = add_chunk(HttpApiAuth, dataset_id, document_id, {"content": unique_content}) + assert res["code"] == 0, f"Failed to add chunk: {res}" + chunk_id = res["data"]["chunk"]["id"] + + # Wait for indexing to complete + sleep(2) + + # Verify the chunk is retrievable + payload = {"question": unique_content, "dataset_ids": [dataset_id]} + res = retrieval_chunks(HttpApiAuth, payload) + assert res["code"] == 0, f"Retrieval failed: {res}" + chunk_ids_before = [c["id"] for c in res["data"]["chunks"]] + assert chunk_id in chunk_ids_before, f"Chunk {chunk_id} should be retrievable before deletion" + + # Delete the chunk + res = delete_chunks(HttpApiAuth, dataset_id, document_id, {"chunk_ids": [chunk_id]}) + assert res["code"] == 0, f"Failed to delete chunk: {res}" + + # Wait for deletion to propagate + sleep(1) + + # Verify the chunk is no longer retrievable + res = retrieval_chunks(HttpApiAuth, payload) + assert res["code"] == 0, f"Retrieval failed after deletion: {res}" + chunk_ids_after = [c["id"] for c in res["data"]["chunks"]] + assert chunk_id not in chunk_ids_after, f"Chunk {chunk_id} should NOT be retrievable after deletion" + + @pytest.mark.p2 + def test_deleted_chunks_batch_not_in_retrieval(self, HttpApiAuth, add_document): + """ + Test that multiple deleted chunks are not returned by retrieval. + """ + dataset_id, document_id = add_document + + # Add multiple chunks with unique content + chunk_ids = [] + for i in range(3): + unique_content = f"BATCH_DELETE_TEST_CHUNK_{i}_12520" + res = add_chunk(HttpApiAuth, dataset_id, document_id, {"content": unique_content}) + assert res["code"] == 0, f"Failed to add chunk {i}: {res}" + chunk_ids.append(res["data"]["chunk"]["id"]) + + # Wait for indexing + sleep(2) + + # Verify chunks are retrievable + payload = {"question": "BATCH_DELETE_TEST_CHUNK", "dataset_ids": [dataset_id]} + res = retrieval_chunks(HttpApiAuth, payload) + assert res["code"] == 0 + retrieved_ids_before = [c["id"] for c in res["data"]["chunks"]] + for cid in chunk_ids: + assert cid in retrieved_ids_before, f"Chunk {cid} should be retrievable before deletion" + + # Delete all chunks + res = delete_chunks(HttpApiAuth, dataset_id, document_id, {"chunk_ids": chunk_ids}) + assert res["code"] == 0, f"Failed to delete chunks: {res}" + + # Wait for deletion to propagate + sleep(1) + + # Verify none of the chunks are retrievable + res = retrieval_chunks(HttpApiAuth, payload) + assert res["code"] == 0 + retrieved_ids_after = [c["id"] for c in res["data"]["chunks"]] + for cid in chunk_ids: + assert cid not in retrieved_ids_after, f"Chunk {cid} should NOT be retrievable after deletion" diff --git a/test/unit/test_delete_query_construction.py b/test/unit/test_delete_query_construction.py new file mode 100644 index 00000000000..eed2a5489ce --- /dev/null +++ b/test/unit/test_delete_query_construction.py @@ -0,0 +1,291 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +""" +Unit tests for delete query construction in ES/OpenSearch connectors. + +These tests verify that the delete method correctly combines chunk IDs with +other filter conditions (doc_id, kb_id) to scope deletions properly. + +This addresses issue #12520: "Files of deleted slices can still be searched +and displayed in 'reference'" - caused by delete queries not properly +combining all filter conditions. + +Run with: python -m pytest test/unit/test_delete_query_construction.py -v +""" + +import pytest +from elasticsearch_dsl import Q, Search + + +class TestDeleteQueryConstruction: + """ + Tests that verify the delete query is constructed correctly to include + all necessary filter conditions (chunk IDs + doc_id + kb_id). + """ + + def build_delete_query(self, condition: dict, knowledgebase_id: str) -> dict: + """ + Simulates the query construction logic from es_conn.py/opensearch_conn.py delete method. + This is extracted to test the logic without needing actual ES/OS connections. + """ + condition = condition.copy() # Don't mutate the original + condition["kb_id"] = knowledgebase_id + + # Build a bool query that combines id filter with other conditions + bool_query = Q("bool") + + # Handle chunk IDs if present + if "id" in condition: + chunk_ids = condition["id"] + if not isinstance(chunk_ids, list): + chunk_ids = [chunk_ids] + if chunk_ids: + # Filter by specific chunk IDs + bool_query.filter.append(Q("ids", values=chunk_ids)) + + # Add all other conditions as filters + for k, v in condition.items(): + if k == "id": + continue # Already handled above + if k == "exists": + bool_query.filter.append(Q("exists", field=v)) + elif k == "must_not": + if isinstance(v, dict): + for kk, vv in v.items(): + if kk == "exists": + bool_query.must_not.append(Q("exists", field=vv)) + elif isinstance(v, list): + bool_query.must.append(Q("terms", **{k: v})) + elif isinstance(v, str) or isinstance(v, int): + bool_query.must.append(Q("term", **{k: v})) + elif v is not None: + raise Exception("Condition value must be int, str or list.") + + # If no filters were added, use match_all + if not bool_query.filter and not bool_query.must and not bool_query.must_not: + qry = Q("match_all") + else: + qry = bool_query + + return Search().query(qry).to_dict() + + def test_delete_with_chunk_ids_includes_kb_id(self): + """ + CRITICAL: When deleting by chunk IDs, kb_id MUST be included in the query. + + This was the root cause of issue #12520 - the original code would + only use Q("ids") and ignore kb_id. + """ + condition = {"id": ["chunk1", "chunk2"]} + query = self.build_delete_query(condition, "kb123") + + query_dict = query["query"]["bool"] + + # Verify chunk IDs filter is present + ids_filter = [f for f in query_dict.get("filter", []) if "ids" in f] + assert len(ids_filter) == 1, "Should have ids filter" + assert set(ids_filter[0]["ids"]["values"]) == {"chunk1", "chunk2"} + + # Verify kb_id is also in the query (CRITICAL FIX) + must_terms = query_dict.get("must", []) + kb_id_terms = [t for t in must_terms if "term" in t and "kb_id" in t.get("term", {})] + assert len(kb_id_terms) == 1, "kb_id MUST be included when deleting by chunk IDs" + assert kb_id_terms[0]["term"]["kb_id"] == "kb123" + + def test_delete_with_chunk_ids_and_doc_id(self): + """ + When deleting chunks, both chunk IDs AND doc_id should be in the query + to properly scope the deletion to a specific document. + """ + condition = {"id": ["chunk1"], "doc_id": "doc456"} + query = self.build_delete_query(condition, "kb123") + + query_dict = query["query"]["bool"] + + # Verify all three conditions are present + ids_filter = [f for f in query_dict.get("filter", []) if "ids" in f] + assert len(ids_filter) == 1, "Should have ids filter" + + must_terms = query_dict.get("must", []) + + # Check kb_id + kb_id_terms = [t for t in must_terms if "term" in t and "kb_id" in t.get("term", {})] + assert len(kb_id_terms) == 1, "kb_id must be present" + + # Check doc_id + doc_id_terms = [t for t in must_terms if "term" in t and "doc_id" in t.get("term", {})] + assert len(doc_id_terms) == 1, "doc_id must be present" + assert doc_id_terms[0]["term"]["doc_id"] == "doc456" + + def test_delete_single_chunk_id_converted_to_list(self): + """ + Single chunk ID (not in a list) should be handled correctly. + """ + condition = {"id": "single_chunk"} + query = self.build_delete_query(condition, "kb123") + + query_dict = query["query"]["bool"] + ids_filter = [f for f in query_dict.get("filter", []) if "ids" in f] + assert len(ids_filter) == 1 + assert ids_filter[0]["ids"]["values"] == ["single_chunk"] + + def test_delete_empty_chunk_ids_uses_other_conditions(self): + """ + When chunk_ids is empty, should rely on other conditions (doc_id, kb_id). + This is used for deleting all chunks of a document. + """ + condition = {"id": [], "doc_id": "doc456"} + query = self.build_delete_query(condition, "kb123") + + query_dict = query["query"]["bool"] + + # Empty chunk_ids should NOT add an ids filter + ids_filter = [f for f in query_dict.get("filter", []) if "ids" in f] + assert len(ids_filter) == 0, "Empty chunk_ids should not create ids filter" + + # But kb_id and doc_id should still be present + must_terms = query_dict.get("must", []) + assert any("kb_id" in str(t) for t in must_terms), "kb_id must be present" + assert any("doc_id" in str(t) for t in must_terms), "doc_id must be present" + + def test_delete_by_doc_id_only(self): + """ + Delete all chunks of a document (no specific chunk IDs). + """ + condition = {"doc_id": "doc456"} + query = self.build_delete_query(condition, "kb123") + + query_dict = query["query"]["bool"] + must_terms = query_dict.get("must", []) + + # Both doc_id and kb_id should be in query + doc_terms = [t for t in must_terms if "term" in t and "doc_id" in t.get("term", {})] + kb_terms = [t for t in must_terms if "term" in t and "kb_id" in t.get("term", {})] + + assert len(doc_terms) == 1 + assert len(kb_terms) == 1 + + def test_delete_with_must_not_exists(self): + """ + Test handling of must_not with exists condition (used in graph cleanup). + """ + condition = { + "kb_id": "kb123", # Will be overwritten + "must_not": {"exists": "source_id"} + } + query = self.build_delete_query(condition, "kb123") + + query_dict = query["query"]["bool"] + must_not = query_dict.get("must_not", []) + + exists_filters = [f for f in must_not if "exists" in f] + assert len(exists_filters) == 1 + assert exists_filters[0]["exists"]["field"] == "source_id" + + def test_delete_with_list_values(self): + """ + Test that list values use 'terms' query (plural). + """ + condition = {"knowledge_graph_kwd": ["entity", "relation"]} + query = self.build_delete_query(condition, "kb123") + + query_dict = query["query"]["bool"] + must_terms = query_dict.get("must", []) + + terms_query = [t for t in must_terms if "terms" in t] + assert len(terms_query) >= 1 + # Find the knowledge_graph_kwd terms + kw_terms = [t for t in terms_query if "knowledge_graph_kwd" in t.get("terms", {})] + assert len(kw_terms) == 1 + + +class TestChunkAppDeleteCondition: + """ + Tests that verify the chunk_app.py rm endpoint passes the correct + condition to docStoreConn.delete. + """ + + def test_rm_endpoint_includes_doc_id_in_condition(self): + """ + The /chunk/rm endpoint MUST include doc_id in the condition + passed to settings.docStoreConn.delete. + + This is the fix applied to api/apps/chunk_app.py + """ + # Simulate what the rm endpoint should construct + req = { + "doc_id": "doc123", + "chunk_ids": ["chunk1", "chunk2"] + } + + # This is what the FIXED code should produce: + correct_condition = { + "id": req["chunk_ids"], + "doc_id": req["doc_id"] # <-- CRITICAL: doc_id must be included + } + + # Verify doc_id is in the condition + assert "doc_id" in correct_condition, "doc_id MUST be in delete condition" + assert correct_condition["doc_id"] == "doc123" + + # Verify chunk IDs are in the condition + assert "id" in correct_condition + assert correct_condition["id"] == ["chunk1", "chunk2"] + + +class TestSDKDocDeleteCondition: + """ + Tests that verify the SDK doc.py rm_chunk endpoint constructs + the correct deletion condition. + """ + + def test_sdk_rm_chunk_includes_doc_id(self): + """ + The SDK /datasets//documents//chunks DELETE endpoint + should include doc_id in the condition. + """ + # Simulate SDK request + document_id = "doc456" + chunk_ids = ["chunk1", "chunk2"] + + # The CORRECT condition construction (from sdk/doc.py): + condition = {"doc_id": document_id} + if chunk_ids: + condition["id"] = chunk_ids + + assert condition == { + "doc_id": "doc456", + "id": ["chunk1", "chunk2"] + } + + def test_sdk_rm_chunk_all_chunks(self): + """ + When no chunk_ids specified, delete all chunks of the document. + """ + document_id = "doc456" + chunk_ids = [] # Delete all + + condition = {"doc_id": document_id} + if chunk_ids: + condition["id"] = chunk_ids + + # When no chunk_ids, only doc_id should be in condition + assert condition == {"doc_id": "doc456"} + assert "id" not in condition + + +if __name__ == "__main__": + pytest.main([__file__, "-v"]) From d531bd4f1acc018043139ad3ab9682949063136d Mon Sep 17 00:00:00 2001 From: balibabu Date: Thu, 15 Jan 2026 14:55:19 +0800 Subject: [PATCH 118/335] Fix: Editing the agent greeting causes the greeting to be continuously added to the message list. #12635 (#12636) ### What problem does this PR solve? Fix: Editing the agent greeting causes the greeting to be continuously added to the message list. #12635 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/components/svg-icon.tsx | 40 ++++++++++--------- web/src/hooks/logic-hooks.ts | 25 ++++++++++++ .../agent/chat/use-send-agent-message.ts | 6 +-- 3 files changed, 50 insertions(+), 21 deletions(-) diff --git a/web/src/components/svg-icon.tsx b/web/src/components/svg-icon.tsx index 8931a292fb6..3f97bf0d074 100644 --- a/web/src/components/svg-icon.tsx +++ b/web/src/components/svg-icon.tsx @@ -65,6 +65,27 @@ const SvgIcon = memo( }, ); +SvgIcon.displayName = 'SvgIcon'; + +const themeIcons = [ + LLMFactory.FishAudio, + LLMFactory.TogetherAI, + LLMFactory.Meituan, + LLMFactory.Longcat, + LLMFactory.MinerU, +]; + +const svgIcons = [ + LLMFactory.LocalAI, + // LLMFactory.VolcEngine, + // LLMFactory.MiniMax, + LLMFactory.Gemini, + LLMFactory.StepFun, + LLMFactory.MinerU, + LLMFactory.PaddleOCR, + // LLMFactory.DeerAPI, +]; + export const LlmIcon = ({ name, height = 48, @@ -79,14 +100,7 @@ export const LlmIcon = ({ imgClass?: string; }) => { const isDark = useIsDarkTheme(); - const themeIcons = [ - LLMFactory.FishAudio, - LLMFactory.TogetherAI, - LLMFactory.Meituan, - LLMFactory.Longcat, - LLMFactory.MinerU, - ]; - let icon = useMemo(() => { + const icon = useMemo(() => { const icontemp = IconMap[name as keyof typeof IconMap]; if (themeIcons.includes(name as LLMFactory)) { if (isDark) { @@ -98,16 +112,6 @@ export const LlmIcon = ({ return icontemp; }, [name, isDark]); - const svgIcons = [ - LLMFactory.LocalAI, - // LLMFactory.VolcEngine, - // LLMFactory.MiniMax, - LLMFactory.Gemini, - LLMFactory.StepFun, - LLMFactory.MinerU, - LLMFactory.PaddleOCR, - // LLMFactory.DeerAPI, - ]; if (svgIcons.includes(name as LLMFactory)) { return ( { }); }, []); + const addPrologue = useCallback((prologue: string) => { + setDerivedMessages((pre) => { + if (pre.length > 0) { + return [ + { + ...pre[0], + content: prologue, + }, + ...pre.slice(1), + ]; + } + + return [ + { + role: MessageType.Assistant, + content: prologue, + id: buildMessageUuid({ + role: MessageType.Assistant, + }), + }, + ]; + }); + }, []); + const removeLatestMessage = useCallback(() => { setDerivedMessages((pre) => { const nextMessages = pre?.slice(0, -2) ?? []; @@ -607,6 +631,7 @@ export const useSelectDerivedMessages = () => { removeAllMessages, scrollToBottom, removeAllMessagesExceptFirst, + addPrologue, }; }; diff --git a/web/src/pages/agent/chat/use-send-agent-message.ts b/web/src/pages/agent/chat/use-send-agent-message.ts index 186f3ac2994..a40c08740d9 100644 --- a/web/src/pages/agent/chat/use-send-agent-message.ts +++ b/web/src/pages/agent/chat/use-send-agent-message.ts @@ -243,6 +243,7 @@ export const useSendAgentMessage = ({ removeAllMessages, removeAllMessagesExceptFirst, scrollToBottom, + addPrologue, } = useSelectDerivedMessages(); const { addEventList: addEventListFun } = useContext(AgentChatLogContext); const { @@ -417,12 +418,11 @@ export const useSendAgentMessage = ({ return; } if (prologue) { - addNewestOneAnswer({ - answer: prologue, - }); + addPrologue(prologue); } }, [ addNewestOneAnswer, + addPrologue, agentId, isTaskMode, prologue, From d68176326df68e8cc580d77ecca641e71f319298 Mon Sep 17 00:00:00 2001 From: longbingljw Date: Thu, 15 Jan 2026 15:20:40 +0800 Subject: [PATCH 119/335] feat: add oceanbase mount to gitignore (#12642) ### What problem does this PR solve? feat: add oceanbase mount to .gitignore ### Type of change - [x] Refactoring --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 22e78ccdd26..16fd3222b7e 100644 --- a/.gitignore +++ b/.gitignore @@ -52,6 +52,10 @@ uv-x86_64*.tar.gz .venv docker/data +# OceanBase data and conf +docker/oceanbase/conf +docker/oceanbase/data + #--------------------------------------------------# # The following was generated with gitignore.nvim: # From 18867daba7ac6cba96f296fbd68822f93d80b8ee Mon Sep 17 00:00:00 2001 From: longbingljw Date: Thu, 15 Jan 2026 15:21:34 +0800 Subject: [PATCH 120/335] chore: bump pyobvector from 0.2.18 to 0.2.22 (#12640) ### What problem does this PR solve? Update ob client ### Type of change - [x] Other (please describe):dependency upgrade --- pyproject.toml | 2 +- uv.lock | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4ba8a8b78f4..6feaa1a4a44 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,7 +75,7 @@ dependencies = [ "psycopg2-binary>=2.9.11,<3.0.0", "pyclipper>=1.4.0,<2.0.0", "pycryptodomex==3.20.0", - "pyobvector==0.2.18", + "pyobvector==0.2.22", "pyodbc>=5.2.0,<6.0.0", "pypandoc>=1.16", "pypdf==6.4.0", diff --git a/uv.lock b/uv.lock index 73448917473..79f20d8ba4c 100644 --- a/uv.lock +++ b/uv.lock @@ -4244,12 +4244,12 @@ name = "onnxruntime-gpu" version = "1.23.2" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ - { name = "coloredlogs" }, - { name = "flatbuffers" }, - { name = "numpy" }, - { name = "packaging" }, - { name = "protobuf" }, - { name = "sympy" }, + { name = "coloredlogs", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, + { name = "flatbuffers", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, + { name = "numpy", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, + { name = "packaging", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, + { name = "protobuf", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, + { name = "sympy", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, ] wheels = [ { url = "https://pypi.tuna.tsinghua.edu.cn/packages/6c/d9/b7140a4f1615195938c7e358c0804bb84271f0d6886b5cbf105c6cb58aae/onnxruntime_gpu-1.23.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4f2d1f720685d729b5258ec1b36dee1de381b8898189908c98cbeecdb2f2b5c2", size = 300509596, upload-time = "2025-10-22T16:56:31.728Z" }, @@ -5478,7 +5478,7 @@ wheels = [ [[package]] name = "pyobvector" -version = "0.2.18" +version = "0.2.22" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "aiomysql" }, @@ -5488,9 +5488,9 @@ dependencies = [ { name = "sqlalchemy" }, { name = "sqlglot" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/82/33/adf722744a88eb75b4422129cbc4fe9b05738064ee79762348e285d93520/pyobvector-0.2.18.tar.gz", hash = "sha256:58ca2765ab99de188e99c815aab914ab9efd003cfa1ce9c5f2e41d0e2b4878be", size = 43035, upload-time = "2025-11-05T06:18:36.747Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/30/b9/443d65757cdfb47d31ef4b9ed0609628ae468e52e57033051e1fad256c59/pyobvector-0.2.22.tar.gz", hash = "sha256:0bd4af46cfdfbc67e691d5b49f3b0662f702a7a42a7f7a240f1021af378e793c", size = 72706, upload-time = "2026-01-15T03:19:57.4Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/5c/1f/73fa42b215722ec36172ac155626db5d2b95ea9f884cf9fb0624492e303b/pyobvector-0.2.18-py3-none-any.whl", hash = "sha256:93e34b7796e4cbc6ad139118d655eb127d1e7a0f5df76df66e25520533a15488", size = 58129, upload-time = "2025-11-05T06:18:35.326Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/e0/88/1583888a4ce85202d93fa03f2817681637465668e8b260ef1b9d5a39c3ca/pyobvector-0.2.22-py3-none-any.whl", hash = "sha256:4a0f5c094af7ca8242fdf9e5111e75544de0a9615491e9ec2f9d218dc909b509", size = 60627, upload-time = "2026-01-15T03:19:55.918Z" }, ] [[package]] @@ -6259,7 +6259,7 @@ requires-dist = [ { name = "pyclipper", specifier = ">=1.4.0,<2.0.0" }, { name = "pycryptodomex", specifier = "==3.20.0" }, { name = "pygithub", specifier = ">=2.8.1" }, - { name = "pyobvector", specifier = "==0.2.18" }, + { name = "pyobvector", specifier = "==0.2.22" }, { name = "pyodbc", specifier = ">=5.2.0,<6.0.0" }, { name = "pypandoc", specifier = ">=1.16" }, { name = "pypdf", specifier = "==6.4.0" }, From 2ea8dddef6a5c8815f00a32df586e6a75cbfe701 Mon Sep 17 00:00:00 2001 From: liuxiaoyusky <49766325+liuxiaoyusky@users.noreply.github.com> Date: Thu, 15 Jan 2026 15:32:40 +0800 Subject: [PATCH 121/335] =?UTF-8?q?fix(infinity):=20Use=20comma=20separato?= =?UTF-8?q?r=20for=20important=5Fkwd=20to=20preserve=20mult=E2=80=A6=20(#1?= =?UTF-8?q?2618)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem The \`important_kwd\` field in Infinity connector was using mismatched separators: - **Storage**: \`list2str(v)\` uses space as default separator - **Reading**: \`v.split()\` splits by all whitespace This causes multi-word keywords like \`\"Senior Fund Manager\"\` to be incorrectly split into \`[\"Senior\", \"Fund\", \"Manager\"]\`. ## Solution Use comma \`,\` as separator for both storing and reading, consistent with: 1. The LLM output format in \`keyword_prompt.md\` (\"delimited by ENGLISH COMMA\") 2. The \`cached.split(\",\")\` in \`task_executor.py\` ## Changes - \`insert()\`: \`list2str(v)\` → \`list2str(v, \",\")\` - \`update()\`: \`list2str(v)\` → \`list2str(v, \",\")\` - \`get_fields()\`: \`v.split()\` → \`v.split(\",\") if v else []\` ## Impact This bug affects: - Python-level reranking weight calculation (\`important_kwd * 5\`) - API response keyword display - Search precision due to fragmented keywords --- rag/utils/infinity_conn.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rag/utils/infinity_conn.py b/rag/utils/infinity_conn.py index 79f871e80a2..ac5129735f7 100644 --- a/rag/utils/infinity_conn.py +++ b/rag/utils/infinity_conn.py @@ -340,7 +340,7 @@ def insert(self, documents: list[dict], index_name: str, knowledgebase_id: str = if not d.get("docnm_kwd"): d["docnm"] = self.list2str(v) elif k == "important_kwd": - d["important_keywords"] = self.list2str(v) + d["important_keywords"] = self.list2str(v, ",") elif k == "important_tks": if not d.get("important_kwd"): d["important_keywords"] = v @@ -429,7 +429,7 @@ def update(self, condition: dict, new_value: dict, index_name: str, knowledgebas if not new_value.get("docnm_kwd"): new_value["docnm"] = v elif k == "important_kwd": - new_value["important_keywords"] = self.list2str(v) + new_value["important_keywords"] = self.list2str(v, ",") elif k == "important_tks": if not new_value.get("important_kwd"): new_value["important_keywords"] = v @@ -532,7 +532,7 @@ def get_fields(self, res: tuple[pd.DataFrame, int] | pd.DataFrame, fields: list[ res[field] = res["docnm"] if "important_keywords" in res.columns: if "important_kwd" in fields_all: - res["important_kwd"] = res["important_keywords"].apply(lambda v: v.split()) + res["important_kwd"] = res["important_keywords"].apply(lambda v: v.split(",") if v else []) if "important_tks" in fields_all: res["important_tks"] = res["important_keywords"] if "questions" in res.columns: From 2167e3a3c07b95fd25a5bfe2539ff3e64397539f Mon Sep 17 00:00:00 2001 From: writinwaters <93570324+writinwaters@users.noreply.github.com> Date: Thu, 15 Jan 2026 17:21:36 +0800 Subject: [PATCH 122/335] Docs: Added share memory (#12647) ### Type of change - [x] Documentation Update --- docs/guides/memory/_category_.json | 11 +++++++++++ docs/guides/memory/use_memory.md | 9 ++++++++- docs/guides/team/share_memory.md | 21 +++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 docs/guides/memory/_category_.json create mode 100644 docs/guides/team/share_memory.md diff --git a/docs/guides/memory/_category_.json b/docs/guides/memory/_category_.json new file mode 100644 index 00000000000..6ff7c8cf628 --- /dev/null +++ b/docs/guides/memory/_category_.json @@ -0,0 +1,11 @@ +{ + "label": "Memory", + "position": 10, + "link": { + "type": "generated-index", + "description": "Guides on using Memory." + }, + "customProps": { + "categoryIcon": "LucideBox" + } +} diff --git a/docs/guides/memory/use_memory.md b/docs/guides/memory/use_memory.md index 05ffd0be3ba..a1586d51da6 100644 --- a/docs/guides/memory/use_memory.md +++ b/docs/guides/memory/use_memory.md @@ -38,7 +38,7 @@ When the Memory reaches its storage limit and the automatic forgetting policy is ## Enhance Agent context -Under **Retrieval** and **Message** component settings, a new Memory invocation capability is available. In the Message component, users can configure the Agent to write selected data into a designated Memory, while the Retrieval component can be set to read from that same Memory to answer future queries. This enables a simple Q&A bot Agent to accumulate context over time and respond with richer, memory-aware answers. +Under [Retrieval](../agent/agent_component_reference/retrieval.mdx) and [Message](../agent/agent_component_reference/message.mdx) component settings, a new Memory invocation capability is available. In the Message component, users can configure the Agent to write selected data into a designated Memory, while the Retrieval component can be set to read from that same Memory to answer future queries. This enables a simple Q&A bot Agent to accumulate context over time and respond with richer, memory-aware answers. ### Retrieve from memory @@ -54,5 +54,12 @@ At the same time you have finished **Retrieval** component settings, select the ![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/save_to_memory.png) +## Frequently asked questions + +### Can I share my memory? + +Yes, you can. Your memory can be shared between Agents. If you wish to share your memory with your team members, please ensure you have configured its team permissions. See [Share memory](../team/share_memory.md) for details. + + diff --git a/docs/guides/team/share_memory.md b/docs/guides/team/share_memory.md new file mode 100644 index 00000000000..2c41db492e3 --- /dev/null +++ b/docs/guides/team/share_memory.md @@ -0,0 +1,21 @@ +--- +sidebar_position: 9 +slug: /share_memory +sidebar_custom_props: { + categoryIcon: LucideShare2 +} +--- +# Share memory + +Share a memory with your team members. + +--- + +When ready, you may share your memory with your team members so that they can use it. Please note that your memories are not shared automatically; you must manually enable sharing by selecting the corresponding **Permissions** radio button: + +1. Click the intended memory to open its editing canvas. +2. Click **Configurations**. +3. Change **Permissions** from **Only me** to **Team**. +4. Click **Save** to apply your changes. + +*When completed, your team members will see your shared memories.* \ No newline at end of file From cec06bfb5daf7719656771259740ffdceefa602c Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Thu, 15 Jan 2026 17:46:21 +0800 Subject: [PATCH 123/335] Fix: empty chunk issue. (#12638) #12570 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/llm_app.py | 7 ++++--- rag/flow/splitter/splitter.py | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/api/apps/llm_app.py b/api/apps/llm_app.py index 3272a36add2..695f4f13e89 100644 --- a/api/apps/llm_app.py +++ b/api/apps/llm_app.py @@ -373,13 +373,14 @@ def my_llms(): @manager.route("/list", methods=["GET"]) # noqa: F821 @login_required -def list_app(): +async def list_app(): self_deployed = ["FastEmbed", "Ollama", "Xinference", "LocalAI", "LM-Studio", "GPUStack"] weighted = [] model_type = request.args.get("model_type") + tenant_id = current_user.id try: - TenantLLMService.ensure_mineru_from_env(current_user.id) - objs = TenantLLMService.query(tenant_id=current_user.id) + TenantLLMService.ensure_mineru_from_env(tenant_id) + objs = TenantLLMService.query(tenant_id=tenant_id) facts = set([o.to_dict()["llm_factory"] for o in objs if o.api_key and o.status == StatusEnum.VALID.value]) status = {(o.llm_name + "@" + o.llm_factory) for o in objs if o.status == StatusEnum.VALID.value} llms = LLMService.get_all() diff --git a/rag/flow/splitter/splitter.py b/rag/flow/splitter/splitter.py index 343241ab391..4fc4e544c42 100644 --- a/rag/flow/splitter/splitter.py +++ b/rag/flow/splitter/splitter.py @@ -93,6 +93,8 @@ async def _invoke(self, **kwargs): split_sec = re.split(r"(%s)" % custom_pattern, c, flags=re.DOTALL) if split_sec: for j in range(0, len(split_sec), 2): + if not split_sec[j].strip(): + continue docs.append({ "text": split_sec[j], "mom": c @@ -156,6 +158,8 @@ async def _invoke(self, **kwargs): if split_sec: c["mom"] = c["text"] for j in range(0, len(split_sec), 2): + if not split_sec[j].strip(): + continue cc = deepcopy(c) cc["text"] = split_sec[j] docs.append(cc) From 8c1fbfb130c17ba0ad9880825fac19073d90e3f5 Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Thu, 15 Jan 2026 19:28:22 +0800 Subject: [PATCH 124/335] =?UTF-8?q?Fix=EF=BC=9ASome=20bugs=20(#12648)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What problem does this PR solve? Fix: Modified and optimized the metadata condition card component. Fix: Use startOfDay and endOfDay to ensure the date range includes a full day. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- .../metadata-filter-conditions.tsx | 109 ++++++++++-------- .../components/originui/time-range-picker.tsx | 95 ++++++++++----- 2 files changed, 129 insertions(+), 75 deletions(-) diff --git a/web/src/components/metadata-filter/metadata-filter-conditions.tsx b/web/src/components/metadata-filter/metadata-filter-conditions.tsx index 1ddf90acf99..777d8eb9ec9 100644 --- a/web/src/components/metadata-filter/metadata-filter-conditions.tsx +++ b/web/src/components/metadata-filter/metadata-filter-conditions.tsx @@ -1,4 +1,3 @@ -import { SelectWithSearch } from '@/components/originui/select-with-search'; import { Button } from '@/components/ui/button'; import { DropdownMenu, @@ -18,13 +17,16 @@ import { Separator } from '@/components/ui/separator'; import { SwitchLogicOperator, SwitchOperatorOptions } from '@/constants/agent'; import { useBuildSwitchOperatorOptions } from '@/hooks/logic-hooks/use-build-operator-options'; import { useFetchKnowledgeMetadata } from '@/hooks/use-knowledge-request'; +import { cn } from '@/lib/utils'; import { PromptEditor } from '@/pages/agent/form/components/prompt-editor'; import { Plus, X } from 'lucide-react'; import { useCallback, useMemo } from 'react'; import { useFieldArray, useFormContext, useWatch } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import { LogicalOperator } from '../logical-operator'; +import { Card, CardContent } from '../ui/card'; import { InputSelect } from '../ui/input-select'; +import { RAGFlowSelect } from '../ui/select'; export function MetadataFilterConditions({ kbIds, @@ -62,13 +64,14 @@ export function MetadataFilterConditions({ [append, fields.length, form, logic], ); - const RenderField = ({ + function ConditionCards({ fieldName, index, }: { fieldName: string; index: number; - }) => { + }) { + const { t } = useTranslation(); const form = useFormContext(); const key = useWatch({ name: fieldName }); const valueOptions = useMemo(() => { @@ -83,14 +86,18 @@ export function MetadataFilterConditions({ }, [key]); return ( -
    -
    -
    +
    + +
    ( - + )} /> - +
    + + ( + + + + + + + )} + /> +
    +
    + ( - + name={`${name}.${index}.value`} + render={({ field: valueField }) => ( + - + {canReference ? ( + + ) : ( + + )} )} /> -
    - ( - - - {canReference ? ( - - ) : ( - - )} - - - - )} - /> -
    + + -
    + ); - }; + } return (
    @@ -177,7 +190,11 @@ export function MetadataFilterConditions({ {fields.map((field, index) => { const typeField = `${name}.${index}.key`; return ( - + ); })}
    diff --git a/web/src/components/originui/time-range-picker.tsx b/web/src/components/originui/time-range-picker.tsx index e117f74c98e..f04eb9390b5 100644 --- a/web/src/components/originui/time-range-picker.tsx +++ b/web/src/components/originui/time-range-picker.tsx @@ -1,24 +1,25 @@ +import { Calendar, DateRange } from '@/components/originui/calendar'; +import { Button } from '@/components/ui/button'; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from '@/components/ui/popover'; +import { cn } from '@/lib/utils'; import { + endOfDay, endOfMonth, endOfYear, format, + startOfDay, startOfMonth, startOfYear, subDays, subMonths, subYears, } from 'date-fns'; -import { useEffect, useId, useState } from 'react'; - -import { Calendar, DateRange } from '@/components/originui/calendar'; -import { Button } from '@/components/ui/button'; -import { - Popover, - PopoverContent, - PopoverTrigger, -} from '@/components/ui/popover'; -import { cn } from '@/lib/utils'; import { CalendarIcon } from 'lucide-react'; +import { useEffect, useId, useState } from 'react'; const CalendarComp = ({ selectDateRange, @@ -27,20 +28,20 @@ const CalendarComp = ({ }: ITimeRangePickerProps) => { const today = new Date(); const yesterday = { - from: subDays(today, 1), - to: subDays(today, 1), + from: startOfDay(subDays(today, 1)), + to: endOfDay(subDays(today, 1)), }; const last7Days = { - from: subDays(today, 6), - to: today, + from: startOfDay(subDays(today, 6)), + to: endOfDay(today), }; const last30Days = { - from: subDays(today, 29), - to: today, + from: startOfDay(subDays(today, 29)), + to: endOfDay(today), }; const monthToDate = { from: startOfMonth(today), - to: today, + to: endOfDay(today), }; const lastMonth = { from: startOfMonth(subMonths(today, 1)), @@ -48,7 +49,7 @@ const CalendarComp = ({ }; const yearToDate = { from: startOfYear(today), - to: today, + to: endOfDay(today), }; const lastYear = { from: startOfYear(subYears(today, 1)), @@ -65,9 +66,7 @@ const CalendarComp = ({ ]; const [month, setMonth] = useState(today); const [date, setDate] = useState(selectDateRange || last7Days); - useEffect(() => { - onSelect?.(date); - }, [date, onSelect]); + return (
    @@ -80,11 +79,13 @@ const CalendarComp = ({ size="sm" className="w-full justify-start" onClick={() => { - setDate({ - from: today, - to: today, - }); + const newDateRange = { + from: startOfDay(today), + to: endOfDay(today), + }; + setDate(newDateRange); setMonth(today); + onSelect?.(newDateRange); }} > Today @@ -98,6 +99,7 @@ const CalendarComp = ({ onClick={() => { setDate(dateRange.value); setMonth(dateRange.value.to); + onSelect?.(dateRange.value); }} > {dateRange.key} @@ -111,7 +113,13 @@ const CalendarComp = ({ selected={date} onSelect={(newDate) => { if (newDate) { - setDate(newDate as DateRange); + const dateRange = newDate as DateRange; + const newDateRange = { + from: startOfDay(dateRange.from), + to: dateRange.to ? endOfDay(dateRange.to) : undefined, + }; + setDate(newDateRange); + onSelect?.(newDateRange); } }} month={month} @@ -130,7 +138,7 @@ const CalendarComp = ({ export type ITimeRangePickerProps = { onSelect: (e: DateRange) => void; - selectDateRange: DateRange; + selectDateRange?: DateRange; className?: string; }; const TimeRangePicker = ({ @@ -140,11 +148,40 @@ const TimeRangePicker = ({ }: ITimeRangePickerProps) => { const id = useId(); const today = new Date(); + + // Initialize without timezone conversion const [date, setDate] = useState( - selectDateRange || { from: today, to: today }, + selectDateRange + ? { + from: startOfDay(selectDateRange.from), + to: selectDateRange.to ? endOfDay(selectDateRange.to) : undefined, + } + : { + from: startOfDay(today), + to: endOfDay(today), + }, ); + useEffect(() => { - setDate(selectDateRange); + if (!selectDateRange || !selectDateRange.from) return; + + try { + const fromDate = new Date(selectDateRange.from); + const toDate = selectDateRange.to + ? new Date(selectDateRange.to) + : undefined; + + if (isNaN(fromDate.getTime())) return; + + if (toDate && isNaN(toDate.getTime())) return; + + setDate({ + from: startOfDay(fromDate), + to: toDate ? endOfDay(toDate) : undefined, + }); + } catch (error) { + console.error('Error updating date range from props:', error); + } }, [selectDateRange]); const onChange = (e: DateRange | undefined) => { if (!e) return; From 59f4c512222c479ec0c5fbbc82927a382d6e2abd Mon Sep 17 00:00:00 2001 From: zagnaan <146335521+zagnaan@users.noreply.github.com> Date: Thu, 15 Jan 2026 12:30:33 +0100 Subject: [PATCH 125/335] fix(entrypoint): Preserve $ in passwords during template expansion (#12509) ### What problem does this PR solve? Fix shell variable expansion to preserve $ in password defaults when env vars are unset. Fixes Azure RDS auto-rotated passwords (that contain $) being truncated during template processing. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- docker/entrypoint.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 7770ab8d0d1..60030dbe21b 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -156,8 +156,20 @@ TEMPLATE_FILE="${CONF_DIR}/service_conf.yaml.template" CONF_FILE="${CONF_DIR}/service_conf.yaml" rm -f "${CONF_FILE}" +DEF_ENV_VALUE_PATTERN="\$\{([^:]+):-([^}]+)\}" while IFS= read -r line || [[ -n "$line" ]]; do - eval "echo \"$line\"" >> "${CONF_FILE}" + if [[ "$line" =~ DEF_ENV_VALUE_PATTERN ]]; then + varname="${BASH_REMATCH[1]}" + default="${BASH_REMATCH[2]}" + + if [ -n "${!varname}" ]; then + eval "echo \"$line"\" >> "${CONF_FILE}" + else + echo "$line" | sed -E "s/\\\$\{[^:]+:-([^}]+)\}/\1/g" >> "${CONF_FILE}" + fi + else + eval "echo \"$line\"" >> "${CONF_FILE}" + fi done < "${TEMPLATE_FILE}" export LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/" From 2b20d0b3bb439e09c0403873deaf1c55699106a5 Mon Sep 17 00:00:00 2001 From: 6ba3i <112825897+6ba3i@users.noreply.github.com> Date: Fri, 16 Jan 2026 11:09:22 +0800 Subject: [PATCH 126/335] Fix : Web API tests by normalizing errors, validation, and uploads (#12620) ### What problem does this PR solve? Fixes web API behavior mismatches that caused test failures by normalizing error responses, tightening validations, correcting error messages, and closing upload file handles. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/__init__.py | 73 +++++++++++++---- api/apps/chunk_app.py | 34 ++++++-- api/apps/dialog_app.py | 36 +++++---- api/apps/document_app.py | 11 +++ api/apps/sdk/memories.py | 45 +++++++++++ api/db/services/document_service.py | 16 +++- api/db/services/knowledgebase_service.py | 2 +- api/utils/api_utils.py | 78 +++++++++++-------- sdk/python/ragflow_sdk/ragflow.py | 2 + test/testcases/test_web_api/common.py | 5 +- test/testcases/test_web_api/conftest.py | 7 +- .../test_chunk_app/test_retrieval_chunks.py | 10 +-- .../test_upload_documents.py | 20 ++--- 13 files changed, 241 insertions(+), 98 deletions(-) diff --git a/api/apps/__init__.py b/api/apps/__init__.py index 98882a58a0a..7feae696e35 100644 --- a/api/apps/__init__.py +++ b/api/apps/__init__.py @@ -16,21 +16,23 @@ import logging import os import sys +import time from importlib.util import module_from_spec, spec_from_file_location from pathlib import Path -from quart import Blueprint, Quart, request, g, current_app, session +from quart import Blueprint, Quart, request, g, current_app, session, jsonify from itsdangerous.url_safe import URLSafeTimedSerializer as Serializer from quart_cors import cors -from common.constants import StatusEnum +from common.constants import StatusEnum, RetCode from api.db.db_models import close_connection, APIToken from api.db.services import UserService from api.utils.json_encode import CustomJSONEncoder from api.utils import commands -from quart_auth import Unauthorized +from quart_auth import Unauthorized as QuartAuthUnauthorized +from werkzeug.exceptions import Unauthorized as WerkzeugUnauthorized from quart_schema import QuartSchema from common import settings -from api.utils.api_utils import server_error_response +from api.utils.api_utils import server_error_response, get_json_result from api.constants import API_VERSION from common.misc_utils import get_uuid @@ -38,6 +40,22 @@ __all__ = ["app"] +UNAUTHORIZED_MESSAGE = "" + + +def _unauthorized_message(error): + if error is None: + return UNAUTHORIZED_MESSAGE + try: + msg = repr(error) + except Exception: + return UNAUTHORIZED_MESSAGE + if msg == UNAUTHORIZED_MESSAGE: + return msg + if "Unauthorized" in msg and "401" in msg: + return msg + return UNAUTHORIZED_MESSAGE + app = Quart(__name__) app = cors(app, allow_origin="*") @@ -145,10 +163,18 @@ async def index(): @wraps(func) async def wrapper(*args: P.args, **kwargs: P.kwargs) -> T: - if not current_user: # or not session.get("_user_id"): - raise Unauthorized() - else: - return await current_app.ensure_async(func)(*args, **kwargs) + timing_enabled = os.getenv("RAGFLOW_API_TIMING") + t_start = time.perf_counter() if timing_enabled else None + user = current_user + if timing_enabled: + logging.info( + "api_timing login_required auth_ms=%.2f path=%s", + (time.perf_counter() - t_start) * 1000, + request.path, + ) + if not user: # or not session.get("_user_id"): + raise QuartAuthUnauthorized() + return await current_app.ensure_async(func)(*args, **kwargs) return wrapper @@ -258,12 +284,33 @@ def register_page(page_path): @app.errorhandler(404) async def not_found(error): - error_msg: str = f"The requested URL {request.path} was not found" - logging.error(error_msg) - return { + logging.error(f"The requested URL {request.path} was not found") + message = f"Not Found: {request.path}" + response = { + "code": RetCode.NOT_FOUND, + "message": message, + "data": None, "error": "Not Found", - "message": error_msg, - }, 404 + } + return jsonify(response), RetCode.NOT_FOUND + + +@app.errorhandler(401) +async def unauthorized(error): + logging.warning("Unauthorized request") + return get_json_result(code=RetCode.UNAUTHORIZED, message=_unauthorized_message(error)), RetCode.UNAUTHORIZED + + +@app.errorhandler(QuartAuthUnauthorized) +async def unauthorized_quart_auth(error): + logging.warning("Unauthorized request (quart_auth)") + return get_json_result(code=RetCode.UNAUTHORIZED, message=repr(error)), RetCode.UNAUTHORIZED + + +@app.errorhandler(WerkzeugUnauthorized) +async def unauthorized_werkzeug(error): + logging.warning("Unauthorized request (werkzeug)") + return get_json_result(code=RetCode.UNAUTHORIZED, message=_unauthorized_message(error)), RetCode.UNAUTHORIZED @app.teardown_request def _db_close(exception): diff --git a/api/apps/chunk_app.py b/api/apps/chunk_app.py index e900d0bffbb..67627825451 100644 --- a/api/apps/chunk_app.py +++ b/api/apps/chunk_app.py @@ -126,10 +126,15 @@ def get(): @validate_request("doc_id", "chunk_id", "content_with_weight") async def set(): req = await get_request_json() + content_with_weight = req["content_with_weight"] + if not isinstance(content_with_weight, (str, bytes)): + raise TypeError("expected string or bytes-like object") + if isinstance(content_with_weight, bytes): + content_with_weight = content_with_weight.decode("utf-8", errors="ignore") d = { "id": req["chunk_id"], - "content_with_weight": req["content_with_weight"]} - d["content_ltks"] = rag_tokenizer.tokenize(req["content_with_weight"]) + "content_with_weight": content_with_weight} + d["content_ltks"] = rag_tokenizer.tokenize(content_with_weight) d["content_sm_ltks"] = rag_tokenizer.fine_grained_tokenize(d["content_ltks"]) if "important_kwd" in req: if not isinstance(req["important_kwd"], list): @@ -171,7 +176,7 @@ def _set_sync(): _d = beAdoc(d, q, a, not any( [rag_tokenizer.is_chinese(t) for t in q + a])) - v, c = embd_mdl.encode([doc.name, req["content_with_weight"] if not _d.get("question_kwd") else "\n".join(_d["question_kwd"])]) + v, c = embd_mdl.encode([doc.name, content_with_weight if not _d.get("question_kwd") else "\n".join(_d["question_kwd"])]) v = 0.1 * v[0] + 0.9 * v[1] if doc.parser_id != ParserType.QA else v[1] _d["q_%d_vec" % len(v)] = v.tolist() settings.docStoreConn.update({"id": req["chunk_id"]}, _d, search.index_name(tenant_id), doc.kb_id) @@ -223,14 +228,27 @@ def _rm_sync(): e, doc = DocumentService.get_by_id(req["doc_id"]) if not e: return get_data_error_result(message="Document not found!") - # Include doc_id in condition to properly scope the delete condition = {"id": req["chunk_ids"], "doc_id": req["doc_id"]} - if not settings.docStoreConn.delete(condition, - search.index_name(DocumentService.get_tenant_id(req["doc_id"])), - doc.kb_id): + try: + deleted_count = settings.docStoreConn.delete(condition, + search.index_name(DocumentService.get_tenant_id(req["doc_id"])), + doc.kb_id) + except Exception: return get_data_error_result(message="Chunk deleting failure") deleted_chunk_ids = req["chunk_ids"] - chunk_number = len(deleted_chunk_ids) + if isinstance(deleted_chunk_ids, list): + unique_chunk_ids = list(dict.fromkeys(deleted_chunk_ids)) + has_ids = len(unique_chunk_ids) > 0 + else: + unique_chunk_ids = [deleted_chunk_ids] + has_ids = deleted_chunk_ids not in (None, "") + if has_ids and deleted_count == 0: + return get_data_error_result(message="Index updating failure") + if deleted_count > 0 and deleted_count < len(unique_chunk_ids): + deleted_count += settings.docStoreConn.delete({"doc_id": req["doc_id"]}, + search.index_name(DocumentService.get_tenant_id(req["doc_id"])), + doc.kb_id) + chunk_number = deleted_count DocumentService.decrement_chunk_num(doc.id, doc.kb_id, 1, chunk_number, 0) for cid in deleted_chunk_ids: if settings.STORAGE_IMPL.obj_exist(doc.kb_id, cid): diff --git a/api/apps/dialog_app.py b/api/apps/dialog_app.py index d2aad88ee1a..32f5cdbc80d 100644 --- a/api/apps/dialog_app.py +++ b/api/apps/dialog_app.py @@ -42,13 +42,18 @@ async def set_dialog(): if len(name.encode("utf-8")) > 255: return get_data_error_result(message=f"Dialog name length is {len(name)} which is larger than 255") - if is_create and DialogService.query(tenant_id=current_user.id, name=name.strip()): - name = name.strip() - name = duplicate_name( - DialogService.query, - name=name, - tenant_id=current_user.id, - status=StatusEnum.VALID.value) + name = name.strip() + if is_create: + existing_names = { + d.name.casefold() + for d in DialogService.query(tenant_id=current_user.id, status=StatusEnum.VALID.value) + if d.name + } + if name.casefold() in existing_names: + def _name_exists(name: str, **_kwargs) -> bool: + return name.casefold() in existing_names + + name = duplicate_name(_name_exists, name=name) description = req.get("description", "A helpful dialog") icon = req.get("icon", "") @@ -63,16 +68,15 @@ async def set_dialog(): meta_data_filter = req.get("meta_data_filter", {}) prompt_config = req["prompt_config"] - if not is_create: - if not req.get("kb_ids", []) and not prompt_config.get("tavily_api_key") and "{knowledge}" in prompt_config['system']: - return get_data_error_result(message="Please remove `{knowledge}` in system prompt since no dataset / Tavily used here.") + if not req.get("kb_ids", []) and not prompt_config.get("tavily_api_key") and "{knowledge}" in prompt_config.get("system", ""): + return get_data_error_result(message="Please remove `{knowledge}` in system prompt since no dataset / Tavily used here.") - for p in prompt_config["parameters"]: - if p["optional"]: - continue - if prompt_config["system"].find("{%s}" % p["key"]) < 0: - return get_data_error_result( - message="Parameter '{}' is not used".format(p["key"])) + for p in prompt_config.get("parameters", []): + if p["optional"]: + continue + if prompt_config.get("system", "").find("{%s}" % p["key"]) < 0: + return get_data_error_result( + message="Parameter '{}' is not used".format(p["key"])) try: e, tenant = TenantService.get_by_id(current_user.id) diff --git a/api/apps/document_app.py b/api/apps/document_app.py index 58d576ed255..257506ec80b 100644 --- a/api/apps/document_app.py +++ b/api/apps/document_app.py @@ -62,10 +62,21 @@ async def upload(): return get_json_result(data=False, message="No file part!", code=RetCode.ARGUMENT_ERROR) file_objs = files.getlist("file") + def _close_file_objs(objs): + for obj in objs: + try: + obj.close() + except Exception: + try: + obj.stream.close() + except Exception: + pass for file_obj in file_objs: if file_obj.filename == "": + _close_file_objs(file_objs) return get_json_result(data=False, message="No file selected!", code=RetCode.ARGUMENT_ERROR) if len(file_obj.filename.encode("utf-8")) > FILE_NAME_LEN_LIMIT: + _close_file_objs(file_objs) return get_json_result(data=False, message=f"File name must be {FILE_NAME_LEN_LIMIT} bytes or less.", code=RetCode.ARGUMENT_ERROR) e, kb = KnowledgebaseService.get_by_id(kb_id) diff --git a/api/apps/sdk/memories.py b/api/apps/sdk/memories.py index ceaa93fe66c..ada4b34fab9 100644 --- a/api/apps/sdk/memories.py +++ b/api/apps/sdk/memories.py @@ -14,6 +14,8 @@ # limitations under the License. # import logging +import os +import time from quart import request from api.apps import login_required, current_user @@ -35,22 +37,56 @@ @login_required @validate_request("name", "memory_type", "embd_id", "llm_id") async def create_memory(): + timing_enabled = os.getenv("RAGFLOW_API_TIMING") + t_start = time.perf_counter() if timing_enabled else None req = await get_request_json() + t_parsed = time.perf_counter() if timing_enabled else None # check name length name = req["name"] memory_name = name.strip() if len(memory_name) == 0: + if timing_enabled: + logging.info( + "api_timing create_memory invalid_name parse_ms=%.2f total_ms=%.2f path=%s", + (t_parsed - t_start) * 1000, + (time.perf_counter() - t_start) * 1000, + request.path, + ) return get_error_argument_result("Memory name cannot be empty or whitespace.") if len(memory_name) > MEMORY_NAME_LIMIT: + if timing_enabled: + logging.info( + "api_timing create_memory invalid_name parse_ms=%.2f total_ms=%.2f path=%s", + (t_parsed - t_start) * 1000, + (time.perf_counter() - t_start) * 1000, + request.path, + ) return get_error_argument_result(f"Memory name '{memory_name}' exceeds limit of {MEMORY_NAME_LIMIT}.") # check memory_type valid + if not isinstance(req["memory_type"], list): + if timing_enabled: + logging.info( + "api_timing create_memory invalid_memory_type parse_ms=%.2f total_ms=%.2f path=%s", + (t_parsed - t_start) * 1000, + (time.perf_counter() - t_start) * 1000, + request.path, + ) + return get_error_argument_result("Memory type must be a list.") memory_type = set(req["memory_type"]) invalid_type = memory_type - {e.name.lower() for e in MemoryType} if invalid_type: + if timing_enabled: + logging.info( + "api_timing create_memory invalid_memory_type parse_ms=%.2f total_ms=%.2f path=%s", + (t_parsed - t_start) * 1000, + (time.perf_counter() - t_start) * 1000, + request.path, + ) return get_error_argument_result(f"Memory type '{invalid_type}' is not supported.") memory_type = list(memory_type) try: + t_before_db = time.perf_counter() if timing_enabled else None res, memory = MemoryService.create_memory( tenant_id=current_user.id, name=memory_name, @@ -58,6 +94,15 @@ async def create_memory(): embd_id=req["embd_id"], llm_id=req["llm_id"] ) + if timing_enabled: + logging.info( + "api_timing create_memory parse_ms=%.2f validate_ms=%.2f db_ms=%.2f total_ms=%.2f path=%s", + (t_parsed - t_start) * 1000, + (t_before_db - t_parsed) * 1000, + (time.perf_counter() - t_before_db) * 1000, + (time.perf_counter() - t_start) * 1000, + request.path, + ) if res: return get_json_result(message=True, data=format_ret_data_from_memory(memory)) diff --git a/api/db/services/document_service.py b/api/db/services/document_service.py index 262a43bc51f..ef1b831aa87 100644 --- a/api/db/services/document_service.py +++ b/api/db/services/document_service.py @@ -445,6 +445,7 @@ def get_unfinished_docs(cls): .where( cls.model.status == StatusEnum.VALID.value, ~(cls.model.type == FileType.VIRTUAL.value), + ((cls.model.run.is_null(True)) | (cls.model.run != TaskStatus.CANCEL.value)), (((cls.model.progress < 1) & (cls.model.progress > 0)) | (cls.model.id.in_(unfinished_task_query)))) # including unfinished tasks like GraphRAG, RAPTOR and Mindmap return list(docs.dicts()) @@ -936,6 +937,8 @@ def _sync_progress(cls, docs:list[dict]): bad = 0 e, doc = DocumentService.get_by_id(d["id"]) status = doc.run # TaskStatus.RUNNING.value + if status == TaskStatus.CANCEL.value: + continue doc_progress = doc.progress if doc and doc.progress else 0.0 special_task_running = False priority = 0 @@ -979,7 +982,16 @@ def _sync_progress(cls, docs:list[dict]): info["progress_msg"] += "\n%d tasks are ahead in the queue..."%get_queue_length(priority) else: info["progress_msg"] = "%d tasks are ahead in the queue..."%get_queue_length(priority) - cls.update_by_id(d["id"], info) + info["update_time"] = current_timestamp() + info["update_date"] = get_format_time() + ( + cls.model.update(info) + .where( + (cls.model.id == d["id"]) + & ((cls.model.run.is_null(True)) | (cls.model.run != TaskStatus.CANCEL.value)) + ) + .execute() + ) except Exception as e: if str(e).find("'0'") < 0: logging.exception("fetch task exception") @@ -1012,7 +1024,7 @@ def do_cancel(cls, doc_id): @classmethod @DB.connection_context() def knowledgebase_basic_info(cls, kb_id: str) -> dict[str, int]: - # cancelled: run == "2" but progress can vary + # cancelled: run == "2" cancelled = ( cls.model.select(fn.COUNT(1)) .where((cls.model.kb_id == kb_id) & (cls.model.run == TaskStatus.CANCEL)) diff --git a/api/db/services/knowledgebase_service.py b/api/db/services/knowledgebase_service.py index 5f506888c0d..1f8b096daa3 100644 --- a/api/db/services/knowledgebase_service.py +++ b/api/db/services/knowledgebase_service.py @@ -397,7 +397,7 @@ def create_with_name( if dataset_name == "": return False, get_data_error_result(message="Dataset name can't be empty.") if len(dataset_name.encode("utf-8")) > DATASET_NAME_LIMIT: - return False, get_data_error_result(message=f"Dataset name length is {len(dataset_name)} which is larger than {DATASET_NAME_LIMIT}") + return False, get_data_error_result(message=f"Dataset name length is {len(dataset_name)} which is large than {DATASET_NAME_LIMIT}") # Deduplicate name within tenant dataset_name = duplicate_name( diff --git a/api/utils/api_utils.py b/api/utils/api_utils.py index afb4ff772de..bfdb6ec72af 100644 --- a/api/utils/api_utils.py +++ b/api/utils/api_utils.py @@ -31,6 +31,12 @@ jsonify, request ) +from werkzeug.exceptions import BadRequest as WerkzeugBadRequest + +try: + from quart.exceptions import BadRequest as QuartBadRequest +except ImportError: # pragma: no cover - optional dependency + QuartBadRequest = None from peewee import OperationalError @@ -48,35 +54,33 @@ async def _coerce_request_data() -> dict: """Fetch JSON body with sane defaults; fallback to form data.""" + if hasattr(request, "_cached_payload"): + return request._cached_payload payload: Any = None - last_error: Exception | None = None - - try: - payload = await request.get_json(force=True, silent=True) - except Exception as e: - last_error = e - payload = None - - if payload is None: - try: - form = await request.form - payload = form.to_dict() - except Exception as e: - last_error = e - payload = None - if payload is None: - if last_error is not None: - raise last_error - raise ValueError("No JSON body or form data found in request.") - - if isinstance(payload, dict): - return payload or {} - - if isinstance(payload, str): - raise AttributeError("'str' object has no attribute 'get'") + body_bytes = await request.get_data() + has_body = bool(body_bytes) + content_type = (request.content_type or "").lower() + is_json = content_type.startswith("application/json") + + if not has_body: + payload = {} + elif is_json: + payload = await request.get_json(force=False, silent=False) + if isinstance(payload, dict): + payload = payload or {} + elif isinstance(payload, str): + raise AttributeError("'str' object has no attribute 'get'") + else: + raise TypeError("JSON payload must be an object.") + else: + form = await request.form + payload = form.to_dict() if form else None + if payload is None: + raise TypeError("Request body is not a valid form payload.") - raise TypeError(f"Unsupported request payload type: {type(payload)!r}") + request._cached_payload = payload + return payload async def get_request_json(): return await _coerce_request_data() @@ -124,16 +128,12 @@ def server_error_response(e): try: msg = repr(e).lower() if getattr(e, "code", None) == 401 or ("unauthorized" in msg) or ("401" in msg): - return get_json_result(code=RetCode.UNAUTHORIZED, message=repr(e)) + resp = get_json_result(code=RetCode.UNAUTHORIZED, message="Unauthorized") + resp.status_code = RetCode.UNAUTHORIZED + return resp except Exception as ex: logging.warning(f"error checking authorization: {ex}") - if len(e.args) > 1: - try: - serialized_data = serialize_for_json(e.args[1]) - return get_json_result(code=RetCode.EXCEPTION_ERROR, message=repr(e.args[0]), data=serialized_data) - except Exception: - return get_json_result(code=RetCode.EXCEPTION_ERROR, message=repr(e.args[0]), data=None) if repr(e).find("index_not_found_exception") >= 0: return get_json_result(code=RetCode.EXCEPTION_ERROR, message="No chunk found, please upload file and parse it.") @@ -168,7 +168,17 @@ def process_args(input_arguments): def wrapper(func): @wraps(func) async def decorated_function(*_args, **_kwargs): - errs = process_args(await _coerce_request_data()) + exception_types = (AttributeError, TypeError, WerkzeugBadRequest) + if QuartBadRequest is not None: + exception_types = exception_types + (QuartBadRequest,) + if args or kwargs: + try: + input_arguments = await _coerce_request_data() + except exception_types: + input_arguments = {} + else: + input_arguments = await _coerce_request_data() + errs = process_args(input_arguments) if errs: return get_json_result(code=RetCode.ARGUMENT_ERROR, message=errs) if inspect.iscoroutinefunction(func): diff --git a/sdk/python/ragflow_sdk/ragflow.py b/sdk/python/ragflow_sdk/ragflow.py index 11aa5d4a2a6..7d2bd31ee3a 100644 --- a/sdk/python/ragflow_sdk/ragflow.py +++ b/sdk/python/ragflow_sdk/ragflow.py @@ -318,6 +318,8 @@ def list_memory(self, page: int = 1, page_size: int = 50, tenant_id: str | list[ for data in res["data"]["memory_list"]: result_list.append(Memory(self, data)) return { + "code": res.get("code", 0), + "message": res.get("message"), "memory_list": result_list, "total_count": res["data"]["total_count"] } diff --git a/test/testcases/test_web_api/common.py b/test/testcases/test_web_api/common.py index 6f7487676b5..3e298faa6aa 100644 --- a/test/testcases/test_web_api/common.py +++ b/test/testcases/test_web_api/common.py @@ -99,7 +99,7 @@ def batch_create_datasets(auth, num): # DOCUMENT APP -def upload_documents(auth, payload=None, files_path=None): +def upload_documents(auth, payload=None, files_path=None, *, filename_override=None): url = f"{HOST_ADDRESS}{DOCUMENT_APP_URL}/upload" if files_path is None: @@ -115,7 +115,8 @@ def upload_documents(auth, payload=None, files_path=None): for fp in files_path: p = Path(fp) f = p.open("rb") - fields.append(("file", (p.name, f))) + filename = filename_override if filename_override is not None else p.name + fields.append(("file", (filename, f))) file_objects.append(f) m = MultipartEncoder(fields=fields) diff --git a/test/testcases/test_web_api/conftest.py b/test/testcases/test_web_api/conftest.py index 18b56a8450c..f87f2c9f9cd 100644 --- a/test/testcases/test_web_api/conftest.py +++ b/test/testcases/test_web_api/conftest.py @@ -14,7 +14,8 @@ # limitations under the License. # from time import sleep - +from ragflow_sdk import RAGFlow +from configs import HOST_ADDRESS, VERSION import pytest from common import ( batch_add_chunks, @@ -81,7 +82,9 @@ def generate_test_files(request: FixtureRequest, tmp_path): def ragflow_tmp_dir(request, tmp_path_factory): class_name = request.cls.__name__ return tmp_path_factory.mktemp(class_name) - +@pytest.fixture(scope="session") +def client(token: str) -> RAGFlow: + return RAGFlow(api_key=token, base_url=HOST_ADDRESS, version=VERSION) @pytest.fixture(scope="session") def WebApiAuth(auth): diff --git a/test/testcases/test_web_api/test_chunk_app/test_retrieval_chunks.py b/test/testcases/test_web_api/test_chunk_app/test_retrieval_chunks.py index 62e8efa448b..42bd28f09b3 100644 --- a/test/testcases/test_web_api/test_chunk_app/test_retrieval_chunks.py +++ b/test/testcases/test_web_api/test_chunk_app/test_retrieval_chunks.py @@ -265,11 +265,11 @@ def test_keyword(self, WebApiAuth, add_chunks, payload, expected_code, expected_ @pytest.mark.parametrize( "payload, expected_code, expected_highlight, expected_message", [ - ({"highlight": True}, 0, True, ""), - ({"highlight": "True"}, 0, True, ""), - pytest.param({"highlight": False}, 0, False, "", marks=pytest.mark.skip(reason="issues/6648")), - pytest.param({"highlight": "False"}, 0, False, "", marks=pytest.mark.skip(reason="issues/6648")), - pytest.param({"highlight": None}, 0, False, "", marks=pytest.mark.skip(reason="issues/6648")), + pytest.param({"highlight": True}, 0, True, "", marks=pytest.mark.skip(reason="highlight not functionnal")), + pytest.param({"highlight": "True"}, 0, True, "", marks=pytest.mark.skip(reason="highlight not functionnal")), + ({"highlight": False}, 0, False, ""), + ({"highlight": "False"}, 0, False, ""), + ({"highlight": None}, 0, False, "") ], ) def test_highlight(self, WebApiAuth, add_chunks, payload, expected_code, expected_highlight, expected_message): diff --git a/test/testcases/test_web_api/test_document_app/test_upload_documents.py b/test/testcases/test_web_api/test_document_app/test_upload_documents.py index f7880cea506..b006a720ba9 100644 --- a/test/testcases/test_web_api/test_document_app/test_upload_documents.py +++ b/test/testcases/test_web_api/test_document_app/test_upload_documents.py @@ -17,11 +17,9 @@ from concurrent.futures import ThreadPoolExecutor, as_completed import pytest -import requests -from common import DOCUMENT_APP_URL, list_kbs, upload_documents -from configs import DOCUMENT_NAME_LIMIT, HOST_ADDRESS, INVALID_API_TOKEN +from common import list_kbs, upload_documents +from configs import DOCUMENT_NAME_LIMIT, INVALID_API_TOKEN from libs.auth import RAGFlowWebApiAuth -from requests_toolbelt import MultipartEncoder from utils.file_utils import create_txt_file @@ -111,17 +109,9 @@ def test_filename_empty(self, WebApiAuth, add_dataset_func, tmp_path): kb_id = add_dataset_func fp = create_txt_file(tmp_path / "ragflow_test.txt") - url = f"{HOST_ADDRESS}{DOCUMENT_APP_URL}/upload" - fields = [("file", ("", fp.open("rb"))), ("kb_id", kb_id)] - m = MultipartEncoder(fields=fields) - res = requests.post( - url=url, - headers={"Content-Type": m.content_type}, - auth=WebApiAuth, - data=m, - ) - assert res.json()["code"] == 101, res - assert res.json()["message"] == "No file selected!", res + res = upload_documents(WebApiAuth, {"kb_id": kb_id}, [fp], filename_override="") + assert res["code"] == 101, res + assert res["message"] == "No file selected!", res @pytest.mark.p2 def test_filename_exceeds_max_length(self, WebApiAuth, add_dataset_func, tmp_path): From 045314a1aa6e18cfa86d186bc042f9e5ef000fd2 Mon Sep 17 00:00:00 2001 From: Magicbook1108 Date: Fri, 16 Jan 2026 15:32:04 +0800 Subject: [PATCH 127/335] Fix: duplicate content in chunk (#12655) ### What problem does this PR solve? Fix: duplicate content in chunk #12336 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- deepdoc/parser/pdf_parser.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/deepdoc/parser/pdf_parser.py b/deepdoc/parser/pdf_parser.py index ce6b9298b1f..613787b4803 100644 --- a/deepdoc/parser/pdf_parser.py +++ b/deepdoc/parser/pdf_parser.py @@ -476,7 +476,7 @@ def start_with(b, txts): self.boxes = bxs def _naive_vertical_merge(self, zoomin=3): - #bxs = self._assign_column(self.boxes, zoomin) + # bxs = self._assign_column(self.boxes, zoomin) bxs = self.boxes grouped = defaultdict(list) @@ -553,7 +553,8 @@ def _naive_vertical_merge(self, zoomin=3): merged_boxes.extend(bxs) - #self.boxes = sorted(merged_boxes, key=lambda x: (x["page_number"], x.get("col_id", 0), x["top"])) + # self.boxes = sorted(merged_boxes, key=lambda x: (x["page_number"], x.get("col_id", 0), x["top"])) + self.boxes = merged_boxes def _final_reading_order_merge(self, zoomin=3): if not self.boxes: From 99dae3c64c448674e72499dcf7c7730e62efde84 Mon Sep 17 00:00:00 2001 From: balibabu Date: Fri, 16 Jan 2026 16:49:48 +0800 Subject: [PATCH 128/335] Fix: In the agent loop, if the await response is selected as the variable, the operator cannot be selected. #12656 (#12657) ### What problem does this PR solve? Fix: In the agent loop, if the await response is selected as the variable, the operator cannot be selected. #12656 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/.eslintrc.cjs | 5 +---- web/src/pages/agent/constant/index.tsx | 10 ++++++++++ .../pages/agent/form/begin-form/parameter-dialog.tsx | 2 +- web/src/pages/agent/hooks/use-get-begin-query.tsx | 10 +++++++++- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/web/.eslintrc.cjs b/web/.eslintrc.cjs index 0473e62460d..689dec1fc3e 100644 --- a/web/.eslintrc.cjs +++ b/web/.eslintrc.cjs @@ -53,10 +53,7 @@ module.exports = { ], }, ], - 'react-refresh/only-export-components': [ - 'warn', - { allowConstantExport: true }, - ], + 'react-refresh/only-export-components': 'off', 'no-console': ['warn', { allow: ['warn', 'error'] }], 'check-file/filename-naming-convention': [ 'error', diff --git a/web/src/pages/agent/constant/index.tsx b/web/src/pages/agent/constant/index.tsx index 845450ab3ee..869f247c0bd 100644 --- a/web/src/pages/agent/constant/index.tsx +++ b/web/src/pages/agent/constant/index.tsx @@ -1075,3 +1075,13 @@ export enum WebhookStatus { Live = 'live', Stopped = 'stopped', } + +// Map BeginQueryType to TypesWithArray +export const BeginQueryTypeMap = { + [BeginQueryType.Line]: TypesWithArray.String, + [BeginQueryType.Paragraph]: TypesWithArray.String, + [BeginQueryType.Options]: TypesWithArray.ArrayString, + [BeginQueryType.File]: 'File', + [BeginQueryType.Integer]: TypesWithArray.Number, + [BeginQueryType.Boolean]: TypesWithArray.Boolean, +}; diff --git a/web/src/pages/agent/form/begin-form/parameter-dialog.tsx b/web/src/pages/agent/form/begin-form/parameter-dialog.tsx index 88f239a4e7d..c56f7a1f1db 100644 --- a/web/src/pages/agent/form/begin-form/parameter-dialog.tsx +++ b/web/src/pages/agent/form/begin-form/parameter-dialog.tsx @@ -96,7 +96,7 @@ function ParameterForm({ }, [], ); - }, []); + }, [t]); const type = useWatch({ control: form.control, diff --git a/web/src/pages/agent/hooks/use-get-begin-query.tsx b/web/src/pages/agent/hooks/use-get-begin-query.tsx index 5de22e0e978..9588ee90f9f 100644 --- a/web/src/pages/agent/hooks/use-get-begin-query.tsx +++ b/web/src/pages/agent/hooks/use-get-begin-query.tsx @@ -18,6 +18,7 @@ import { AgentVariableType, BeginId, BeginQueryType, + BeginQueryTypeMap, JsonSchemaDataType, Operator, VariableType, @@ -463,7 +464,14 @@ export function useGetVariableLabelOrTypeByValue({ const getType = useCallback( (val?: string) => { - return getItem(val)?.type || findAgentStructuredOutputTypeByValue(val); + const currentType = + getItem(val)?.type || findAgentStructuredOutputTypeByValue(val); + + if (currentType && currentType in BeginQueryTypeMap) { + return BeginQueryTypeMap[currentType as BeginQueryType]; + } + + return currentType; }, [findAgentStructuredOutputTypeByValue, getItem], ); From 30bd25716bb7dd7bd6503fe2d8fc82274137207f Mon Sep 17 00:00:00 2001 From: PentaFDevs <149094373+PentaFrame-Development@users.noreply.github.com> Date: Fri, 16 Jan 2026 09:50:53 +0100 Subject: [PATCH 129/335] Fix PDF Generator output variables not appearing in subsequent agent steps (#12619) This commit fixes multiple issues preventing PDF Generator (Docs Generator) output variables from being visible in the Output section and available to downstream nodes. ### What problem does this PR solve? Issues Fixed: 1. PDF Generator nodes initialized with empty object instead of proper initial values 2. Output structure mismatch (had 'value' property that system doesn't expect) 3. Missing 'download' output in form schema 4. Output list computed from static values instead of form state 5. Added null/undefined guard to transferOutputs function ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) Changes: - web/src/pages/agent/constant/index.tsx: Fixed output structure in initialPDFGeneratorValues - web/src/pages/agent/hooks/use-add-node.ts: Initialize PDF Generator with proper values - web/src/pages/agent/form/pdf-generator-form/index.tsx: Fixed schema and use form.watch - web/src/pages/agent/form/components/output.tsx: Added null guard and spacing --- web/src/pages/agent/constant/index.tsx | 8 ++++---- .../pages/agent/form/components/output.tsx | 7 +++++-- .../agent/form/pdf-generator-form/index.tsx | 19 ++++++++++--------- web/src/pages/agent/hooks/use-add-node.ts | 3 ++- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/web/src/pages/agent/constant/index.tsx b/web/src/pages/agent/constant/index.tsx index 869f247c0bd..4904a5985f8 100644 --- a/web/src/pages/agent/constant/index.tsx +++ b/web/src/pages/agent/constant/index.tsx @@ -1016,10 +1016,10 @@ export const initialPDFGeneratorValues = { watermark_text: '', enable_toc: false, outputs: { - file_path: { type: 'string', value: '' }, - pdf_base64: { type: 'string', value: '' }, - download: { type: 'string', value: '' }, - success: { type: 'boolean', value: false }, + file_path: { type: 'string' }, + pdf_base64: { type: 'string' }, + download: { type: 'string' }, + success: { type: 'boolean' }, }, }; diff --git a/web/src/pages/agent/form/components/output.tsx b/web/src/pages/agent/form/components/output.tsx index 73058b67be3..e428c465110 100644 --- a/web/src/pages/agent/form/components/output.tsx +++ b/web/src/pages/agent/form/components/output.tsx @@ -14,7 +14,10 @@ type OutputProps = { isFormRequired?: boolean; } & PropsWithChildren; -export function transferOutputs(outputs: Record) { +export function transferOutputs(outputs: Record | undefined) { + if (!outputs) { + return []; + } return Object.entries(outputs).map(([key, value]) => ({ title: key, type: value?.type, @@ -35,7 +38,7 @@ export function Output({
    {t('flow.output')} {children}
    -
      +
        {list.map((x, idx) => (
      • >({ @@ -78,9 +77,11 @@ function PDFGeneratorForm({ node }: INextOperatorForm) { resolver: zodResolver(FormSchema), }); + const formOutputs = form.watch('outputs'); + const outputList = useMemo(() => { - return transferOutputs(values.outputs); - }, [values.outputs]); + return transferOutputs(formOutputs ?? values.outputs); + }, [formOutputs, values.outputs]); useWatchFormChange(node?.id, form); diff --git a/web/src/pages/agent/hooks/use-add-node.ts b/web/src/pages/agent/hooks/use-add-node.ts index 53f99e51ca9..d5cceef6381 100644 --- a/web/src/pages/agent/hooks/use-add-node.ts +++ b/web/src/pages/agent/hooks/use-add-node.ts @@ -48,6 +48,7 @@ import { initialVariableAssignerValues, initialWaitingDialogueValues, initialWenCaiValues, + initialPDFGeneratorValues, initialWikipediaValues, initialYahooFinanceValues, } from '../constant'; @@ -179,7 +180,7 @@ export const useInitializeOperatorParams = () => { [Operator.Loop]: initialLoopValues, [Operator.LoopStart]: {}, [Operator.ExitLoop]: {}, - [Operator.PDFGenerator]: {}, + [Operator.PDFGenerator]: initialPDFGeneratorValues, [Operator.ExcelProcessor]: {}, }; }, [llmId]); From 59075a0b5847808194d8936db068a60c5f967bb8 Mon Sep 17 00:00:00 2001 From: 6ba3i <112825897+6ba3i@users.noreply.github.com> Date: Fri, 16 Jan 2026 17:47:12 +0800 Subject: [PATCH 130/335] Fix : p3 level sdk test error for update chat (#12654) ### What problem does this PR solve? fix for update chat failing ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- sdk/python/ragflow_sdk/modules/chat.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sdk/python/ragflow_sdk/modules/chat.py b/sdk/python/ragflow_sdk/modules/chat.py index 53fcc1af95a..474fa54b87f 100644 --- a/sdk/python/ragflow_sdk/modules/chat.py +++ b/sdk/python/ragflow_sdk/modules/chat.py @@ -60,6 +60,12 @@ def __init__(self, rag, res_dict): super().__init__(rag, res_dict) def update(self, update_message: dict): + if not isinstance(update_message, dict): + raise Exception("ValueError('`update_message` must be a dict')") + if update_message.get("llm") == {}: + raise Exception("ValueError('`llm` cannot be empty')") + if update_message.get("prompt") == {}: + raise Exception("ValueError('`prompt` cannot be empty')") res = self.put(f"/chats/{self.id}", update_message) res = res.json() if res.get("code") != 0: From 4f036a881d2ab80c826c5b68162f88c41973aada Mon Sep 17 00:00:00 2001 From: 6ba3i <112825897+6ba3i@users.noreply.github.com> Date: Fri, 16 Jan 2026 20:03:52 +0800 Subject: [PATCH 131/335] Fix: Infinity keyword round-trip, highlight fallback, and KB update guards (#12660) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What problem does this PR solve? Fixes Infinity-specific API regressions: preserves ```important_kwd``` round‑trip for ```[""]```, restores required highlight key in retrieval responses, and enforces Infinity guards for unsupported ```parser_id=tag``` and pagerank in ```/v1/kb/update```. Also removes a slow/buggy pandas row-wise apply that was throwing ```ValueError``` and causing flakiness. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/kb_app.py | 14 +++++++++++++ common/doc_store/infinity_conn_base.py | 5 ++++- conf/infinity_mapping.json | 1 + rag/utils/infinity_conn.py | 29 +++++++++++++++++++++++--- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/api/apps/kb_app.py b/api/apps/kb_app.py index 5ffc3040eee..a35345feb8d 100644 --- a/api/apps/kb_app.py +++ b/api/apps/kb_app.py @@ -82,6 +82,20 @@ async def update(): return get_data_error_result( message=f"Dataset name length is {len(req['name'])} which is large than {DATASET_NAME_LIMIT}") req["name"] = req["name"].strip() + if settings.DOC_ENGINE_INFINITY: + parser_id = req.get("parser_id") + if isinstance(parser_id, str) and parser_id.lower() == "tag": + return get_json_result( + code=RetCode.OPERATING_ERROR, + message="The chunking method Tag has not been supported by Infinity yet.", + data=False, + ) + if "pagerank" in req: + return get_json_result( + code=RetCode.DATA_ERROR, + message="'pagerank' can only be set when doc_engine is elasticsearch", + data=False, + ) if not KnowledgebaseService.accessible4deletion(req["kb_id"], current_user.id): return get_json_result( diff --git a/common/doc_store/infinity_conn_base.py b/common/doc_store/infinity_conn_base.py index 82650f81d6f..c8679c31ce6 100644 --- a/common/doc_store/infinity_conn_base.py +++ b/common/doc_store/infinity_conn_base.py @@ -367,7 +367,10 @@ def get_highlight(self, res: tuple[pd.DataFrame, int] | pd.DataFrame, keywords: num_rows = len(res) column_id = res["id"] if field_name not in res: - return {} + if field_name == "content_with_weight" and "content" in res: + field_name = "content" + else: + return {} for i in range(num_rows): id = column_id[i] txt = res[field_name][i] diff --git a/conf/infinity_mapping.json b/conf/infinity_mapping.json index de2dd3a17e9..94909f8ffa9 100644 --- a/conf/infinity_mapping.json +++ b/conf/infinity_mapping.json @@ -9,6 +9,7 @@ "docnm": {"type": "varchar", "default": "", "analyzer": ["rag-coarse", "rag-fine"], "comment": "docnm_kwd, title_tks, title_sm_tks"}, "name_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"}, "tag_kwd": {"type": "varchar", "default": "", "analyzer": "whitespace-#"}, + "important_kwd_empty_count": {"type": "integer", "default": 0}, "important_keywords": {"type": "varchar", "default": "", "analyzer": ["rag-coarse", "rag-fine"], "comment": "important_kwd, important_tks"}, "questions": {"type": "varchar", "default": "", "analyzer": ["rag-coarse", "rag-fine"], "comment": "question_kwd, question_tks"}, "content": {"type": "varchar", "default": "", "analyzer": ["rag-coarse", "rag-fine"], "comment": "content_with_weight, content_ltks, content_sm_ltks"}, diff --git a/rag/utils/infinity_conn.py b/rag/utils/infinity_conn.py index ac5129735f7..f65ae3eaf99 100644 --- a/rag/utils/infinity_conn.py +++ b/rag/utils/infinity_conn.py @@ -42,6 +42,7 @@ def field_keyword(field_name: str): return False def convert_select_fields(self, output_fields: list[str]) -> list[str]: + need_empty_count = "important_kwd" in output_fields for i, field in enumerate(output_fields): if field in ["docnm_kwd", "title_tks", "title_sm_tks"]: output_fields[i] = "docnm" @@ -53,6 +54,8 @@ def convert_select_fields(self, output_fields: list[str]) -> list[str]: output_fields[i] = "content" elif field in ["authors_tks", "authors_sm_tks"]: output_fields[i] = "authors" + if need_empty_count and "important_kwd_empty_count" not in output_fields: + output_fields.append("important_kwd_empty_count") return list(set(output_fields)) @staticmethod @@ -340,7 +343,13 @@ def insert(self, documents: list[dict], index_name: str, knowledgebase_id: str = if not d.get("docnm_kwd"): d["docnm"] = self.list2str(v) elif k == "important_kwd": - d["important_keywords"] = self.list2str(v, ",") + if isinstance(v, list): + empty_count = sum(1 for kw in v if kw == "") + tokens = [kw for kw in v if kw != ""] + d["important_keywords"] = self.list2str(tokens, ",") + d["important_kwd_empty_count"] = empty_count + else: + d["important_keywords"] = self.list2str(v, ",") elif k == "important_tks": if not d.get("important_kwd"): d["important_keywords"] = v @@ -429,7 +438,13 @@ def update(self, condition: dict, new_value: dict, index_name: str, knowledgebas if not new_value.get("docnm_kwd"): new_value["docnm"] = v elif k == "important_kwd": - new_value["important_keywords"] = self.list2str(v, ",") + if isinstance(v, list): + empty_count = sum(1 for kw in v if kw == "") + tokens = [kw for kw in v if kw != ""] + new_value["important_keywords"] = self.list2str(tokens, ",") + new_value["important_kwd_empty_count"] = empty_count + else: + new_value["important_keywords"] = self.list2str(v, ",") elif k == "important_tks": if not new_value.get("important_kwd"): new_value["important_keywords"] = v @@ -532,7 +547,15 @@ def get_fields(self, res: tuple[pd.DataFrame, int] | pd.DataFrame, fields: list[ res[field] = res["docnm"] if "important_keywords" in res.columns: if "important_kwd" in fields_all: - res["important_kwd"] = res["important_keywords"].apply(lambda v: v.split(",") if v else []) + if "important_kwd_empty_count" in res.columns: + base = res["important_keywords"].apply(lambda raw: raw.split(",") if raw else []) + counts = res["important_kwd_empty_count"].fillna(0).astype(int) + res["important_kwd"] = [ + tokens + [""] * empty_count + for tokens, empty_count in zip(base.tolist(), counts.tolist()) + ] + else: + res["important_kwd"] = res["important_keywords"].apply(lambda v: v.split(",") if v else []) if "important_tks" in fields_all: res["important_tks"] = res["important_keywords"] if "questions" in res.columns: From b6d77330584dd3159ce899ca3f0aa19d19663ede Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Fri, 16 Jan 2026 20:14:02 +0800 Subject: [PATCH 132/335] Feat: metadata settings in KB. (#12662) ### What problem does this PR solve? #11910 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- web/src/interfaces/database/knowledge.ts | 2 + .../metedata/hooks/use-manage-modal.ts | 174 +++++++-- .../metedata/hooks/use-manage-values-modal.ts | 60 ++- .../dataset/components/metedata/interface.ts | 36 +- .../components/metedata/manage-modal.tsx | 341 +++++++++++++++--- .../metedata/manage-values-modal.tsx | 40 +- .../configuration/common-item.tsx | 24 +- .../dataset/dataset-setting/form-schema.ts | 14 +- .../pages/dataset/dataset-setting/index.tsx | 7 +- 9 files changed, 568 insertions(+), 130 deletions(-) diff --git a/web/src/interfaces/database/knowledge.ts b/web/src/interfaces/database/knowledge.ts index 502c63c1b74..36c55df9f3b 100644 --- a/web/src/interfaces/database/knowledge.ts +++ b/web/src/interfaces/database/knowledge.ts @@ -68,6 +68,8 @@ export interface ParserConfig { topn_tags?: number; graphrag?: { use_graphrag?: boolean }; enable_metadata?: boolean; + metadata?: any; + built_in_metadata?: Array<{ key: string; type: string }>; } export interface IKnowledgeFileParserConfig { diff --git a/web/src/pages/dataset/components/metedata/hooks/use-manage-modal.ts b/web/src/pages/dataset/components/metedata/hooks/use-manage-modal.ts index c9d54b1a570..5a56ad7a189 100644 --- a/web/src/pages/dataset/components/metedata/hooks/use-manage-modal.ts +++ b/web/src/pages/dataset/components/metedata/hooks/use-manage-modal.ts @@ -14,11 +14,14 @@ import { useCallback, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useParams } from 'react-router'; import { + IBuiltInMetadataItem, + IMetaDataJsonSchemaProperty, IMetaDataReturnJSONSettings, IMetaDataReturnJSONType, IMetaDataReturnType, IMetaDataTableData, MetadataOperations, + MetadataValueType, ShowManageMetadataModalProps, } from '../interface'; export enum MetadataType { @@ -71,6 +74,90 @@ export const MetadataDeleteMap = ( }, }; }; + +const DEFAULT_VALUE_TYPE: MetadataValueType = 'string'; +const VALUE_TYPES_WITH_ENUM = new Set(['enum']); +const VALUE_TYPE_LABELS: Record = { + string: 'String', + bool: 'Bool', + enum: 'Enum', + time: 'Time', + int: 'Int', + float: 'Float', +}; + +export const metadataValueTypeOptions = Object.entries(VALUE_TYPE_LABELS).map( + ([value, label]) => ({ label, value }), +); + +export const getMetadataValueTypeLabel = (value?: MetadataValueType) => + VALUE_TYPE_LABELS[value || DEFAULT_VALUE_TYPE] || VALUE_TYPE_LABELS.string; + +export const isMetadataValueTypeWithEnum = (value?: MetadataValueType) => + VALUE_TYPES_WITH_ENUM.has(value || DEFAULT_VALUE_TYPE); + +const schemaToValueType = ( + property?: IMetaDataJsonSchemaProperty, +): MetadataValueType => { + if (!property) return DEFAULT_VALUE_TYPE; + if ( + property.type === 'array' && + property.items?.type === 'string' && + (property.items.enum?.length || 0) > 0 + ) { + return 'enum'; + } + if (property.type === 'boolean') return 'bool'; + if (property.type === 'integer') return 'int'; + if (property.type === 'number') return 'float'; + if (property.type === 'string' && property.format) { + return 'time'; + } + if (property.type === 'string' && property.enum?.length) { + return 'enum'; + } + return DEFAULT_VALUE_TYPE; +}; + +const valueTypeToSchema = ( + valueType: MetadataValueType, + description: string, + values: string[], +): IMetaDataJsonSchemaProperty => { + const schema: IMetaDataJsonSchemaProperty = { + description: description || '', + }; + + switch (valueType) { + case 'bool': + schema.type = 'boolean'; + return schema; + case 'int': + schema.type = 'integer'; + return schema; + case 'float': + schema.type = 'number'; + return schema; + case 'time': + schema.type = 'string'; + schema.format = 'date-time'; + return schema; + case 'enum': + schema.type = 'string'; + if (values?.length) { + schema.enum = values; + } + return schema; + case 'string': + default: + schema.type = 'string'; + if (values?.length) { + schema.enum = values; + } + return schema; + } +}; + export const util = { changeToMetaDataTableData(data: IMetaDataReturnType): IMetaDataTableData[] { return Object.entries(data).map(([key, value]) => { @@ -117,25 +204,58 @@ export const util = { tableDataToMetaDataSettingJSON( data: IMetaDataTableData[], ): IMetaDataReturnJSONSettings { - return data.map((item) => { - return { - key: item.field, - description: item.description, - enum: item.values, - }; - }); + const properties = data.reduce>( + (acc, item) => { + if (!item.field) { + return acc; + } + const valueType = item.valueType || DEFAULT_VALUE_TYPE; + const values = + isMetadataValueTypeWithEnum(valueType) && item.restrictDefinedValues + ? item.values + : []; + acc[item.field] = valueTypeToSchema( + valueType, + item.description, + values, + ); + return acc; + }, + {}, + ); + + return { + type: 'object', + properties, + additionalProperties: false, + }; }, metaDataSettingJSONToMetaDataTableData( data: IMetaDataReturnJSONSettings, ): IMetaDataTableData[] { - if (!Array.isArray(data)) return []; - return data.map((item) => { + if (!data) return []; + if (Array.isArray(data)) { + return data.map((item) => { + return { + field: item.key, + description: item.description, + values: item.enum || [], + restrictDefinedValues: !!item.enum?.length, + valueType: DEFAULT_VALUE_TYPE, + } as IMetaDataTableData; + }); + } + const properties = data.properties || {}; + return Object.entries(properties).map(([key, property]) => { + const valueType = schemaToValueType(property); + const values = property.enum || property.items?.enum || []; return { - field: item.key, - description: item.description, - values: item.enum, - restrictDefinedValues: !!item.enum?.length, + field: key, + description: property.description || '', + values, + restrictDefinedValues: !!values.length, + valueType, } as IMetaDataTableData; }); }, @@ -384,21 +504,15 @@ export const useManageMetaDataModal = ( ); const handleSaveSettings = useCallback( - async (callback: () => void) => { + async (callback: () => void, builtInMetadata?: IBuiltInMetadataItem[]) => { const data = util.tableDataToMetaDataSettingJSON(tableData); - const { data: res } = await kbService.kbUpdateMetaData({ - kb_id: id, + callback?.(); + return { metadata: data, - enable_metadata: true, - }); - if (res.code === 0) { - message.success(t('message.operated')); - callback?.(); - } - - return data; + builtInMetadata: builtInMetadata || [], + }; }, - [tableData, id, t], + [tableData], ); const handleSaveSingleFileSettings = useCallback( @@ -421,7 +535,13 @@ export const useManageMetaDataModal = ( ); const handleSave = useCallback( - async ({ callback }: { callback: () => void }) => { + async ({ + callback, + builtInMetadata, + }: { + callback: () => void; + builtInMetadata?: string[]; + }) => { switch (type) { case MetadataType.UpdateSingle: handleSaveUpdateSingle(callback); @@ -430,7 +550,7 @@ export const useManageMetaDataModal = ( handleSaveManage(callback); break; case MetadataType.Setting: - return handleSaveSettings(callback); + return handleSaveSettings(callback, builtInMetadata); case MetadataType.SingleFileSetting: return handleSaveSingleFileSettings(callback); default: diff --git a/web/src/pages/dataset/components/metedata/hooks/use-manage-values-modal.ts b/web/src/pages/dataset/components/metedata/hooks/use-manage-values-modal.ts index 38608109df8..9550f4aebf5 100644 --- a/web/src/pages/dataset/components/metedata/hooks/use-manage-values-modal.ts +++ b/web/src/pages/dataset/components/metedata/hooks/use-manage-values-modal.ts @@ -1,13 +1,16 @@ import { useCallback, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { MetadataDeleteMap, MetadataType } from '../hooks/use-manage-modal'; +import { + isMetadataValueTypeWithEnum, + MetadataDeleteMap, + MetadataType, +} from '../hooks/use-manage-modal'; import { IManageValuesProps, IMetaDataTableData } from '../interface'; export const useManageValues = (props: IManageValuesProps) => { const { data, - isShowValueSwitch, hideModal, onSave, addUpdateValue, @@ -16,7 +19,10 @@ export const useManageValues = (props: IManageValuesProps) => { type, } = props; const { t } = useTranslation(); - const [metaData, setMetaData] = useState(data); + const [metaData, setMetaData] = useState({ + ...data, + valueType: data.valueType || 'string', + }); const [valueError, setValueError] = useState>({ field: '', values: '', @@ -61,10 +67,28 @@ export const useManageValues = (props: IManageValuesProps) => { }; }); } - setMetaData((prev) => ({ - ...prev, - [field]: value, - })); + setMetaData((prev) => { + if (field === 'valueType') { + const nextValueType = (value || + 'string') as IMetaDataTableData['valueType']; + const supportsEnum = isMetadataValueTypeWithEnum(nextValueType); + if (!supportsEnum) { + setTempValues([]); + } + return { + ...prev, + valueType: nextValueType, + values: supportsEnum ? prev.values : [], + restrictDefinedValues: supportsEnum + ? prev.restrictDefinedValues || nextValueType === 'enum' + : false, + }; + } + return { + ...prev, + [field]: value, + }; + }); }, [existsKeys, type, t], ); @@ -74,7 +98,10 @@ export const useManageValues = (props: IManageValuesProps) => { useEffect(() => { setTempValues([...data.values]); - setMetaData(data); + setMetaData({ + ...data, + valueType: data.valueType || 'string', + }); }, [data]); const handleHideModal = useCallback(() => { @@ -86,14 +113,19 @@ export const useManageValues = (props: IManageValuesProps) => { if (type === MetadataType.Setting && valueError.field) { return; } - if (!metaData.restrictDefinedValues && isShowValueSwitch) { - const newMetaData = { ...metaData, values: [] }; - onSave(newMetaData); - } else { - onSave(metaData); + const supportsEnum = isMetadataValueTypeWithEnum(metaData.valueType); + if (!supportsEnum) { + onSave({ + ...metaData, + values: [], + restrictDefinedValues: false, + }); + handleHideModal(); + return; } + onSave(metaData); handleHideModal(); - }, [metaData, onSave, handleHideModal, isShowValueSwitch, type, valueError]); + }, [metaData, onSave, handleHideModal, type, valueError]); // Handle value changes, only update temporary state const handleValueChange = useCallback( diff --git a/web/src/pages/dataset/components/metedata/interface.ts b/web/src/pages/dataset/components/metedata/interface.ts index ef299036657..27f38d06fcc 100644 --- a/web/src/pages/dataset/components/metedata/interface.ts +++ b/web/src/pages/dataset/components/metedata/interface.ts @@ -11,13 +11,44 @@ export interface IMetaDataReturnJSONSettingItem { description?: string; enum?: string[]; } -export type IMetaDataReturnJSONSettings = Array; +export interface IMetaDataJsonSchemaProperty { + type?: string; + description?: string; + enum?: string[]; + items?: { + type?: string; + enum?: string[]; + }; + format?: string; +} +export interface IMetaDataJsonSchema { + type?: 'object'; + properties?: Record; + additionalProperties?: boolean; +} +export type IMetaDataReturnJSONSettings = + | IMetaDataJsonSchema + | Array; + +export type MetadataValueType = + | 'string' + | 'bool' + | 'enum' + | 'time' + | 'int' + | 'float'; export type IMetaDataTableData = { field: string; description: string; restrictDefinedValues?: boolean; values: string[]; + valueType?: MetadataValueType; +}; + +export type IBuiltInMetadataItem = { + key: string; + type: MetadataValueType; }; export type IManageModalProps = { @@ -34,6 +65,7 @@ export type IManageModalProps = { isAddValue?: boolean; isShowValueSwitch?: boolean; isVerticalShowValue?: boolean; + builtInMetadata?: IBuiltInMetadataItem[]; success?: (data: any) => void; }; @@ -45,6 +77,7 @@ export interface IManageValuesProps { isAddValue?: boolean; isShowDescription?: boolean; isShowValueSwitch?: boolean; + isShowType?: boolean; isVerticalShowValue?: boolean; data: IMetaDataTableData; type: MetadataType; @@ -81,6 +114,7 @@ export type ShowManageMetadataModalProps = Partial & { isCanAdd: boolean; type: MetadataType; record?: Record; + builtInMetadata?: IBuiltInMetadataItem[]; options?: ShowManageMetadataModalOptions; title?: ReactNode | string; isDeleteSingleValue?: boolean; diff --git a/web/src/pages/dataset/components/metedata/manage-modal.tsx b/web/src/pages/dataset/components/metedata/manage-modal.tsx index 790b2f1ea95..68053b6bd8a 100644 --- a/web/src/pages/dataset/components/metedata/manage-modal.tsx +++ b/web/src/pages/dataset/components/metedata/manage-modal.tsx @@ -7,6 +7,7 @@ import Empty from '@/components/empty/empty'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Modal } from '@/components/ui/modal/modal'; +import { Switch } from '@/components/ui/switch'; import { Table, TableBody, @@ -15,6 +16,7 @@ import { TableHeader, TableRow, } from '@/components/ui/table'; +import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { useSetModalState } from '@/hooks/common-hooks'; import { Routes } from '@/routes'; import { @@ -39,11 +41,19 @@ import { useHandleMenuClick } from '../../sidebar/hooks'; import { MetadataDeleteMap, MetadataType, + getMetadataValueTypeLabel, + isMetadataValueTypeWithEnum, useManageMetaDataModal, } from './hooks/use-manage-modal'; -import { IManageModalProps, IMetaDataTableData } from './interface'; +import { + IBuiltInMetadataItem, + IManageModalProps, + IMetaDataTableData, +} from './interface'; import { ManageValuesModal } from './manage-values-modal'; +type MetadataSettingsTab = 'generation' | 'built-in'; + export const ManageMetadataModal = (props: IManageModalProps) => { const { title, @@ -59,6 +69,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => { isShowDescription = false, isShowValueSwitch = false, isVerticalShowValue = true, + builtInMetadata, success, } = props; const { t } = useTranslation(); @@ -66,10 +77,15 @@ export const ManageMetadataModal = (props: IManageModalProps) => { field: '', description: '', values: [], + valueType: 'string', }); const [expanded, setExpanded] = useState(true); + const [activeTab, setActiveTab] = useState('generation'); const [currentValueIndex, setCurrentValueIndex] = useState(0); + const [builtInSelection, setBuiltInSelection] = useState< + IBuiltInMetadataItem[] + >([]); const [deleteDialogContent, setDeleteDialogContent] = useState({ visible: false, title: '', @@ -111,6 +127,62 @@ export const ManageMetadataModal = (props: IManageModalProps) => { }); }; + const isSettingsMode = + metadataType === MetadataType.Setting || + metadataType === MetadataType.SingleFileSetting; + const showTypeColumn = isSettingsMode; + const builtInRows = useMemo( + () => [ + { + field: 'update_time', + valueType: 'time', + description: t('knowledgeConfiguration.builtIn'), + }, + { + field: 'file_name', + valueType: 'string', + description: t('knowledgeConfiguration.builtIn'), + }, + ], + [t], + ); + const builtInTypeByKey = useMemo( + () => + new Map( + builtInRows.map((row) => [ + row.field, + row.valueType as IBuiltInMetadataItem['type'], + ]), + ), + [builtInRows], + ); + + useEffect(() => { + if (!visible) return; + setBuiltInSelection( + (builtInMetadata || []).map((item) => { + if (typeof item === 'string') { + return { + key: item, + type: builtInTypeByKey.get(item) || 'string', + }; + } + return { + key: item.key, + type: (item.type || + builtInTypeByKey.get(item.key) || + 'string') as IBuiltInMetadataItem['type'], + }; + }), + ); + setActiveTab('generation'); + }, [builtInMetadata, builtInTypeByKey, visible]); + + const builtInSelectionKeys = useMemo( + () => new Set(builtInSelection.map((item) => item.key)), + [builtInSelection], + ); + const handleEditValue = (field: string, value: string) => { setEditingValue({ field, value, newValue: value }); }; @@ -141,6 +213,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => { field: '', description: '', values: [], + valueType: 'string', }); setCurrentValueIndex(tableData.length || 0); showManageValuesModal(); @@ -165,6 +238,21 @@ export const ManageMetadataModal = (props: IManageModalProps) => {
    ), }, + ...(showTypeColumn + ? ([ + { + accessorKey: 'valueType', + header: () => Type, + cell: ({ row }) => ( +
    + {getMetadataValueTypeLabel( + row.original.valueType as IMetaDataTableData['valueType'], + )} +
    + ), + }, + ] as ColumnDef[]) + : []), { accessorKey: 'description', header: () => {t('knowledgeDetails.metadata.description')}, @@ -196,8 +284,11 @@ export const ManageMetadataModal = (props: IManageModalProps) => { ), cell: ({ row }) => { const values = row.getValue('values') as Array; + const supportsEnum = isMetadataValueTypeWithEnum( + row.original.valueType, + ); - if (!Array.isArray(values) || values.length === 0) { + if (!supportsEnum || !Array.isArray(values) || values.length === 0) { return
    ; } @@ -342,7 +433,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => { }, ]; if (!isShowDescription) { - cols.splice(1, 1); + return cols.filter((col) => col.accessorKey !== 'description'); } return cols; }, [ @@ -356,6 +447,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => { expanded, editingValue, saveEditedValue, + showTypeColumn, ]); const table = useReactTable({ @@ -393,7 +485,11 @@ export const ManageMetadataModal = (props: IManageModalProps) => { const mergedValues = [ ...new Set([...existingItem.values, ...item.values]), ]; - fieldMap.set(item.field, { ...existingItem, values: mergedValues }); + fieldMap.set(item.field, { + ...existingItem, + ...item, + values: mergedValues, + }); } else { fieldMap.set(item.field, item); } @@ -407,13 +503,13 @@ export const ManageMetadataModal = (props: IManageModalProps) => { useEffect(() => { if (shouldSave) { const timer = setTimeout(() => { - handleSave({ callback: () => {} }); + handleSave({ callback: () => {}, builtInMetadata: builtInSelection }); setShouldSave(false); }, 0); return () => clearTimeout(timer); } - }, [tableData, shouldSave, handleSave]); + }, [tableData, shouldSave, handleSave, builtInSelection]); const existsKeys = useMemo(() => { return tableData.map((item) => item.field); @@ -428,7 +524,10 @@ export const ManageMetadataModal = (props: IManageModalProps) => { maskClosable={false} okText={t('common.save')} onOk={async () => { - const res = await handleSave({ callback: hideModal }); + const res = await handleSave({ + callback: hideModal, + builtInMetadata: builtInSelection, + }); console.log('data', res); success?.(res); }} @@ -449,7 +548,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => { {t('knowledgeDetails.metadata.toMetadataSetting')} )} - {isCanAdd && ( + {isCanAdd && activeTab !== 'built-in' && ( )}
    - - - {table.getHeaderGroups().map((headerGroup) => ( - - {headerGroup.headers.map((header) => ( - - {header.isPlaceholder - ? null - : flexRender( - header.column.columnDef.header, - header.getContext(), - )} - - ))} - - ))} - - - {table.getRowModel().rows?.length ? ( - table.getRowModel().rows.map((row) => ( - - {row.getVisibleCells().map((cell) => ( - - {flexRender( - cell.column.columnDef.cell, - cell.getContext(), - )} - + {metadataType === MetadataType.Setting ? ( + setActiveTab(v as MetadataSettingsTab)} + > + + Generation + + {t('knowledgeConfiguration.builtIn')} + + + +
    + + {table.getHeaderGroups().map((headerGroup) => ( + + {headerGroup.headers.map((header) => ( + + {header.isPlaceholder + ? null + : flexRender( + header.column.columnDef.header, + header.getContext(), + )} + + ))} + + ))} + + + {table.getRowModel().rows?.length ? ( + table.getRowModel().rows.map((row) => ( + + {row.getVisibleCells().map((cell) => ( + + {flexRender( + cell.column.columnDef.cell, + cell.getContext(), + )} + + ))} + + )) + ) : ( + + + + + + )} + +
    + + + + + + + {t('knowledgeDetails.metadata.field')} + + Type + + {t('knowledgeDetails.metadata.description')} + + + {t('knowledgeDetails.metadata.action')} + + + + + {builtInRows.map((row) => ( + + +
    + {row.field} +
    +
    + +
    + {getMetadataValueTypeLabel( + row.valueType as IMetaDataTableData['valueType'], + )} +
    +
    + +
    + {row.description} +
    +
    + + { + setBuiltInSelection((prev) => { + if (checked) { + const nextType = + row.valueType as IBuiltInMetadataItem['type']; + if ( + prev.some( + (item) => item.key === row.field, + ) + ) { + return prev.map((item) => + item.key === row.field + ? { ...item, type: nextType } + : item, + ); + } + return [ + ...prev, + { key: row.field, type: nextType }, + ]; + } + return prev.filter( + (item) => item.key !== row.field, + ); + }); + }} + /> + +
    + ))} +
    +
    +
    + + ) : ( + + + {table.getHeaderGroups().map((headerGroup) => ( + + {headerGroup.headers.map((header) => ( + + {header.isPlaceholder + ? null + : flexRender( + header.column.columnDef.header, + header.getContext(), + )} + ))} - )) - ) : ( - - - - - - )} - -
    + ))} + + + {table.getRowModel().rows?.length ? ( + table.getRowModel().rows.map((row) => ( + + {row.getVisibleCells().map((cell) => ( + + {flexRender( + cell.column.columnDef.cell, + cell.getContext(), + )} + + ))} + + )) + ) : ( + + + + + + )} + + + )} {metadataType === MetadataType.Manage && (
    @@ -537,6 +771,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => { isAddValue={isAddValue || isCanAdd} isShowDescription={isShowDescription} isShowValueSwitch={isShowValueSwitch} + isShowType={isSettingsMode} isVerticalShowValue={isVerticalShowValue} // handleDeleteSingleValue={handleDeleteSingleValue} // handleDeleteSingleRow={handleDeleteSingleRow} diff --git a/web/src/pages/dataset/components/metedata/manage-values-modal.tsx b/web/src/pages/dataset/components/metedata/manage-values-modal.tsx index f1c6343f645..2498dd887bd 100644 --- a/web/src/pages/dataset/components/metedata/manage-values-modal.tsx +++ b/web/src/pages/dataset/components/metedata/manage-values-modal.tsx @@ -7,11 +7,15 @@ import { Button } from '@/components/ui/button'; import { FormLabel } from '@/components/ui/form'; import { Input } from '@/components/ui/input'; import { Modal } from '@/components/ui/modal/modal'; -import { Switch } from '@/components/ui/switch'; +import { RAGFlowSelect } from '@/components/ui/select'; import { Textarea } from '@/components/ui/textarea'; import { Plus, Trash2 } from 'lucide-react'; import { memo } from 'react'; import { useTranslation } from 'react-i18next'; +import { + isMetadataValueTypeWithEnum, + metadataValueTypeOptions, +} from './hooks/use-manage-modal'; import { useManageValues } from './hooks/use-manage-values-modal'; import { IManageValuesProps } from './interface'; @@ -62,8 +66,8 @@ export const ManageValuesModal = (props: IManageValuesProps) => { visible, isAddValue, isShowDescription, - isShowValueSwitch, isVerticalShowValue, + isShowType, } = props; const { metaData, @@ -80,6 +84,7 @@ export const ManageValuesModal = (props: IManageValuesProps) => { handleHideModal, } = useManageValues(props); const { t } = useTranslation(); + const canShowValues = isMetadataValueTypeWithEnum(metaData.valueType); return ( {
    )} + {isShowType && ( +
    +
    Type
    + handleChange('valueType', value)} + /> +
    + )} {isShowDescription && (
    {
    )} - {isShowValueSwitch && ( -
    - - {t('knowledgeDetails.metadata.restrictDefinedValues')} - -
    - - handleChange('restrictDefinedValues', checked) - } - /> -
    -
    - )} - {((metaData.restrictDefinedValues && isShowValueSwitch) || - !isShowValueSwitch) && ( + {canShowValues && (
    {t('knowledgeDetails.metadata.values')}
    diff --git a/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx b/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx index 39fef6c45d2..943c381cf2f 100644 --- a/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx +++ b/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx @@ -39,7 +39,10 @@ import { useManageMetadata, util, } from '../../components/metedata/hooks/use-manage-modal'; -import { IMetaDataReturnJSONSettings } from '../../components/metedata/interface'; +import { + IBuiltInMetadataItem, + IMetaDataReturnJSONSettings, +} from '../../components/metedata/interface'; import { ManageMetadataModal } from '../../components/metedata/manage-modal'; import { useHandleKbEmbedding, @@ -384,12 +387,14 @@ export function AutoMetadata({ const handleClickOpenMetadata = useCallback(() => { const metadata = form.getValues('parser_config.metadata'); + const builtInMetadata = form.getValues('parser_config.built_in_metadata'); const tableMetaData = util.metaDataSettingJSONToMetaDataTableData(metadata); showManageMetadataModal({ metadata: tableMetaData, isCanAdd: true, type: type, record: otherData, + builtInMetadata, }); }, [form, otherData, showManageMetadataModal, type]); @@ -429,8 +434,15 @@ export function AutoMetadata({ ), }; - const handleSaveMetadata = (data?: IMetaDataReturnJSONSettings) => { - form.setValue('parser_config.metadata', data || []); + const handleSaveMetadata = (data?: { + metadata?: IMetaDataReturnJSONSettings; + builtInMetadata?: IBuiltInMetadataItem[]; + }) => { + form.setValue('parser_config.metadata', data?.metadata || []); + form.setValue( + 'parser_config.built_in_metadata', + data?.builtInMetadata || [], + ); form.setValue('parser_config.enable_metadata', true); }; return ( @@ -461,7 +473,11 @@ export function AutoMetadata({ isShowDescription={true} isShowValueSwitch={true} isVerticalShowValue={false} - success={(data?: IMetaDataReturnJSONSettings) => { + builtInMetadata={metadataConfig.builtInMetadata} + success={(data?: { + metadata?: IMetaDataReturnJSONSettings; + builtInMetadata?: IBuiltInMetadataItem[]; + }) => { handleSaveMetadata(data); }} /> diff --git a/web/src/pages/dataset/dataset-setting/form-schema.ts b/web/src/pages/dataset/dataset-setting/form-schema.ts index 196fefe7624..1884ff42552 100644 --- a/web/src/pages/dataset/dataset-setting/form-schema.ts +++ b/web/src/pages/dataset/dataset-setting/form-schema.ts @@ -84,15 +84,13 @@ export const formSchema = z path: ['entity_types'], }, ), - metadata: z + metadata: z.any().optional(), + built_in_metadata: z .array( - z - .object({ - key: z.string().optional(), - description: z.string().optional(), - enum: z.array(z.string().optional()).optional(), - }) - .optional(), + z.object({ + key: z.string().optional(), + type: z.string().optional(), + }), ) .optional(), enable_metadata: z.boolean().optional(), diff --git a/web/src/pages/dataset/dataset-setting/index.tsx b/web/src/pages/dataset/dataset-setting/index.tsx index b3d9f87a297..b4a85905387 100644 --- a/web/src/pages/dataset/dataset-setting/index.tsx +++ b/web/src/pages/dataset/dataset-setting/index.tsx @@ -95,7 +95,12 @@ export default function DatasetSettings() { entity_types: initialEntityTypes, method: MethodValue.Light, }, - metadata: [], + metadata: { + type: 'object', + properties: {}, + additionalProperties: false, + }, + built_in_metadata: [], enable_metadata: false, llm_id: '', }, From bd9163904a88dd54d5ef56651d1b2413dfb9b3f5 Mon Sep 17 00:00:00 2001 From: He Wang Date: Fri, 16 Jan 2026 20:46:37 +0800 Subject: [PATCH 133/335] fix(ob_conn): ignore duplicate errors when executing 'create_idx' (#12661) ### What problem does this PR solve? Skip duplicate errors to avoid 'create_idx' failures caused by slow metadata refresh or external modifications. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/utils/ob_conn.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rag/utils/ob_conn.py b/rag/utils/ob_conn.py index 6f6457cda9b..78a77e9c99a 100644 --- a/rag/utils/ob_conn.py +++ b/rag/utils/ob_conn.py @@ -329,6 +329,14 @@ def _try_with_lock(lock_name: str, process_func, check_func, timeout: int = None try: process_func() return + except Exception as e: + if "Duplicate" in str(e): + # In some cases, the schema may change after the lock is acquired, so if the error message + # indicates that the column or index is duplicated, it should be assumed that 'process_func' + # has been executed correctly. + logger.warning(f"Skip processing {lock_name} due to duplication: {str(e)}") + return + raise finally: lock.release() From 46305ef35eeac4e7d5c8964600517a774f2e23f4 Mon Sep 17 00:00:00 2001 From: Hetavi Shah Date: Sat, 17 Jan 2026 12:51:00 +0530 Subject: [PATCH 134/335] Add User API Token Management to Admin API and CLI (#12595) ## Summary This PR extends the RAGFlow Admin API and CLI with comprehensive user API token management capabilities. Administrators can now generate, list, and delete API tokens for users through both the REST API and the Admin CLI interface. ## Changes ### Backend API (`admin/server/`) #### New Endpoints - **POST `/api/v1/admin/users//new_token`** - Generate a new API token for a user - **GET `/api/v1/admin/users//token_list`** - List all API tokens for a user - **DELETE `/api/v1/admin/users//token/`** - Delete a specific API token for a user #### Service Layer Updates (`services.py`) - Added `get_user_api_key(username)` - Retrieves all API tokens for a user - Added `save_api_token(api_token)` - Saves a new API token to the database - Added `delete_api_token(username, token)` - Deletes an API token for a user ### Admin CLI (`admin/client/`) #### New Commands - **`GENERATE TOKEN FOR USER ;`** - Generate a new API token for the specified user - **`LIST TOKENS OF ;`** - List all API tokens associated with a user - **`DROP TOKEN OF ;`** - Delete a specific API token for a user ### Testing Added comprehensive test suite in `test/testcases/test_admin_api/`: - **`test_generate_user_api_key.py`** - Tests for API token generation - **`test_get_user_api_key.py`** - Tests for listing user API tokens - **`test_delete_user_api_key.py`** - Tests for deleting API tokens - **`conftest.py`** - Shared test fixtures and utilities ## Technical Details ### Token Generation - Tokens are generated using `generate_confirmation_token()` utility - Each token includes metadata: `tenant_id`, `token`, `beta`, `create_time`, `create_date` - Tokens are associated with user tenants automatically ### Security Considerations - All endpoints require admin authentication (`@check_admin_auth`) - Tokens are URL-encoded when passed in DELETE requests to handle special characters - Proper error handling for unauthorized access and missing resources ### API Response Format All endpoints follow the standard RAGFlow response format: ```json { "code": 0, "data": {...}, "message": "Success message" } ``` ## Files Changed - `admin/client/admin_client.py` - CLI token management commands - `admin/server/routes.py` - New API endpoints - `admin/server/services.py` - Token management service methods - `docs/guides/admin/admin_cli.md` - CLI documentation updates - `test/testcases/test_admin_api/conftest.py` - Test fixtures - `test/testcases/test_admin_api/test_user_api_key_management/*` - Test suites ### Type of change - [x] New Feature (non-breaking change which adds functionality) --------- Co-authored-by: Alexander Strasser Co-authored-by: Hetavi Shah --- admin/client/admin_client.py | 80 +++++- admin/server/routes.py | 200 ++++++++++----- admin/server/services.py | 178 +++++++++----- docs/guides/admin/admin_cli.md | 95 +++++-- test/testcases/test_admin_api/conftest.py | 120 +++++++++ .../test_delete_user_api_key.py | 191 ++++++++++++++ .../test_generate_user_api_key.py | 232 ++++++++++++++++++ .../test_get_user_api_key.py | 169 +++++++++++++ 8 files changed, 1124 insertions(+), 141 deletions(-) create mode 100644 test/testcases/test_admin_api/conftest.py create mode 100644 test/testcases/test_admin_api/test_user_api_key_management/test_delete_user_api_key.py create mode 100644 test/testcases/test_admin_api/test_user_api_key_management/test_generate_user_api_key.py create mode 100644 test/testcases/test_admin_api/test_user_api_key_management/test_get_user_api_key.py diff --git a/admin/client/admin_client.py b/admin/client/admin_client.py index 174cd5857a0..79284a53f35 100644 --- a/admin/client/admin_client.py +++ b/admin/client/admin_client.py @@ -17,6 +17,7 @@ import argparse import base64 import getpass +import urllib.parse from cmd import Cmd from typing import Any, Dict, List @@ -60,6 +61,9 @@ | list_variables | list_configs | list_environments + | generate_key + | list_keys + | drop_key // meta command definition meta_command: "\\" meta_command_name [meta_args] @@ -107,6 +111,9 @@ VARS: "VARS"i CONFIGS: "CONFIGS"i ENVS: "ENVS"i +KEY: "KEY"i +KEYS: "KEYS"i +GENERATE: "GENERATE"i list_services: LIST SERVICES ";" show_service: SHOW SERVICE NUMBER ";" @@ -144,6 +151,10 @@ list_configs: LIST CONFIGS ";" list_environments: LIST ENVS ";" +generate_key: GENERATE KEY FOR USER quoted_string ";" +list_keys: LIST KEYS OF quoted_string ";" +drop_key: DROP KEY quoted_string OF quoted_string ";" + show_version: SHOW VERSION ";" action_list: identifier ("," identifier)* @@ -296,6 +307,19 @@ def list_configs(self, items): def list_environments(self, items): return {"type": "list_environments"} + def generate_key(self, items): + user_name = items[4] + return {"type": "generate_key", "user_name": user_name} + + def list_keys(self, items): + user_name = items[3] + return {"type": "list_keys", "user_name": user_name} + + def drop_key(self, items): + key = items[2] + user_name = items[4] + return {"type": "drop_key", "key": key, "user_name": user_name} + def action_list(self, items): return items @@ -362,6 +386,9 @@ def show_help(): SHOW VERSION GRANT ADMIN REVOKE ADMIN +GENERATE KEY FOR USER +LIST KEYS OF +DROP KEY OF Meta Commands: \\?, \\h, \\help Show this help @@ -664,6 +691,12 @@ def execute_command(self, parsed_command: Dict[str, Any]): self._list_configs(command_dict) case "list_environments": self._list_environments(command_dict) + case "generate_key": + self._generate_key(command_dict) + case "list_keys": + self._list_keys(command_dict) + case "drop_key": + self._drop_key(command_dict) case "meta": self._handle_meta_command(command_dict) case _: @@ -796,7 +829,6 @@ def _handle_activate_user(self, command): else: print(f"Unknown activate status: {activate_status}.") - def _grant_admin(self, command): user_name_tree: Tree = command["user_name"] user_name: str = user_name_tree.children[0].strip("'\"") @@ -1044,6 +1076,46 @@ def _show_version(self, command): else: print(f"Fail to show version, code: {res_json['code']}, message: {res_json['message']}") + def _generate_key(self, command: dict[str, Any]) -> None: + username_tree: Tree = command["user_name"] + user_name: str = username_tree.children[0].strip("'\"") + print(f"Generating API key for user: {user_name}") + url: str = f"http://{self.host}:{self.port}/api/v1/admin/users/{user_name}/new_token" + response: requests.Response = self.session.post(url) + res_json: dict[str, Any] = response.json() + if response.status_code == 200: + self._print_table_simple(res_json["data"]) + else: + print(f"Failed to generate key for user {user_name}, code: {res_json['code']}, message: {res_json['message']}") + + def _list_keys(self, command: dict[str, Any]) -> None: + username_tree: Tree = command["user_name"] + user_name: str = username_tree.children[0].strip("'\"") + print(f"Listing API keys for user: {user_name}") + url: str = f"http://{self.host}:{self.port}/api/v1/admin/users/{user_name}/token_list" + response: requests.Response = self.session.get(url) + res_json: dict[str, Any] = response.json() + if response.status_code == 200: + self._print_table_simple(res_json["data"]) + else: + print(f"Failed to list keys for user {user_name}, code: {res_json['code']}, message: {res_json['message']}") + + def _drop_key(self, command: dict[str, Any]) -> None: + key_tree: Tree = command["key"] + key: str = key_tree.children[0].strip("'\"") + username_tree: Tree = command["user_name"] + user_name: str = username_tree.children[0].strip("'\"") + print(f"Dropping API key for user: {user_name}") + # URL encode the key to handle special characters + encoded_key: str = urllib.parse.quote(key, safe="") + url: str = f"http://{self.host}:{self.port}/api/v1/admin/users/{user_name}/token/{encoded_key}" + response: requests.Response = self.session.delete(url) + res_json: dict[str, Any] = response.json() + if response.status_code == 200: + print(res_json["message"]) + else: + print(f"Failed to drop key for user {user_name}, code: {res_json['code']}, message: {res_json['message']}") + def _handle_meta_command(self, command): meta_command = command["command"] args = command.get("args", []) @@ -1077,11 +1149,11 @@ def main(): else: if cli.verify_admin(args, single_command=False): print(r""" - ____ ___ ______________ ___ __ _ - / __ \/ | / ____/ ____/ /___ _ __ / | ____/ /___ ___ (_)___ + ____ ___ ______________ ___ __ _ + / __ \/ | / ____/ ____/ /___ _ __ / | ____/ /___ ___ (_)___ / /_/ / /| |/ / __/ /_ / / __ \ | /| / / / /| |/ __ / __ `__ \/ / __ \ / _, _/ ___ / /_/ / __/ / / /_/ / |/ |/ / / ___ / /_/ / / / / / / / / / / - /_/ |_/_/ |_\____/_/ /_/\____/|__/|__/ /_/ |_\__,_/_/ /_/ /_/_/_/ /_/ + /_/ |_/_/ |_\____/_/ /_/\____/|__/|__/ /_/ |_\__,_/_/ /_/ /_/_/_/ /_/ """) cli.cmdloop() diff --git a/admin/server/routes.py b/admin/server/routes.py index ec63dbfe193..d7d3e53f80a 100644 --- a/admin/server/routes.py +++ b/admin/server/routes.py @@ -15,8 +15,11 @@ # import secrets +from typing import Any -from flask import Blueprint, request +from common.time_utils import current_timestamp, datetime_format +from datetime import datetime +from flask import Blueprint, Response, request from flask_login import current_user, login_required, logout_user from auth import login_verify, login_admin, check_admin_auth @@ -25,19 +28,20 @@ from roles import RoleMgr from api.common.exceptions import AdminException from common.versions import get_ragflow_version +from api.utils.api_utils import generate_confirmation_token -admin_bp = Blueprint('admin', __name__, url_prefix='/api/v1/admin') +admin_bp = Blueprint("admin", __name__, url_prefix="/api/v1/admin") -@admin_bp.route('/ping', methods=['GET']) +@admin_bp.route("/ping", methods=["GET"]) def ping(): - return success_response('PONG') + return success_response("PONG") -@admin_bp.route('/login', methods=['POST']) +@admin_bp.route("/login", methods=["POST"]) def login(): if not request.json: - return error_response('Authorize admin failed.' ,400) + return error_response("Authorize admin failed.", 400) try: email = request.json.get("email", "") password = request.json.get("password", "") @@ -46,7 +50,7 @@ def login(): return error_response(str(e), 500) -@admin_bp.route('/logout', methods=['GET']) +@admin_bp.route("/logout", methods=["GET"]) @login_required def logout(): try: @@ -58,7 +62,7 @@ def logout(): return error_response(str(e), 500) -@admin_bp.route('/auth', methods=['GET']) +@admin_bp.route("/auth", methods=["GET"]) @login_verify def auth_admin(): try: @@ -67,7 +71,7 @@ def auth_admin(): return error_response(str(e), 500) -@admin_bp.route('/users', methods=['GET']) +@admin_bp.route("/users", methods=["GET"]) @login_required @check_admin_auth def list_users(): @@ -78,18 +82,18 @@ def list_users(): return error_response(str(e), 500) -@admin_bp.route('/users', methods=['POST']) +@admin_bp.route("/users", methods=["POST"]) @login_required @check_admin_auth def create_user(): try: data = request.get_json() - if not data or 'username' not in data or 'password' not in data: + if not data or "username" not in data or "password" not in data: return error_response("Username and password are required", 400) - username = data['username'] - password = data['password'] - role = data.get('role', 'user') + username = data["username"] + password = data["password"] + role = data.get("role", "user") res = UserMgr.create_user(username, password, role) if res["success"]: @@ -105,7 +109,7 @@ def create_user(): return error_response(str(e)) -@admin_bp.route('/users/', methods=['DELETE']) +@admin_bp.route("/users/", methods=["DELETE"]) @login_required @check_admin_auth def delete_user(username): @@ -122,16 +126,16 @@ def delete_user(username): return error_response(str(e), 500) -@admin_bp.route('/users//password', methods=['PUT']) +@admin_bp.route("/users//password", methods=["PUT"]) @login_required @check_admin_auth def change_password(username): try: data = request.get_json() - if not data or 'new_password' not in data: + if not data or "new_password" not in data: return error_response("New password is required", 400) - new_password = data['new_password'] + new_password = data["new_password"] msg = UserMgr.update_user_password(username, new_password) return success_response(None, msg) @@ -141,15 +145,15 @@ def change_password(username): return error_response(str(e), 500) -@admin_bp.route('/users//activate', methods=['PUT']) +@admin_bp.route("/users//activate", methods=["PUT"]) @login_required @check_admin_auth def alter_user_activate_status(username): try: data = request.get_json() - if not data or 'activate_status' not in data: + if not data or "activate_status" not in data: return error_response("Activation status is required", 400) - activate_status = data['activate_status'] + activate_status = data["activate_status"] msg = UserMgr.update_user_activate_status(username, activate_status) return success_response(None, msg) except AdminException as e: @@ -158,7 +162,7 @@ def alter_user_activate_status(username): return error_response(str(e), 500) -@admin_bp.route('/users//admin', methods=['PUT']) +@admin_bp.route("/users//admin", methods=["PUT"]) @login_required @check_admin_auth def grant_admin(username): @@ -173,7 +177,8 @@ def grant_admin(username): except Exception as e: return error_response(str(e), 500) -@admin_bp.route('/users//admin', methods=['DELETE']) + +@admin_bp.route("/users//admin", methods=["DELETE"]) @login_required @check_admin_auth def revoke_admin(username): @@ -188,7 +193,8 @@ def revoke_admin(username): except Exception as e: return error_response(str(e), 500) -@admin_bp.route('/users/', methods=['GET']) + +@admin_bp.route("/users/", methods=["GET"]) @login_required @check_admin_auth def get_user_details(username): @@ -202,7 +208,7 @@ def get_user_details(username): return error_response(str(e), 500) -@admin_bp.route('/users//datasets', methods=['GET']) +@admin_bp.route("/users//datasets", methods=["GET"]) @login_required @check_admin_auth def get_user_datasets(username): @@ -216,7 +222,7 @@ def get_user_datasets(username): return error_response(str(e), 500) -@admin_bp.route('/users//agents', methods=['GET']) +@admin_bp.route("/users//agents", methods=["GET"]) @login_required @check_admin_auth def get_user_agents(username): @@ -230,7 +236,7 @@ def get_user_agents(username): return error_response(str(e), 500) -@admin_bp.route('/services', methods=['GET']) +@admin_bp.route("/services", methods=["GET"]) @login_required @check_admin_auth def get_services(): @@ -241,7 +247,7 @@ def get_services(): return error_response(str(e), 500) -@admin_bp.route('/service_types/', methods=['GET']) +@admin_bp.route("/service_types/", methods=["GET"]) @login_required @check_admin_auth def get_services_by_type(service_type_str): @@ -252,7 +258,7 @@ def get_services_by_type(service_type_str): return error_response(str(e), 500) -@admin_bp.route('/services/', methods=['GET']) +@admin_bp.route("/services/", methods=["GET"]) @login_required @check_admin_auth def get_service(service_id): @@ -263,7 +269,7 @@ def get_service(service_id): return error_response(str(e), 500) -@admin_bp.route('/services/', methods=['DELETE']) +@admin_bp.route("/services/", methods=["DELETE"]) @login_required @check_admin_auth def shutdown_service(service_id): @@ -274,7 +280,7 @@ def shutdown_service(service_id): return error_response(str(e), 500) -@admin_bp.route('/services/', methods=['PUT']) +@admin_bp.route("/services/", methods=["PUT"]) @login_required @check_admin_auth def restart_service(service_id): @@ -285,38 +291,38 @@ def restart_service(service_id): return error_response(str(e), 500) -@admin_bp.route('/roles', methods=['POST']) +@admin_bp.route("/roles", methods=["POST"]) @login_required @check_admin_auth def create_role(): try: data = request.get_json() - if not data or 'role_name' not in data: + if not data or "role_name" not in data: return error_response("Role name is required", 400) - role_name: str = data['role_name'] - description: str = data['description'] + role_name: str = data["role_name"] + description: str = data["description"] res = RoleMgr.create_role(role_name, description) return success_response(res) except Exception as e: return error_response(str(e), 500) -@admin_bp.route('/roles/', methods=['PUT']) +@admin_bp.route("/roles/", methods=["PUT"]) @login_required @check_admin_auth def update_role(role_name: str): try: data = request.get_json() - if not data or 'description' not in data: + if not data or "description" not in data: return error_response("Role description is required", 400) - description: str = data['description'] + description: str = data["description"] res = RoleMgr.update_role_description(role_name, description) return success_response(res) except Exception as e: return error_response(str(e), 500) -@admin_bp.route('/roles/', methods=['DELETE']) +@admin_bp.route("/roles/", methods=["DELETE"]) @login_required @check_admin_auth def delete_role(role_name: str): @@ -327,7 +333,7 @@ def delete_role(role_name: str): return error_response(str(e), 500) -@admin_bp.route('/roles', methods=['GET']) +@admin_bp.route("/roles", methods=["GET"]) @login_required @check_admin_auth def list_roles(): @@ -338,7 +344,7 @@ def list_roles(): return error_response(str(e), 500) -@admin_bp.route('/roles//permission', methods=['GET']) +@admin_bp.route("/roles//permission", methods=["GET"]) @login_required @check_admin_auth def get_role_permission(role_name: str): @@ -349,54 +355,54 @@ def get_role_permission(role_name: str): return error_response(str(e), 500) -@admin_bp.route('/roles//permission', methods=['POST']) +@admin_bp.route("/roles//permission", methods=["POST"]) @login_required @check_admin_auth def grant_role_permission(role_name: str): try: data = request.get_json() - if not data or 'actions' not in data or 'resource' not in data: + if not data or "actions" not in data or "resource" not in data: return error_response("Permission is required", 400) - actions: list = data['actions'] - resource: str = data['resource'] + actions: list = data["actions"] + resource: str = data["resource"] res = RoleMgr.grant_role_permission(role_name, actions, resource) return success_response(res) except Exception as e: return error_response(str(e), 500) -@admin_bp.route('/roles//permission', methods=['DELETE']) +@admin_bp.route("/roles//permission", methods=["DELETE"]) @login_required @check_admin_auth def revoke_role_permission(role_name: str): try: data = request.get_json() - if not data or 'actions' not in data or 'resource' not in data: + if not data or "actions" not in data or "resource" not in data: return error_response("Permission is required", 400) - actions: list = data['actions'] - resource: str = data['resource'] + actions: list = data["actions"] + resource: str = data["resource"] res = RoleMgr.revoke_role_permission(role_name, actions, resource) return success_response(res) except Exception as e: return error_response(str(e), 500) -@admin_bp.route('/users//role', methods=['PUT']) +@admin_bp.route("/users//role", methods=["PUT"]) @login_required @check_admin_auth def update_user_role(user_name: str): try: data = request.get_json() - if not data or 'role_name' not in data: + if not data or "role_name" not in data: return error_response("Role name is required", 400) - role_name: str = data['role_name'] + role_name: str = data["role_name"] res = RoleMgr.update_user_role(user_name, role_name) return success_response(res) except Exception as e: return error_response(str(e), 500) -@admin_bp.route('/users//permission', methods=['GET']) +@admin_bp.route("/users//permission", methods=["GET"]) @login_required @check_admin_auth def get_user_permission(user_name: str): @@ -406,19 +412,20 @@ def get_user_permission(user_name: str): except Exception as e: return error_response(str(e), 500) -@admin_bp.route('/variables', methods=['PUT']) + +@admin_bp.route("/variables", methods=["PUT"]) @login_required @check_admin_auth def set_variable(): try: data = request.get_json() - if not data and 'var_name' not in data: + if not data and "var_name" not in data: return error_response("Var name is required", 400) - if 'var_value' not in data: + if "var_value" not in data: return error_response("Var value is required", 400) - var_name: str = data['var_name'] - var_value: str = data['var_value'] + var_name: str = data["var_name"] + var_value: str = data["var_value"] SettingsMgr.update_by_name(var_name, var_value) return success_response(None, "Set variable successfully") @@ -427,7 +434,8 @@ def set_variable(): except Exception as e: return error_response(str(e), 500) -@admin_bp.route('/variables', methods=['GET']) + +@admin_bp.route("/variables", methods=["GET"]) @login_required @check_admin_auth def get_variable(): @@ -439,9 +447,9 @@ def get_variable(): # get var data = request.get_json() - if not data and 'var_name' not in data: + if not data and "var_name" not in data: return error_response("Var name is required", 400) - var_name: str = data['var_name'] + var_name: str = data["var_name"] res = SettingsMgr.get_by_name(var_name) return success_response(res) except AdminException as e: @@ -449,7 +457,8 @@ def get_variable(): except Exception as e: return error_response(str(e), 500) -@admin_bp.route('/configs', methods=['GET']) + +@admin_bp.route("/configs", methods=["GET"]) @login_required @check_admin_auth def get_config(): @@ -461,7 +470,8 @@ def get_config(): except Exception as e: return error_response(str(e), 500) -@admin_bp.route('/environments', methods=['GET']) + +@admin_bp.route("/environments", methods=["GET"]) @login_required @check_admin_auth def get_environments(): @@ -473,7 +483,69 @@ def get_environments(): except Exception as e: return error_response(str(e), 500) -@admin_bp.route('/version', methods=['GET']) + +@admin_bp.route("/users//new_token", methods=["POST"]) +@login_required +@check_admin_auth +def generate_user_api_key(username: str) -> tuple[Response, int]: + try: + user_details: list[dict[str, Any]] = UserMgr.get_user_details(username) + if not user_details: + return error_response("User not found!", 404) + tenants: list[dict[str, Any]] = UserServiceMgr.get_user_tenants(username) + if not tenants: + return error_response("Tenant not found!", 404) + tenant_id: str = tenants[0]["tenant_id"] + token: str = generate_confirmation_token() + obj: dict[str, Any] = { + "tenant_id": tenant_id, + "token": token, + "beta": generate_confirmation_token().replace("ragflow-", "")[:32], + "create_time": current_timestamp(), + "create_date": datetime_format(datetime.now()), + "update_time": None, + "update_date": None, + } + + if not UserMgr.save_api_token(obj): + return error_response("Failed to generate API key!", 500) + return success_response(obj, "API key generated successfully") + except AdminException as e: + return error_response(e.message, e.code) + except Exception as e: + return error_response(str(e), 500) + + +@admin_bp.route("/users//token_list", methods=["GET"]) +@login_required +@check_admin_auth +def get_user_api_keys(username: str) -> tuple[Response, int]: + try: + api_keys: list[dict[str, Any]] = UserMgr.get_user_api_key(username) + return success_response(api_keys, "Get user API keys") + except AdminException as e: + return error_response(e.message, e.code) + except Exception as e: + return error_response(str(e), 500) + + +@admin_bp.route("/users//token/", methods=["DELETE"]) +@login_required +@check_admin_auth +def delete_user_api_key(username: str, token: str) -> tuple[Response, int]: + try: + deleted = UserMgr.delete_api_token(username, token) + if deleted: + return success_response(None, "API key deleted successfully") + else: + return error_response("API key not found or could not be deleted", 404) + except AdminException as e: + return error_response(e.message, e.code) + except Exception as e: + return error_response(str(e), 500) + + +@admin_bp.route("/version", methods=["GET"]) @login_required @check_admin_auth def show_version(): diff --git a/admin/server/services.py b/admin/server/services.py index a3e29a51c47..8b4e2347617 100644 --- a/admin/server/services.py +++ b/admin/server/services.py @@ -17,14 +17,18 @@ import os import logging import re +from typing import Any + from werkzeug.security import check_password_hash from common.constants import ActiveEnum from api.db.services import UserService from api.db.joint_services.user_account_service import create_new_user, delete_user_data from api.db.services.canvas_service import UserCanvasService -from api.db.services.user_service import TenantService +from api.db.services.user_service import TenantService, UserTenantService from api.db.services.knowledgebase_service import KnowledgebaseService from api.db.services.system_settings_service import SystemSettingsService +from api.db.services.api_service import APITokenService +from api.db.db_models import APIToken from api.utils.crypt import decrypt from api.utils import health_utils @@ -38,13 +42,15 @@ def get_all_users(): users = UserService.get_all_users() result = [] for user in users: - result.append({ - 'email': user.email, - 'nickname': user.nickname, - 'create_date': user.create_date, - 'is_active': user.is_active, - 'is_superuser': user.is_superuser, - }) + result.append( + { + "email": user.email, + "nickname": user.nickname, + "create_date": user.create_date, + "is_active": user.is_active, + "is_superuser": user.is_superuser, + } + ) return result @staticmethod @@ -53,19 +59,21 @@ def get_user_details(username): users = UserService.query_user_by_email(username) result = [] for user in users: - result.append({ - 'avatar': user.avatar, - 'email': user.email, - 'language': user.language, - 'last_login_time': user.last_login_time, - 'is_active': user.is_active, - 'is_anonymous': user.is_anonymous, - 'login_channel': user.login_channel, - 'status': user.status, - 'is_superuser': user.is_superuser, - 'create_date': user.create_date, - 'update_date': user.update_date - }) + result.append( + { + "avatar": user.avatar, + "email": user.email, + "language": user.language, + "last_login_time": user.last_login_time, + "is_active": user.is_active, + "is_anonymous": user.is_anonymous, + "login_channel": user.login_channel, + "status": user.status, + "is_superuser": user.is_superuser, + "create_date": user.create_date, + "update_date": user.update_date, + } + ) return result @staticmethod @@ -127,8 +135,8 @@ def update_user_activate_status(username, activate_status: str): # format activate_status before handle _activate_status = activate_status.lower() target_status = { - 'on': ActiveEnum.ACTIVE.value, - 'off': ActiveEnum.INACTIVE.value, + "on": ActiveEnum.ACTIVE.value, + "off": ActiveEnum.INACTIVE.value, }.get(_activate_status) if not target_status: raise AdminException(f"Invalid activate_status: {activate_status}") @@ -138,6 +146,49 @@ def update_user_activate_status(username, activate_status: str): UserService.update_user(usr.id, {"is_active": target_status}) return f"Turn {_activate_status} user activate status successfully!" + @staticmethod + def get_user_api_key(username: str) -> list[dict[str, Any]]: + # use email to find user. check exist and unique. + user_list: list[Any] = UserService.query_user_by_email(username) + if not user_list: + raise UserNotFoundError(username) + elif len(user_list) > 1: + raise AdminException(f"More than one user with username '{username}' found!") + + usr: Any = user_list[0] + # tenant_id is typically the same as user_id for the owner tenant + tenant_id: str = usr.id + + # Query all API tokens for this tenant + api_tokens: Any = APITokenService.query(tenant_id=tenant_id) + + result: list[dict[str, Any]] = [] + for token_obj in api_tokens: + result.append(token_obj.to_dict()) + + return result + + @staticmethod + def save_api_token(api_token: dict[str, Any]) -> bool: + return APITokenService.save(**api_token) + + @staticmethod + def delete_api_token(username: str, token: str) -> bool: + # use email to find user. check exist and unique. + user_list: list[Any] = UserService.query_user_by_email(username) + if not user_list: + raise UserNotFoundError(username) + elif len(user_list) > 1: + raise AdminException(f"Exist more than 1 user: {username}!") + + usr: Any = user_list[0] + # tenant_id is typically the same as user_id for the owner tenant + tenant_id: str = usr.id + + # Delete the API token + deleted_count: int = APITokenService.filter_delete([APIToken.tenant_id == tenant_id, APIToken.token == token]) + return deleted_count > 0 + @staticmethod def grant_admin(username: str): # use email to find user. check exist and unique. @@ -146,6 +197,7 @@ def grant_admin(username: str): raise UserNotFoundError(username) elif len(user_list) > 1: raise AdminException(f"Exist more than 1 user: {username}!") + # check activate status different from new usr = user_list[0] if usr.is_superuser: @@ -172,7 +224,6 @@ def revoke_admin(username: str): class UserServiceMgr: - @staticmethod def get_user_datasets(username): # use email to find user. @@ -202,39 +253,43 @@ def get_user_agents(username): tenant_ids = [m["tenant_id"] for m in tenants] # filter permitted agents and owned agents res = UserCanvasService.get_all_agents_by_tenant_ids(tenant_ids, usr.id) - return [{ - 'title': r['title'], - 'permission': r['permission'], - 'canvas_category': r['canvas_category'].split('_')[0], - 'avatar': r['avatar'] - } for r in res] + return [{"title": r["title"], "permission": r["permission"], "canvas_category": r["canvas_category"].split("_")[0], "avatar": r["avatar"]} for r in res] + @staticmethod + def get_user_tenants(email: str) -> list[dict[str, Any]]: + users: list[Any] = UserService.query_user_by_email(email) + if not users: + raise UserNotFoundError(email) + user: Any = users[0] + + tenants: list[dict[str, Any]] = UserTenantService.get_tenants_by_user_id(user.id) + return tenants -class ServiceMgr: +class ServiceMgr: @staticmethod def get_all_services(): - doc_engine = os.getenv('DOC_ENGINE', 'elasticsearch') + doc_engine = os.getenv("DOC_ENGINE", "elasticsearch") result = [] configs = SERVICE_CONFIGS.configs for service_id, config in enumerate(configs): config_dict = config.to_dict() - if config_dict['service_type'] == 'retrieval': - if config_dict['extra']['retrieval_type'] != doc_engine: + if config_dict["service_type"] == "retrieval": + if config_dict["extra"]["retrieval_type"] != doc_engine: continue try: service_detail = ServiceMgr.get_service_details(service_id) if "status" in service_detail: - config_dict['status'] = service_detail['status'] + config_dict["status"] = service_detail["status"] else: - config_dict['status'] = 'timeout' + config_dict["status"] = "timeout" except Exception as e: logging.warning(f"Can't get service details, error: {e}") - config_dict['status'] = 'timeout' - if not config_dict['host']: - config_dict['host'] = '-' - if not config_dict['port']: - config_dict['port'] = '-' + config_dict["status"] = "timeout" + if not config_dict["host"]: + config_dict["host"] = "-" + if not config_dict["port"]: + config_dict["port"] = "-" result.append(config_dict) return result @@ -250,11 +305,11 @@ def get_service_details(service_id: int): raise AdminException(f"invalid service_index: {service_idx}") service_config = configs[service_idx] - service_info = {'name': service_config.name, 'detail_func_name': service_config.detail_func_name} + service_info = {"name": service_config.name, "detail_func_name": service_config.detail_func_name} - detail_func = getattr(health_utils, service_info.get('detail_func_name')) + detail_func = getattr(health_utils, service_info.get("detail_func_name")) res = detail_func() - res.update({'service_name': service_info.get('name')}) + res.update({"service_name": service_info.get("name")}) return res @staticmethod @@ -265,19 +320,21 @@ def shutdown_service(service_id: int): def restart_service(service_id: int): raise AdminException("restart_service: not implemented") + class SettingsMgr: @staticmethod def get_all(): - settings = SystemSettingsService.get_all() result = [] for setting in settings: - result.append({ - 'name': setting.name, - 'source': setting.source, - 'data_type': setting.data_type, - 'value': setting.value, - }) + result.append( + { + "name": setting.name, + "source": setting.source, + "data_type": setting.data_type, + "value": setting.value, + } + ) return result @staticmethod @@ -287,12 +344,14 @@ def get_by_name(name: str): raise AdminException(f"Can't get setting: {name}") result = [] for setting in settings: - result.append({ - 'name': setting.name, - 'source': setting.source, - 'data_type': setting.data_type, - 'value': setting.value, - }) + result.append( + { + "name": setting.name, + "source": setting.source, + "data_type": setting.data_type, + "value": setting.value, + } + ) return result @staticmethod @@ -308,8 +367,8 @@ def update_by_name(name: str, value: str): else: raise AdminException(f"No setting: {name}") -class ConfigMgr: +class ConfigMgr: @staticmethod def get_all(): result = [] @@ -319,12 +378,13 @@ def get_all(): result.append(config_dict) return result + class EnvironmentsMgr: @staticmethod def get_all(): result = [] - env_kv = {"env": "DOC_ENGINE", "value": os.getenv('DOC_ENGINE')} + env_kv = {"env": "DOC_ENGINE", "value": os.getenv("DOC_ENGINE")} result.append(env_kv) env_kv = {"env": "DEFAULT_SUPERUSER_EMAIL", "value": os.getenv("DEFAULT_SUPERUSER_EMAIL", "admin@ragflow.io")} diff --git a/docs/guides/admin/admin_cli.md b/docs/guides/admin/admin_cli.md index a8a7f0983d6..fed8a62642b 100644 --- a/docs/guides/admin/admin_cli.md +++ b/docs/guides/admin/admin_cli.md @@ -93,6 +93,21 @@ Commands are case-insensitive and must be terminated with a semicolon(;). - Changes the user to active or inactive. - [Example](#example-alter-user-active) +`GENERATE KEY FOR USER ;` + +- Generates a new API key for the specified user. +- [Example](#example-generate-key) + +`LIST KEYS OF ;` + +- Lists all API keys associated with the specified user. +- [Example](#example-list-keys) + +`DROP KEY OF ;` + +- Deletes a specific API key for the specified user. +- [Example](#example-drop-key) + ### Data and Agent Commands `LIST DATASETS OF ;` @@ -345,6 +360,44 @@ Delete done! Delete user's data at the same time. + + +- Generate API key for user. + +``` +admin> generate key for user "example@ragflow.io"; +Generating API key for user: example@ragflow.io ++----------------------------------+-------------------------------+---------------+----------------------------------+-----------------------------------------------------+-------------+-------------+ +| beta | create_date | create_time | tenant_id | token | update_date | update_time | ++----------------------------------+-------------------------------+---------------+----------------------------------+-----------------------------------------------------+-------------+-------------+ +| Es9OpZ6hrnPGeYA3VU1xKUkj6NCb7cp- | Mon, 12 Jan 2026 15:19:11 GMT | 1768227551361 | 5d5ea8a3efc111f0a79b80fa5b90e659 | ragflow-piwVJHEk09M5UN3LS_Xx9HA7yehs3yNOc9GGsD4jzus | None | None | ++----------------------------------+-------------------------------+---------------+----------------------------------+-----------------------------------------------------+-------------+-------------+ +``` + + + +- List all API keys for user. + +``` +admin> list keys of "example@ragflow.io"; +Listing API keys for user: example@ragflow.io ++----------------------------------+-------------------------------+---------------+-----------+--------+----------------------------------+-----------------------------------------------------+-------------------------------+---------------+ +| beta | create_date | create_time | dialog_id | source | tenant_id | token | update_date | update_time | ++----------------------------------+-------------------------------+---------------+-----------+--------+----------------------------------+-----------------------------------------------------+-------------------------------+---------------+ +| Es9OpZ6hrnPGeYA3VU1xKUkj6NCb7cp- | Mon, 12 Jan 2026 15:19:11 GMT | 1768227551361 | None | None | 5d5ea8a3efc111f0a79b80fa5b90e659 | ragflow-piwVJHEk09M5UN3LS_Xx9HA7yehs3yNOc9GGsD4jzus | Mon, 12 Jan 2026 15:19:11 GMT | 1768227551361 | ++----------------------------------+-------------------------------+---------------+-----------+--------+----------------------------------+-----------------------------------------------------+-------------------------------+---------------+ +``` + + + +- Drop API key for user. + +``` +admin> drop key "ragflow-piwVJHEk09M5UN3LS_Xx9HA7yehs3yNOc9GGsD4jzus" of "example@ragflow.io"; +Dropping API key for user: example@ragflow.io +API key deleted successfully +``` + - List the specified user's dataset. @@ -499,19 +552,34 @@ admin> \help command: \help Commands: - LIST SERVICES - SHOW SERVICE - STARTUP SERVICE - SHUTDOWN SERVICE - RESTART SERVICE - LIST USERS - SHOW USER - DROP USER - CREATE USER - ALTER USER PASSWORD - ALTER USER ACTIVE - LIST DATASETS OF - LIST AGENTS OF +LIST SERVICES +SHOW SERVICE +STARTUP SERVICE +SHUTDOWN SERVICE +RESTART SERVICE +LIST USERS +SHOW USER +DROP USER +CREATE USER +ALTER USER PASSWORD +ALTER USER ACTIVE +LIST DATASETS OF +LIST AGENTS OF +CREATE ROLE +DROP ROLE +ALTER ROLE SET DESCRIPTION +LIST ROLES +SHOW ROLE +GRANT ON TO ROLE +REVOKE ON TO ROLE +ALTER USER SET ROLE +SHOW USER PERMISSION +SHOW VERSION +GRANT ADMIN +REVOKE ADMIN +GENERATE KEY FOR USER +LIST KEYS OF +DROP KEY OF Meta Commands: \?, \h, \help Show this help @@ -525,4 +593,3 @@ admin> \q command: \q Goodbye! ``` - diff --git a/test/testcases/test_admin_api/conftest.py b/test/testcases/test_admin_api/conftest.py new file mode 100644 index 00000000000..45c9875f70e --- /dev/null +++ b/test/testcases/test_admin_api/conftest.py @@ -0,0 +1,120 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import urllib.parse +from typing import Any + +import pytest +import requests +from configs import VERSION + +# Admin API runs on port 9381 +ADMIN_HOST_ADDRESS = os.getenv("ADMIN_HOST_ADDRESS", "http://127.0.0.1:9381") + +UNAUTHORIZED_ERROR_MESSAGE = "\n\n401 unauthorized\n

    unauthorized

    \n

    the server could not verify that you are authorized to access the url requested. you either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.

    \n" + +# password is "admin" +ENCRYPTED_ADMIN_PASSWORD: str = """WBPsJbL/W+1HN+hchm5pgu1YC3yMEb/9MFtsanZrpKEE9kAj4u09EIIVDtIDZhJOdTjz5pp5QW9TwqXBfQ2qzDqVJiwK7HGcNsoPi4wQPCmnLo0fs62QklMlg7l1Q7fjGRgV+KWtvNUce2PFzgrcAGDqRIuA/slSclKUEISEiK4z62rdDgvHT8LyuACuF1lPUY5wV0m/MbmGijRJlgvglAF8BX0BP8rQr8wZeaJdcnAy/keuODCjltMZDL06tYluN7HoiU+qlhBB+ltqG411oO/+vVhBgWsuVVOHd8uMjJEL320GUWUicprDUZvjlLaSSqVyyOiRMHpqAE9eHEecWg==""" + + +def admin_login(session: requests.Session, email: str = "admin@ragflow.io", password: str = "admin") -> str: + """Helper function to login as admin and return authorization token""" + url: str = f"{ADMIN_HOST_ADDRESS}/api/{VERSION}/admin/login" + response: requests.Response = session.post(url, json={"email": email, "password": ENCRYPTED_ADMIN_PASSWORD}) + res_json: dict[str, Any] = response.json() + if res_json.get("code") != 0: + raise Exception(res_json.get("message")) + # Admin login uses session cookies and Authorization header + # Set Authorization header for subsequent requests + auth: str = response.headers.get("Authorization", "") + if auth: + session.headers.update({"Authorization": auth}) + return auth + + +@pytest.fixture(scope="session") +def admin_session() -> requests.Session: + """Fixture to create an admin session with login""" + session: requests.Session = requests.Session() + try: + admin_login(session) + except Exception as e: + pytest.skip(f"Admin login failed: {e}") + return session + + +def generate_user_api_key(session: requests.Session, user_name: str) -> dict[str, Any]: + """Helper function to generate API key for a user + + Returns: + Dict containing the full API response with keys: code, message, data + """ + url: str = f"{ADMIN_HOST_ADDRESS}/api/{VERSION}/admin/users/{user_name}/new_token" + response: requests.Response = session.post(url) + + # Some error responses (e.g., 401) may return HTML instead of JSON. + try: + res_json: dict[str, Any] = response.json() + except requests.exceptions.JSONDecodeError: + return { + "code": response.status_code, + "message": response.text, + "data": None, + } + return res_json + + +def get_user_api_key(session: requests.Session, username: str) -> dict[str, Any]: + """Helper function to get API keys for a user + + Returns: + Dict containing the full API response with keys: code, message, data + """ + url: str = f"{ADMIN_HOST_ADDRESS}/api/{VERSION}/admin/users/{username}/token_list" + response: requests.Response = session.get(url) + + try: + res_json: dict[str, Any] = response.json() + except requests.exceptions.JSONDecodeError: + return { + "code": response.status_code, + "message": response.text, + "data": None, + } + return res_json + + +def delete_user_api_key(session: requests.Session, username: str, token: str) -> dict[str, Any]: + """Helper function to delete an API key for a user + + Returns: + Dict containing the full API response with keys: code, message, data + """ + # URL encode the token to handle special characters + encoded_token: str = urllib.parse.quote(token, safe="") + url: str = f"{ADMIN_HOST_ADDRESS}/api/{VERSION}/admin/users/{username}/token/{encoded_token}" + response: requests.Response = session.delete(url) + + try: + res_json: dict[str, Any] = response.json() + except requests.exceptions.JSONDecodeError: + return { + "code": response.status_code, + "message": response.text, + "data": None, + } + return res_json diff --git a/test/testcases/test_admin_api/test_user_api_key_management/test_delete_user_api_key.py b/test/testcases/test_admin_api/test_user_api_key_management/test_delete_user_api_key.py new file mode 100644 index 00000000000..5e89f57a5c2 --- /dev/null +++ b/test/testcases/test_admin_api/test_user_api_key_management/test_delete_user_api_key.py @@ -0,0 +1,191 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from typing import Any + +import pytest +import requests + +from conftest import delete_user_api_key, generate_user_api_key, get_user_api_key, UNAUTHORIZED_ERROR_MESSAGE +from common.constants import RetCode +from configs import EMAIL, HOST_ADDRESS, PASSWORD, VERSION + + +class TestDeleteUserApiKey: + @pytest.mark.p1 + def test_delete_user_api_key_success(self, admin_session: requests.Session) -> None: + """Test successfully deleting an API key for a user""" + user_name: str = EMAIL + + # Generate an API key first + generate_response: dict[str, Any] = generate_user_api_key(admin_session, user_name) + assert generate_response.get("code") == RetCode.SUCCESS, f"Generate should succeed, got code {generate_response.get('code')}" + generated_key: dict[str, Any] = generate_response["data"] + token: str = generated_key["token"] + + # Delete the API key + delete_response: dict[str, Any] = delete_user_api_key(admin_session, user_name, token) + + # Verify response + assert delete_response.get("code") == RetCode.SUCCESS, f"Delete should succeed, got code {delete_response.get('code')}" + assert "message" in delete_response, "Response should contain message" + message: str = delete_response.get("message", "") + assert message == "API key deleted successfully", f"Message should indicate success, got: {message}" + + @pytest.mark.p1 + def test_user_api_key_removed_from_list_after_deletion(self, admin_session: requests.Session) -> None: + """Test that deleted API key is removed from the list""" + user_name: str = EMAIL + + # Generate an API key + generate_response: dict[str, Any] = generate_user_api_key(admin_session, user_name) + assert generate_response.get("code") == RetCode.SUCCESS, f"Generate should succeed, got code {generate_response.get('code')}" + generated_key: dict[str, Any] = generate_response["data"] + token: str = generated_key["token"] + + # Verify the key exists in the list + get_response_before: dict[str, Any] = get_user_api_key(admin_session, user_name) + assert get_response_before.get("code") == RetCode.SUCCESS, f"Get should succeed, got code {get_response_before.get('code')}" + api_keys_before: list[dict[str, Any]] = get_response_before["data"] + token_found_before: bool = any(key.get("token") == token for key in api_keys_before) + assert token_found_before, "Generated API key should be in the list before deletion" + + # Delete the API key + delete_response: dict[str, Any] = delete_user_api_key(admin_session, user_name, token) + assert delete_response.get("code") == RetCode.SUCCESS, f"Delete should succeed, got code {delete_response.get('code')}" + + # Verify the key is no longer in the list + get_response_after: dict[str, Any] = get_user_api_key(admin_session, user_name) + assert get_response_after.get("code") == RetCode.SUCCESS, f"Get should succeed, got code {get_response_after.get('code')}" + api_keys_after: list[dict[str, Any]] = get_response_after["data"] + token_found_after: bool = any(key.get("token") == token for key in api_keys_after) + assert not token_found_after, "Deleted API key should not be in the list after deletion" + + @pytest.mark.p2 + def test_delete_user_api_key_response_structure(self, admin_session: requests.Session) -> None: + """Test that delete_user_api_key returns correct response structure""" + user_name: str = EMAIL + + # Generate an API key + generate_response: dict[str, Any] = generate_user_api_key(admin_session, user_name) + assert generate_response.get("code") == RetCode.SUCCESS, f"Generate should succeed, got code {generate_response.get('code')}" + token: str = generate_response["data"]["token"] + + # Delete the API key + delete_response: dict[str, Any] = delete_user_api_key(admin_session, user_name, token) + + # Verify response structure + assert delete_response.get("code") == RetCode.SUCCESS, f"Response code should be {RetCode.SUCCESS}, got {delete_response.get('code')}" + assert "message" in delete_response, "Response should contain message" + # Data can be None for delete operations + assert "data" in delete_response, "Response should contain data field" + + @pytest.mark.p2 + def test_delete_user_api_key_twice(self, admin_session: requests.Session) -> None: + """Test that deleting the same token twice behaves correctly""" + user_name: str = EMAIL + + # Generate an API key + generate_response: dict[str, Any] = generate_user_api_key(admin_session, user_name) + assert generate_response.get("code") == RetCode.SUCCESS, f"Generate should succeed, got code {generate_response.get('code')}" + token: str = generate_response["data"]["token"] + + # Delete the API key first time + delete_response1: dict[str, Any] = delete_user_api_key(admin_session, user_name, token) + assert delete_response1.get("code") == RetCode.SUCCESS, f"First delete should succeed, got code {delete_response1.get('code')}" + + # Try to delete the same token again + delete_response2: dict[str, Any] = delete_user_api_key(admin_session, user_name, token) + + # Second delete should fail since token no longer exists + assert delete_response2.get("code") == RetCode.NOT_FOUND, "Second delete should fail for already deleted token" + assert "message" in delete_response2, "Response should contain message" + + @pytest.mark.p2 + def test_delete_user_api_key_with_nonexistent_token(self, admin_session: requests.Session) -> None: + """Test deleting a non-existent API key fails""" + user_name: str = EMAIL + nonexistent_token: str = "ragflow-nonexistent-token-12345" + + # Try to delete a non-existent token + delete_response: dict[str, Any] = delete_user_api_key(admin_session, user_name, nonexistent_token) + + # Should return error + assert delete_response.get("code") == RetCode.NOT_FOUND, "Delete should fail for non-existent token" + assert "message" in delete_response, "Response should contain message" + message: str = delete_response.get("message", "") + assert message == "API key not found or could not be deleted", f"Message should indicate token not found, got: {message}" + + @pytest.mark.p2 + def test_delete_user_api_key_with_nonexistent_user(self, admin_session: requests.Session) -> None: + """Test deleting API key for non-existent user fails""" + nonexistent_user: str = "nonexistent_user_12345@example.com" + token: str = "ragflow-test-token-12345" + + # Try to delete token for non-existent user + delete_response: dict[str, Any] = delete_user_api_key(admin_session, nonexistent_user, token) + + # Should return error + assert delete_response.get("code") == RetCode.NOT_FOUND, "Delete should fail for non-existent user" + assert "message" in delete_response, "Response should contain message" + message: str = delete_response.get("message", "") + expected_message: str = f"User '{nonexistent_user}' not found" + assert message == expected_message, f"Message should indicate user not found, got: {message}" + + @pytest.mark.p2 + def test_delete_user_api_key_wrong_user_token(self, admin_session: requests.Session) -> None: + """Test that deleting a token belonging to another user fails""" + user_name: str = EMAIL + + # create second user + url: str = HOST_ADDRESS + f"/{VERSION}/user/register" + user2_email: str = "qa2@ragflow.io" + register_data: dict[str, str] = {"email": user2_email, "nickname": "qa2", "password": PASSWORD} + res: Any = requests.post(url=url, json=register_data) + res: dict[str, Any] = res.json() + if res.get("code") != 0 and "has already registered" not in res.get("message"): + raise Exception(f"Failed to create second user: {res.get("message")}") + + # Generate a token for the test user + generate_response: dict[str, Any] = generate_user_api_key(admin_session, user_name) + assert generate_response.get("code") == RetCode.SUCCESS, f"Generate should succeed, got code {generate_response.get('code')}" + token: str = generate_response["data"]["token"] + + # Try to delete with the second username + delete_response: dict[str, Any] = delete_user_api_key(admin_session, user2_email, token) + + # Should fail because user doesn't exist or token doesn't belong to that user + assert delete_response.get("code") == RetCode.NOT_FOUND, "Delete should fail for wrong user" + assert "message" in delete_response, "Response should contain message" + message: str = delete_response.get("message", "") + expected_message: str = "API key not found or could not be deleted" + assert message == expected_message, f"Message should indicate user not found, got: {message}" + + @pytest.mark.p3 + def test_delete_user_api_key_without_auth(self) -> None: + """Test that deleting API key without admin auth fails""" + session: requests.Session = requests.Session() + user_name: str = EMAIL + token: str = "ragflow-test-token-12345" + + response: dict[str, Any] = delete_user_api_key(session, user_name, token) + + # Verify error response + assert response.get("code") == RetCode.UNAUTHORIZED, "Response code should indicate error" + assert "message" in response, "Response should contain message" + message: str = response.get("message", "").lower() + # The message is an HTML string indicating unauthorized user. + assert message == UNAUTHORIZED_ERROR_MESSAGE diff --git a/test/testcases/test_admin_api/test_user_api_key_management/test_generate_user_api_key.py b/test/testcases/test_admin_api/test_user_api_key_management/test_generate_user_api_key.py new file mode 100644 index 00000000000..3dc502967c5 --- /dev/null +++ b/test/testcases/test_admin_api/test_user_api_key_management/test_generate_user_api_key.py @@ -0,0 +1,232 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from typing import Any, Dict, List + +import pytest +import requests + +from common.constants import RetCode +from conftest import generate_user_api_key, get_user_api_key, UNAUTHORIZED_ERROR_MESSAGE +from configs import EMAIL + + +class TestGenerateUserApiKey: + @pytest.mark.p1 + def test_generate_user_api_key_success(self, admin_session: requests.Session) -> None: + """Test successfully generating API key for a user""" + # Use the test user email (get_user_details expects email) + user_name: str = EMAIL + + # Generate API key + response: Dict[str, Any] = generate_user_api_key(admin_session, user_name) + + # Verify response code, message, and data + assert response.get("code") == RetCode.SUCCESS, f"Response code should be {RetCode.SUCCESS}, got {response.get('code')}" + assert "message" in response, "Response should contain message" + assert "data" in response, "Response should contain data" + assert response.get("data") is not None, "API key generation should return data" + + result: Dict[str, Any] = response["data"] + + # Verify response structure + assert "tenant_id" in result, "Response should contain tenant_id" + assert "token" in result, "Response should contain token" + assert "beta" in result, "Response should contain beta" + assert "create_time" in result, "Response should contain create_time" + assert "create_date" in result, "Response should contain create_date" + + # Verify token format (should start with "ragflow-") + token: str = result["token"] + assert isinstance(token, str), "Token should be a string" + assert len(token) > 0, "Token should not be empty" + + # Verify beta is independently generated + beta: str = result["beta"] + assert isinstance(beta, str), "Beta should be a string" + assert len(beta) == 32, "Beta should be 32 characters" + # Beta should be independent from token (not derived from it) + if token.startswith("ragflow-"): + token_without_prefix: str = token.replace("ragflow-", "")[:32] + assert beta != token_without_prefix, "Beta should be independently generated, not derived from token" + + @pytest.mark.p1 + def test_generate_user_api_key_appears_in_list(self, admin_session: requests.Session) -> None: + """Test that generated API key appears in get_user_api_key list""" + user_name: str = EMAIL + + # Generate API key + generate_response: Dict[str, Any] = generate_user_api_key(admin_session, user_name) + assert generate_response.get("code") == RetCode.SUCCESS, f"Generate should succeed, got code {generate_response.get('code')}" + generated_key: Dict[str, Any] = generate_response["data"] + token: str = generated_key["token"] + + # Get all API keys for the user + get_response: Dict[str, Any] = get_user_api_key(admin_session, user_name) + assert get_response.get("code") == RetCode.SUCCESS, f"Get should succeed, got code {get_response.get('code')}" + api_keys: List[Dict[str, Any]] = get_response["data"] + + # Verify the generated key is in the list + assert len(api_keys) > 0, "User should have at least one API key" + token_found: bool = any(key.get("token") == token for key in api_keys) + assert token_found, "Generated API key should appear in the list" + + @pytest.mark.p1 + def test_generate_user_api_key_response_structure(self, admin_session: requests.Session) -> None: + """Test that generate_user_api_key returns correct response structure""" + user_name: str = EMAIL + + response: Dict[str, Any] = generate_user_api_key(admin_session, user_name) + + # Verify response code, message, and data + assert response.get("code") == RetCode.SUCCESS, f"Response code should be {RetCode.SUCCESS}, got {response.get('code')}" + assert "message" in response, "Response should contain message" + assert "data" in response, "Response should contain data" + + result: Dict[str, Any] = response["data"] + + # Verify all required fields + assert "tenant_id" in result, "Response should have tenant_id" + assert "token" in result, "Response should have token" + assert "beta" in result, "Response should have beta" + assert "create_time" in result, "Response should have create_time" + assert "create_date" in result, "Response should have create_date" + assert "update_time" in result, "Response should have update_time" + assert "update_date" in result, "Response should have update_date" + + # Verify field types + assert isinstance(result["tenant_id"], str), "tenant_id should be string" + assert isinstance(result["token"], str), "token should be string" + assert isinstance(result["beta"], str), "beta should be string" + assert isinstance(result["create_time"], (int, type(None))), "create_time should be int or None" + assert isinstance(result["create_date"], (str, type(None))), "create_date should be string or None" + + @pytest.mark.p2 + def test_generate_user_api_key_multiple_times(self, admin_session: requests.Session) -> None: + """Test generating multiple API keys for the same user""" + user_name: str = EMAIL + + # Generate first API key + response1: Dict[str, Any] = generate_user_api_key(admin_session, user_name) + assert response1.get("code") == RetCode.SUCCESS, f"First generate should succeed, got code {response1.get('code')}" + key1: Dict[str, Any] = response1["data"] + token1: str = key1["token"] + + # Generate second API key + response2: Dict[str, Any] = generate_user_api_key(admin_session, user_name) + assert response2.get("code") == RetCode.SUCCESS, f"Second generate should succeed, got code {response2.get('code')}" + key2: Dict[str, Any] = response2["data"] + token2: str = key2["token"] + + # Tokens should be different + assert token1 != token2, "Multiple API keys should have different tokens" + + # Both should appear in the list + get_response: Dict[str, Any] = get_user_api_key(admin_session, user_name) + assert get_response.get("code") == RetCode.SUCCESS, f"Get should succeed, got code {get_response.get('code')}" + api_keys: List[Dict[str, Any]] = get_response["data"] + tokens: List[str] = [key.get("token") for key in api_keys] + assert token1 in tokens, "First token should be in the list" + assert token2 in tokens, "Second token should be in the list" + + @pytest.mark.p2 + def test_generate_user_api_key_nonexistent_user(self, admin_session: requests.Session) -> None: + """Test generating API key for non-existent user fails""" + response: Dict[str, Any] = generate_user_api_key(admin_session, "nonexistent_user_12345") + + # Verify error response + assert response.get("code") == RetCode.NOT_FOUND, "Response code should indicate error" + assert "message" in response, "Response should contain message" + message: str = response.get("message", "") + assert message == "User not found!", f"Message should indicate user not found, got: {message}" + + @pytest.mark.p2 + def test_generate_user_api_key_tenant_id_consistency(self, admin_session: requests.Session) -> None: + """Test that generated API keys have consistent tenant_id""" + user_name: str = EMAIL + + # Generate multiple API keys + response1: Dict[str, Any] = generate_user_api_key(admin_session, user_name) + assert response1.get("code") == RetCode.SUCCESS, f"First generate should succeed, got code {response1.get('code')}" + key1: Dict[str, Any] = response1["data"] + + response2: Dict[str, Any] = generate_user_api_key(admin_session, user_name) + assert response2.get("code") == RetCode.SUCCESS, f"Second generate should succeed, got code {response2.get('code')}" + key2: Dict[str, Any] = response2["data"] + + # Tenant IDs should be the same for the same user + assert key1["tenant_id"] == key2["tenant_id"], "Same user should have same tenant_id" + + @pytest.mark.p2 + def test_generate_user_api_key_token_format(self, admin_session: requests.Session) -> None: + """Test that generated API key has correct format""" + user_name: str = EMAIL + + response: Dict[str, Any] = generate_user_api_key(admin_session, user_name) + assert response.get("code") == RetCode.SUCCESS, f"Response code should be {RetCode.SUCCESS}, got {response.get('code')}" + result: Dict[str, Any] = response["data"] + token: str = result["token"] + + # Token should be a non-empty string + assert isinstance(token, str), "Token should be a string" + assert len(token) > 0, "Token should not be empty" + + # Beta should be independently generated (32 chars, not derived from token) + beta: str = result["beta"] + assert isinstance(beta, str), "Beta should be a string" + assert len(beta) == 32, "Beta should be 32 characters" + # Beta should be independent from token (not derived from it) + if token.startswith("ragflow-"): + token_without_prefix: str = token.replace("ragflow-", "")[:32] + assert beta != token_without_prefix, "Beta should be independently generated, not derived from token" + + @pytest.mark.p1 + def test_generate_user_api_key_without_auth(self) -> None: + """Test that generating API key without admin auth fails""" + session: requests.Session = requests.Session() + user_name: str = EMAIL + + response: Dict[str, Any] = generate_user_api_key(session, user_name) + + # Verify error response + assert response.get("code") == RetCode.UNAUTHORIZED, "Response code should indicate error" + assert "message" in response, "Response should contain message" + message: str = response.get("message", "").lower() + # The message is an HTML string indicating unauthorized user . + assert message == UNAUTHORIZED_ERROR_MESSAGE + + @pytest.mark.p3 + def test_generate_user_api_key_timestamp_fields(self, admin_session: requests.Session) -> None: + """Test that generated API key has correct timestamp fields""" + user_name: str = EMAIL + + response: Dict[str, Any] = generate_user_api_key(admin_session, user_name) + assert response.get("code") == RetCode.SUCCESS, f"Response code should be {RetCode.SUCCESS}, got {response.get('code')}" + result: Dict[str, Any] = response["data"] + + # create_time should be a timestamp (int) + create_time: Any = result.get("create_time") + assert create_time is None or isinstance(create_time, int), "create_time should be int or None" + if create_time is not None: + assert create_time > 0, "create_time should be positive" + + # create_date should be a date string + create_date: Any = result.get("create_date") + assert create_date is None or isinstance(create_date, str), "create_date should be string or None" + + # update_time and update_date should be None for new keys + assert result.get("update_time") is None, "update_time should be None for new keys" + assert result.get("update_date") is None, "update_date should be None for new keys" diff --git a/test/testcases/test_admin_api/test_user_api_key_management/test_get_user_api_key.py b/test/testcases/test_admin_api/test_user_api_key_management/test_get_user_api_key.py new file mode 100644 index 00000000000..f2941a5af35 --- /dev/null +++ b/test/testcases/test_admin_api/test_user_api_key_management/test_get_user_api_key.py @@ -0,0 +1,169 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from typing import Any, Dict, List + +import pytest +import requests + +from conftest import generate_user_api_key, get_user_api_key, UNAUTHORIZED_ERROR_MESSAGE +from common.constants import RetCode +from configs import EMAIL + + +class TestGetUserApiKey: + @pytest.mark.p1 + def test_get_user_api_key_success(self, admin_session: requests.Session) -> None: + """Test successfully getting API keys for a user with correct response structure""" + user_name: str = EMAIL + + # Generate a test API key first + generate_response: Dict[str, Any] = generate_user_api_key(admin_session, user_name) + assert generate_response["code"] == RetCode.SUCCESS, generate_response + generated_key: Dict[str, Any] = generate_response["data"] + generated_token: str = generated_key["token"] + + # Get all API keys for the user + get_response: Dict[str, Any] = get_user_api_key(admin_session, user_name) + assert get_response["code"] == RetCode.SUCCESS, get_response + assert "message" in get_response, "Response should contain message" + assert "data" in get_response, "Response should contain data" + + api_keys: List[Dict[str, Any]] = get_response["data"] + + # Verify response is a list with at least one key + assert isinstance(api_keys, list), "API keys should be returned as a list" + assert len(api_keys) > 0, "User should have at least one API key" + + # Verify structure of each API key + for key in api_keys: + assert isinstance(key, dict), "Each API key should be a dictionary" + assert "token" in key, "API key should contain token" + assert "beta" in key, "API key should contain beta" + assert "tenant_id" in key, "API key should contain tenant_id" + assert "create_date" in key, "API key should contain create_date" + + # Verify field types + assert isinstance(key["token"], str), "token should be string" + assert isinstance(key["beta"], str), "beta should be string" + assert isinstance(key["tenant_id"], str), "tenant_id should be string" + assert isinstance(key.get("create_date"), (str, type(None))), "create_date should be string or None" + assert isinstance(key.get("update_date"), (str, type(None))), "update_date should be string or None" + + # Verify the generated key is in the list + token_found: bool = any(key.get("token") == generated_token for key in api_keys) + assert token_found, "Generated API key should appear in the list" + + @pytest.mark.p2 + def test_get_user_api_key_nonexistent_user(self, admin_session: requests.Session) -> None: + """Test getting API keys for non-existent user fails""" + nonexistent_user: str = "nonexistent_user_12345" + response: Dict[str, Any] = get_user_api_key(admin_session, nonexistent_user) + + assert response["code"] == RetCode.NOT_FOUND, response + assert "message" in response, "Response should contain message" + message: str = response["message"] + expected_message: str = f"User '{nonexistent_user}' not found" + assert message == expected_message, f"Message should indicate user not found, got: {message}" + + @pytest.mark.p2 + def test_get_user_api_key_empty_username(self, admin_session: requests.Session) -> None: + """Test getting API keys with empty username""" + response: Dict[str, Any] = get_user_api_key(admin_session, "") + + # Empty username should either return error or empty list + if response["code"] == RetCode.SUCCESS: + assert "data" in response, "Response should contain data" + api_keys: List[Dict[str, Any]] = response["data"] + assert isinstance(api_keys, list), "Should return a list" + assert len(api_keys) == 0, "Empty username should return empty list" + else: + assert "message" in response, "Error response should contain message" + assert len(response["message"]) > 0, "Error message should not be empty" + + @pytest.mark.p2 + def test_get_user_api_key_token_uniqueness(self, admin_session: requests.Session) -> None: + """Test that all API keys in the list have unique tokens""" + user_name: str = EMAIL + + # Generate multiple API keys + response1: Dict[str, Any] = generate_user_api_key(admin_session, user_name) + assert response1["code"] == RetCode.SUCCESS, response1 + response2: Dict[str, Any] = generate_user_api_key(admin_session, user_name) + assert response2["code"] == RetCode.SUCCESS, response2 + + # Get all API keys + get_response: Dict[str, Any] = get_user_api_key(admin_session, user_name) + assert get_response["code"] == RetCode.SUCCESS, get_response + api_keys: List[Dict[str, Any]] = get_response["data"] + + # Verify all tokens are unique + tokens: List[str] = [key.get("token") for key in api_keys if key.get("token")] + assert len(tokens) == len(set(tokens)), "All API keys should have unique tokens" + + @pytest.mark.p2 + def test_get_user_api_key_tenant_id_consistency(self, admin_session: requests.Session) -> None: + """Test that all API keys for a user have the same tenant_id""" + user_name: str = EMAIL + + # Generate multiple API keys + response1: Dict[str, Any] = generate_user_api_key(admin_session, user_name) + assert response1["code"] == RetCode.SUCCESS, response1 + response2: Dict[str, Any] = generate_user_api_key(admin_session, user_name) + assert response2["code"] == RetCode.SUCCESS, response2 + + # Get all API keys + get_response: Dict[str, Any] = get_user_api_key(admin_session, user_name) + assert get_response["code"] == RetCode.SUCCESS, get_response + api_keys: List[Dict[str, Any]] = get_response["data"] + + # Verify all keys have the same tenant_id + tenant_ids: List[str] = [key.get("tenant_id") for key in api_keys if key.get("tenant_id")] + if len(tenant_ids) > 0: + assert all(tid == tenant_ids[0] for tid in tenant_ids), "All API keys should have the same tenant_id" + + @pytest.mark.p2 + def test_get_user_api_key_beta_format(self, admin_session: requests.Session) -> None: + """Test that beta field in API keys has correct format (32 characters)""" + user_name: str = EMAIL + + # Generate a test API key + generate_response: Dict[str, Any] = generate_user_api_key(admin_session, user_name) + assert generate_response["code"] == RetCode.SUCCESS, generate_response + + # Get all API keys + get_response: Dict[str, Any] = get_user_api_key(admin_session, user_name) + assert get_response["code"] == RetCode.SUCCESS, get_response + api_keys: List[Dict[str, Any]] = get_response["data"] + + # Verify beta format for all keys + for key in api_keys: + beta: str = key.get("beta", "") + assert isinstance(beta, str), "beta should be a string" + assert len(beta) == 32, f"beta should be 32 characters, got {len(beta)}" + + @pytest.mark.p3 + def test_get_user_api_key_without_auth(self) -> None: + """Test that getting API keys without admin auth fails""" + session: requests.Session = requests.Session() + user_name: str = EMAIL + + response: Dict[str, Any] = get_user_api_key(session, user_name) + + assert response["code"] == RetCode.UNAUTHORIZED, response + assert "message" in response, "Response should contain message" + message: str = response["message"].lower() + assert message == UNAUTHORIZED_ERROR_MESSAGE From 067ddcbf23f0dbc04306a4f3ab9ff425cab98d9b Mon Sep 17 00:00:00 2001 From: writinwaters <93570324+writinwaters@users.noreply.github.com> Date: Sat, 17 Jan 2026 17:49:19 +0800 Subject: [PATCH 135/335] Docs: Added configure memory (#12665) ### What problem does this PR solve? As title. ### Type of change - [x] Documentation Update --- docs/guides/memory/use_memory.md | 45 +++++++++++++++++++++++++++++++- docs/guides/team/share_memory.md | 7 +++-- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/docs/guides/memory/use_memory.md b/docs/guides/memory/use_memory.md index a1586d51da6..3979ea55896 100644 --- a/docs/guides/memory/use_memory.md +++ b/docs/guides/memory/use_memory.md @@ -23,6 +23,44 @@ When creating a Memory, users can precisely define which types of information to ![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/memory_interface.PNG) +## Configure memory + +On the **Memory** page, click the intended memory **>** **Configuration** to view and update its settings. + +### Name + +The unique name of the memory created. + +### Embedding model + +The embedding model for converting the memory into embeddings. + +### LLM + +The chat model for extracting knowledge from the memory. + +### Memory type + +What is stored in the memory: + +`Raw`: The raw dialogue between the user and the Agent (Required by default). +`Semantic Memory`: General knowledge and facts about the user and world. +`Episodic Memory`: Time-stamped records of specific events and experiences. +`Procedural Memory`: Learned skills, habits, and automated procedures. + +### Memory size + +The default capacity allocated to the memory and the corresponding embeddings in bytes. Defaults to `5242880` (5MB). + +:::tip NOTE +A 1KB message with a 1024-dimension embedding occupies approximately 9KB of memory (1KB + 1024 x 8Bytes = 9KB). With a default limit of 5 MB, the system can store roughly 500 such messages. +::: + +### Permission + +- **Only me**: Exclusive to the user. +- **Team**: Share this memory with the team members. + ## Manage memory @@ -58,7 +96,12 @@ At the same time you have finished **Retrieval** component settings, select the ### Can I share my memory? -Yes, you can. Your memory can be shared between Agents. If you wish to share your memory with your team members, please ensure you have configured its team permissions. See [Share memory](../team/share_memory.md) for details. +Yes, you can. Your memory can be shared between Agents. See these topics: + +- [Create memory](#create-memory) +- [Enhance Agent context](#enhance-agent-context) + +If you wish to share your memory with your team members, please ensure you have configured its team permissions. See [Share memory](../team/share_memory.md) for details. diff --git a/docs/guides/team/share_memory.md b/docs/guides/team/share_memory.md index 2c41db492e3..fa7a1c51b0a 100644 --- a/docs/guides/team/share_memory.md +++ b/docs/guides/team/share_memory.md @@ -13,9 +13,8 @@ Share a memory with your team members. When ready, you may share your memory with your team members so that they can use it. Please note that your memories are not shared automatically; you must manually enable sharing by selecting the corresponding **Permissions** radio button: -1. Click the intended memory to open its editing canvas. +1. Navigate to the **Memory** page, find the intended memory, and click to open its editing canvas. 2. Click **Configurations**. 3. Change **Permissions** from **Only me** to **Team**. -4. Click **Save** to apply your changes. - -*When completed, your team members will see your shared memories.* \ No newline at end of file +4. Click **Save** to apply your changes. + *When completed, your team members will see your shared memories.* \ No newline at end of file From 38f0a92da9ebc5e8e3b18ac2a3fab62c6060bdb6 Mon Sep 17 00:00:00 2001 From: Jin Hai Date: Sat, 17 Jan 2026 17:52:38 +0800 Subject: [PATCH 136/335] Use RAGFlow CLI to replace RAGFlow Admin CLI (#12653) ### What problem does this PR solve? ``` $ python admin/client/ragflow_cli.py -t user -u aaa@aaa.com -p 9380 ragflow> list datasets; ragflow> list default models; ragflow> show version; ``` ### Type of change - [x] New Feature (non-breaking change which adds functionality) --------- Signed-off-by: Jin Hai --- .gitignore | 5 + admin/build_cli_release.sh | 2 +- admin/client/pyproject.toml | 2 +- .../{admin_client.py => ragflow_cli.py} | 437 ++++++++++++++---- api/utils/crypt.py | 2 +- .../admin/{admin_cli.md => ragflow_cli.md} | 58 +-- web/src/pages/agent/hooks/use-add-node.ts | 2 +- 7 files changed, 380 insertions(+), 128 deletions(-) rename admin/client/{admin_client.py => ragflow_cli.py} (76%) rename docs/guides/admin/{admin_cli.md => ragflow_cli.md} (94%) diff --git a/.gitignore b/.gitignore index 16fd3222b7e..310629bfa7a 100644 --- a/.gitignore +++ b/.gitignore @@ -203,3 +203,8 @@ backup .hypothesis + + +# Added by cargo + +/target diff --git a/admin/build_cli_release.sh b/admin/build_cli_release.sh index c9fd6d9d909..d9025ff181d 100755 --- a/admin/build_cli_release.sh +++ b/admin/build_cli_release.sh @@ -21,7 +21,7 @@ cp pyproject.toml release/$PROJECT_NAME/pyproject.toml cp README.md release/$PROJECT_NAME/README.md mkdir release/$PROJECT_NAME/$SOURCE_DIR/$PACKAGE_DIR -p -cp admin_client.py release/$PROJECT_NAME/$SOURCE_DIR/$PACKAGE_DIR/admin_client.py +cp ragflow_cli.py release/$PROJECT_NAME/$SOURCE_DIR/$PACKAGE_DIR/ragflow_cli.py if [ -d "release/$PROJECT_NAME/$SOURCE_DIR" ]; then echo "✅ source dir: release/$PROJECT_NAME/$SOURCE_DIR" diff --git a/admin/client/pyproject.toml b/admin/client/pyproject.toml index de6bf7bc348..3e35d86c13a 100644 --- a/admin/client/pyproject.toml +++ b/admin/client/pyproject.toml @@ -21,4 +21,4 @@ test = [ ] [project.scripts] -ragflow-cli = "admin_client:main" +ragflow-cli = "ragflow_cli:main" diff --git a/admin/client/admin_client.py b/admin/client/ragflow_cli.py similarity index 76% rename from admin/client/admin_client.py rename to admin/client/ragflow_cli.py index 79284a53f35..a8e50caeac7 100644 --- a/admin/client/admin_client.py +++ b/admin/client/ragflow_cli.py @@ -64,6 +64,11 @@ | generate_key | list_keys | drop_key + | list_user_datasets + | list_user_agents + | list_user_chats + | list_user_model_providers + | list_user_default_models // meta command definition meta_command: "\\" meta_command_name [meta_args] @@ -114,6 +119,11 @@ KEY: "KEY"i KEYS: "KEYS"i GENERATE: "GENERATE"i +MODEL: "MODEL"i +MODELS: "MODELS"i +PROVIDERS: "PROVIDERS"i +DEFAULT: "DEFAULT"i +CHATS: "CHATS"i list_services: LIST SERVICES ";" show_service: SHOW SERVICE NUMBER ";" @@ -142,20 +152,26 @@ alter_user_role: ALTER USER quoted_string SET ROLE identifier ";" show_user_permission: SHOW USER PERMISSION quoted_string ";" +show_version: SHOW VERSION ";" + grant_admin: GRANT ADMIN quoted_string ";" revoke_admin: REVOKE ADMIN quoted_string ";" +generate_key: GENERATE KEY FOR USER quoted_string ";" +list_keys: LIST KEYS OF quoted_string ";" +drop_key: DROP KEY quoted_string OF quoted_string ";" + set_variable: SET VAR identifier identifier ";" show_variable: SHOW VAR identifier ";" list_variables: LIST VARS ";" list_configs: LIST CONFIGS ";" list_environments: LIST ENVS ";" -generate_key: GENERATE KEY FOR USER quoted_string ";" -list_keys: LIST KEYS OF quoted_string ";" -drop_key: DROP KEY quoted_string OF quoted_string ";" - -show_version: SHOW VERSION ";" +list_user_datasets: LIST DATASETS ";" +list_user_agents: LIST AGENTS ";" +list_user_chats: LIST CHATS ";" +list_user_model_providers: LIST MODEL PROVIDERS ";" +list_user_default_models: LIST DEFAULT MODELS ";" action_list: identifier ("," identifier)* @@ -172,7 +188,7 @@ """ -class AdminTransformer(Transformer): +class RAGFlowCLITransformer(Transformer): def start(self, items): return items[0] @@ -289,6 +305,19 @@ def revoke_admin(self, items): user_name = items[2] return {"type": "revoke_admin", "user_name": user_name} + def generate_key(self, items): + user_name = items[4] + return {"type": "generate_key", "user_name": user_name} + + def list_keys(self, items): + user_name = items[3] + return {"type": "list_keys", "user_name": user_name} + + def drop_key(self, items): + key = items[2] + user_name = items[4] + return {"type": "drop_key", "key": key, "user_name": user_name} + def set_variable(self, items): var_name = items[2] var_value = items[3] @@ -307,18 +336,20 @@ def list_configs(self, items): def list_environments(self, items): return {"type": "list_environments"} - def generate_key(self, items): - user_name = items[4] - return {"type": "generate_key", "user_name": user_name} + def list_user_datasets(self, items): + return {"type": "list_user_datasets"} - def list_keys(self, items): - user_name = items[3] - return {"type": "list_keys", "user_name": user_name} + def list_user_agents(self, items): + return {"type": "list_user_agents"} - def drop_key(self, items): - key = items[2] - user_name = items[4] - return {"type": "drop_key", "key": key, "user_name": user_name} + def list_user_chats(self, items): + return {"type": "list_user_chats"} + + def list_user_model_providers(self, items): + return {"type": "list_user_model_providers"} + + def list_user_default_models(self, items): + return {"type": "list_user_default_models"} def action_list(self, items): return items @@ -397,21 +428,22 @@ def show_help(): print(help_text) -class AdminCLI(Cmd): +class RAGFlowCLI(Cmd): def __init__(self): super().__init__() - self.parser = Lark(GRAMMAR, start="start", parser="lalr", transformer=AdminTransformer()) + self.parser = Lark(GRAMMAR, start="start", parser="lalr", transformer=RAGFlowCLITransformer()) self.command_history = [] self.is_interactive = False - self.admin_account = "admin@ragflow.io" - self.admin_password: str = "admin" + self.account = "admin@ragflow.io" + self.account_password: str = "admin" self.session = requests.Session() self.access_token: str = "" self.host: str = "" self.port: int = 0 + self.mode: str = "admin" intro = r"""Type "\h" for help.""" - prompt = "admin> " + prompt = "ragflow> " def onecmd(self, command: str) -> bool: try: @@ -454,11 +486,21 @@ def parse_command(self, command_str: str) -> dict[str, str]: except Exception as e: return {"type": "error", "message": f"Parse error: {str(e)}"} - def verify_admin(self, arguments: dict, single_command: bool): + def verify_auth(self, arguments: dict, single_command: bool): self.host = arguments["host"] self.port = arguments["port"] - print("Attempt to access server for admin login") - url = f"http://{self.host}:{self.port}/api/v1/admin/login" + # Determine mode and username + self.mode = arguments.get("type", "admin") + username = arguments.get("username", "admin@ragflow.io") + self.account = username + + # Set login endpoint based on mode + if self.mode == "admin": + url = f"http://{self.host}:{self.port}/api/v1/admin/login" + print("Attempt to access server for admin login") + else: # user mode + url = f"http://{self.host}:{self.port}/v1/user/login" + print("Attempt to access server for user login") attempt_count = 3 if single_command: @@ -471,17 +513,19 @@ def verify_admin(self, arguments: dict, single_command: bool): return False if single_command: - admin_passwd = arguments["password"] + account_passwd = arguments["password"] else: - admin_passwd = getpass.getpass(f"password for {self.admin_account}: ").strip() + account_passwd = getpass.getpass(f"password for {self.account}: ").strip() try: - self.admin_password = encrypt(admin_passwd) - response = self.session.post(url, json={"email": self.admin_account, "password": self.admin_password}) + self.account_password = encrypt(account_passwd) + response = self.session.post(url, json={"email": self.account, "password": self.account_password}) if response.status_code == 200: res_json = response.json() error_code = res_json.get("code", -1) if error_code == 0: - self.session.headers.update({"Content-Type": "application/json", "Authorization": response.headers["Authorization"], "User-Agent": "RAGFlow-CLI/0.23.1"}) + self.session.headers.update( + {"Content-Type": "application/json", "Authorization": response.headers["Authorization"], + "User-Agent": "RAGFlow-CLI/0.23.1"}) print("Authentication successful.") return True else: @@ -492,7 +536,7 @@ def verify_admin(self, arguments: dict, single_command: bool): print(f"Bad response,status: {response.status_code}, password is wrong") except Exception as e: print(str(e)) - print("Can't access server for admin login (connection failed)") + print("Can't access server for login (connection failed)") def _format_service_detail_table(self, data): if isinstance(data, list): @@ -568,11 +612,11 @@ def get_string_width(text): def run_interactive(self): self.is_interactive = True - print("RAGFlow Admin command line interface - Type '\\?' for help, '\\q' to quit") + print("RAGFlow command line interface - Type '\\?' for help, '\\q' to quit") while True: try: - command = input("admin> ").strip() + command = input("ragflow> ").strip() if not command: continue @@ -597,20 +641,42 @@ def run_single_command(self, command: str): self.execute_command(result) def parse_connection_args(self, args: List[str]) -> Dict[str, Any]: - parser = argparse.ArgumentParser(description="Admin CLI Client", add_help=False) - parser.add_argument("-h", "--host", default="localhost", help="Admin service host") - parser.add_argument("-p", "--port", type=int, default=9381, help="Admin service port") + parser = argparse.ArgumentParser(description="RAGFlow CLI Client", add_help=False) + parser.add_argument("-h", "--host", default="localhost", help="Admin or RAGFlow service host") + parser.add_argument("-p", "--port", type=int, default=9381, help="Admin or RAGFlow service port") parser.add_argument("-w", "--password", default="admin", type=str, help="Superuser password") + parser.add_argument("-t", "--type", default="admin", type=str, help="CLI mode, admin or user") + parser.add_argument("-u", "--username", default=None, + help="Username (email). In admin mode defaults to admin@ragflow.io, in user mode required.") parser.add_argument("command", nargs="?", help="Single command") try: parsed_args, remaining_args = parser.parse_known_args(args) + # Determine username based on mode + username = parsed_args.username + if parsed_args.type == "admin": + if username is None: + username = "admin@ragflow.io" + else: # user mode + if username is None: + print("Error: username (-u) is required in user mode") + return {"error": "Username required"} + if remaining_args: command = remaining_args[0] - return {"host": parsed_args.host, "port": parsed_args.port, "password": parsed_args.password, "command": command} + return { + "host": parsed_args.host, + "port": parsed_args.port, + "password": parsed_args.password, + "type": parsed_args.type, + "username": username, + "command": command + } else: return { "host": parsed_args.host, "port": parsed_args.port, + "type": parsed_args.type, + "username": username, } except SystemExit: return {"error": "Invalid connection arguments"} @@ -681,6 +747,12 @@ def execute_command(self, parsed_command: Dict[str, Any]): self._grant_admin(command_dict) case "revoke_admin": self._revoke_admin(command_dict) + case "generate_key": + self._generate_key(command_dict) + case "list_keys": + self._list_keys(command_dict) + case "drop_key": + self._drop_key(command_dict) case "set_variable": self._set_variable(command_dict) case "show_variable": @@ -691,19 +763,24 @@ def execute_command(self, parsed_command: Dict[str, Any]): self._list_configs(command_dict) case "list_environments": self._list_environments(command_dict) - case "generate_key": - self._generate_key(command_dict) - case "list_keys": - self._list_keys(command_dict) - case "drop_key": - self._drop_key(command_dict) + case "list_user_datasets": + self._list_user_datasets(command_dict) + case "list_user_agents": + self._list_user_agents(command_dict) + case "list_user_chats": + self._list_user_chats(command_dict) + case "list_user_model_providers": + self._list_user_model_providers(command_dict) + case "list_user_default_models": + self._list_user_default_models(command_dict) case "meta": self._handle_meta_command(command_dict) case _: print(f"Command '{command_type}' would be executed with API") def _handle_list_services(self, command): - print("Listing all services") + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") url = f"http://{self.host}:{self.port}/api/v1/admin/services" response = self.session.get(url) @@ -714,8 +791,10 @@ def _handle_list_services(self, command): print(f"Fail to get all services, code: {res_json['code']}, message: {res_json['message']}") def _handle_show_service(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + service_id: int = command["number"] - print(f"Showing service: {service_id}") url = f"http://{self.host}:{self.port}/api/v1/admin/services/{service_id}" response = self.session.get(url) @@ -735,19 +814,29 @@ def _handle_show_service(self, command): print(f"Fail to show service, code: {res_json['code']}, message: {res_json['message']}") def _handle_restart_service(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + service_id: int = command["number"] print(f"Restart service {service_id}") def _handle_shutdown_service(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + service_id: int = command["number"] print(f"Shutdown service {service_id}") def _handle_startup_service(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + service_id: int = command["number"] print(f"Startup service {service_id}") def _handle_list_users(self, command): - print("Listing all users") + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") url = f"http://{self.host}:{self.port}/api/v1/admin/users" response = self.session.get(url) @@ -758,6 +847,9 @@ def _handle_list_users(self, command): print(f"Fail to get all users, code: {res_json['code']}, message: {res_json['message']}") def _handle_show_user(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + username_tree: Tree = command["user_name"] user_name: str = username_tree.children[0].strip("'\"") print(f"Showing user: {user_name}") @@ -765,13 +857,16 @@ def _handle_show_user(self, command): response = self.session.get(url) res_json = response.json() if response.status_code == 200: - table_data = res_json["data"] + table_data = res_json["data"][0] table_data.pop("avatar") self._print_table_simple(table_data) else: print(f"Fail to get user {user_name}, code: {res_json['code']}, message: {res_json['message']}") def _handle_drop_user(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + username_tree: Tree = command["user_name"] user_name: str = username_tree.children[0].strip("'\"") print(f"Drop user: {user_name}") @@ -784,6 +879,9 @@ def _handle_drop_user(self, command): print(f"Fail to drop user, code: {res_json['code']}, message: {res_json['message']}") def _handle_alter_user(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + user_name_tree: Tree = command["user_name"] user_name: str = user_name_tree.children[0].strip("'\"") password_tree: Tree = command["password"] @@ -798,6 +896,9 @@ def _handle_alter_user(self, command): print(f"Fail to alter password, code: {res_json['code']}, message: {res_json['message']}") def _handle_create_user(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + user_name_tree: Tree = command["user_name"] user_name: str = user_name_tree.children[0].strip("'\"") password_tree: Tree = command["password"] @@ -813,6 +914,9 @@ def _handle_create_user(self, command): print(f"Fail to create user {user_name}, code: {res_json['code']}, message: {res_json['message']}") def _handle_activate_user(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + user_name_tree: Tree = command["user_name"] user_name: str = user_name_tree.children[0].strip("'\"") activate_tree: Tree = command["activate_status"] @@ -830,6 +934,9 @@ def _handle_activate_user(self, command): print(f"Unknown activate status: {activate_status}.") def _grant_admin(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + user_name_tree: Tree = command["user_name"] user_name: str = user_name_tree.children[0].strip("'\"") url = f"http://{self.host}:{self.port}/api/v1/admin/users/{user_name}/admin" @@ -840,9 +947,13 @@ def _grant_admin(self, command): if response.status_code == 200: print(res_json["message"]) else: - print(f"Fail to grant {user_name} admin authorization, code: {res_json['code']}, message: {res_json['message']}") + print( + f"Fail to grant {user_name} admin authorization, code: {res_json['code']}, message: {res_json['message']}") def _revoke_admin(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + user_name_tree: Tree = command["user_name"] user_name: str = user_name_tree.children[0].strip("'\"") url = f"http://{self.host}:{self.port}/api/v1/admin/users/{user_name}/admin" @@ -853,9 +964,54 @@ def _revoke_admin(self, command): if response.status_code == 200: print(res_json["message"]) else: - print(f"Fail to revoke {user_name} admin authorization, code: {res_json['code']}, message: {res_json['message']}") + print( + f"Fail to revoke {user_name} admin authorization, code: {res_json['code']}, message: {res_json['message']}") + + def _generate_key(self, command: dict[str, Any]) -> None: + username_tree: Tree = command["user_name"] + user_name: str = username_tree.children[0].strip("'\"") + print(f"Generating API key for user: {user_name}") + url: str = f"http://{self.host}:{self.port}/api/v1/admin/users/{user_name}/new_token" + response: requests.Response = self.session.post(url) + res_json: dict[str, Any] = response.json() + if response.status_code == 200: + self._print_table_simple(res_json["data"]) + else: + print( + f"Failed to generate key for user {user_name}, code: {res_json['code']}, message: {res_json['message']}") + + def _list_keys(self, command: dict[str, Any]) -> None: + username_tree: Tree = command["user_name"] + user_name: str = username_tree.children[0].strip("'\"") + print(f"Listing API keys for user: {user_name}") + url: str = f"http://{self.host}:{self.port}/api/v1/admin/users/{user_name}/token_list" + response: requests.Response = self.session.get(url) + res_json: dict[str, Any] = response.json() + if response.status_code == 200: + self._print_table_simple(res_json["data"]) + else: + print(f"Failed to list keys for user {user_name}, code: {res_json['code']}, message: {res_json['message']}") + + def _drop_key(self, command: dict[str, Any]) -> None: + key_tree: Tree = command["key"] + key: str = key_tree.children[0].strip("'\"") + username_tree: Tree = command["user_name"] + user_name: str = username_tree.children[0].strip("'\"") + print(f"Dropping API key for user: {user_name}") + # URL encode the key to handle special characters + encoded_key: str = urllib.parse.quote(key, safe="") + url: str = f"http://{self.host}:{self.port}/api/v1/admin/users/{user_name}/token/{encoded_key}" + response: requests.Response = self.session.delete(url) + res_json: dict[str, Any] = response.json() + if response.status_code == 200: + print(res_json["message"]) + else: + print(f"Failed to drop key for user {user_name}, code: {res_json['code']}, message: {res_json['message']}") def _set_variable(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + var_name_tree: Tree = command["var_name"] var_name = var_name_tree.children[0].strip("'\"") var_value_tree: Tree = command["var_value"] @@ -866,9 +1022,13 @@ def _set_variable(self, command): if response.status_code == 200: print(res_json["message"]) else: - print(f"Fail to set variable {var_name} to {var_value}, code: {res_json['code']}, message: {res_json['message']}") + print( + f"Fail to set variable {var_name} to {var_value}, code: {res_json['code']}, message: {res_json['message']}") def _show_variable(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + var_name_tree: Tree = command["var_name"] var_name = var_name_tree.children[0].strip("'\"") url = f"http://{self.host}:{self.port}/api/v1/admin/variables" @@ -880,6 +1040,9 @@ def _show_variable(self, command): print(f"Fail to get variable {var_name}, code: {res_json['code']}, message: {res_json['message']}") def _list_variables(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + url = f"http://{self.host}:{self.port}/api/v1/admin/variables" response = self.session.get(url) res_json = response.json() @@ -889,6 +1052,9 @@ def _list_variables(self, command): print(f"Fail to list variables, code: {res_json['code']}, message: {res_json['message']}") def _list_configs(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + url = f"http://{self.host}:{self.port}/api/v1/admin/configs" response = self.session.get(url) res_json = response.json() @@ -898,6 +1064,9 @@ def _list_configs(self, command): print(f"Fail to list variables, code: {res_json['code']}, message: {res_json['message']}") def _list_environments(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + url = f"http://{self.host}:{self.port}/api/v1/admin/environments" response = self.session.get(url) res_json = response.json() @@ -907,6 +1076,9 @@ def _list_environments(self, command): print(f"Fail to list variables, code: {res_json['code']}, message: {res_json['message']}") def _handle_list_datasets(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + username_tree: Tree = command["user_name"] user_name: str = username_tree.children[0].strip("'\"") print(f"Listing all datasets of user: {user_name}") @@ -922,6 +1094,9 @@ def _handle_list_datasets(self, command): print(f"Fail to get all datasets of {user_name}, code: {res_json['code']}, message: {res_json['message']}") def _handle_list_agents(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + username_tree: Tree = command["user_name"] user_name: str = username_tree.children[0].strip("'\"") print(f"Listing all agents of user: {user_name}") @@ -937,6 +1112,9 @@ def _handle_list_agents(self, command): print(f"Fail to get all agents of {user_name}, code: {res_json['code']}, message: {res_json['message']}") def _create_role(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + role_name_tree: Tree = command["role_name"] role_name: str = role_name_tree.children[0].strip("'\"") desc_str: str = "" @@ -954,6 +1132,9 @@ def _create_role(self, command): print(f"Fail to create role {role_name}, code: {res_json['code']}, message: {res_json['message']}") def _drop_role(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + role_name_tree: Tree = command["role_name"] role_name: str = role_name_tree.children[0].strip("'\"") print(f"drop role name: {role_name}") @@ -966,6 +1147,9 @@ def _drop_role(self, command): print(f"Fail to drop role {role_name}, code: {res_json['code']}, message: {res_json['message']}") def _alter_role(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + role_name_tree: Tree = command["role_name"] role_name: str = role_name_tree.children[0].strip("'\"") desc_tree: Tree = command["description"] @@ -978,10 +1162,13 @@ def _alter_role(self, command): if response.status_code == 200: self._print_table_simple(res_json["data"]) else: - print(f"Fail to update role {role_name} with description: {desc_str}, code: {res_json['code']}, message: {res_json['message']}") + print( + f"Fail to update role {role_name} with description: {desc_str}, code: {res_json['code']}, message: {res_json['message']}") def _list_roles(self, command): - print("Listing all roles") + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + url = f"http://{self.host}:{self.port}/api/v1/admin/roles" response = self.session.get(url) res_json = response.json() @@ -991,6 +1178,9 @@ def _list_roles(self, command): print(f"Fail to list roles, code: {res_json['code']}, message: {res_json['message']}") def _show_role(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + role_name_tree: Tree = command["role_name"] role_name: str = role_name_tree.children[0].strip("'\"") print(f"show role: {role_name}") @@ -1003,6 +1193,9 @@ def _show_role(self, command): print(f"Fail to list roles, code: {res_json['code']}, message: {res_json['message']}") def _grant_permission(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + role_name_tree: Tree = command["role_name"] role_name_str: str = role_name_tree.children[0].strip("'\"") resource_tree: Tree = command["resource"] @@ -1019,9 +1212,13 @@ def _grant_permission(self, command): if response.status_code == 200: self._print_table_simple(res_json["data"]) else: - print(f"Fail to grant role {role_name_str} with {actions} on {resource_str}, code: {res_json['code']}, message: {res_json['message']}") + print( + f"Fail to grant role {role_name_str} with {actions} on {resource_str}, code: {res_json['code']}, message: {res_json['message']}") def _revoke_permission(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + role_name_tree: Tree = command["role_name"] role_name_str: str = role_name_tree.children[0].strip("'\"") resource_tree: Tree = command["resource"] @@ -1038,9 +1235,13 @@ def _revoke_permission(self, command): if response.status_code == 200: self._print_table_simple(res_json["data"]) else: - print(f"Fail to revoke role {role_name_str} with {actions} on {resource_str}, code: {res_json['code']}, message: {res_json['message']}") + print( + f"Fail to revoke role {role_name_str} with {actions} on {resource_str}, code: {res_json['code']}, message: {res_json['message']}") def _alter_user_role(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + role_name_tree: Tree = command["role_name"] role_name_str: str = role_name_tree.children[0].strip("'\"") user_name_tree: Tree = command["user_name"] @@ -1052,9 +1253,13 @@ def _alter_user_role(self, command): if response.status_code == 200: self._print_table_simple(res_json["data"]) else: - print(f"Fail to alter user: {user_name_str} to role {role_name_str}, code: {res_json['code']}, message: {res_json['message']}") + print( + f"Fail to alter user: {user_name_str} to role {role_name_str}, code: {res_json['code']}, message: {res_json['message']}") def _show_user_permission(self, command): + if self.mode != "admin": + print("This command is only allowed in ADMIN mode") + user_name_tree: Tree = command["user_name"] user_name_str: str = user_name_tree.children[0].strip("'\"") print(f"show_user_permission user_name: {user_name_str}") @@ -1064,57 +1269,99 @@ def _show_user_permission(self, command): if response.status_code == 200: self._print_table_simple(res_json["data"]) else: - print(f"Fail to show user: {user_name_str} permission, code: {res_json['code']}, message: {res_json['message']}") + print( + f"Fail to show user: {user_name_str} permission, code: {res_json['code']}, message: {res_json['message']}") def _show_version(self, command): - print("show_version") - url = f"http://{self.host}:{self.port}/api/v1/admin/version" + if self.mode == "admin": + url = f"http://{self.host}:{self.port}/api/v1/admin/version" + else: + url = f"http://{self.host}:{self.port}/v1/system/version" + response = self.session.get(url) res_json = response.json() if response.status_code == 200: - self._print_table_simple(res_json["data"]) + if self.mode == "admin": + self._print_table_simple(res_json["data"]) + else: + self._print_table_simple({"version": res_json["data"]}) else: print(f"Fail to show version, code: {res_json['code']}, message: {res_json['message']}") - def _generate_key(self, command: dict[str, Any]) -> None: - username_tree: Tree = command["user_name"] - user_name: str = username_tree.children[0].strip("'\"") - print(f"Generating API key for user: {user_name}") - url: str = f"http://{self.host}:{self.port}/api/v1/admin/users/{user_name}/new_token" - response: requests.Response = self.session.post(url) - res_json: dict[str, Any] = response.json() + def _list_user_datasets(self, command): + if self.mode != "user": + print("This command is only allowed in USER mode") + + url = f"http://{self.host}:{self.port}/v1/kb/list" + response = self.session.post(url) + res_json = response.json() if response.status_code == 200: self._print_table_simple(res_json["data"]) else: - print(f"Failed to generate key for user {user_name}, code: {res_json['code']}, message: {res_json['message']}") + print(f"Fail to list datasets, code: {res_json['code']}, message: {res_json['message']}") - def _list_keys(self, command: dict[str, Any]) -> None: - username_tree: Tree = command["user_name"] - user_name: str = username_tree.children[0].strip("'\"") - print(f"Listing API keys for user: {user_name}") - url: str = f"http://{self.host}:{self.port}/api/v1/admin/users/{user_name}/token_list" - response: requests.Response = self.session.get(url) - res_json: dict[str, Any] = response.json() + def _list_user_agents(self, command): + if self.mode != "user": + print("This command is only allowed in USER mode") + + url = f"http://{self.host}:{self.port}/v1/canvas/list" + response = self.session.get(url) + res_json = response.json() if response.status_code == 200: self._print_table_simple(res_json["data"]) else: - print(f"Failed to list keys for user {user_name}, code: {res_json['code']}, message: {res_json['message']}") + print(f"Fail to list datasets, code: {res_json['code']}, message: {res_json['message']}") - def _drop_key(self, command: dict[str, Any]) -> None: - key_tree: Tree = command["key"] - key: str = key_tree.children[0].strip("'\"") - username_tree: Tree = command["user_name"] - user_name: str = username_tree.children[0].strip("'\"") - print(f"Dropping API key for user: {user_name}") - # URL encode the key to handle special characters - encoded_key: str = urllib.parse.quote(key, safe="") - url: str = f"http://{self.host}:{self.port}/api/v1/admin/users/{user_name}/token/{encoded_key}" - response: requests.Response = self.session.delete(url) - res_json: dict[str, Any] = response.json() + def _list_user_chats(self, command): + if self.mode != "user": + print("This command is only allowed in USER mode") + + url = f"http://{self.host}:{self.port}/v1/dialog/next" + response = self.session.get(url) + res_json = response.json() if response.status_code == 200: - print(res_json["message"]) + self._print_table_simple(res_json["data"]) else: - print(f"Failed to drop key for user {user_name}, code: {res_json['code']}, message: {res_json['message']}") + print(f"Fail to list datasets, code: {res_json['code']}, message: {res_json['message']}") + + def _list_user_model_providers(self, command): + if self.mode != "user": + print("This command is only allowed in USER mode") + + url = f"http://{self.host}:{self.port}/v1/llm/my_llms" + response = self.session.get(url) + res_json = response.json() + if response.status_code == 200: + new_input = [] + for key, value in res_json["data"].items(): + new_input.append({"model provider": key, "models": value}) + self._print_table_simple(new_input) + + def _list_user_default_models(self, command): + if self.mode != "user": + print("This command is only allowed in USER mode") + + url = f"http://{self.host}:{self.port}/v1/user/tenant_info" + response = self.session.get(url) + res_json = response.json() + if response.status_code == 200: + new_input = [] + for key, value in res_json["data"].items(): + if key == "asr_id" and value != "": + new_input.append({"model_category": "ASR", "model_name": value}) + elif key == "embd_id" and value != "": + new_input.append({"model_category": "Embedding", "model_name": value}) + elif key == "llm_id" and value != "": + new_input.append({"model_category": "LLM", "model_name": value}) + elif key == "rerank_id" and value != "": + new_input.append({"model_category": "Reranker", "model_name": value}) + elif key == "tts_id" and value != "": + new_input.append({"model_category": "TTS", "model_name": value}) + elif key == "img2txt_id" and value != "": + new_input.append({"model_category": "VLM", "model_name": value}) + else: + continue + self._print_table_simple(new_input) def _handle_meta_command(self, command): meta_command = command["command"] @@ -1131,7 +1378,7 @@ def _handle_meta_command(self, command): def main(): import sys - cli = AdminCLI() + cli = RAGFlowCLI() args = cli.parse_connection_args(sys.argv) if "error" in args: @@ -1142,18 +1389,18 @@ def main(): if "password" not in args: print("Error: password is missing") return - if cli.verify_admin(args, single_command=True): + if cli.verify_auth(args, single_command=True): command: str = args["command"] # print(f"Run single command: {command}") cli.run_single_command(command) else: - if cli.verify_admin(args, single_command=False): + if cli.verify_auth(args, single_command=False): print(r""" - ____ ___ ______________ ___ __ _ - / __ \/ | / ____/ ____/ /___ _ __ / | ____/ /___ ___ (_)___ - / /_/ / /| |/ / __/ /_ / / __ \ | /| / / / /| |/ __ / __ `__ \/ / __ \ - / _, _/ ___ / /_/ / __/ / / /_/ / |/ |/ / / ___ / /_/ / / / / / / / / / / - /_/ |_/_/ |_\____/_/ /_/\____/|__/|__/ /_/ |_\__,_/_/ /_/ /_/_/_/ /_/ + ____ ___ ______________ ________ ____ + / __ \/ | / ____/ ____/ /___ _ __ / ____/ / / _/ + / /_/ / /| |/ / __/ /_ / / __ \ | /| / / / / / / / / + / _, _/ ___ / /_/ / __/ / / /_/ / |/ |/ / / /___/ /____/ / + /_/ |_/_/ |_\____/_/ /_/\____/|__/|__/ \____/_____/___/ """) cli.cmdloop() diff --git a/api/utils/crypt.py b/api/utils/crypt.py index 174ca356835..d81cf7c6a1c 100644 --- a/api/utils/crypt.py +++ b/api/utils/crypt.py @@ -24,7 +24,7 @@ def crypt(line): """ - decrypt(crypt(input_string)) == base64(input_string), which frontend and admin_client use. + decrypt(crypt(input_string)) == base64(input_string), which frontend and ragflow_cli use. """ file_path = os.path.join(get_project_base_directory(), "conf", "public.pem") rsa_key = RSA.importKey(open(file_path).read(), "Welcome") diff --git a/docs/guides/admin/admin_cli.md b/docs/guides/admin/ragflow_cli.md similarity index 94% rename from docs/guides/admin/admin_cli.md rename to docs/guides/admin/ragflow_cli.md index fed8a62642b..73db779a9d8 100644 --- a/docs/guides/admin/admin_cli.md +++ b/docs/guides/admin/ragflow_cli.md @@ -5,11 +5,11 @@ sidebar_custom_props: { categoryIcon: LucideSquareTerminal } --- -# Admin CLI +# RAGFlow CLI -The RAGFlow Admin CLI is a command-line-based system administration tool that offers administrators an efficient and flexible method for system interaction and control. Operating on a client-server architecture, it communicates in real-time with the Admin Service, receiving administrator commands and dynamically returning execution results. +The RAGFlow CLI is a command-line-based system administration tool that offers administrators an efficient and flexible method for system interaction and control. Operating on a client-server architecture, it communicates in real-time with the Admin Service, receiving administrator commands and dynamically returning execution results. -## Using the Admin CLI +## Using the RAGFlow CLI 1. Ensure the Admin Service is running. @@ -169,7 +169,7 @@ Commands are case-insensitive and must be terminated with a semicolon(;). - List all available services. ``` -admin> list services; +ragflow> list services; command: list services; Listing all services +-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+---------+ @@ -190,7 +190,7 @@ Listing all services - Show ragflow_server. ``` -admin> show service 0; +ragflow> show service 0; command: show service 0; Showing service: 0 Service ragflow_0 is alive. Detail: @@ -200,7 +200,7 @@ Confirm elapsed: 26.0 ms. - Show mysql. ``` -admin> show service 1; +ragflow> show service 1; command: show service 1; Showing service: 1 Service mysql is alive. Detail: @@ -216,7 +216,7 @@ Service mysql is alive. Detail: - Show minio. ``` -admin> show service 2; +ragflow> show service 2; command: show service 2; Showing service: 2 Service minio is alive. Detail: @@ -226,7 +226,7 @@ Confirm elapsed: 2.1 ms. - Show elasticsearch. ``` -admin> show service 3; +ragflow> show service 3; command: show service 3; Showing service: 3 Service elasticsearch is alive. Detail: @@ -240,7 +240,7 @@ Service elasticsearch is alive. Detail: - Show infinity. ``` -admin> show service 4; +ragflow> show service 4; command: show service 4; Showing service: 4 Fail to show service, code: 500, message: Infinity is not in use. @@ -249,7 +249,7 @@ Fail to show service, code: 500, message: Infinity is not in use. - Show redis. ``` -admin> show service 5; +ragflow> show service 5; command: show service 5; Showing service: 5 Service redis is alive. Detail: @@ -264,7 +264,7 @@ Service redis is alive. Detail: - Show RAGFlow version ``` -admin> show version; +ragflow> show version; +-----------------------+ | version | +-----------------------+ @@ -277,7 +277,7 @@ admin> show version; - List all user. ``` -admin> list users; +ragflow> list users; command: list users; Listing all users +-------------------------------+----------------------+-----------+----------+ @@ -293,7 +293,7 @@ Listing all users - Show specified user. ``` -admin> show user "admin@ragflow.io"; +ragflow> show user "admin@ragflow.io"; command: show user "admin@ragflow.io"; Showing user: admin@ragflow.io +-------------------------------+------------------+-----------+--------------+------------------+--------------+----------+-----------------+---------------+--------+-------------------------------+ @@ -308,7 +308,7 @@ Showing user: admin@ragflow.io - Create new user. ``` -admin> create user "example@ragflow.io" "psw"; +ragflow> create user "example@ragflow.io" "psw"; command: create user "example@ragflow.io" "psw"; Create user: example@ragflow.io, password: psw, role: user +----------------------------------+--------------------+----------------------------------+--------------+---------------+----------+ @@ -323,7 +323,7 @@ Create user: example@ragflow.io, password: psw, role: user - Alter user password. ``` -admin> alter user password "example@ragflow.io" "newpsw"; +ragflow> alter user password "example@ragflow.io" "newpsw"; command: alter user password "example@ragflow.io" "newpsw"; Alter user: example@ragflow.io, password: newpsw Password updated successfully! @@ -334,7 +334,7 @@ Password updated successfully! - Alter user active, turn off. ``` -admin> alter user active "example@ragflow.io" off; +ragflow> alter user active "example@ragflow.io" off; command: alter user active "example@ragflow.io" off; Alter user example@ragflow.io activate status, turn off. Turn off user activate status successfully! @@ -345,7 +345,7 @@ Turn off user activate status successfully! - Drop user. ``` -admin> Drop user "example@ragflow.io"; +ragflow> Drop user "example@ragflow.io"; command: Drop user "example@ragflow.io"; Drop user: example@ragflow.io Successfully deleted user. Details: @@ -403,7 +403,7 @@ API key deleted successfully - List the specified user's dataset. ``` -admin> list datasets of "lynn_inf@hotmail.com"; +ragflow> list datasets of "lynn_inf@hotmail.com"; command: list datasets of "lynn_inf@hotmail.com"; Listing all datasets of user: lynn_inf@hotmail.com +-----------+-------------------------------+---------+----------+---------------+------------+--------+-----------+-------------------------------+ @@ -419,7 +419,7 @@ Listing all datasets of user: lynn_inf@hotmail.com - List the specified user's agents. ``` -admin> list agents of "lynn_inf@hotmail.com"; +ragflow> list agents of "lynn_inf@hotmail.com"; command: list agents of "lynn_inf@hotmail.com"; Listing all agents of user: lynn_inf@hotmail.com +-----------------+-------------+------------+-----------------+ @@ -434,7 +434,7 @@ Listing all agents of user: lynn_inf@hotmail.com - Display the current RAGFlow version. ``` -admin> show version; +ragflow> show version; show_version +-----------------------+ | version | @@ -448,7 +448,7 @@ show_version - Grant administrator privileges to the specified user. ``` -admin> grant admin "anakin.skywalker@ragflow.io"; +ragflow> grant admin "anakin.skywalker@ragflow.io"; Grant successfully! ``` @@ -457,7 +457,7 @@ Grant successfully! - Revoke administrator privileges from the specified user. ``` -admin> revoke admin "anakin.skywalker@ragflow.io"; +ragflow> revoke admin "anakin.skywalker@ragflow.io"; Revoke successfully! ``` @@ -466,7 +466,7 @@ Revoke successfully! - List all system settings. ``` -admin> list vars; +ragflow> list vars; +-----------+---------------------+--------------+-----------+ | data_type | name | source | value | +-----------+---------------------+--------------+-----------+ @@ -488,7 +488,7 @@ admin> list vars; - Display the content of a specific system configuration/setting by its name or name prefix. ``` -admin> show var mail.server; +ragflow> show var mail.server; +-----------+-------------+--------------+-----------+ | data_type | name | source | value | +-----------+-------------+--------------+-----------+ @@ -501,7 +501,7 @@ admin> show var mail.server; - Set the value for a specified configuration item. ``` -admin> set var mail.server 127.0.0.1; +ragflow> set var mail.server 127.0.0.1; Set variable successfully ``` @@ -511,7 +511,7 @@ Set variable successfully - List all system configurations. ``` -admin> list configs; +ragflow> list configs; +-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+ | extra | host | id | name | port | service_type | +-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+ @@ -530,7 +530,7 @@ admin> list configs; - List all system environments which can accessed by Admin service. ``` -admin> list envs; +ragflow> list envs; +-------------------------+------------------+ | env | value | +-------------------------+------------------+ @@ -548,7 +548,7 @@ admin> list envs; - Show help information. ``` -admin> \help +ragflow> \help command: \help Commands: @@ -589,7 +589,7 @@ Meta Commands: - Exit ``` -admin> \q +ragflow> \q command: \q Goodbye! ``` diff --git a/web/src/pages/agent/hooks/use-add-node.ts b/web/src/pages/agent/hooks/use-add-node.ts index d5cceef6381..257307cf4bc 100644 --- a/web/src/pages/agent/hooks/use-add-node.ts +++ b/web/src/pages/agent/hooks/use-add-node.ts @@ -32,6 +32,7 @@ import { initialLoopValues, initialMessageValues, initialNoteValues, + initialPDFGeneratorValues, initialParserValues, initialPubMedValues, initialRetrievalValues, @@ -48,7 +49,6 @@ import { initialVariableAssignerValues, initialWaitingDialogueValues, initialWenCaiValues, - initialPDFGeneratorValues, initialWikipediaValues, initialYahooFinanceValues, } from '../constant'; From 0a8eb11c3db20aa62c78641b3aea16d3c2150c6c Mon Sep 17 00:00:00 2001 From: Mohan <158349177+mohansinghi@users.noreply.github.com> Date: Sun, 18 Jan 2026 17:48:10 -0800 Subject: [PATCH 137/335] fix: Add proper error handling for database reconnection attempts (#12650) ## Problem When database connection is lost, the reconnection logic had a bug: if the first reconnect attempt failed, the second attempt was not wrapped in error handling, causing unhandled exceptions. ## Solution Added proper try-except blocks around the second reconnect attempt in both MySQL and PostgreSQL database classes to ensure errors are properly logged and handled. ## Changes - Fixed `_handle_connection_loss()` in `RetryingPooledMySQLDatabase` - Fixed `_handle_connection_loss()` in `RetryingPooledPostgresqlDatabase` Fixes #12294 --- Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=158349177 Co-authored-by: SID <158349177+0xsid0703@users.noreply.github.com> --- api/db/db_models.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/api/db/db_models.py b/api/db/db_models.py index 080613b84c9..cdd986c48e4 100644 --- a/api/db/db_models.py +++ b/api/db/db_models.py @@ -281,7 +281,11 @@ def _handle_connection_loss(self): except Exception as e: logging.error(f"Failed to reconnect: {e}") time.sleep(0.1) - self.connect() + try: + self.connect() + except Exception as e2: + logging.error(f"Failed to reconnect on second attempt: {e2}") + raise def begin(self): for attempt in range(self.max_retries + 1): @@ -352,7 +356,11 @@ def _handle_connection_loss(self): except Exception as e: logging.error(f"Failed to reconnect to PostgreSQL: {e}") time.sleep(0.1) - self.connect() + try: + self.connect() + except Exception as e2: + logging.error(f"Failed to reconnect to PostgreSQL on second attempt: {e2}") + raise def begin(self): for attempt in range(self.max_retries + 1): From 57d189b483fec6c888e62feefa293a29f9bdcedd Mon Sep 17 00:00:00 2001 From: francisye19 <39322616+francisye19@users.noreply.github.com> Date: Mon, 19 Jan 2026 11:01:34 +0800 Subject: [PATCH 138/335] fix: Correct gitlab_url access in sync_data_source.py (#12681) ### What problem does this PR solve? Correct gitlab_url access. See https://github.com/infiniflow/ragflow/blob/main/web/src/pages/user-setting/data-source/constant/index.tsx#L660-L666 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/svr/sync_data_source.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rag/svr/sync_data_source.py b/rag/svr/sync_data_source.py index aae977891df..b6cce38b22f 100644 --- a/rag/svr/sync_data_source.py +++ b/rag/svr/sync_data_source.py @@ -1096,7 +1096,7 @@ async def _generate(self, task: dict): self.connector.load_credentials( { "gitlab_access_token": self.conf.get("credentials", {}).get("gitlab_access_token"), - "gitlab_url": self.conf.get("credentials", {}).get("gitlab_url"), + "gitlab_url": self.conf.get("gitlab_url"), } ) From 828ae1e82f1364fb63d7296d7533e5062b7a61dd Mon Sep 17 00:00:00 2001 From: qinling0210 <88864212+qinling0210@users.noreply.github.com> Date: Mon, 19 Jan 2026 11:39:33 +0800 Subject: [PATCH 139/335] Round float value of minimum_should_match (#12688) ### What problem does this PR solve? In paragraph() of class FulltextQueryer, "len(keywords) / 10" should be rounded to integer before set to minimum_should_match. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/nlp/query.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rag/nlp/query.py b/rag/nlp/query.py index 402b240fe94..096cfa4cea6 100644 --- a/rag/nlp/query.py +++ b/rag/nlp/query.py @@ -232,5 +232,5 @@ def paragraph(self, content_tks: str, keywords: list = [], keywords_topn=30): keywords.append(f"{tk}^{w}") return MatchTextExpr(self.query_fields, " ".join(keywords), 100, - {"minimum_should_match": min(3, len(keywords) / 10), + {"minimum_should_match": min(3, round(len(keywords) / 10)), "original_query": " ".join(origin_keywords)}) From d6897b605475469a9e9d9720a34facda76b262ee Mon Sep 17 00:00:00 2001 From: Jin Hai Date: Mon, 19 Jan 2026 12:45:14 +0800 Subject: [PATCH 140/335] Fix chat error (#12693) ### What problem does this PR solve? As title. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Signed-off-by: Jin Hai --- api/apps/dialog_app.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/api/apps/dialog_app.py b/api/apps/dialog_app.py index 32f5cdbc80d..33502f402b0 100644 --- a/api/apps/dialog_app.py +++ b/api/apps/dialog_app.py @@ -44,6 +44,7 @@ async def set_dialog(): name = name.strip() if is_create: + # only for chat creating existing_names = { d.name.casefold() for d in DialogService.query(tenant_id=current_user.id, status=StatusEnum.VALID.value) @@ -68,8 +69,10 @@ def _name_exists(name: str, **_kwargs) -> bool: meta_data_filter = req.get("meta_data_filter", {}) prompt_config = req["prompt_config"] - if not req.get("kb_ids", []) and not prompt_config.get("tavily_api_key") and "{knowledge}" in prompt_config.get("system", ""): - return get_data_error_result(message="Please remove `{knowledge}` in system prompt since no dataset / Tavily used here.") + if not is_create: + # only for chat updating + if not req.get("kb_ids", []) and not prompt_config.get("tavily_api_key") and "{knowledge}" in prompt_config.get("system", ""): + return get_data_error_result(message="Please remove `{knowledge}` in system prompt since no dataset / Tavily used here.") for p in prompt_config.get("parameters", []): if p["optional"]: From 4a7e40630b58eb34111d8ba31be989ef6485aefa Mon Sep 17 00:00:00 2001 From: Stephen Hu <812791840@qq.com> Date: Mon, 19 Jan 2026 12:45:37 +0800 Subject: [PATCH 141/335] Refactor:memory delete will re-use super method (#12684) ### What problem does this PR solve? memory delete will re-use super method ### Type of change - [x] Refactoring --- api/db/services/memory_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/db/services/memory_service.py b/api/db/services/memory_service.py index 8a65d15e24d..215a198fe27 100644 --- a/api/db/services/memory_service.py +++ b/api/db/services/memory_service.py @@ -167,4 +167,4 @@ def update_memory(cls, tenant_id: str, memory_id: str, update_dict: dict): @classmethod @DB.connection_context() def delete_memory(cls, memory_id: str): - return cls.model.delete().where(cls.model.id == memory_id).execute() + return cls.delete_by_id(memory_id) From 9da48ab0bd427276a686a4b0a45c554df6f2321a Mon Sep 17 00:00:00 2001 From: "E.G" <146701565+GlobalStar117@users.noreply.github.com> Date: Mon, 19 Jan 2026 15:46:06 +1100 Subject: [PATCH 142/335] fix: Handle NaN/Infinity values in ExeSQL JSON response (#12666) ## Summary Fixes #12631 When SQL query results contain NaN (Not a Number) or Infinity values (e.g., from division by zero or other calculations), the JSON serialization would fail because **NaN and Infinity are not valid JSON values**. This caused the agent interface to show 'undefined' error, as described in the issue where `EXAMINE_TIMES` became `NaN` and broke the JSON parsing. ## Root Cause The `convert_decimals` function in `exesql.py` was only handling `Decimal` types, but not `float` values that could be `NaN` or `Infinity`. When these invalid JSON values were serialized: ```json {"EXAMINE_TIMES": NaN} // Invalid JSON! ``` The frontend JSON parser would fail, causing the 'undefined' error. ## Solution Extended `convert_decimals` to detect `float` values and convert `NaN`/`Infinity` to `null` before JSON serialization: ```python if isinstance(obj, float): if math.isnan(obj) or math.isinf(obj): return None return obj ``` This ensures all SQL results can be properly serialized to valid JSON. --- This is a Gittensor contribution. gittensor:user:GlobalStar117 Co-authored-by: GlobalStar117 Co-authored-by: Jin Hai Co-authored-by: Zhichang Yu --- agent/tools/exesql.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/agent/tools/exesql.py b/agent/tools/exesql.py index 012b00d84e2..8f3f9dd1753 100644 --- a/agent/tools/exesql.py +++ b/agent/tools/exesql.py @@ -86,6 +86,12 @@ def _invoke(self, **kwargs): def convert_decimals(obj): from decimal import Decimal + import math + if isinstance(obj, float): + # Handle NaN and Infinity which are not valid JSON values + if math.isnan(obj) or math.isinf(obj): + return None + return obj if isinstance(obj, Decimal): return float(obj) # 或 str(obj) elif isinstance(obj, dict): From f3d347f55f5594dbd2be4e1bcbf9f6a6ade3bfb2 Mon Sep 17 00:00:00 2001 From: "n1n.ai" <1119883939@qq.com> Date: Mon, 19 Jan 2026 13:12:42 +0800 Subject: [PATCH 143/335] feat: Add n1n provider (#12680) This PR adds n1n as an LLM provider to RAGFlow. Co-authored-by: Qun --- conf/llm_factories.json | 39 ++++++++++++++++++++++++++++++++- rag/llm/__init__.py | 3 +++ rag/llm/chat_model.py | 9 ++++++++ web/src/assets/svg/llm/n1n.svg | 4 ++++ web/src/components/svg-icon.tsx | 1 + web/src/constants/llm.ts | 3 +++ 6 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 web/src/assets/svg/llm/n1n.svg diff --git a/conf/llm_factories.json b/conf/llm_factories.json index b128f4e67f8..5439f368b62 100644 --- a/conf/llm_factories.json +++ b/conf/llm_factories.json @@ -5539,6 +5539,43 @@ "status": "1", "rank": "910", "llm": [] + }, + { + "name": "n1n", + "logo": "", + "tags": "LLM", + "status": "1", + "rank": "900", + "llm": [ + { + "llm_name": "gpt-4o-mini", + "tags": "LLM,CHAT,128K,IMAGE2TEXT", + "max_tokens": 128000, + "model_type": "chat", + "is_tools": true + }, + { + "llm_name": "gpt-4o", + "tags": "LLM,CHAT,128K,IMAGE2TEXT", + "max_tokens": 128000, + "model_type": "chat", + "is_tools": true + }, + { + "llm_name": "gpt-3.5-turbo", + "tags": "LLM,CHAT,4K", + "max_tokens": 4096, + "model_type": "chat", + "is_tools": false + }, + { + "llm_name": "deepseek-chat", + "tags": "LLM,CHAT,128K", + "max_tokens": 128000, + "model_type": "chat", + "is_tools": true + } + ] } ] -} +} \ No newline at end of file diff --git a/rag/llm/__init__.py b/rag/llm/__init__.py index 4b36d8a0518..ce5b5ef2341 100644 --- a/rag/llm/__init__.py +++ b/rag/llm/__init__.py @@ -56,6 +56,7 @@ class SupportedLiteLLMProvider(StrEnum): GPUStack = "GPUStack" OpenAI = "OpenAI" Azure_OpenAI = "Azure-OpenAI" + n1n = "n1n" FACTORY_DEFAULT_BASE_URL = { @@ -81,6 +82,7 @@ class SupportedLiteLLMProvider(StrEnum): SupportedLiteLLMProvider.MiniMax: "https://api.minimaxi.com/v1", SupportedLiteLLMProvider.DeerAPI: "https://api.deerapi.com/v1", SupportedLiteLLMProvider.OpenAI: "https://api.openai.com/v1", + SupportedLiteLLMProvider.n1n: "https://api.n1n.ai/v1", } @@ -118,6 +120,7 @@ class SupportedLiteLLMProvider(StrEnum): SupportedLiteLLMProvider.GPUStack: "openai/", SupportedLiteLLMProvider.OpenAI: "openai/", SupportedLiteLLMProvider.Azure_OpenAI: "azure/", + SupportedLiteLLMProvider.n1n: "openai/", } ChatModel = globals().get("ChatModel", {}) diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py index eb1a0f82612..edb74b214ed 100644 --- a/rag/llm/chat_model.py +++ b/rag/llm/chat_model.py @@ -1165,6 +1165,15 @@ def __init__(self, key, model_name, base_url="https://ragflow.vip-api.tokenpony. super().__init__(key, model_name, base_url, **kwargs) +class N1nChat(Base): + _FACTORY_NAME = "n1n" + + def __init__(self, key, model_name, base_url="https://api.n1n.ai/v1", **kwargs): + if not base_url: + base_url = "https://api.n1n.ai/v1" + super().__init__(key, model_name, base_url, **kwargs) + + class LiteLLMBase(ABC): _FACTORY_NAME = [ "Tongyi-Qianwen", diff --git a/web/src/assets/svg/llm/n1n.svg b/web/src/assets/svg/llm/n1n.svg new file mode 100644 index 00000000000..58296008bce --- /dev/null +++ b/web/src/assets/svg/llm/n1n.svg @@ -0,0 +1,4 @@ + + + n1n + diff --git a/web/src/components/svg-icon.tsx b/web/src/components/svg-icon.tsx index 3f97bf0d074..2b3ae9be54d 100644 --- a/web/src/components/svg-icon.tsx +++ b/web/src/components/svg-icon.tsx @@ -83,6 +83,7 @@ const svgIcons = [ LLMFactory.StepFun, LLMFactory.MinerU, LLMFactory.PaddleOCR, + LLMFactory.N1n, // LLMFactory.DeerAPI, ]; diff --git a/web/src/constants/llm.ts b/web/src/constants/llm.ts index 5551ad3cee2..f8ae3326697 100644 --- a/web/src/constants/llm.ts +++ b/web/src/constants/llm.ts @@ -62,6 +62,7 @@ export enum LLMFactory { Builtin = 'Builtin', MinerU = 'MinerU', PaddleOCR = 'PaddleOCR', + N1n = 'n1n', } // Please lowercase the file name @@ -129,6 +130,7 @@ export const IconMap = { [LLMFactory.Builtin]: 'builtin', [LLMFactory.MinerU]: 'mineru', [LLMFactory.PaddleOCR]: 'paddleocr', + [LLMFactory.N1n]: 'n1n', }; export const APIMapUrl = { @@ -181,4 +183,5 @@ export const APIMapUrl = { [LLMFactory.TokenPony]: 'https://www.tokenpony.cn/#/user/keys', [LLMFactory.DeepInfra]: 'https://deepinfra.com/dash/api_keys', [LLMFactory.PaddleOCR]: 'https://www.paddleocr.ai/latest/', + [LLMFactory.N1n]: 'https://docs.n1n.ai', }; From 7a53d2dd976f329c9479a086cd1ac97682cef295 Mon Sep 17 00:00:00 2001 From: Loganaden Velvindron Date: Mon, 19 Jan 2026 09:15:15 +0400 Subject: [PATCH 144/335] Fix CVE-2025-59466 (#12679) ### What problem does this PR solve? https://nodejs.org/en/blog/vulnerability/january-2026-dos-mitigation-async-hooks ### Type of change - [X] Bug Fix (non-breaking change which fixes an issue) --- sandbox/sandbox_base_image/nodejs/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sandbox/sandbox_base_image/nodejs/Dockerfile b/sandbox/sandbox_base_image/nodejs/Dockerfile index ada730faf1c..fe7b19f7733 100644 --- a/sandbox/sandbox_base_image/nodejs/Dockerfile +++ b/sandbox/sandbox_base_image/nodejs/Dockerfile @@ -1,4 +1,4 @@ -FROM node:24-bookworm-slim +FROM node:24.13-bookworm-slim RUN npm config set registry https://registry.npmmirror.com From ab1836f216ac320c9de9ca954baee9cc217d1ee7 Mon Sep 17 00:00:00 2001 From: LIRUI YU <128563231+LiruiYu33@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:28:38 +0800 Subject: [PATCH 145/335] An issue involving node.js OOM happened (#12690) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What problem does this PR solve? The Node.js memory issue occurred due to JavaScript heap exhaustion during the Vite build process sometimes. Here's what happened: export NODE_OPTIONS="--max-old-space-size=4096" && \ Root Cause: The Node.js memory issue occurred due to JavaScript heap exhaustion during the Vite build process sometimes. Here's what happened: Root Cause: When building the web frontend with npm run build, Vite needs to bundle, transform, and optimize all JavaScript/TypeScript code Node.js has a default maximum heap size of ~2GB The RAGFlow web application is large enough that the build process exceeded this limit This triggered garbage collection failures ("Ineffective mark-compacts near heap limit") and eventually crashed with exit code 134 (SIGABRT) The solution I attempted: I did not find a simple method to reduce the use of memory for node.js, so I added NODE_OPTIONS=--max-old-space-size=4096 to allocate 4GB heap memory for Node.js during the build. ### Type of change - Bug Fix (non-breaking change which fixes an issue) => ERROR [builder 6/8] RUN --mount=type=cache,id=ragflow_npm,target=/ro 53.3s [builder 6/8] RUN --mount=type=cache,id=ragflow_npm,target=/root/.npm,sharing=locked cd web && npm install && npm run build: 4.551 4.551 > prepare 4.551 > cd .. && husky web/.husky 4.551 4.810 .git can't be found 4.833 added 7 packages in 4s 4.833 4.833 499 packages are looking for funding 4.833 run npm fund for details 5.206 5.206 > build 5.206 > vite build --mode production 5.206 5.939 vite v7.3.0 building client environment for production... 6.169 transforming... 6.472 6.472 WARN 6.472 6.472 6.472 WARN warn - As of Tailwind CSS v3.3, the @tailwindcss/line-clamp plugin is now included by default. 6.472 6.472 6.472 WARN warn - Remove it from the plugins array in your configuration to eliminate this warning. 6.472 53.14 53.14 <--- Last few GCs ---> 53.14 53.14 [41:0x55f82d0] 47673 ms: Scavenge (reduce) 2041.5 (2086.0) -> 2038.7 (2079.7) MB, 6.11 / 0.00 ms (average mu = 0.330, current mu = 0.319) allocation failure; 53.14 [41:0x55f82d0] 47727 ms: Scavenge (reduce) 2039.4 (2079.7) -> 2038.7 (2080.2) MB, 5.34 / 0.00 ms (average mu = 0.330, current mu = 0.319) allocation failure; 53.14 [41:0x55f82d0] 47809 ms: Scavenge (reduce) 2039.6 (2080.2) -> 2038.7 (2080.2) MB, 4.59 / 0.00 ms (average mu = 0.330, current mu = 0.319) allocation failure; 53.14 53.14 53.14 <--- JS stacktrace ---> 53.14 53.14 FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 53.14 ----- Native stack trace ----- 53.14 53.14 1: 0xb76db1 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [node] 53.14 2: 0xee62f0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node] 53.14 3: 0xee65d7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node] 53.14 4: 0x10f82d5 [node] 53.14 5: 0x10f8864 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node] 53.14 6: 0x110f754 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) [node] 53.14 7: 0x110ff6c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node] 53.14 8: 0x11120ca v8::internal::Heap::HandleGCRequest() [node] 53.14 9: 0x107d737 v8::internal::StackGuard::HandleInterrupts() [node] 53.15 10: 0x151fb9a v8::internal::Runtime_StackGuard(int, unsigned long*, v8::internal::Isolate*) [node] 53.15 11: 0x1959ef6 [node] 53.22 Aborted [+] up 0/1 ⠙ Image docker-ragflow Building 58.0s Dockerfile:161 160 | COPY docs docs 161 | >>> RUN --mount=type=cache,id=ragflow_npm,target=/root/.npm,sharing=locked \ 162 | >>> cd web && npm install && npm run build 163 | failed to solve: process "/bin/bash -c cd web && npm install && npm run build" did not complete successfully: exit code: 134 View build details: docker-desktop://dashboard/build/default/default/j68n2ke32cd8bte4y8fs471au --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 48a3e687d70..75df154923e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -159,6 +159,7 @@ RUN --mount=type=cache,id=ragflow_uv,target=/root/.cache/uv,sharing=locked \ COPY web web COPY docs docs RUN --mount=type=cache,id=ragflow_npm,target=/root/.npm,sharing=locked \ + export NODE_OPTIONS="--max-old-space-size=4096" && \ cd web && npm install && npm run build COPY .git /ragflow/.git From b27dc26be3e93c4668c940cfa5154be47fc5efba Mon Sep 17 00:00:00 2001 From: Hwwwww-dev <47653238+Hwwwww-dev@users.noreply.github.com> Date: Mon, 19 Jan 2026 16:06:36 +0800 Subject: [PATCH 146/335] fix: Update answer concatenation logic to handle overlapping values (#12676) ### What problem does this PR solve? Update answer concatenation logic to handle overlapping values ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/hooks/logic-hooks.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/web/src/hooks/logic-hooks.ts b/web/src/hooks/logic-hooks.ts index 1f7909016b8..25b2589ff68 100644 --- a/web/src/hooks/logic-hooks.ts +++ b/web/src/hooks/logic-hooks.ts @@ -274,8 +274,17 @@ export const useSendMessageWithSse = ( const val = JSON.parse(value?.data || ''); const d = val?.data; if (typeof d !== 'boolean') { + setAnswer((prev) => { - let newAnswer = (prev.answer || '') + (d.answer || ''); + const prevAnswer = prev.answer || ''; + const currentAnswer = d.answer || ''; + + let newAnswer: string; + if (prevAnswer && currentAnswer.startsWith(prevAnswer)) { + newAnswer = currentAnswer; + } else { + newAnswer = prevAnswer + currentAnswer; + } if (d.start_to_think === true) { newAnswer = newAnswer + ''; From c4a982e9fa00e81f408485cc4ff76657f5b5a25f Mon Sep 17 00:00:00 2001 From: longbingljw Date: Mon, 19 Jan 2026 16:07:43 +0800 Subject: [PATCH 147/335] feat: add seekdb which is lite version of oceanbase (#12692) ### What problem does this PR solve? Add seekdb as doc_engine wich is the lite version of oceanbase. close #12691 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- .gitignore | 3 +++ common/settings.py | 3 +++ docker/.env | 14 ++++++++++++++ docker/docker-compose-base.yml | 26 ++++++++++++++++++++++++++ docker/service_conf.yaml.template | 8 ++++++++ 5 files changed, 54 insertions(+) diff --git a/.gitignore b/.gitignore index 310629bfa7a..bc2bb8abe3a 100644 --- a/.gitignore +++ b/.gitignore @@ -56,6 +56,9 @@ docker/data docker/oceanbase/conf docker/oceanbase/data +# SeekDB data and conf +docker/seekdb + #--------------------------------------------------# # The following was generated with gitignore.nvim: # diff --git a/common/settings.py b/common/settings.py index 7b19357ad4a..efdd1fe3697 100644 --- a/common/settings.py +++ b/common/settings.py @@ -257,6 +257,9 @@ def init_settings(): elif lower_case_doc_engine == "oceanbase": OB = get_base_config("oceanbase", {}) docStoreConn = rag.utils.ob_conn.OBConnection() + elif lower_case_doc_engine == "seekdb": + OB = get_base_config("seekdb", {}) + docStoreConn = rag.utils.ob_conn.OBConnection() else: raise Exception(f"Not supported doc engine: {DOC_ENGINE}") diff --git a/docker/.env b/docker/.env index 2d31177d759..c939cc8d559 100644 --- a/docker/.env +++ b/docker/.env @@ -16,6 +16,7 @@ # - `infinity` (https://github.com/infiniflow/infinity) # - `oceanbase` (https://github.com/oceanbase/oceanbase) # - `opensearch` (https://github.com/opensearch-project/OpenSearch) +# - `seekdb` (https://github.com/oceanbase/seekdb) DOC_ENGINE=${DOC_ENGINE:-elasticsearch} # Device on which deepdoc inference run. @@ -92,6 +93,19 @@ OB_SYSTEM_MEMORY=${OB_SYSTEM_MEMORY:-2G} OB_DATAFILE_SIZE=${OB_DATAFILE_SIZE:-20G} OB_LOG_DISK_SIZE=${OB_LOG_DISK_SIZE:-20G} +# The hostname where the SeekDB service is exposed +SEEKDB_HOST=seekdb +# The port used to expose the SeekDB service +SEEKDB_PORT=2881 +# The username for SeekDB +SEEKDB_USER=root +# The password for SeekDB +SEEKDB_PASSWORD=infini_rag_flow +# The doc database of the SeekDB service to use +SEEKDB_DOC_DBNAME=ragflow_doc +# SeekDB memory limit +SEEKDB_MEMORY_LIMIT=2G + # The password for MySQL. # WARNING: Change this for production! MYSQL_PASSWORD=infini_rag_flow diff --git a/docker/docker-compose-base.yml b/docker/docker-compose-base.yml index 11104aef53c..0d265d8bf83 100644 --- a/docker/docker-compose-base.yml +++ b/docker/docker-compose-base.yml @@ -121,6 +121,30 @@ services: - ragflow restart: unless-stopped + seekdb: + profiles: + - seekdb + image: oceanbase/seekdb:latest + container_name: seekdb + volumes: + - ./seekdb:/var/lib/oceanbase + ports: + - ${SEEKDB_PORT:-2881}:2881 + env_file: .env + environment: + - ROOT_PASSWORD=${SEEKDB_PASSWORD:-infini_rag_flow} + - MEMORY_LIMIT=${SEEKDB_MEMORY_LIMIT:-2G} + - REPORTER=ragflow-seekdb + mem_limit: ${MEM_LIMIT} + healthcheck: + test: ['CMD-SHELL', 'mysql -h127.0.0.1 -P2881 -uroot -p${SEEKDB_PASSWORD:-infini_rag_flow} -e "CREATE DATABASE IF NOT EXISTS ${SEEKDB_DOC_DBNAME:-ragflow_doc};"'] + interval: 5s + retries: 60 + timeout: 5s + networks: + - ragflow + restart: unless-stopped + sandbox-executor-manager: profiles: - sandbox @@ -283,6 +307,8 @@ volumes: driver: local ob_data: driver: local + seekdb_data: + driver: local mysql_data: driver: local minio_data: diff --git a/docker/service_conf.yaml.template b/docker/service_conf.yaml.template index 1500c2eaf4f..6e08e962abe 100644 --- a/docker/service_conf.yaml.template +++ b/docker/service_conf.yaml.template @@ -38,6 +38,14 @@ oceanbase: password: '${OCEANBASE_PASSWORD:-infini_rag_flow}' host: '${OCEANBASE_HOST:-oceanbase}' port: ${OCEANBASE_PORT:-2881} +seekdb: + scheme: 'oceanbase' # SeekDB is the lite version of OceanBase + config: + db_name: '${SEEKDB_DOC_DBNAME:-ragflow_doc}' + user: '${SEEKDB_USER:-root}' + password: '${SEEKDB_PASSWORD:-infini_rag_flow}' + host: '${SEEKDB_HOST:-seekdb}' + port: ${SEEKDB_PORT:-2881} redis: db: 1 username: '${REDIS_USERNAME:-}' From 3188cd26592c6adac837af3f00b79b6db5348092 Mon Sep 17 00:00:00 2001 From: "E.G" <146701565+GlobalStar117@users.noreply.github.com> Date: Mon, 19 Jan 2026 19:08:14 +1100 Subject: [PATCH 148/335] fix: Ensure pip is available in venv for runtime installation (#12667) ## Summary Fixes #12651 The Docker container was failing at startup with: ``` /ragflow/.venv/bin/python3: No module named pip ``` This occurred when `USE_DOCLING=true` because the `entrypoint.sh` tries to use `uv pip install` to install docling at runtime. ## Root Cause As explained in the issue: 1. `uv sync` creates a minimal, production-focused environment **without pip** 2. The production stage copies the venv from builder 3. Runtime commands using `uv pip install` fail because pip is not present ## Solution Added `python -m ensurepip --upgrade` after `uv sync` in the Dockerfile to ensure pip is available in the virtual environment: ```dockerfile uv sync --python 3.12 --frozen && \ # Ensure pip is available in the venv for runtime package installation (fixes #12651) .venv/bin/python3 -m ensurepip --upgrade ``` This is a minimal change that: - Ensures pip is installed during build time - Doesn't change any other behavior - Allows runtime package installation via `uv pip install` to work --- This is a Gittensor contribution. gittensor:user:GlobalStar117 Co-authored-by: GlobalStar117 --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 75df154923e..47ef161e46b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -154,7 +154,9 @@ RUN --mount=type=cache,id=ragflow_uv,target=/root/.cache/uv,sharing=locked \ else \ sed -i 's|pypi.tuna.tsinghua.edu.cn|pypi.org|g' uv.lock; \ fi; \ - uv sync --python 3.12 --frozen + uv sync --python 3.12 --frozen && \ + # Ensure pip is available in the venv for runtime package installation (fixes #12651) + .venv/bin/python3 -m ensurepip --upgrade COPY web web COPY docs docs From 4fbaa4aae9b065e344bb9f0802bff7058726b138 Mon Sep 17 00:00:00 2001 From: qinling0210 <88864212+qinling0210@users.noreply.github.com> Date: Mon, 19 Jan 2026 16:36:03 +0800 Subject: [PATCH 149/335] Bump to infinity v0.7.0-dev1 (#12699) ### What problem does this PR solve? Bump to infinity v0.7.0-dev1 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- docker/docker-compose-base.yml | 2 +- docker/infinity_conf.toml | 2 +- helm/values.yaml | 2 +- pyproject.toml | 2 +- uv.lock | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docker/docker-compose-base.yml b/docker/docker-compose-base.yml index 0d265d8bf83..8c4916943d1 100644 --- a/docker/docker-compose-base.yml +++ b/docker/docker-compose-base.yml @@ -72,7 +72,7 @@ services: infinity: profiles: - infinity - image: infiniflow/infinity:v0.6.15 + image: infiniflow/infinity:v0.7.0-dev1 volumes: - infinity_data:/var/infinity - ./infinity_conf.toml:/infinity_conf.toml diff --git a/docker/infinity_conf.toml b/docker/infinity_conf.toml index d1dc8bfdc31..661877389e5 100644 --- a/docker/infinity_conf.toml +++ b/docker/infinity_conf.toml @@ -1,5 +1,5 @@ [general] -version = "0.6.15" +version = "0.7.0" time_zone = "utc-8" [network] diff --git a/helm/values.yaml b/helm/values.yaml index af364f1faaf..291addb40bc 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -117,7 +117,7 @@ ragflow: infinity: image: repository: infiniflow/infinity - tag: v0.6.15 + tag: v0.7.0-dev1 pullPolicy: IfNotPresent pullSecrets: [] storage: diff --git a/pyproject.toml b/pyproject.toml index 6feaa1a4a44..943a455d048 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ dependencies = [ "groq==0.9.0", "grpcio-status==1.67.1", "html-text==0.6.2", - "infinity-sdk==0.6.15", + "infinity-sdk==0.7.0-dev1", "infinity-emb>=0.0.66,<0.0.67", "jira==3.10.5", "json-repair==0.35.0", diff --git a/uv.lock b/uv.lock index 79f20d8ba4c..ba0096c199c 100644 --- a/uv.lock +++ b/uv.lock @@ -2956,7 +2956,7 @@ wheels = [ [[package]] name = "infinity-sdk" -version = "0.6.15" +version = "0.7.0.dev1" source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" } dependencies = [ { name = "datrie" }, @@ -2973,9 +2973,9 @@ dependencies = [ { name = "sqlglot", extra = ["rs"] }, { name = "thrift" }, ] -sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/f9/e3/c7433ce0017fba9cd833bc2f2d0208acfdfaf4e635594f7257976bb7230e/infinity_sdk-0.6.15.tar.gz", hash = "sha256:b3159acb1b026e1868ac90a480d8259748655df82a32acdd838279b867b5f587", size = 29518841, upload-time = "2025-12-27T10:39:09.676Z" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/de/d8/7d3cc5cd15eadbb4500f927566cbae0db2db9bf291800d73134f4333c6b7/infinity_sdk-0.7.0.dev1.tar.gz", hash = "sha256:fa1f9be4cb2a4b1043960e0fae0c93bc9d4c544a5679ac6979a0c498d69123b5", size = 29590153, upload-time = "2026-01-19T06:35:00.531Z" } wheels = [ - { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0f/2c/427702ff4231f8965053b8c585b32cfd7571e0515e05fe5e95ddf2c56030/infinity_sdk-0.6.15-py3-none-any.whl", hash = "sha256:06f8a7f50c9817f17aac9d3cafe08f3478423b02b233bd608d17317e23588dc7", size = 29737429, upload-time = "2025-12-27T10:41:58.352Z" }, + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/21/d6/8e68c287d08af3a8c0511eadb81b8f9f1511be7437a369ec51ccd82b862e/infinity_sdk-0.7.0.dev1-py3-none-any.whl", hash = "sha256:5d4600b79bcff3a19c9963eddb37552749ea52358a8ab85090ee3e74b4c5a0c1", size = 29818804, upload-time = "2026-01-19T06:35:13.886Z" }, ] [[package]] @@ -6229,7 +6229,7 @@ requires-dist = [ { name = "grpcio-status", specifier = "==1.67.1" }, { name = "html-text", specifier = "==0.6.2" }, { name = "infinity-emb", specifier = ">=0.0.66,<0.0.67" }, - { name = "infinity-sdk", specifier = "==0.6.15" }, + { name = "infinity-sdk", specifier = "==0.7.0.dev1" }, { name = "jira", specifier = "==3.10.5" }, { name = "json-repair", specifier = "==0.35.0" }, { name = "langfuse", specifier = ">=2.60.0" }, From 05da2a5872931787ca3720a4f244f69fa81700c5 Mon Sep 17 00:00:00 2001 From: balibabu Date: Mon, 19 Jan 2026 19:09:41 +0800 Subject: [PATCH 150/335] Fix: When large models output data rapidly, the scrollbar cannot remain at the bottom. #12701 (#12702) ### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/hooks/logic-hooks.ts | 2 +- web/src/utils/authorization-util.ts | 2 +- web/src/wrappers/auth.tsx | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web/src/hooks/logic-hooks.ts b/web/src/hooks/logic-hooks.ts index 25b2589ff68..3c1baccbd46 100644 --- a/web/src/hooks/logic-hooks.ts +++ b/web/src/hooks/logic-hooks.ts @@ -409,7 +409,7 @@ export const useScrollToBottom = ( const container = containerRef.current; container.scrollTo({ top: container.scrollHeight - container.clientHeight, - behavior: 'smooth', + behavior: 'auto', }); } }, [containerRef]); diff --git a/web/src/utils/authorization-util.ts b/web/src/utils/authorization-util.ts index 0c9118cd35c..227f33b5439 100644 --- a/web/src/utils/authorization-util.ts +++ b/web/src/utils/authorization-util.ts @@ -22,7 +22,7 @@ const storage = { localStorage.setItem(Token, value); }, setUserInfo: (value: string | Record) => { - let valueStr = typeof value !== 'string' ? JSON.stringify(value) : value; + const valueStr = typeof value !== 'string' ? JSON.stringify(value) : value; localStorage.setItem(UserInfo, valueStr); }, setItems: (pairs: Record) => { diff --git a/web/src/wrappers/auth.tsx b/web/src/wrappers/auth.tsx index 1d827cf7005..05275033226 100644 --- a/web/src/wrappers/auth.tsx +++ b/web/src/wrappers/auth.tsx @@ -2,7 +2,7 @@ import { useAuth } from '@/hooks/auth-hooks'; import { redirectToLogin } from '@/utils/authorization-util'; import { Outlet } from 'react-router'; -export default () => { +export default function AuthWrapper() { const { isLogin } = useAuth(); if (isLogin === true) { return ; @@ -11,4 +11,4 @@ export default () => { } return <>; -}; +} From b40d639fdbf4ba65af684e1c68f4f013c023535d Mon Sep 17 00:00:00 2001 From: qinling0210 <88864212+qinling0210@users.noreply.github.com> Date: Mon, 19 Jan 2026 19:35:14 +0800 Subject: [PATCH 151/335] Add dataset with table parser type for Infinity and answer question in chat using SQL (#12541) ### What problem does this PR solve? 1) Create dataset using table parser for infinity 2) Answer questions in chat using SQL ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- Dockerfile | 3 +- api/apps/dialog_app.py | 14 + api/apps/kb_app.py | 11 +- api/apps/sdk/dataset.py | 9 + api/db/services/dialog_service.py | 321 +++++++++++++---- api/db/services/document_service.py | 2 +- common/doc_store/doc_store_base.py | 2 +- common/doc_store/es_conn_base.py | 3 +- common/doc_store/infinity_conn_base.py | 209 ++++++++++- common/doc_store/infinity_conn_pool.py | 19 +- common/settings.py | 12 +- conf/service_conf.yaml | 1 + docker/service_conf.yaml.template | 1 + rag/app/table.py | 42 ++- rag/svr/task_executor.py | 36 +- rag/utils/infinity_conn.py | 22 +- test/testcases/test_http_api/common.py | 31 +- .../test_chat_management/conftest.py | 42 +++ .../test_table_parser_dataset_chat.py | 324 ++++++++++++++++++ 19 files changed, 1003 insertions(+), 101 deletions(-) create mode 100644 test/testcases/test_http_api/test_chat_management/conftest.py create mode 100644 test/testcases/test_http_api/test_chat_management/test_table_parser_dataset_chat.py diff --git a/Dockerfile b/Dockerfile index 47ef161e46b..1da88434355 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,7 +53,8 @@ RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \ apt install -y ghostscript && \ apt install -y pandoc && \ apt install -y texlive && \ - apt install -y fonts-freefont-ttf fonts-noto-cjk + apt install -y fonts-freefont-ttf fonts-noto-cjk && \ + apt install -y postgresql-client # Install uv RUN --mount=type=bind,from=infiniflow/ragflow_deps:latest,source=/,target=/deps \ diff --git a/api/apps/dialog_app.py b/api/apps/dialog_app.py index 33502f402b0..9b7617797d8 100644 --- a/api/apps/dialog_app.py +++ b/api/apps/dialog_app.py @@ -25,6 +25,7 @@ from common.misc_utils import get_uuid from common.constants import RetCode from api.apps import login_required, current_user +import logging @manager.route('/set', methods=['POST']) # noqa: F821 @@ -69,6 +70,19 @@ def _name_exists(name: str, **_kwargs) -> bool: meta_data_filter = req.get("meta_data_filter", {}) prompt_config = req["prompt_config"] + # Set default parameters for datasets with knowledge retrieval + # All datasets with {knowledge} in system prompt need "knowledge" parameter to enable retrieval + kb_ids = req.get("kb_ids", []) + parameters = prompt_config.get("parameters") + logging.debug(f"set_dialog: kb_ids={kb_ids}, parameters={parameters}, is_create={not is_create}") + # Check if parameters is missing, None, or empty list + if kb_ids and not parameters: + # Check if system prompt uses {knowledge} placeholder + if "{knowledge}" in prompt_config.get("system", ""): + # Set default parameters for any dataset with knowledge placeholder + prompt_config["parameters"] = [{"key": "knowledge", "optional": False}] + logging.debug(f"Set default parameters for datasets with knowledge placeholder: {kb_ids}") + if not is_create: # only for chat updating if not req.get("kb_ids", []) and not prompt_config.get("tavily_api_key") and "{knowledge}" in prompt_config.get("system", ""): diff --git a/api/apps/kb_app.py b/api/apps/kb_app.py index a35345feb8d..e7d86594d14 100644 --- a/api/apps/kb_app.py +++ b/api/apps/kb_app.py @@ -295,12 +295,19 @@ def _rm_sync(): File.name == kbs[0].name, ] ) + # Delete the table BEFORE deleting the database record + for kb in kbs: + try: + settings.docStoreConn.delete({"kb_id": kb.id}, search.index_name(kb.tenant_id), kb.id) + settings.docStoreConn.delete_idx(search.index_name(kb.tenant_id), kb.id) + logging.info(f"Dropped index for dataset {kb.id}") + except Exception as e: + logging.error(f"Failed to drop index for dataset {kb.id}: {e}") + if not KnowledgebaseService.delete_by_id(req["kb_id"]): return get_data_error_result( message="Database error (Knowledgebase removal)!") for kb in kbs: - settings.docStoreConn.delete({"kb_id": kb.id}, search.index_name(kb.tenant_id), kb.id) - settings.docStoreConn.delete_idx(search.index_name(kb.tenant_id), kb.id) if hasattr(settings.STORAGE_IMPL, 'remove_bucket'): settings.STORAGE_IMPL.remove_bucket(kb.id) return get_json_result(data=True) diff --git a/api/apps/sdk/dataset.py b/api/apps/sdk/dataset.py index f98705de0b9..d0d7ff0c66a 100644 --- a/api/apps/sdk/dataset.py +++ b/api/apps/sdk/dataset.py @@ -233,6 +233,15 @@ async def delete(tenant_id): File2DocumentService.delete_by_document_id(doc.id) FileService.filter_delete( [File.source_type == FileSource.KNOWLEDGEBASE, File.type == "folder", File.name == kb.name]) + + # Drop index for this dataset + try: + from rag.nlp import search + idxnm = search.index_name(kb.tenant_id) + settings.docStoreConn.delete_idx(idxnm, kb_id) + except Exception as e: + logging.warning(f"Failed to drop index for dataset {kb_id}: {e}") + if not KnowledgebaseService.delete_by_id(kb_id): errors.append(f"Delete dataset error for {kb_id}") continue diff --git a/api/db/services/dialog_service.py b/api/db/services/dialog_service.py index ccf8474b6ab..707227653cb 100644 --- a/api/db/services/dialog_service.py +++ b/api/db/services/dialog_service.py @@ -37,7 +37,6 @@ from common.time_utils import current_timestamp, datetime_format from graphrag.general.mind_map_extractor import MindMapExtractor from rag.advanced_rag import DeepResearcher -from rag.app.resume import forbidden_select_fields4resume from rag.app.tag import label_question from rag.nlp.search import index_name from rag.prompts.generator import chunks_format, citation_prompt, cross_languages, full_question, kb_prompt, keyword_extraction, message_fit_in, \ @@ -274,6 +273,7 @@ def replacement(match): async def async_chat(dialog, messages, stream=True, **kwargs): + logging.debug("Begin async_chat") assert messages[-1]["role"] == "user", "The last content of this conversation is not from user." if not dialog.kb_ids and not dialog.prompt_config.get("tavily_api_key"): async for ans in async_chat_solo(dialog, messages, stream): @@ -323,13 +323,20 @@ async def async_chat(dialog, messages, stream=True, **kwargs): prompt_config = dialog.prompt_config field_map = KnowledgebaseService.get_field_map(dialog.kb_ids) + logging.debug(f"field_map retrieved: {field_map}") # try to use sql if field mapping is good to go if field_map: logging.debug("Use SQL to retrieval:{}".format(questions[-1])) ans = await use_sql(questions[-1], field_map, dialog.tenant_id, chat_mdl, prompt_config.get("quote", True), dialog.kb_ids) - if ans: + # For aggregate queries (COUNT, SUM, etc.), chunks may be empty but answer is still valid + if ans and (ans.get("reference", {}).get("chunks") or ans.get("answer")): yield ans return + else: + logging.debug("SQL failed or returned no results, falling back to vector search") + + param_keys = [p["key"] for p in prompt_config.get("parameters", [])] + logging.debug(f"attachments={attachments}, param_keys={param_keys}, embd_mdl={embd_mdl}") for p in prompt_config["parameters"]: if p["key"] == "knowledge": @@ -366,7 +373,8 @@ async def async_chat(dialog, messages, stream=True, **kwargs): kbinfos = {"total": 0, "chunks": [], "doc_aggs": []} knowledges = [] - if attachments is not None and "knowledge" in [p["key"] for p in prompt_config["parameters"]]: + if attachments is not None and "knowledge" in param_keys: + logging.debug("Proceeding with retrieval") tenant_ids = list(set([kb.tenant_id for kb in kbs])) knowledges = [] if prompt_config.get("reasoning", False): @@ -575,112 +583,306 @@ def decorate_answer(answer): async def use_sql(question, field_map, tenant_id, chat_mdl, quota=True, kb_ids=None): - sys_prompt = """ -You are a Database Administrator. You need to check the fields of the following tables based on the user's list of questions and write the SQL corresponding to the last question. -Ensure that: -1. Field names should not start with a digit. If any field name starts with a digit, use double quotes around it. -2. Write only the SQL, no explanations or additional text. -""" - user_prompt = """ -Table name: {}; -Table of database fields are as follows: + logging.debug(f"use_sql: Question: {question}") + + # Determine which document engine we're using + doc_engine = "infinity" if settings.DOC_ENGINE_INFINITY else "es" + + # Construct the full table name + # For Elasticsearch: ragflow_{tenant_id} (kb_id is in WHERE clause) + # For Infinity: ragflow_{tenant_id}_{kb_id} (each KB has its own table) + base_table = index_name(tenant_id) + if doc_engine == "infinity" and kb_ids and len(kb_ids) == 1: + # Infinity: append kb_id to table name + table_name = f"{base_table}_{kb_ids[0]}" + logging.debug(f"use_sql: Using Infinity table name: {table_name}") + else: + # Elasticsearch/OpenSearch: use base index name + table_name = base_table + logging.debug(f"use_sql: Using ES/OS table name: {table_name}") + + # Generate engine-specific SQL prompts + if doc_engine == "infinity": + # Build Infinity prompts with JSON extraction context + json_field_names = list(field_map.keys()) + sys_prompt = """You are a Database Administrator. Write SQL for a table with JSON 'chunk_data' column. + +JSON Extraction: json_extract_string(chunk_data, '$.FieldName') +Numeric Cast: CAST(json_extract_string(chunk_data, '$.FieldName') AS INTEGER/FLOAT) +NULL Check: json_extract_isnull(chunk_data, '$.FieldName') == false + +RULES: +1. Use EXACT field names (case-sensitive) from the list below +2. For SELECT: include doc_id, docnm, and json_extract_string() for requested fields +3. For COUNT: use COUNT(*) or COUNT(DISTINCT json_extract_string(...)) +4. Add AS alias for extracted field names +5. DO NOT select 'content' field +6. Only add NULL check (json_extract_isnull() == false) in WHERE clause when: + - Question asks to "show me" or "display" specific columns + - Question mentions "not null" or "excluding null" + - Add NULL check for count specific column + - DO NOT add NULL check for COUNT(*) queries (COUNT(*) counts all rows including nulls) +7. Output ONLY the SQL, no explanations""" + user_prompt = """Table: {} +Fields (EXACT case): {} {} - -Question are as follows: +Question: {} +Write SQL using json_extract_string() with exact field names. Include doc_id, docnm for data queries. Only SQL.""".format( + table_name, + ", ".join(json_field_names), + "\n".join([f" - {field}" for field in json_field_names]), + question + ) + else: + # Build ES/OS prompts with direct field access + sys_prompt = """You are a Database Administrator. Write SQL queries. + +RULES: +1. Use EXACT field names from the schema below (e.g., product_tks, not product) +2. Quote field names starting with digit: "123_field" +3. Add IS NOT NULL in WHERE clause when: + - Question asks to "show me" or "display" specific columns +4. Include doc_id/docnm in non-aggregate statement +5. Output ONLY the SQL, no explanations""" + user_prompt = """Table: {} +Available fields: {} -Please write the SQL, only SQL, without any other explanations or text. -""".format(index_name(tenant_id), "\n".join([f"{k}: {v}" for k, v in field_map.items()]), question) +Question: {} +Write SQL using exact field names above. Include doc_id, docnm_kwd for data queries. Only SQL.""".format( + table_name, + "\n".join([f" - {k} ({v})" for k, v in field_map.items()]), + question + ) + tried_times = 0 async def get_table(): nonlocal sys_prompt, user_prompt, question, tried_times sql = await chat_mdl.async_chat(sys_prompt, [{"role": "user", "content": user_prompt}], {"temperature": 0.06}) - sql = re.sub(r"^.*", "", sql, flags=re.DOTALL) - logging.debug(f"{question} ==> {user_prompt} get SQL: {sql}") - sql = re.sub(r"[\r\n]+", " ", sql.lower()) - sql = re.sub(r".*select ", "select ", sql.lower()) - sql = re.sub(r" +", " ", sql) - sql = re.sub(r"([;;]|```).*", "", sql) - sql = re.sub(r"&", "and", sql) - if sql[: len("select ")] != "select ": - return None, None - if not re.search(r"((sum|avg|max|min)\(|group by )", sql.lower()): - if sql[: len("select *")] != "select *": - sql = "select doc_id,docnm_kwd," + sql[6:] + logging.debug(f"use_sql: Raw SQL from LLM: {repr(sql[:500])}") + # Remove think blocks if present (format: ...) + sql = re.sub(r"\n.*?\n\s*", "", sql, flags=re.DOTALL) + sql = re.sub(r"思考\n.*?\n", "", sql, flags=re.DOTALL) + # Remove markdown code blocks (```sql ... ```) + sql = re.sub(r"```(?:sql)?\s*", "", sql, flags=re.IGNORECASE) + sql = re.sub(r"```\s*$", "", sql, flags=re.IGNORECASE) + # Remove trailing semicolon that ES SQL parser doesn't like + sql = sql.rstrip().rstrip(';').strip() + + # Add kb_id filter for ES/OS only (Infinity already has it in table name) + if doc_engine != "infinity" and kb_ids: + # Build kb_filter: single KB or multiple KBs with OR + if len(kb_ids) == 1: + kb_filter = f"kb_id = '{kb_ids[0]}'" else: - flds = [] - for k in field_map.keys(): - if k in forbidden_select_fields4resume: - continue - if len(flds) > 11: - break - flds.append(k) - sql = "select doc_id,docnm_kwd," + ",".join(flds) + sql[8:] - - if kb_ids: - kb_filter = "(" + " OR ".join([f"kb_id = '{kb_id}'" for kb_id in kb_ids]) + ")" - if "where" not in sql.lower(): + kb_filter = "(" + " OR ".join([f"kb_id = '{kb_id}'" for kb_id in kb_ids]) + ")" + + if "where " not in sql.lower(): o = sql.lower().split("order by") if len(o) > 1: sql = o[0] + f" WHERE {kb_filter} order by " + o[1] else: sql += f" WHERE {kb_filter}" - else: - sql += f" AND {kb_filter}" + elif "kb_id =" not in sql.lower() and "kb_id=" not in sql.lower(): + sql = re.sub(r"\bwhere\b ", f"where {kb_filter} and ", sql, flags=re.IGNORECASE) logging.debug(f"{question} get SQL(refined): {sql}") tried_times += 1 - return settings.retriever.sql_retrieval(sql, format="json"), sql + logging.debug(f"use_sql: Executing SQL retrieval (attempt {tried_times})") + tbl = settings.retriever.sql_retrieval(sql, format="json") + if tbl is None: + logging.debug("use_sql: SQL retrieval returned None") + return None, sql + logging.debug(f"use_sql: SQL retrieval completed, got {len(tbl.get('rows', []))} rows") + return tbl, sql try: tbl, sql = await get_table() + logging.debug(f"use_sql: Initial SQL execution SUCCESS. SQL: {sql}") + logging.debug(f"use_sql: Retrieved {len(tbl.get('rows', []))} rows, columns: {[c['name'] for c in tbl.get('columns', [])]}") except Exception as e: - user_prompt = """ + logging.warning(f"use_sql: Initial SQL execution FAILED with error: {e}") + # Build retry prompt with error information + if doc_engine == "infinity": + # Build Infinity error retry prompt + json_field_names = list(field_map.keys()) + user_prompt = """ +Table name: {}; +JSON fields available in 'chunk_data' column (use these exact names in json_extract_string): +{} + +Question: {} +Please write the SQL using json_extract_string(chunk_data, '$.field_name') with the field names from the list above. Only SQL, no explanations. + + +The SQL error you provided last time is as follows: +{} + +Please correct the error and write SQL again using json_extract_string(chunk_data, '$.field_name') syntax with the correct field names. Only SQL, no explanations. +""".format(table_name, "\n".join([f" - {field}" for field in json_field_names]), question, e) + else: + # Build ES/OS error retry prompt + user_prompt = """ Table name: {}; - Table of database fields are as follows: + Table of database fields are as follows (use the field names directly in SQL): {} Question are as follows: {} - Please write the SQL, only SQL, without any other explanations or text. + Please write the SQL using the exact field names above, only SQL, without any other explanations or text. The SQL error you provided last time is as follows: {} - Please correct the error and write SQL again, only SQL, without any other explanations or text. - """.format(index_name(tenant_id), "\n".join([f"{k}: {v}" for k, v in field_map.items()]), question, e) + Please correct the error and write SQL again using the exact field names above, only SQL, without any other explanations or text. + """.format(table_name, "\n".join([f"{k} ({v})" for k, v in field_map.items()]), question, e) try: tbl, sql = await get_table() + logging.debug(f"use_sql: Retry SQL execution SUCCESS. SQL: {sql}") + logging.debug(f"use_sql: Retrieved {len(tbl.get('rows', []))} rows on retry") except Exception: + logging.error("use_sql: Retry SQL execution also FAILED, returning None") return if len(tbl["rows"]) == 0: + logging.warning(f"use_sql: No rows returned from SQL query, returning None. SQL: {sql}") return None - docid_idx = set([ii for ii, c in enumerate(tbl["columns"]) if c["name"] == "doc_id"]) - doc_name_idx = set([ii for ii, c in enumerate(tbl["columns"]) if c["name"] == "docnm_kwd"]) + logging.debug(f"use_sql: Proceeding with {len(tbl['rows'])} rows to build answer") + + docid_idx = set([ii for ii, c in enumerate(tbl["columns"]) if c["name"].lower() == "doc_id"]) + doc_name_idx = set([ii for ii, c in enumerate(tbl["columns"]) if c["name"].lower() in ["docnm_kwd", "docnm"]]) + + logging.debug(f"use_sql: All columns: {[(i, c['name']) for i, c in enumerate(tbl['columns'])]}") + logging.debug(f"use_sql: docid_idx={docid_idx}, doc_name_idx={doc_name_idx}") + column_idx = [ii for ii in range(len(tbl["columns"])) if ii not in (docid_idx | doc_name_idx)] + logging.debug(f"use_sql: column_idx={column_idx}") + logging.debug(f"use_sql: field_map={field_map}") + + # Helper function to map column names to display names + def map_column_name(col_name): + if col_name.lower() == "count(star)": + return "COUNT(*)" + + # First, try to extract AS alias from any expression (aggregate functions, json_extract_string, etc.) + # Pattern: anything AS alias_name + as_match = re.search(r'\s+AS\s+([^\s,)]+)', col_name, re.IGNORECASE) + if as_match: + alias = as_match.group(1).strip('"\'') + + # Use the alias for display name lookup + if alias in field_map: + display = field_map[alias] + return re.sub(r"(/.*|([^()]+))", "", display) + # If alias not in field_map, try to match case-insensitively + for field_key, display_value in field_map.items(): + if field_key.lower() == alias.lower(): + return re.sub(r"(/.*|([^()]+))", "", display_value) + # Return alias as-is if no mapping found + return alias + + # Try direct mapping first (for simple column names) + if col_name in field_map: + display = field_map[col_name] + # Clean up any suffix patterns + return re.sub(r"(/.*|([^()]+))", "", display) + + # Try case-insensitive match for simple column names + col_lower = col_name.lower() + for field_key, display_value in field_map.items(): + if field_key.lower() == col_lower: + return re.sub(r"(/.*|([^()]+))", "", display_value) + + # For aggregate expressions or complex expressions without AS alias, + # try to replace field names with display names + result = col_name + for field_name, display_name in field_map.items(): + # Replace field_name with display_name in the expression + result = result.replace(field_name, display_name) + + # Clean up any suffix patterns + result = re.sub(r"(/.*|([^()]+))", "", result) + return result + # compose Markdown table columns = ( "|" + "|".join( - [re.sub(r"(/.*|([^()]+))", "", field_map.get(tbl["columns"][i]["name"], tbl["columns"][i]["name"])) for i in column_idx]) + ( - "|Source|" if docid_idx and docid_idx else "|") + [map_column_name(tbl["columns"][i]["name"]) for i in column_idx]) + ( + "|Source|" if docid_idx and doc_name_idx else "|") ) line = "|" + "|".join(["------" for _ in range(len(column_idx))]) + ("|------|" if docid_idx and docid_idx else "") - rows = ["|" + "|".join([remove_redundant_spaces(str(r[i])) for i in column_idx]).replace("None", " ") + "|" for r in tbl["rows"]] - rows = [r for r in rows if re.sub(r"[ |]+", "", r)] + # Build rows ensuring column names match values - create a dict for each row + # keyed by column name to handle any SQL column order + rows = [] + for row_idx, r in enumerate(tbl["rows"]): + row_dict = {tbl["columns"][i]["name"]: r[i] for i in range(len(tbl["columns"])) if i < len(r)} + if row_idx == 0: + logging.debug(f"use_sql: First row data: {row_dict}") + row_values = [] + for col_idx in column_idx: + col_name = tbl["columns"][col_idx]["name"] + value = row_dict.get(col_name, " ") + row_values.append(remove_redundant_spaces(str(value)).replace("None", " ")) + # Add Source column with citation marker if Source column exists + if docid_idx and doc_name_idx: + row_values.append(f" ##{row_idx}$$") + row_str = "|" + "|".join(row_values) + "|" + if re.sub(r"[ |]+", "", row_str): + rows.append(row_str) if quota: - rows = "\n".join([r + f" ##{ii}$$ |" for ii, r in enumerate(rows)]) + rows = "\n".join(rows) else: - rows = "\n".join([r + f" ##{ii}$$ |" for ii, r in enumerate(rows)]) + rows = "\n".join(rows) rows = re.sub(r"T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+Z)?\|", "|", rows) if not docid_idx or not doc_name_idx: - logging.warning("SQL missing field: " + sql) + logging.warning(f"use_sql: SQL missing required doc_id or docnm_kwd field. docid_idx={docid_idx}, doc_name_idx={doc_name_idx}. SQL: {sql}") + # For aggregate queries (COUNT, SUM, AVG, MAX, MIN, DISTINCT), fetch doc_id, docnm_kwd separately + # to provide source chunks, but keep the original table format answer + if re.search(r"(count|sum|avg|max|min|distinct)\s*\(", sql.lower()): + # Keep original table format as answer + answer = "\n".join([columns, line, rows]) + + # Now fetch doc_id, docnm_kwd to provide source chunks + # Extract WHERE clause from the original SQL + where_match = re.search(r"\bwhere\b(.+?)(?:\bgroup by\b|\border by\b|\blimit\b|$)", sql, re.IGNORECASE) + if where_match: + where_clause = where_match.group(1).strip() + # Build a query to get doc_id and docnm_kwd with the same WHERE clause + chunks_sql = f"select doc_id, docnm_kwd from {table_name} where {where_clause}" + # Add LIMIT to avoid fetching too many chunks + if "limit" not in chunks_sql.lower(): + chunks_sql += " limit 20" + logging.debug(f"use_sql: Fetching chunks with SQL: {chunks_sql}") + try: + chunks_tbl = settings.retriever.sql_retrieval(chunks_sql, format="json") + if chunks_tbl.get("rows") and len(chunks_tbl["rows"]) > 0: + # Build chunks reference - use case-insensitive matching + chunks_did_idx = next((i for i, c in enumerate(chunks_tbl["columns"]) if c["name"].lower() == "doc_id"), None) + chunks_dn_idx = next((i for i, c in enumerate(chunks_tbl["columns"]) if c["name"].lower() in ["docnm_kwd", "docnm"]), None) + if chunks_did_idx is not None and chunks_dn_idx is not None: + chunks = [{"doc_id": r[chunks_did_idx], "docnm_kwd": r[chunks_dn_idx]} for r in chunks_tbl["rows"]] + # Build doc_aggs + doc_aggs = {} + for r in chunks_tbl["rows"]: + doc_id = r[chunks_did_idx] + doc_name = r[chunks_dn_idx] + if doc_id not in doc_aggs: + doc_aggs[doc_id] = {"doc_name": doc_name, "count": 0} + doc_aggs[doc_id]["count"] += 1 + doc_aggs_list = [{"doc_id": did, "doc_name": d["doc_name"], "count": d["count"]} for did, d in doc_aggs.items()] + logging.debug(f"use_sql: Returning aggregate answer with {len(chunks)} chunks from {len(doc_aggs)} documents") + return {"answer": answer, "reference": {"chunks": chunks, "doc_aggs": doc_aggs_list}, "prompt": sys_prompt} + except Exception as e: + logging.warning(f"use_sql: Failed to fetch chunks: {e}") + # Fallback: return answer without chunks + return {"answer": answer, "reference": {"chunks": [], "doc_aggs": []}, "prompt": sys_prompt} + # Fallback to table format for other cases return {"answer": "\n".join([columns, line, rows]), "reference": {"chunks": [], "doc_aggs": []}, "prompt": sys_prompt} docid_idx = list(docid_idx)[0] @@ -690,7 +892,8 @@ async def get_table(): if r[docid_idx] not in doc_aggs: doc_aggs[r[docid_idx]] = {"doc_name": r[doc_name_idx], "count": 0} doc_aggs[r[docid_idx]]["count"] += 1 - return { + + result = { "answer": "\n".join([columns, line, rows]), "reference": { "chunks": [{"doc_id": r[docid_idx], "docnm_kwd": r[doc_name_idx]} for r in tbl["rows"]], @@ -698,6 +901,8 @@ async def get_table(): }, "prompt": sys_prompt, } + logging.debug(f"use_sql: Returning answer with {len(result['reference']['chunks'])} chunks from {len(doc_aggs)} documents") + return result def clean_tts_text(text: str) -> str: if not text: diff --git a/api/db/services/document_service.py b/api/db/services/document_service.py index ef1b831aa87..896d97c77e0 100644 --- a/api/db/services/document_service.py +++ b/api/db/services/document_service.py @@ -1279,7 +1279,7 @@ def embedding(doc_id, cnts, batch_size=16): for b in range(0, len(cks), es_bulk_size): if try_create_idx: if not settings.docStoreConn.index_exist(idxnm, kb_id): - settings.docStoreConn.create_idx(idxnm, kb_id, len(vectors[0])) + settings.docStoreConn.create_idx(idxnm, kb_id, len(vectors[0]), kb.parser_id) try_create_idx = False settings.docStoreConn.insert(cks[b:b + es_bulk_size], idxnm, kb_id) diff --git a/common/doc_store/doc_store_base.py b/common/doc_store/doc_store_base.py index fe6304f7579..fd684baef25 100644 --- a/common/doc_store/doc_store_base.py +++ b/common/doc_store/doc_store_base.py @@ -164,7 +164,7 @@ def health(self) -> dict: """ @abstractmethod - def create_idx(self, index_name: str, dataset_id: str, vector_size: int): + def create_idx(self, index_name: str, dataset_id: str, vector_size: int, parser_id: str = None): """ Create an index with given name """ diff --git a/common/doc_store/es_conn_base.py b/common/doc_store/es_conn_base.py index cec628c0db5..3bbd8f7caea 100644 --- a/common/doc_store/es_conn_base.py +++ b/common/doc_store/es_conn_base.py @@ -123,7 +123,8 @@ def get_cluster_stats(self): Table operations """ - def create_idx(self, index_name: str, dataset_id: str, vector_size: int): + def create_idx(self, index_name: str, dataset_id: str, vector_size: int, parser_id: str = None): + # parser_id is used by Infinity but not needed for ES (kept for interface compatibility) if self.index_exist(index_name, dataset_id): return True try: diff --git a/common/doc_store/infinity_conn_base.py b/common/doc_store/infinity_conn_base.py index c8679c31ce6..218f1255211 100644 --- a/common/doc_store/infinity_conn_base.py +++ b/common/doc_store/infinity_conn_base.py @@ -228,15 +228,26 @@ def health(self) -> dict: Table operations """ - def create_idx(self, index_name: str, dataset_id: str, vector_size: int): + def create_idx(self, index_name: str, dataset_id: str, vector_size: int, parser_id: str = None): table_name = f"{index_name}_{dataset_id}" + self.logger.debug(f"CREATE_IDX: Creating table {table_name}, parser_id: {parser_id}") + inf_conn = self.connPool.get_conn() inf_db = inf_conn.create_database(self.dbName, ConflictType.Ignore) + # Use configured schema fp_mapping = os.path.join(get_project_base_directory(), "conf", self.mapping_file_name) if not os.path.exists(fp_mapping): raise Exception(f"Mapping file not found at {fp_mapping}") schema = json.load(open(fp_mapping)) + + if parser_id is not None: + from common.constants import ParserType + if parser_id == ParserType.TABLE.value: + # Table parser: add chunk_data JSON column to store table-specific fields + schema["chunk_data"] = {"type": "json", "default": "{}"} + self.logger.info("Added chunk_data column for TABLE parser") + vector_name = f"q_{vector_size}_vec" schema[vector_name] = {"type": f"vector,{vector_size},float"} inf_table = inf_db.create_table( @@ -453,4 +464,198 @@ def get_aggregation(self, res: tuple[pd.DataFrame, int] | pd.DataFrame, field_na """ def sql(self, sql: str, fetch_size: int, format: str): - raise NotImplementedError("Not implemented") + """ + Execute SQL query on Infinity database via psql command. + Transform text-to-sql for Infinity's SQL syntax. + """ + import subprocess + + try: + self.logger.debug(f"InfinityConnection.sql get sql: {sql}") + + # Clean up SQL + sql = re.sub(r"[ `]+", " ", sql) + sql = sql.replace("%", "") + + # Transform SELECT field aliases to actual stored field names + # Build field mapping from infinity_mapping.json comment field + field_mapping = {} + # Also build reverse mapping for column names in result + reverse_mapping = {} + fp_mapping = os.path.join(get_project_base_directory(), "conf", self.mapping_file_name) + if os.path.exists(fp_mapping): + schema = json.load(open(fp_mapping)) + for field_name, field_info in schema.items(): + if "comment" in field_info: + # Parse comma-separated aliases from comment + # e.g., "docnm_kwd, title_tks, title_sm_tks" + aliases = [a.strip() for a in field_info["comment"].split(",")] + for alias in aliases: + field_mapping[alias] = field_name + reverse_mapping[field_name] = alias # Store first alias for reverse mapping + + # Replace field names in SELECT clause + select_match = re.search(r"(select\s+.*?)(from\s+)", sql, re.IGNORECASE) + if select_match: + select_clause = select_match.group(1) + from_clause = select_match.group(2) + + # Apply field transformations + for alias, actual in field_mapping.items(): + select_clause = re.sub( + rf'(^|[, ]){alias}([, ]|$)', + rf'\1{actual}\2', + select_clause + ) + + sql = select_clause + from_clause + sql[select_match.end():] + + # Also replace field names in WHERE, ORDER BY, GROUP BY, and HAVING clauses + for alias, actual in field_mapping.items(): + # Transform in WHERE clause + sql = re.sub( + rf'(\bwhere\s+[^;]*?)(\b){re.escape(alias)}\b', + rf'\1{actual}', + sql, + flags=re.IGNORECASE + ) + # Transform in ORDER BY clause + sql = re.sub( + rf'(\border by\s+[^;]*?)(\b){re.escape(alias)}\b', + rf'\1{actual}', + sql, + flags=re.IGNORECASE + ) + # Transform in GROUP BY clause + sql = re.sub( + rf'(\bgroup by\s+[^;]*?)(\b){re.escape(alias)}\b', + rf'\1{actual}', + sql, + flags=re.IGNORECASE + ) + # Transform in HAVING clause + sql = re.sub( + rf'(\bhaving\s+[^;]*?)(\b){re.escape(alias)}\b', + rf'\1{actual}', + sql, + flags=re.IGNORECASE + ) + + self.logger.debug(f"InfinityConnection.sql to execute: {sql}") + + # Get connection parameters from the Infinity connection pool wrapper + # We need to use INFINITY_CONN singleton, not the raw ConnectionPool + from common.doc_store.infinity_conn_pool import INFINITY_CONN + conn_info = INFINITY_CONN.get_conn_uri() + + # Parse host and port from conn_info + if conn_info and "host=" in conn_info: + host_match = re.search(r"host=(\S+)", conn_info) + if host_match: + host = host_match.group(1) + else: + host = "infinity" + else: + host = "infinity" + + # Parse port from conn_info, default to 5432 if not found + if conn_info and "port=" in conn_info: + port_match = re.search(r"port=(\d+)", conn_info) + if port_match: + port = port_match.group(1) + else: + port = "5432" + else: + port = "5432" + + # Use psql command to execute SQL + # Use full path to psql to avoid PATH issues + psql_path = "/usr/bin/psql" + # Check if psql exists at expected location, otherwise try to find it + import shutil + psql_from_path = shutil.which("psql") + if psql_from_path: + psql_path = psql_from_path + + # Execute SQL with psql to get both column names and data in one call + psql_cmd = [ + psql_path, + "-h", host, + "-p", port, + "-c", sql, + ] + + self.logger.debug(f"Executing psql command: {' '.join(psql_cmd)}") + + result = subprocess.run( + psql_cmd, + capture_output=True, + text=True, + timeout=10 # 10 second timeout + ) + + if result.returncode != 0: + error_msg = result.stderr.strip() + raise Exception(f"psql command failed: {error_msg}\nSQL: {sql}") + + # Parse the output + output = result.stdout.strip() + if not output: + # No results + return { + "columns": [], + "rows": [] + } if format == "json" else [] + + # Parse psql table output which has format: + # col1 | col2 | col3 + # -----+-----+----- + # val1 | val2 | val3 + lines = output.split("\n") + + # Extract column names from first line + columns = [] + rows = [] + + if len(lines) >= 1: + header_line = lines[0] + for col_name in header_line.split("|"): + col_name = col_name.strip() + if col_name: + columns.append({"name": col_name}) + + # Data starts after the separator line (line with dashes) + data_start = 2 if len(lines) >= 2 and "-" in lines[1] else 1 + for i in range(data_start, len(lines)): + line = lines[i].strip() + # Skip empty lines and footer lines like "(1 row)" + if not line or re.match(r"^\(\d+ row", line): + continue + # Split by | and strip each cell + row = [cell.strip() for cell in line.split("|")] + # Ensure row matches column count + if len(row) == len(columns): + rows.append(row) + elif len(row) > len(columns): + # Row has more cells than columns - truncate + rows.append(row[:len(columns)]) + elif len(row) < len(columns): + # Row has fewer cells - pad with empty strings + rows.append(row + [""] * (len(columns) - len(row))) + + if format == "json": + result = { + "columns": columns, + "rows": rows[:fetch_size] if fetch_size > 0 else rows + } + else: + result = rows[:fetch_size] if fetch_size > 0 else rows + + return result + + except subprocess.TimeoutExpired: + self.logger.exception(f"InfinityConnection.sql timeout. SQL:\n{sql}") + raise Exception(f"SQL timeout\n\nSQL: {sql}") + except Exception as e: + self.logger.exception(f"InfinityConnection.sql got exception. SQL:\n{sql}") + raise Exception(f"SQL error: {e}\n\nSQL: {sql}") diff --git a/common/doc_store/infinity_conn_pool.py b/common/doc_store/infinity_conn_pool.py index f74e244096d..1aa3f81254d 100644 --- a/common/doc_store/infinity_conn_pool.py +++ b/common/doc_store/infinity_conn_pool.py @@ -31,7 +31,11 @@ def __init__(self): if hasattr(settings, "INFINITY"): self.INFINITY_CONFIG = settings.INFINITY else: - self.INFINITY_CONFIG = settings.get_base_config("infinity", {"uri": "infinity:23817"}) + self.INFINITY_CONFIG = settings.get_base_config("infinity", { + "uri": "infinity:23817", + "postgres_port": 5432, + "db_name": "default_db" + }) infinity_uri = self.INFINITY_CONFIG["uri"] if ":" in infinity_uri: @@ -61,6 +65,19 @@ def __init__(self): def get_conn_pool(self): return self.conn_pool + def get_conn_uri(self): + """ + Get connection URI for PostgreSQL protocol. + """ + infinity_uri = self.INFINITY_CONFIG["uri"] + postgres_port = self.INFINITY_CONFIG["postgres_port"] + db_name = self.INFINITY_CONFIG["db_name"] + + if ":" in infinity_uri: + host, _ = infinity_uri.split(":") + return f"host={host} port={postgres_port} dbname={db_name}" + return f"host=localhost port={postgres_port} dbname={db_name}" + def refresh_conn_pool(self): try: inf_conn = self.conn_pool.get_conn() diff --git a/common/settings.py b/common/settings.py index efdd1fe3697..83415c680ae 100644 --- a/common/settings.py +++ b/common/settings.py @@ -249,7 +249,11 @@ def init_settings(): ES = get_base_config("es", {}) docStoreConn = rag.utils.es_conn.ESConnection() elif lower_case_doc_engine == "infinity": - INFINITY = get_base_config("infinity", {"uri": "infinity:23817"}) + INFINITY = get_base_config("infinity", { + "uri": "infinity:23817", + "postgres_port": 5432, + "db_name": "default_db" + }) docStoreConn = rag.utils.infinity_conn.InfinityConnection() elif lower_case_doc_engine == "opensearch": OS = get_base_config("os", {}) @@ -269,7 +273,11 @@ def init_settings(): ES = get_base_config("es", {}) msgStoreConn = memory_es_conn.ESConnection() elif DOC_ENGINE == "infinity": - INFINITY = get_base_config("infinity", {"uri": "infinity:23817"}) + INFINITY = get_base_config("infinity", { + "uri": "infinity:23817", + "postgres_port": 5432, + "db_name": "default_db" + }) msgStoreConn = memory_infinity_conn.InfinityConnection() global AZURE, S3, MINIO, OSS, GCS diff --git a/conf/service_conf.yaml b/conf/service_conf.yaml index afd9b98bcb0..04a3164882d 100644 --- a/conf/service_conf.yaml +++ b/conf/service_conf.yaml @@ -29,6 +29,7 @@ os: password: 'infini_rag_flow_OS_01' infinity: uri: 'localhost:23817' + postgres_port: 5432 db_name: 'default_db' oceanbase: scheme: 'oceanbase' # set 'mysql' to create connection using mysql config diff --git a/docker/service_conf.yaml.template b/docker/service_conf.yaml.template index 6e08e962abe..c03eaf2a984 100644 --- a/docker/service_conf.yaml.template +++ b/docker/service_conf.yaml.template @@ -29,6 +29,7 @@ os: password: '${OPENSEARCH_PASSWORD:-infini_rag_flow_OS_01}' infinity: uri: '${INFINITY_HOST:-infinity}:23817' + postgres_port: 5432 db_name: 'default_db' oceanbase: scheme: 'oceanbase' # set 'mysql' to create connection using mysql config diff --git a/rag/app/table.py b/rag/app/table.py index f931d2849bc..1b49994e58d 100644 --- a/rag/app/table.py +++ b/rag/app/table.py @@ -33,6 +33,7 @@ from deepdoc.parser.utils import get_text from rag.nlp import rag_tokenizer, tokenize, tokenize_table from deepdoc.parser import ExcelParser +from common import settings class Excel(ExcelParser): @@ -431,7 +432,9 @@ def chunk(filename, binary=None, from_page=0, to_page=10000000000, lang="Chinese res = [] PY = Pinyin() - fieds_map = {"text": "_tks", "int": "_long", "keyword": "_kwd", "float": "_flt", "datetime": "_dt", "bool": "_kwd"} + # Field type suffixes for database columns + # Maps data types to their database field suffixes + fields_map = {"text": "_tks", "int": "_long", "keyword": "_kwd", "float": "_flt", "datetime": "_dt", "bool": "_kwd"} for df in dfs: for n in ["id", "_id", "index", "idx"]: if n in df.columns: @@ -452,13 +455,24 @@ def chunk(filename, binary=None, from_page=0, to_page=10000000000, lang="Chinese df[clmns[j]] = cln if ty == "text": txts.extend([str(c) for c in cln if c]) - clmns_map = [(py_clmns[i].lower() + fieds_map[clmn_tys[i]], str(clmns[i]).replace("_", " ")) for i in + clmns_map = [(py_clmns[i].lower() + fields_map[clmn_tys[i]], str(clmns[i]).replace("_", " ")) for i in range(len(clmns))] + # For Infinity: Use original column names as keys since they're stored in chunk_data JSON + # For ES/OS: Use full field names with type suffixes (e.g., url_kwd, body_tks) + if settings.DOC_ENGINE_INFINITY: + # For Infinity: key = original column name, value = display name + field_map = {py_clmns[i].lower(): str(clmns[i]).replace("_", " ") for i in range(len(clmns))} + else: + # For ES/OS: key = typed field name, value = display name + field_map = {k: v for k, v in clmns_map} + logging.debug(f"Field map: {field_map}") + KnowledgebaseService.update_parser_config(kwargs["kb_id"], {"field_map": field_map}) eng = lang.lower() == "english" # is_english(txts) for ii, row in df.iterrows(): d = {"docnm_kwd": filename, "title_tks": rag_tokenizer.tokenize(re.sub(r"\.[a-zA-Z]+$", "", filename))} - row_txt = [] + row_fields = [] + data_json = {} # For Infinity: Store all columns in a JSON object for j in range(len(clmns)): if row[clmns[j]] is None: continue @@ -466,17 +480,27 @@ def chunk(filename, binary=None, from_page=0, to_page=10000000000, lang="Chinese continue if not isinstance(row[clmns[j]], pd.Series) and pd.isna(row[clmns[j]]): continue - fld = clmns_map[j][0] - d[fld] = row[clmns[j]] if clmn_tys[j] != "text" else rag_tokenizer.tokenize(row[clmns[j]]) - row_txt.append("{}:{}".format(clmns[j], row[clmns[j]])) - if not row_txt: + # For Infinity: Store in chunk_data JSON column + # For Elasticsearch/OpenSearch: Store as individual fields with type suffixes + if settings.DOC_ENGINE_INFINITY: + data_json[str(clmns[j])] = row[clmns[j]] + else: + fld = clmns_map[j][0] + d[fld] = row[clmns[j]] if clmn_tys[j] != "text" else rag_tokenizer.tokenize(row[clmns[j]]) + row_fields.append((clmns[j], row[clmns[j]])) + if not row_fields: continue - tokenize(d, "; ".join(row_txt), eng) + # Add the data JSON field to the document (for Infinity only) + if settings.DOC_ENGINE_INFINITY: + d["chunk_data"] = data_json + # Format as a structured text for better LLM comprehension + # Format each field as "- Field Name: Value" on separate lines + formatted_text = "\n".join([f"- {field}: {value}" for field, value in row_fields]) + tokenize(d, formatted_text, eng) res.append(d) if tbls: doc = {"docnm_kwd": filename, "title_tks": rag_tokenizer.tokenize(re.sub(r"\.[a-zA-Z]+$", "", filename))} res.extend(tokenize_table(tbls, doc, is_english)) - KnowledgebaseService.update_parser_config(kwargs["kb_id"], {"field_map": {k: v for k, v in clmns_map}}) callback(0.35, "") return res diff --git a/rag/svr/task_executor.py b/rag/svr/task_executor.py index 622da383405..cf2a37bea07 100644 --- a/rag/svr/task_executor.py +++ b/rag/svr/task_executor.py @@ -558,7 +558,8 @@ def build_TOC(task, docs, progress_callback): def init_kb(row, vector_size: int): idxnm = search.index_name(row["tenant_id"]) - return settings.docStoreConn.create_idx(idxnm, row.get("kb_id", ""), vector_size) + parser_id = row.get("parser_id", None) + return settings.docStoreConn.create_idx(idxnm, row.get("kb_id", ""), vector_size, parser_id) async def embedding(docs, mdl, parser_config=None, callback=None): @@ -739,7 +740,7 @@ def batch_encode(txts): start_ts = timer() set_progress(task_id, prog=0.82, msg="[DOC Engine]:\nStart to index...") - e = await insert_es(task_id, task["tenant_id"], task["kb_id"], chunks, partial(set_progress, task_id, 0, 100000000)) + e = await insert_chunks(task_id, task["tenant_id"], task["kb_id"], chunks, partial(set_progress, task_id, 0, 100000000)) if not e: PipelineOperationLogService.create(document_id=doc_id, pipeline_id=dataflow_id, task_type=PipelineTaskType.PARSE, dsl=str(pipeline)) @@ -833,7 +834,17 @@ async def delete_image(kb_id, chunk_id): raise -async def insert_es(task_id, task_tenant_id, task_dataset_id, chunks, progress_callback): +async def insert_chunks(task_id, task_tenant_id, task_dataset_id, chunks, progress_callback): + """ + Insert chunks into document store (Elasticsearch OR Infinity). + + Args: + task_id: Task identifier + task_tenant_id: Tenant ID + task_dataset_id: Dataset/knowledge base ID + chunks: List of chunk dictionaries to insert + progress_callback: Callback function for progress updates + """ mothers = [] mother_ids = set([]) for ck in chunks: @@ -858,7 +869,7 @@ async def insert_es(task_id, task_tenant_id, task_dataset_id, chunks, progress_c for b in range(0, len(mothers), settings.DOC_BULK_SIZE): await asyncio.to_thread(settings.docStoreConn.insert, mothers[b:b + settings.DOC_BULK_SIZE], - search.index_name(task_tenant_id), task_dataset_id, ) + search.index_name(task_tenant_id), task_dataset_id) task_canceled = has_canceled(task_id) if task_canceled: progress_callback(-1, msg="Task has been canceled.") @@ -866,7 +877,7 @@ async def insert_es(task_id, task_tenant_id, task_dataset_id, chunks, progress_c for b in range(0, len(chunks), settings.DOC_BULK_SIZE): doc_store_result = await asyncio.to_thread(settings.docStoreConn.insert, chunks[b:b + settings.DOC_BULK_SIZE], - search.index_name(task_tenant_id), task_dataset_id, ) + search.index_name(task_tenant_id), task_dataset_id) task_canceled = has_canceled(task_id) if task_canceled: progress_callback(-1, msg="Task has been canceled.") @@ -932,13 +943,6 @@ async def do_handle_task(task): # prepare the progress callback function progress_callback = partial(set_progress, task_id, task_from_page, task_to_page) - # FIXME: workaround, Infinity doesn't support table parsing method, this check is to notify user - lower_case_doc_engine = settings.DOC_ENGINE.lower() - if lower_case_doc_engine == 'infinity' and task['parser_id'].lower() == 'table': - error_message = "Table parsing method is not supported by Infinity, please use other parsing methods or use Elasticsearch as the document engine." - progress_callback(-1, msg=error_message) - raise Exception(error_message) - task_canceled = has_canceled(task_id) if task_canceled: progress_callback(-1, msg="Task has been canceled.") @@ -1092,14 +1096,14 @@ async def do_handle_task(task): chunk_count = len(set([chunk["id"] for chunk in chunks])) start_ts = timer() - async def _maybe_insert_es(_chunks): + async def _maybe_insert_chunks(_chunks): if has_canceled(task_id): return True - insert_result = await insert_es(task_id, task_tenant_id, task_dataset_id, _chunks, progress_callback) + insert_result = await insert_chunks(task_id, task_tenant_id, task_dataset_id, _chunks, progress_callback) return bool(insert_result) try: - if not await _maybe_insert_es(chunks): + if not await _maybe_insert_chunks(chunks): return logging.info( @@ -1115,7 +1119,7 @@ async def _maybe_insert_es(_chunks): if toc_thread: d = toc_thread.result() if d: - if not await _maybe_insert_es([d]): + if not await _maybe_insert_chunks([d]): return DocumentService.increment_chunk_num(task_doc_id, task_dataset_id, 0, 1, 0) diff --git a/rag/utils/infinity_conn.py b/rag/utils/infinity_conn.py index f65ae3eaf99..916f919ee3b 100644 --- a/rag/utils/infinity_conn.py +++ b/rag/utils/infinity_conn.py @@ -317,7 +317,18 @@ def insert(self, documents: list[dict], index_name: str, knowledgebase_id: str = break if vector_size == 0: raise ValueError("Cannot infer vector size from documents") - self.create_idx(index_name, knowledgebase_id, vector_size) + + # Determine parser_id from document structure + # Table parser documents have 'chunk_data' field + parser_id = None + if "chunk_data" in documents[0] and isinstance(documents[0].get("chunk_data"), dict): + from common.constants import ParserType + parser_id = ParserType.TABLE.value + self.logger.debug("Detected TABLE parser from document structure") + + # Fallback: Create table with base schema (shouldn't normally happen as init_kb() creates it) + self.logger.debug(f"Fallback: Creating table {table_name} with base schema, parser_id: {parser_id}") + self.create_idx(index_name, knowledgebase_id, vector_size, parser_id) table_instance = db_instance.get_table(table_name) # embedding fields can't have a default value.... @@ -378,6 +389,12 @@ def insert(self, documents: list[dict], index_name: str, knowledgebase_id: str = d[k] = v elif re.search(r"_feas$", k): d[k] = json.dumps(v) + elif k == "chunk_data": + # Convert data dict to JSON string for storage + if isinstance(v, dict): + d[k] = json.dumps(v) + else: + d[k] = v elif k == "kb_id": if isinstance(d[k], list): d[k] = d[k][0] # since d[k] is a list, but we need a str @@ -586,6 +603,9 @@ def get_fields(self, res: tuple[pd.DataFrame, int] | pd.DataFrame, fields: list[ res2[column] = res2[column].apply(lambda v: [kwd for kwd in v.split("###") if kwd]) elif re.search(r"_feas$", k): res2[column] = res2[column].apply(lambda v: json.loads(v) if v else {}) + elif k == "chunk_data": + # Parse JSON data back to dict for table parser fields + res2[column] = res2[column].apply(lambda v: json.loads(v) if v and isinstance(v, str) else v) elif k == "position_int": def to_position_int(v): if v: diff --git a/test/testcases/test_http_api/common.py b/test/testcases/test_http_api/common.py index 6810ca64768..7e1d9927a25 100644 --- a/test/testcases/test_http_api/common.py +++ b/test/testcases/test_http_api/common.py @@ -49,6 +49,11 @@ def update_dataset(auth, dataset_id, payload=None, *, headers=HEADERS, data=None def delete_datasets(auth, payload=None, *, headers=HEADERS, data=None): + """ + Delete datasets. + The endpoint is DELETE /api/{VERSION}/datasets with payload {"ids": [...]} + This is the standard SDK REST API endpoint for dataset deletion. + """ res = requests.delete(url=f"{HOST_ADDRESS}{DATASETS_API_URL}", headers=headers, auth=auth, json=payload, data=data) return res.json() @@ -300,12 +305,6 @@ def metadata_summary(auth, dataset_id, params=None): # CHAT COMPLETIONS AND RELATED QUESTIONS -def chat_completions(auth, chat_assistant_id, payload=None): - url = f"{HOST_ADDRESS}{CHAT_ASSISTANT_API_URL}/{chat_assistant_id}/completions" - res = requests.post(url=url, headers=HEADERS, auth=auth, json=payload) - return res.json() - - def related_questions(auth, payload=None): url = f"{HOST_ADDRESS}/api/{VERSION}/sessions/related_questions" res = requests.post(url=url, headers=HEADERS, auth=auth, json=payload) @@ -355,3 +354,23 @@ def agent_completions(auth, agent_id, payload=None): url = f"{HOST_ADDRESS}{AGENT_API_URL}/{agent_id}/completions" res = requests.post(url=url, headers=HEADERS, auth=auth, json=payload) return res.json() + + +def chat_completions(auth, chat_id, payload=None): + """ + Send a question/message to a chat assistant and get completion. + + Args: + auth: Authentication object + chat_id: Chat assistant ID + payload: Dictionary containing: + - question: str (required) - The question to ask + - stream: bool (optional) - Whether to stream responses, default False + - session_id: str (optional) - Session ID for conversation context + + Returns: + Response JSON with answer data + """ + url = f"{HOST_ADDRESS}/api/{VERSION}/chats/{chat_id}/completions" + res = requests.post(url=url, headers=HEADERS, auth=auth, json=payload) + return res.json() diff --git a/test/testcases/test_http_api/test_chat_management/conftest.py b/test/testcases/test_http_api/test_chat_management/conftest.py new file mode 100644 index 00000000000..cf64a5889b6 --- /dev/null +++ b/test/testcases/test_http_api/test_chat_management/conftest.py @@ -0,0 +1,42 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +import pytest +from common import create_dataset, delete_datasets + + +@pytest.fixture(scope="class") +def add_table_parser_dataset(HttpApiAuth, request): + """ + Fixture to create a table parser dataset for testing. + Automatically cleans up after tests complete (deletes dataset and table). + Note: field_map is automatically generated by the table parser when processing files. + """ + dataset_payload = { + "name": "test_table_parser_dataset", + "chunk_method": "table", # table parser + } + res = create_dataset(HttpApiAuth, dataset_payload) + assert res["code"] == 0, f"Failed to create dataset: {res}" + dataset_id = res["data"]["id"] + + def cleanup(): + delete_datasets(HttpApiAuth, {"ids": [dataset_id]}) + + request.addfinalizer(cleanup) + + return dataset_id diff --git a/test/testcases/test_http_api/test_chat_management/test_table_parser_dataset_chat.py b/test/testcases/test_http_api/test_chat_management/test_table_parser_dataset_chat.py new file mode 100644 index 00000000000..b34a34f62ad --- /dev/null +++ b/test/testcases/test_http_api/test_chat_management/test_table_parser_dataset_chat.py @@ -0,0 +1,324 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import os +import re +import tempfile + +import pytest + +from common import ( + chat_completions, + create_chat_assistant, + create_session_with_chat_assistant, + delete_chat_assistants, + list_documents, + upload_documents, + parse_documents, +) +from utils import wait_for + +@wait_for(200, 1, "Document parsing timeout") +def wait_for_parsing_completion(auth, dataset_id, document_id=None): + """ + Wait for document parsing to complete. + + Args: + auth: Authentication object + dataset_id: Dataset ID + document_id: Optional specific document ID to wait for + + Returns: + bool: True if parsing is complete, False otherwise + """ + res = list_documents(auth, dataset_id) + docs = res["data"]["docs"] + + if document_id is None: + # Wait for all documents to complete + for doc in docs: + status = doc.get("run", "UNKNOWN") + if status != "DONE": + print(f"[DEBUG] Document {doc.get('name', 'unknown')} status: {status}, progress: {doc.get('progress', 0)}%, msg: {doc.get('progress_msg', '')}") + return False + return True + else: + # Wait for specific document + for doc in docs: + if doc["id"] == document_id: + status = doc.get("run", "UNKNOWN") + print(f"[DEBUG] Document {doc.get('name', 'unknown')} status: {status}, progress: {doc.get('progress', 0)}%, msg: {doc.get('progress_msg', '')}") + if status == "DONE": + return True + elif status == "FAILED": + pytest.fail(f"Document parsing failed: {doc}") + return False + return False + +# Test data +TEST_EXCEL_DATA = [ + ["employee_id", "name", "department", "salary"], + ["E001", "Alice Johnson", "Engineering", "95000"], + ["E002", "Bob Smith", "Marketing", "65000"], + ["E003", "Carol Williams", "Engineering", "88000"], + ["E004", "David Brown", "Sales", "72000"], + ["E005", "Eva Davis", "HR", "68000"], + ["E006", "Frank Miller", "Engineering", "102000"], +] + +TEST_EXCEL_DATA_2 = [ + ["product", "price", "category"], + ["Laptop", "999", "Electronics"], + ["Mouse", "29", "Electronics"], + ["Desk", "299", "Furniture"], + ["Chair", "199", "Furniture"], + ["Monitor", "399", "Electronics"], + ["Keyboard", "79", "Electronics"], +] + +DEFAULT_CHAT_PROMPT = ( + "You are a helpful assistant that answers questions about table data using SQL queries.\n\n" + "Here is the knowledge base:\n{knowledge}\n\n" + "Use this information to answer questions." +) + + +@pytest.mark.usefixtures("add_table_parser_dataset") +class TestTableParserDatasetChat: + """ + Test table parser dataset chat functionality with Infinity backend. + + Verifies that: + 1. Excel files are uploaded and parsed correctly into table parser datasets + 2. Chat assistants can query the parsed table data via SQL + 3. Different types of queries work + """ + + @pytest.fixture(autouse=True) + def setup_chat_assistant(self, HttpApiAuth, add_table_parser_dataset, request): + """ + Setup fixture that runs before each test method. + Creates chat assistant once and reuses it across all test cases. + """ + # Only setup once (first time) + if not hasattr(self.__class__, 'chat_id'): + self.__class__.dataset_id = add_table_parser_dataset + self.__class__.auth = HttpApiAuth + + # Upload and parse Excel files once for all tests + self._upload_and_parse_excel(HttpApiAuth, add_table_parser_dataset) + + # Create a single chat assistant and session for all tests + chat_id, session_id = self._create_chat_assistant_with_session( + HttpApiAuth, add_table_parser_dataset + ) + self.__class__.chat_id = chat_id + self.__class__.session_id = session_id + + # Store the total number of parametrize cases + mark = request.node.get_closest_marker('parametrize') + if mark: + # Get the number of test cases from parametrize + param_values = mark.args[1] + self.__class__._total_tests = len(param_values) + else: + self.__class__._total_tests = 1 + + yield + + # Teardown: cleanup chat assistant after all tests + # Use a class-level counter to track tests + if not hasattr(self.__class__, '_test_counter'): + self.__class__._test_counter = 0 + self.__class__._test_counter += 1 + + # Cleanup after all parametrize tests complete + if self.__class__._test_counter >= self.__class__._total_tests: + self._teardown_chat_assistant() + + def _teardown_chat_assistant(self): + """Teardown method to clean up chat assistant.""" + if hasattr(self.__class__, 'chat_id') and self.__class__.chat_id: + try: + delete_chat_assistants(self.__class__.auth, {"ids": [self.__class__.chat_id]}) + except Exception as e: + print(f"[Teardown] Warning: Failed to delete chat assistant: {e}") + + @pytest.mark.p1 + @pytest.mark.parametrize( + "question, expected_answer_pattern", + [ + ("show me column of product", r"\|product\|Source"), + ("which product has price 79", r"Keyboard"), + ("How many rows in the dataset?", r"count\(\*\)"), + ("Show me all employees in Engineering department", r"(Alice|Carol|Frank)"), + ], + ) + def test_table_parser_dataset_chat(self, question, expected_answer_pattern): + """ + Test that table parser dataset chat works correctly. + """ + # Use class-level attributes (set by setup fixture) + answer = self._ask_question( + self.__class__.auth, + self.__class__.chat_id, + self.__class__.session_id, + question + ) + + # Verify answer matches expected pattern if provided + if expected_answer_pattern: + self._assert_answer_matches_pattern(answer, expected_answer_pattern) + else: + # Just verify we got a non-empty answer + assert answer and len(answer) > 0, "Expected non-empty answer" + + print(f"[Test] Question: {question}") + print(f"[Test] Answer: {answer[:100]}...") + + @staticmethod + def _upload_and_parse_excel(auth, dataset_id): + """ + Upload 2 Excel files and wait for parsing to complete. + + Returns: + list: The document IDs of the uploaded files + + Raises: + AssertionError: If upload or parsing fails + """ + excel_file_paths = [] + document_ids = [] + try: + # Create 2 temporary Excel files + excel_file_paths.append(TestTableParserDatasetChat._create_temp_excel_file(TEST_EXCEL_DATA)) + excel_file_paths.append(TestTableParserDatasetChat._create_temp_excel_file(TEST_EXCEL_DATA_2)) + + # Upload documents + res = upload_documents(auth, dataset_id, excel_file_paths) + assert res["code"] == 0, f"Failed to upload documents: {res}" + + for doc in res["data"]: + document_ids.append(doc["id"]) + + # Start parsing for all documents + parse_payload = {"document_ids": document_ids} + res = parse_documents(auth, dataset_id, parse_payload) + assert res["code"] == 0, f"Failed to start parsing: {res}" + + # Wait for parsing completion for all documents + for doc_id in document_ids: + wait_for_parsing_completion(auth, dataset_id, doc_id) + + return document_ids + + finally: + # Clean up temporary files + for excel_file_path in excel_file_paths: + if excel_file_path: + os.unlink(excel_file_path) + + @staticmethod + def _create_temp_excel_file(data): + """ + Create a temporary Excel file with the given table test data. + + Args: + data: List of lists containing the Excel data + + Returns: + str: Path to the created temporary file + """ + from openpyxl import Workbook + + f = tempfile.NamedTemporaryFile(mode="wb", suffix=".xlsx", delete=False) + f.close() + + wb = Workbook() + ws = wb.active + + # Write test data to the worksheet + for row_idx, row_data in enumerate(data, start=1): + for col_idx, value in enumerate(row_data, start=1): + ws.cell(row=row_idx, column=col_idx, value=value) + + wb.save(f.name) + return f.name + + @staticmethod + def _create_chat_assistant_with_session(auth, dataset_id): + """ + Create a chat assistant and session for testing. + + Returns: + tuple: (chat_id, session_id) + """ + import uuid + + chat_payload = { + "name": f"test_table_parser_dataset_chat_{uuid.uuid4().hex[:8]}", + "dataset_ids": [dataset_id], + "prompt_config": { + "system": DEFAULT_CHAT_PROMPT, + "parameters": [ + { + "key": "knowledge", + "optional": True, + "value": "Use the table data to answer questions with SQL queries.", + } + ], + }, + } + + res = create_chat_assistant(auth, chat_payload) + assert res["code"] == 0, f"Failed to create chat assistant: {res}" + chat_id = res["data"]["id"] + + res = create_session_with_chat_assistant(auth, chat_id, {"name": f"test_session_{uuid.uuid4().hex[:8]}"}) + assert res["code"] == 0, f"Failed to create session: {res}" + session_id = res["data"]["id"] + + return chat_id, session_id + + def _ask_question(self, auth, chat_id, session_id, question): + """ + Send a question to the chat assistant and return the answer. + + Returns: + str: The assistant's answer + """ + payload = { + "question": question, + "stream": False, + "session_id": session_id, + } + + res_json = chat_completions(auth, chat_id, payload) + assert res_json["code"] == 0, f"Chat completion failed: {res_json}" + + return res_json["data"]["answer"] + + def _assert_answer_matches_pattern(self, answer, pattern): + """ + Assert that the answer matches the expected pattern. + + Args: + answer: The actual answer from the chat assistant + pattern: Regular expression pattern to match + """ + assert re.search(pattern, answer, re.IGNORECASE), ( + f"Answer does not match expected pattern '{pattern}'.\n" + f"Answer: {answer}" + ) From 59f3da2bdfe3cbcae25895e196610387e07813a7 Mon Sep 17 00:00:00 2001 From: balibabu Date: Tue, 20 Jan 2026 09:47:16 +0800 Subject: [PATCH 152/335] Fix: The time zone is unable to update properly in the database #12696 (#12704) ### What problem does this PR solve? Fix: The time zone is unable to update properly in the database #12696 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/pages/user-setting/profile/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/src/pages/user-setting/profile/index.tsx b/web/src/pages/user-setting/profile/index.tsx index 5fd2f80b4e5..8b496a9d503 100644 --- a/web/src/pages/user-setting/profile/index.tsx +++ b/web/src/pages/user-setting/profile/index.tsx @@ -1,6 +1,7 @@ // src/components/ProfilePage.tsx import { AvatarUpload } from '@/components/avatar-upload'; import PasswordInput from '@/components/originui/password-input'; +import { SelectWithSearch } from '@/components/originui/select-with-search'; import Spotlight from '@/components/spotlight'; import { Button } from '@/components/ui/button'; import { @@ -13,7 +14,6 @@ import { } from '@/components/ui/form'; import { Input } from '@/components/ui/input'; import { Modal } from '@/components/ui/modal/modal'; -import { RAGFlowSelect } from '@/components/ui/select'; import { useTranslate } from '@/hooks/common-hooks'; import { TimezoneList } from '@/pages/user-setting/constants'; import { zodResolver } from '@hookform/resolvers/zod'; @@ -276,12 +276,12 @@ const ProfilePage: FC = () => { {t('timezone')} - { return { value: timeStr, label: timeStr }; })} placeholder="Select a timeZone" - onValueChange={field.onChange} + onChange={field.onChange} value={field.value} />
    From 1b1554c5631849b51209e51d8734105ea0b0f872 Mon Sep 17 00:00:00 2001 From: writinwaters <93570324+writinwaters@users.noreply.github.com> Date: Tue, 20 Jan 2026 09:48:32 +0800 Subject: [PATCH 153/335] Docs: Added ingestion pipeline quickstart (#12708) ### What problem does this PR solve? Added ingestion pipeline quickstart ### Type of change - [x] Documentation Update --- .../agent/agent_quickstarts/_category_.json | 11 ++ .../ingestion_pipeline_quickstart.md | 133 ++++++++++++++++++ docs/guides/chat/set_chat_variables.md | 2 +- 3 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 docs/guides/agent/agent_quickstarts/_category_.json create mode 100644 docs/guides/agent/agent_quickstarts/ingestion_pipeline_quickstart.md diff --git a/docs/guides/agent/agent_quickstarts/_category_.json b/docs/guides/agent/agent_quickstarts/_category_.json new file mode 100644 index 00000000000..fc5ce9c0ac6 --- /dev/null +++ b/docs/guides/agent/agent_quickstarts/_category_.json @@ -0,0 +1,11 @@ +{ + "label": "Quickstarts", + "position": 2, + "link": { + "type": "generated-index", + "description": "Agent-specific quickstart" + }, + "customProps": { + "categoryIcon": "LucideRocket" + } +} diff --git a/docs/guides/agent/agent_quickstarts/ingestion_pipeline_quickstart.md b/docs/guides/agent/agent_quickstarts/ingestion_pipeline_quickstart.md new file mode 100644 index 00000000000..452463e8cdb --- /dev/null +++ b/docs/guides/agent/agent_quickstarts/ingestion_pipeline_quickstart.md @@ -0,0 +1,133 @@ +--- +sidebar_position: 5 +slug: /ingestion_pipeline_quickstart +sidebar_custom_props: { + categoryIcon: LucideRoute +} +--- + +# Ingestion pipeline quickstart + +RAGFlow's ingestion pipeline is a customizable, step-by-step workflow that prepares your documents for high-quality AI retrieval and answering. You can think of it as building blocks: you connect different processing "components" to create a pipeline tailored to your specific documents and needs. + +--- + +RAGFlow is an open-source RAG platform with strong document processing capabilities. Its built-in module, DeepDoc, uses intelligent parsing to split documents for accurate retrieval. To handle diverse real-world needs—like varied file sources, complex layouts, and richer semantics—RAGFlow now introduces the *ingestion pipeline*. + +The ingestion pipeline lets you customize every step of document processing: + +- Apply different parsing and splitting rules per scenario +- Add preprocessing like summarization or keyword extraction +- Connect to cloud drives and online data sources +- Use advanced layout-aware models for tables and mixed content + +This flexible pipeline adapts to your data, improving answer quality in RAG. + +## 1. Understand the core pipeline components + +- **Parser** component: Reads and understands your files (PDFs, images, emails, etc.), extracting text and structure. +- **Transformer** component: Enhances text by using AI to add summaries, keywords, or questions to improve search. +- **Chunker** component: Splits long text into optimal-sized segments ("chunks") for better AI retrieval. +- **Indexer** component: The final step. Sends the processed data to the document engine (supports hybrid full-text and vector search). + +## 2. Create an ingestion pipeline + +1. Go to the **Agent** page. +2. Click **Create agent** and start from a blank canvas or a pre-built template (recommended for beginners). +3. On the canvas, drag and connect components from the right-side panel to design your flow (e.g., Parser → Chunker → Transformer → Indexer). + +*Now let's build a typical ingestion pipeline!* + +## 3. Configure Parser component + +A **Parser** component converts your files into structured text while preserving layout, tables, headers, and other formatting. Its supported files 8 categories, 23+ formats including PDF, Image, Audio, Video, Email, Spreadsheet (Excel), Word, PPT, HTML, and Markdown. The following are some key configurations: + +- For PDF files, choose one of the following: + - **DeepDoc** (Default): RAGFlow's built-in model. Best for scanned documents or complex layouts with tables. + - **MinerU**: Industry-leading for complex elements like mathematical formulas and intricate layouts. + - **Naive**: Simple text extraction. Use for clean, text-based PDFs without complex elements. +- For image files: Default uses OCR. Can also configure Vision Language Models (VLMs) for advanced visual understanding. +- For Email Files: Select specific fields to parse (e.g., "subject", "body") for precise extraction. +- For Spreadsheets: Outputs in HTML format, preserving row/column structure. +- For Word/PPT: Outputs in JSON format, retaining document hierarchy (titles, paragraphs, slides). +- For Text & Markup (HTML/MD): Automatically strips formatting tags, outputting clean text. + +![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/parser1.png) +![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/parser2.png) + +## 4. Configure Chunker component + +The chunker component splits text intelligently. It's goal is to prevent AI context window overflow and improve semantic accuracy in hybrid search. There are two core methods (Can be used sequentially): + +- By Tokens (Default): + - Chunk Size: Default is 512 tokens. Balance between retrieval quality and model compatibility. + - Overlap: Set **Overlapped percent** to duplicate end of one chunk into start of next. Improves semantic continuity. + - Separators: Default uses `\n` (newlines) to split at natural paragraph boundaries first, avoiding mid-sentence cuts. +- By Title (Hierarchical): + - Best for structured documents like manuals, papers, legal contracts. + - System splits document by chapter/section structure. Each chunk represents a complete structural unit. + +:::caution IMPORTANT +In the current design, if using both Token and Title methods, connect the **Token chunker** component first, then **Title chunker** component. Connecting **Title chunker** directly to **Parser** may cause format errors for Email, Image, Spreadsheet, and Text files. +::: + +## 5. Configure Transformer component + +A **Transformer** component is designed to bridge the "Semantic Gap". Generally speaking, it uses AI models to add semantic metadata, making your content more discoverable during retrieval. It has four generation types: + +- Summary: Create concise overviews. +- Keywords: Extract key terms. +- Questions: Generate questions each text chunk can answer. +- Metadata: Custom metadata extraction. + +If you have multiple **Transformers**, ensure that you separate **Transformer** components for each function (e.g., one for Summary, another for Keywords). + +The following are some key configurations: + +- Model modes: (choose one) + - Improvise: More creative, good for question generation. + - Precise: Strictly faithful to text, good for Summary/Keyword extraction. + - Balance: Middle ground for most scenarios. +- Prompt engineering: System prompts for each generation type are open and customizable. +- Connection: **Transformer** can connect after **Parser** (processes whole document) OR after **Chunker** (processes each chunk). +- Variable referencing: The node doesn't auto-acquire content. In the User prompt, manually reference upstream variables by typing `/` and selecting the specific output (e.g., `/{Parser.output}` or `/{Chunker.output}`). +- Series connection: When chaining **Transformers**, the second **Transformer** component will process the output of the first (e.g., generate Keywords from a Summary) if variables are correctly referenced. + +![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/transformer1.png) +![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/transformer2.png) +![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/transformer3.png) + +## 6. Configure Indexer component + +The **Indexer** component indexes for optimal retrieval. It is the final step writes processed data to the search engine (such as Infinity, Elasticsearch, OpenSearch). The following are some key configurations: + +- Search methods: + - Full-text: Keyword search for exact matches (codes, names). + - Embedding: Semantic search using vector similarity. + - Hybrid (Recommended): Both methods combined for best recall. +- Retrieval Strategy: + - Processed text (Default): Indexes the chunked text. + - Questions: Indexes generated questions. Often yields higher similarity matching than text-to-text. + - Augmented context: Indexes summaries instead of raw text. Good for broad topic matching. +- Filename weight: Slider to include document filename as semantic information in retrieval. +- Embedding model: Automatically uses the model set when creating the dataset. + +![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/indexer.png) + +:::caution IMPORTANT +To search across multiple datasets simultaneously, all selected datasets must use the same embedding model. +::: + +## 7. Test run + +Click **Run** on your pipeline canvas to upload a sample file and see the step-by-step results. + +## 8. Connect pipeline to a dataset + +1. When creating or editing a dataset, find the **Ingestion pipeline** section. +2. Click **Choose pipeline** and select your saved pipeline. + +![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/dataset_ingestion_settings.png) + +*Now, any files uploaded to this dataset will be processed by your custom pipeline.* + diff --git a/docs/guides/chat/set_chat_variables.md b/docs/guides/chat/set_chat_variables.md index ac5559d605a..a9bd9dcdcb8 100644 --- a/docs/guides/chat/set_chat_variables.md +++ b/docs/guides/chat/set_chat_variables.md @@ -19,7 +19,7 @@ In RAGFlow, variables are closely linked with the system prompt. When you add a ## Where to set variables -![set_variables](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/chat_variables.jpg) +![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/chat_variables.jpg) ## 1. Manage variables From f367189703b2d7fd90c7a58930027e790ef1abeb Mon Sep 17 00:00:00 2001 From: "E.G" <146701565+GlobalStar117@users.noreply.github.com> Date: Tue, 20 Jan 2026 15:24:20 +1100 Subject: [PATCH 154/335] fix(raptor): handle missing vector fields gracefully (#12713) ## Summary This PR fixes a `KeyError` crash when running RAPTOR tasks on documents that don't have the expected vector field. ## Related Issue Fixes https://github.com/infiniflow/ragflow/issues/12675 ## Problem When running RAPTOR tasks, the code assumes all chunks have the vector field `q__vec` (e.g., `q_1024_vec`). However, chunks may not have this field if: 1. They were indexed with a **different embedding model** (different vector size) 2. The embedding step **failed silently** during initial parsing 3. The document was parsed before the current embedding model was configured This caused a crash: ``` KeyError: 'q_1024_vec' ``` ## Solution Added defensive validation in `run_raptor_for_kb()`: 1. **Check for vector field existence** before accessing it 2. **Skip chunks** that don't have the required vector field instead of crashing 3. **Log warnings** for skipped chunks with actionable guidance 4. **Provide informative error messages** suggesting users re-parse documents with the current embedding model 5. **Handle both scopes** (`file` and `kb` modes) ## Changes - `rag/svr/task_executor.py`: Added validation and error handling in `run_raptor_for_kb()` ## Testing 1. Create a knowledge base with an embedding model 2. Parse documents 3. Change the embedding model to one with a different vector size 4. Run RAPTOR task 5. **Before**: Crashes with `KeyError` 6. **After**: Gracefully skips incompatible chunks with informative warnings --- Co-authored-by: GlobalStar117 --- rag/svr/task_executor.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/rag/svr/task_executor.py b/rag/svr/task_executor.py index cf2a37bea07..15db3a8a76f 100644 --- a/rag/svr/task_executor.py +++ b/rag/svr/task_executor.py @@ -806,20 +806,49 @@ async def generate(chunks, did): if raptor_config.get("scope", "file") == "file": for x, doc_id in enumerate(doc_ids): chunks = [] + skipped_chunks = 0 for d in settings.retriever.chunk_list(doc_id, row["tenant_id"], [str(row["kb_id"])], fields=["content_with_weight", vctr_nm], sort_by_position=True): + # Skip chunks that don't have the required vector field (may have been indexed with different embedding model) + if vctr_nm not in d or d[vctr_nm] is None: + skipped_chunks += 1 + logging.warning(f"RAPTOR: Chunk missing vector field '{vctr_nm}' in doc {doc_id}, skipping") + continue chunks.append((d["content_with_weight"], np.array(d[vctr_nm]))) + + if skipped_chunks > 0: + callback(msg=f"[WARN] Skipped {skipped_chunks} chunks without vector field '{vctr_nm}' for doc {doc_id}. Consider re-parsing the document with the current embedding model.") + + if not chunks: + logging.warning(f"RAPTOR: No valid chunks with vectors found for doc {doc_id}") + callback(msg=f"[WARN] No valid chunks with vectors found for doc {doc_id}, skipping") + continue + await generate(chunks, doc_id) callback(prog=(x + 1.) / len(doc_ids)) else: chunks = [] + skipped_chunks = 0 for doc_id in doc_ids: for d in settings.retriever.chunk_list(doc_id, row["tenant_id"], [str(row["kb_id"])], fields=["content_with_weight", vctr_nm], sort_by_position=True): + # Skip chunks that don't have the required vector field + if vctr_nm not in d or d[vctr_nm] is None: + skipped_chunks += 1 + logging.warning(f"RAPTOR: Chunk missing vector field '{vctr_nm}' in doc {doc_id}, skipping") + continue chunks.append((d["content_with_weight"], np.array(d[vctr_nm]))) + if skipped_chunks > 0: + callback(msg=f"[WARN] Skipped {skipped_chunks} chunks without vector field '{vctr_nm}'. Consider re-parsing documents with the current embedding model.") + + if not chunks: + logging.error(f"RAPTOR: No valid chunks with vectors found in any document for kb {row['kb_id']}") + callback(msg=f"[ERROR] No valid chunks with vectors found. Please ensure documents are parsed with the current embedding model (vector size: {vector_size}).") + return res, tk_count + await generate(chunks, fake_doc_id) return res, tk_count From 120648ac81c5e1ddef61eb8949a39631a62acf2c Mon Sep 17 00:00:00 2001 From: lys1313013 Date: Tue, 20 Jan 2026 12:24:54 +0800 Subject: [PATCH 155/335] fix: inaccurate error message when uploading multiple files containing an unsupported file type (#12711) ### What problem does this PR solve? When uploading multiple files at once, if any of the files are of an unsupported type and the blob is not removed, it triggers a TypeError('Object of type bytes is not JSON serializable') exception. This prevents the frontend from responding properly. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/document_app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/api/apps/document_app.py b/api/apps/document_app.py index 257506ec80b..1267db9bc9b 100644 --- a/api/apps/document_app.py +++ b/api/apps/document_app.py @@ -87,6 +87,7 @@ def _close_file_objs(objs): err, files = await asyncio.to_thread(FileService.upload_document, kb, file_objs, current_user.id) if err: + files = [f[0] for f in files] if files else [] return get_json_result(data=files, message="\n".join(err), code=RetCode.SERVER_ERROR) if not files: From 927db0b3732796930573db33609e960288410109 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Tue, 20 Jan 2026 13:29:37 +0800 Subject: [PATCH 156/335] =?UTF-8?q?Refa:=20asyncio.to=5Fthread=20to=20Thre?= =?UTF-8?q?adPoolExecutor=20to=20break=20thread=20limitat=E2=80=A6=20(#127?= =?UTF-8?q?16)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Type of change - [x] Refactoring --- agent/component/base.py | 7 +++- agent/tools/base.py | 11 ++++-- api/apps/canvas_app.py | 19 +++++++---- api/apps/chunk_app.py | 20 ++++++----- api/apps/document_app.py | 20 +++++------ api/apps/file_app.py | 34 +++++++++---------- api/apps/kb_app.py | 21 +++++++----- api/apps/mcp_server_app.py | 23 ++++++------- api/apps/sdk/files.py | 6 ++-- api/utils/api_utils.py | 29 ++++++++++------ common/misc_utils.py | 34 ++++++++++++++++--- deepdoc/parser/pdf_parser.py | 6 +++- deepdoc/vision/t_ocr.py | 8 +++-- docker/.env | 4 +++ graphrag/entity_resolution.py | 4 ++- .../general/community_reports_extractor.py | 6 ++-- graphrag/general/extractor.py | 3 +- graphrag/general/graph_extractor.py | 10 +++--- graphrag/general/index.py | 9 ++--- graphrag/general/mind_map_extractor.py | 3 +- graphrag/light/graph_extractor.py | 11 +++--- graphrag/utils.py | 19 ++++++----- rag/flow/parser/parser.py | 6 +++- rag/flow/tokenizer/tokenizer.py | 4 +-- rag/llm/chat_model.py | 11 +++--- rag/llm/cv_model.py | 15 ++++---- rag/nlp/search.py | 12 +++---- rag/raptor.py | 11 +++--- rag/svr/task_executor.py | 28 ++++++++------- rag/utils/base64_image.py | 9 +++-- 30 files changed, 246 insertions(+), 157 deletions(-) diff --git a/agent/component/base.py b/agent/component/base.py index 264f3972a34..9bceb4ce6d9 100644 --- a/agent/component/base.py +++ b/agent/component/base.py @@ -27,6 +27,10 @@ from agent import settings from common.connection_utils import timeout + + +from common.misc_utils import thread_pool_exec + _FEEDED_DEPRECATED_PARAMS = "_feeded_deprecated_params" _DEPRECATED_PARAMS = "_deprecated_params" _USER_FEEDED_PARAMS = "_user_feeded_params" @@ -379,6 +383,7 @@ def __str__(self): def __init__(self, canvas, id, param: ComponentParamBase): from agent.canvas import Graph # Local import to avoid cyclic dependency + assert isinstance(canvas, Graph), "canvas must be an instance of Canvas" self._canvas = canvas self._id = id @@ -430,7 +435,7 @@ async def invoke_async(self, **kwargs) -> dict[str, Any]: elif asyncio.iscoroutinefunction(self._invoke): await self._invoke(**kwargs) else: - await asyncio.to_thread(self._invoke, **kwargs) + await thread_pool_exec(self._invoke, **kwargs) except Exception as e: if self.get_exception_default_value(): self.set_exception_default_value() diff --git a/agent/tools/base.py b/agent/tools/base.py index ac8336f5d32..1f629a252bc 100644 --- a/agent/tools/base.py +++ b/agent/tools/base.py @@ -27,6 +27,10 @@ from timeit import default_timer as timer + + +from common.misc_utils import thread_pool_exec + class ToolParameter(TypedDict): type: str description: str @@ -56,12 +60,12 @@ async def tool_call_async(self, name: str, arguments: dict[str, Any]) -> Any: st = timer() tool_obj = self.tools_map[name] if isinstance(tool_obj, MCPToolCallSession): - resp = await asyncio.to_thread(tool_obj.tool_call, name, arguments, 60) + resp = await thread_pool_exec(tool_obj.tool_call, name, arguments, 60) else: if hasattr(tool_obj, "invoke_async") and asyncio.iscoroutinefunction(tool_obj.invoke_async): resp = await tool_obj.invoke_async(**arguments) else: - resp = await asyncio.to_thread(tool_obj.invoke, **arguments) + resp = await thread_pool_exec(tool_obj.invoke, **arguments) self.callback(name, arguments, resp, elapsed_time=timer()-st) return resp @@ -122,6 +126,7 @@ def get_meta(self): class ToolBase(ComponentBase): def __init__(self, canvas, id, param: ComponentParamBase): from agent.canvas import Canvas # Local import to avoid cyclic dependency + assert isinstance(canvas, Canvas), "canvas must be an instance of Canvas" self._canvas = canvas self._id = id @@ -164,7 +169,7 @@ async def invoke_async(self, **kwargs): elif asyncio.iscoroutinefunction(self._invoke): res = await self._invoke(**kwargs) else: - res = await asyncio.to_thread(self._invoke, **kwargs) + res = await thread_pool_exec(self._invoke, **kwargs) except Exception as e: self._param.outputs["_ERROR"] = {"value": str(e)} logging.exception(e) diff --git a/api/apps/canvas_app.py b/api/apps/canvas_app.py index 21bd237894f..14dc52a4499 100644 --- a/api/apps/canvas_app.py +++ b/api/apps/canvas_app.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import asyncio import inspect import json import logging @@ -29,9 +28,14 @@ from api.db.services.user_service import TenantService from api.db.services.user_canvas_version import UserCanvasVersionService from common.constants import RetCode -from common.misc_utils import get_uuid -from api.utils.api_utils import get_json_result, server_error_response, validate_request, get_data_error_result, \ - get_request_json +from common.misc_utils import get_uuid, thread_pool_exec +from api.utils.api_utils import ( + get_json_result, + server_error_response, + validate_request, + get_data_error_result, + get_request_json, +) from agent.canvas import Canvas from peewee import MySQLDatabase, PostgresqlDatabase from api.db.db_models import APIToken, Task @@ -132,12 +136,12 @@ async def run(): files = req.get("files", []) inputs = req.get("inputs", {}) user_id = req.get("user_id", current_user.id) - if not await asyncio.to_thread(UserCanvasService.accessible, req["id"], current_user.id): + if not await thread_pool_exec(UserCanvasService.accessible, req["id"], current_user.id): return get_json_result( data=False, message='Only owner of canvas authorized for this operation.', code=RetCode.OPERATING_ERROR) - e, cvs = await asyncio.to_thread(UserCanvasService.get_by_id, req["id"]) + e, cvs = await thread_pool_exec(UserCanvasService.get_by_id, req["id"]) if not e: return get_data_error_result(message="canvas not found.") @@ -147,7 +151,7 @@ async def run(): if cvs.canvas_category == CanvasCategory.DataFlow: task_id = get_uuid() Pipeline(cvs.dsl, tenant_id=current_user.id, doc_id=CANVAS_DEBUG_DOC_ID, task_id=task_id, flow_id=req["id"]) - ok, error_message = await asyncio.to_thread(queue_dataflow, user_id, req["id"], task_id, CANVAS_DEBUG_DOC_ID, files[0], 0) + ok, error_message = await thread_pool_exec(queue_dataflow, user_id, req["id"], task_id, CANVAS_DEBUG_DOC_ID, files[0], 0) if not ok: return get_data_error_result(message=error_message) return get_json_result(data={"message_id": task_id}) @@ -540,6 +544,7 @@ def sessions(canvas_id): @login_required def prompts(): from rag.prompts.generator import ANALYZE_TASK_SYSTEM, ANALYZE_TASK_USER, NEXT_STEP, REFLECT, CITATION_PROMPT_TEMPLATE + return get_json_result(data={ "task_analysis": ANALYZE_TASK_SYSTEM +"\n\n"+ ANALYZE_TASK_USER, "plan_generation": NEXT_STEP, diff --git a/api/apps/chunk_app.py b/api/apps/chunk_app.py index 67627825451..e3ddaf224b7 100644 --- a/api/apps/chunk_app.py +++ b/api/apps/chunk_app.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import asyncio import datetime import json import re @@ -27,8 +26,14 @@ from common.metadata_utils import apply_meta_data_filter from api.db.services.search_service import SearchService from api.db.services.user_service import UserTenantService -from api.utils.api_utils import get_data_error_result, get_json_result, server_error_response, validate_request, \ - get_request_json +from api.utils.api_utils import ( + get_data_error_result, + get_json_result, + server_error_response, + validate_request, + get_request_json, +) +from common.misc_utils import thread_pool_exec from rag.app.qa import beAdoc, rmPrefix from rag.app.tag import label_question from rag.nlp import rag_tokenizer, search @@ -38,7 +43,6 @@ from common import settings from api.apps import login_required, current_user - @manager.route('/list', methods=['POST']) # noqa: F821 @login_required @validate_request("doc_id") @@ -190,7 +194,7 @@ def _set_sync(): settings.STORAGE_IMPL.put(bkt, name, image_binary) return get_json_result(data=True) - return await asyncio.to_thread(_set_sync) + return await thread_pool_exec(_set_sync) except Exception as e: return server_error_response(e) @@ -213,7 +217,7 @@ def _switch_sync(): return get_data_error_result(message="Index updating failure") return get_json_result(data=True) - return await asyncio.to_thread(_switch_sync) + return await thread_pool_exec(_switch_sync) except Exception as e: return server_error_response(e) @@ -255,7 +259,7 @@ def _rm_sync(): settings.STORAGE_IMPL.rm(doc.kb_id, cid) return get_json_result(data=True) - return await asyncio.to_thread(_rm_sync) + return await thread_pool_exec(_rm_sync) except Exception as e: return server_error_response(e) @@ -314,7 +318,7 @@ def _create_sync(): doc.id, doc.kb_id, c, 1, 0) return get_json_result(data={"chunk_id": chunck_id}) - return await asyncio.to_thread(_create_sync) + return await thread_pool_exec(_create_sync) except Exception as e: return server_error_response(e) diff --git a/api/apps/document_app.py b/api/apps/document_app.py index 1267db9bc9b..2b21475795f 100644 --- a/api/apps/document_app.py +++ b/api/apps/document_app.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License # -import asyncio import json import os.path import pathlib @@ -33,12 +32,13 @@ from api.db.services.knowledgebase_service import KnowledgebaseService from api.db.services.task_service import TaskService, cancel_all_task_of from api.db.services.user_service import UserTenantService -from common.misc_utils import get_uuid +from common.misc_utils import get_uuid, thread_pool_exec from api.utils.api_utils import ( get_data_error_result, get_json_result, server_error_response, - validate_request, get_request_json, + validate_request, + get_request_json, ) from api.utils.file_utils import filename_type, thumbnail from common.file_utils import get_project_base_directory @@ -85,7 +85,7 @@ def _close_file_objs(objs): if not check_kb_team_permission(kb, current_user.id): return get_json_result(data=False, message="No authorization.", code=RetCode.AUTHENTICATION_ERROR) - err, files = await asyncio.to_thread(FileService.upload_document, kb, file_objs, current_user.id) + err, files = await thread_pool_exec(FileService.upload_document, kb, file_objs, current_user.id) if err: files = [f[0] for f in files] if files else [] return get_json_result(data=files, message="\n".join(err), code=RetCode.SERVER_ERROR) @@ -574,7 +574,7 @@ async def rm(): if not DocumentService.accessible4deletion(doc_id, current_user.id): return get_json_result(data=False, message="No authorization.", code=RetCode.AUTHENTICATION_ERROR) - errors = await asyncio.to_thread(FileService.delete_docs, doc_ids, current_user.id) + errors = await thread_pool_exec(FileService.delete_docs, doc_ids, current_user.id) if errors: return get_json_result(data=False, message=errors, code=RetCode.SERVER_ERROR) @@ -636,7 +636,7 @@ def _run_sync(): return get_json_result(data=True) - return await asyncio.to_thread(_run_sync) + return await thread_pool_exec(_run_sync) except Exception as e: return server_error_response(e) @@ -687,7 +687,7 @@ def _rename_sync(): ) return get_json_result(data=True) - return await asyncio.to_thread(_rename_sync) + return await thread_pool_exec(_rename_sync) except Exception as e: return server_error_response(e) @@ -702,7 +702,7 @@ async def get(doc_id): return get_data_error_result(message="Document not found!") b, n = File2DocumentService.get_storage_address(doc_id=doc_id) - data = await asyncio.to_thread(settings.STORAGE_IMPL.get, b, n) + data = await thread_pool_exec(settings.STORAGE_IMPL.get, b, n) response = await make_response(data) ext = re.search(r"\.([^.]+)$", doc.name.lower()) @@ -724,7 +724,7 @@ async def get(doc_id): async def download_attachment(attachment_id): try: ext = request.args.get("ext", "markdown") - data = await asyncio.to_thread(settings.STORAGE_IMPL.get, current_user.id, attachment_id) + data = await thread_pool_exec(settings.STORAGE_IMPL.get, current_user.id, attachment_id) response = await make_response(data) response.headers.set("Content-Type", CONTENT_TYPE_MAP.get(ext, f"application/{ext}")) @@ -797,7 +797,7 @@ async def get_image(image_id): if len(arr) != 2: return get_data_error_result(message="Image not found.") bkt, nm = image_id.split("-") - data = await asyncio.to_thread(settings.STORAGE_IMPL.get, bkt, nm) + data = await thread_pool_exec(settings.STORAGE_IMPL.get, bkt, nm) response = await make_response(data) response.headers.set("Content-Type", "image/JPEG") return response diff --git a/api/apps/file_app.py b/api/apps/file_app.py index 1ce5d4caed9..ec535ad5579 100644 --- a/api/apps/file_app.py +++ b/api/apps/file_app.py @@ -14,7 +14,6 @@ # limitations under the License # import logging -import asyncio import os import pathlib import re @@ -25,7 +24,7 @@ from api.db.services.document_service import DocumentService from api.db.services.file2document_service import File2DocumentService from api.utils.api_utils import server_error_response, get_data_error_result, validate_request -from common.misc_utils import get_uuid +from common.misc_utils import get_uuid, thread_pool_exec from common.constants import RetCode, FileSource from api.db import FileType from api.db.services import duplicate_name @@ -35,7 +34,6 @@ from api.utils.web_utils import CONTENT_TYPE_MAP from common import settings - @manager.route('/upload', methods=['POST']) # noqa: F821 @login_required # @validate_request("parent_id") @@ -65,7 +63,7 @@ async def upload(): async def _handle_single_file(file_obj): MAX_FILE_NUM_PER_USER: int = int(os.environ.get('MAX_FILE_NUM_PER_USER', 0)) - if 0 < MAX_FILE_NUM_PER_USER <= await asyncio.to_thread(DocumentService.get_doc_count, current_user.id): + if 0 < MAX_FILE_NUM_PER_USER <= await thread_pool_exec(DocumentService.get_doc_count, current_user.id): return get_data_error_result( message="Exceed the maximum file number of a free user!") # split file name path @@ -77,35 +75,35 @@ async def _handle_single_file(file_obj): file_len = len(file_obj_names) # get folder - file_id_list = await asyncio.to_thread(FileService.get_id_list_by_id, pf_id, file_obj_names, 1, [pf_id]) + file_id_list = await thread_pool_exec(FileService.get_id_list_by_id, pf_id, file_obj_names, 1, [pf_id]) len_id_list = len(file_id_list) # create folder if file_len != len_id_list: - e, file = await asyncio.to_thread(FileService.get_by_id, file_id_list[len_id_list - 1]) + e, file = await thread_pool_exec(FileService.get_by_id, file_id_list[len_id_list - 1]) if not e: return get_data_error_result(message="Folder not found!") - last_folder = await asyncio.to_thread(FileService.create_folder, file, file_id_list[len_id_list - 1], file_obj_names, + last_folder = await thread_pool_exec(FileService.create_folder, file, file_id_list[len_id_list - 1], file_obj_names, len_id_list) else: - e, file = await asyncio.to_thread(FileService.get_by_id, file_id_list[len_id_list - 2]) + e, file = await thread_pool_exec(FileService.get_by_id, file_id_list[len_id_list - 2]) if not e: return get_data_error_result(message="Folder not found!") - last_folder = await asyncio.to_thread(FileService.create_folder, file, file_id_list[len_id_list - 2], file_obj_names, + last_folder = await thread_pool_exec(FileService.create_folder, file, file_id_list[len_id_list - 2], file_obj_names, len_id_list) # file type filetype = filename_type(file_obj_names[file_len - 1]) location = file_obj_names[file_len - 1] - while await asyncio.to_thread(settings.STORAGE_IMPL.obj_exist, last_folder.id, location): + while await thread_pool_exec(settings.STORAGE_IMPL.obj_exist, last_folder.id, location): location += "_" - blob = await asyncio.to_thread(file_obj.read) - filename = await asyncio.to_thread( + blob = await thread_pool_exec(file_obj.read) + filename = await thread_pool_exec( duplicate_name, FileService.query, name=file_obj_names[file_len - 1], parent_id=last_folder.id) - await asyncio.to_thread(settings.STORAGE_IMPL.put, last_folder.id, location, blob) + await thread_pool_exec(settings.STORAGE_IMPL.put, last_folder.id, location, blob) file_data = { "id": get_uuid(), "parent_id": last_folder.id, @@ -116,7 +114,7 @@ async def _handle_single_file(file_obj): "location": location, "size": len(blob), } - inserted = await asyncio.to_thread(FileService.insert, file_data) + inserted = await thread_pool_exec(FileService.insert, file_data) return inserted.to_json() for file_obj in file_objs: @@ -301,7 +299,7 @@ def _rm_sync(): return get_json_result(data=True) - return await asyncio.to_thread(_rm_sync) + return await thread_pool_exec(_rm_sync) except Exception as e: return server_error_response(e) @@ -357,10 +355,10 @@ async def get(file_id): if not check_file_team_permission(file, current_user.id): return get_json_result(data=False, message='No authorization.', code=RetCode.AUTHENTICATION_ERROR) - blob = await asyncio.to_thread(settings.STORAGE_IMPL.get, file.parent_id, file.location) + blob = await thread_pool_exec(settings.STORAGE_IMPL.get, file.parent_id, file.location) if not blob: b, n = File2DocumentService.get_storage_address(file_id=file_id) - blob = await asyncio.to_thread(settings.STORAGE_IMPL.get, b, n) + blob = await thread_pool_exec(settings.STORAGE_IMPL.get, b, n) response = await make_response(blob) ext = re.search(r"\.([^.]+)$", file.name.lower()) @@ -460,7 +458,7 @@ def _move_sync(): _move_entry_recursive(file, dest_folder) return get_json_result(data=True) - return await asyncio.to_thread(_move_sync) + return await thread_pool_exec(_move_sync) except Exception as e: return server_error_response(e) diff --git a/api/apps/kb_app.py b/api/apps/kb_app.py index e7d86594d14..7a57ab949d4 100644 --- a/api/apps/kb_app.py +++ b/api/apps/kb_app.py @@ -17,7 +17,6 @@ import logging import random import re -import asyncio from quart import request import numpy as np @@ -30,8 +29,15 @@ from api.db.services.pipeline_operation_log_service import PipelineOperationLogService from api.db.services.task_service import TaskService, GRAPH_RAPTOR_FAKE_DOC_ID from api.db.services.user_service import TenantService, UserTenantService -from api.utils.api_utils import get_error_data_result, server_error_response, get_data_error_result, validate_request, not_allowed_parameters, \ - get_request_json +from api.utils.api_utils import ( + get_error_data_result, + server_error_response, + get_data_error_result, + validate_request, + not_allowed_parameters, + get_request_json, +) +from common.misc_utils import thread_pool_exec from api.db import VALID_FILE_TYPES from api.db.services.knowledgebase_service import KnowledgebaseService from api.db.db_models import File @@ -44,7 +50,6 @@ from common.doc_store.doc_store_base import OrderByExpr from api.apps import login_required, current_user - @manager.route('/create', methods=['post']) # noqa: F821 @login_required @validate_request("name") @@ -90,7 +95,7 @@ async def update(): message="The chunking method Tag has not been supported by Infinity yet.", data=False, ) - if "pagerank" in req: + if "pagerank" in req and req["pagerank"] > 0: return get_json_result( code=RetCode.DATA_ERROR, message="'pagerank' can only be set when doc_engine is elasticsearch", @@ -144,7 +149,7 @@ async def update(): if kb.pagerank != req.get("pagerank", 0): if req.get("pagerank", 0) > 0: - await asyncio.to_thread( + await thread_pool_exec( settings.docStoreConn.update, {"kb_id": kb.id}, {PAGERANK_FLD: req["pagerank"]}, @@ -153,7 +158,7 @@ async def update(): ) else: # Elasticsearch requires PAGERANK_FLD be non-zero! - await asyncio.to_thread( + await thread_pool_exec( settings.docStoreConn.update, {"exists": PAGERANK_FLD}, {"remove": PAGERANK_FLD}, @@ -312,7 +317,7 @@ def _rm_sync(): settings.STORAGE_IMPL.remove_bucket(kb.id) return get_json_result(data=True) - return await asyncio.to_thread(_rm_sync) + return await thread_pool_exec(_rm_sync) except Exception as e: return server_error_response(e) diff --git a/api/apps/mcp_server_app.py b/api/apps/mcp_server_app.py index 62ae2e3c06b..187560d626b 100644 --- a/api/apps/mcp_server_app.py +++ b/api/apps/mcp_server_app.py @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import asyncio - from quart import Response, request from api.apps import current_user, login_required @@ -23,12 +21,11 @@ from api.db.services.user_service import TenantService from common.constants import RetCode, VALID_MCP_SERVER_TYPES -from common.misc_utils import get_uuid +from common.misc_utils import get_uuid, thread_pool_exec from api.utils.api_utils import get_data_error_result, get_json_result, get_mcp_tools, get_request_json, server_error_response, validate_request from api.utils.web_utils import get_float, safe_json_parse from common.mcp_tool_call_conn import MCPToolCallSession, close_multiple_mcp_toolcall_sessions - @manager.route("/list", methods=["POST"]) # noqa: F821 @login_required async def list_mcp() -> Response: @@ -108,7 +105,7 @@ async def create() -> Response: return get_data_error_result(message="Tenant not found.") mcp_server = MCPServer(id=server_name, name=server_name, url=url, server_type=server_type, variables=variables, headers=headers) - server_tools, err_message = await asyncio.to_thread(get_mcp_tools, [mcp_server], timeout) + server_tools, err_message = await thread_pool_exec(get_mcp_tools, [mcp_server], timeout) if err_message: return get_data_error_result(err_message) @@ -160,7 +157,7 @@ async def update() -> Response: req["id"] = mcp_id mcp_server = MCPServer(id=server_name, name=server_name, url=url, server_type=server_type, variables=variables, headers=headers) - server_tools, err_message = await asyncio.to_thread(get_mcp_tools, [mcp_server], timeout) + server_tools, err_message = await thread_pool_exec(get_mcp_tools, [mcp_server], timeout) if err_message: return get_data_error_result(err_message) @@ -244,7 +241,7 @@ async def import_multiple() -> Response: headers = {"authorization_token": config["authorization_token"]} if "authorization_token" in config else {} variables = {k: v for k, v in config.items() if k not in {"type", "url", "headers"}} mcp_server = MCPServer(id=new_name, name=new_name, url=config["url"], server_type=config["type"], variables=variables, headers=headers) - server_tools, err_message = await asyncio.to_thread(get_mcp_tools, [mcp_server], timeout) + server_tools, err_message = await thread_pool_exec(get_mcp_tools, [mcp_server], timeout) if err_message: results.append({"server": base_name, "success": False, "message": err_message}) continue @@ -324,7 +321,7 @@ async def list_tools() -> Response: tool_call_sessions.append(tool_call_session) try: - tools = await asyncio.to_thread(tool_call_session.get_tools, timeout) + tools = await thread_pool_exec(tool_call_session.get_tools, timeout) except Exception as e: return get_data_error_result(message=f"MCP list tools error: {e}") @@ -341,7 +338,7 @@ async def list_tools() -> Response: return server_error_response(e) finally: # PERF: blocking call to close sessions — consider moving to background thread or task queue - await asyncio.to_thread(close_multiple_mcp_toolcall_sessions, tool_call_sessions) + await thread_pool_exec(close_multiple_mcp_toolcall_sessions, tool_call_sessions) @manager.route("/test_tool", methods=["POST"]) # noqa: F821 @@ -368,10 +365,10 @@ async def test_tool() -> Response: tool_call_session = MCPToolCallSession(mcp_server, mcp_server.variables) tool_call_sessions.append(tool_call_session) - result = await asyncio.to_thread(tool_call_session.tool_call, tool_name, arguments, timeout) + result = await thread_pool_exec(tool_call_session.tool_call, tool_name, arguments, timeout) # PERF: blocking call to close sessions — consider moving to background thread or task queue - await asyncio.to_thread(close_multiple_mcp_toolcall_sessions, tool_call_sessions) + await thread_pool_exec(close_multiple_mcp_toolcall_sessions, tool_call_sessions) return get_json_result(data=result) except Exception as e: return server_error_response(e) @@ -425,12 +422,12 @@ async def test_mcp() -> Response: tool_call_session = MCPToolCallSession(mcp_server, mcp_server.variables) try: - tools = await asyncio.to_thread(tool_call_session.get_tools, timeout) + tools = await thread_pool_exec(tool_call_session.get_tools, timeout) except Exception as e: return get_data_error_result(message=f"Test MCP error: {e}") finally: # PERF: blocking call to close sessions — consider moving to background thread or task queue - await asyncio.to_thread(close_multiple_mcp_toolcall_sessions, [tool_call_session]) + await thread_pool_exec(close_multiple_mcp_toolcall_sessions, [tool_call_session]) for tool in tools: tool_dict = tool.model_dump() diff --git a/api/apps/sdk/files.py b/api/apps/sdk/files.py index a618777884e..759dfae80dd 100644 --- a/api/apps/sdk/files.py +++ b/api/apps/sdk/files.py @@ -14,7 +14,6 @@ # limitations under the License. # -import asyncio import pathlib import re from quart import request, make_response @@ -24,7 +23,7 @@ from api.db.services.file2document_service import File2DocumentService from api.db.services.knowledgebase_service import KnowledgebaseService from api.utils.api_utils import get_json_result, get_request_json, server_error_response, token_required -from common.misc_utils import get_uuid +from common.misc_utils import get_uuid, thread_pool_exec from api.db import FileType from api.db.services import duplicate_name from api.db.services.file_service import FileService @@ -33,7 +32,6 @@ from common import settings from common.constants import RetCode - @manager.route('/file/upload', methods=['POST']) # noqa: F821 @token_required async def upload(tenant_id): @@ -640,7 +638,7 @@ async def get(tenant_id, file_id): async def download_attachment(tenant_id, attachment_id): try: ext = request.args.get("ext", "markdown") - data = await asyncio.to_thread(settings.STORAGE_IMPL.get, tenant_id, attachment_id) + data = await thread_pool_exec(settings.STORAGE_IMPL.get, tenant_id, attachment_id) response = await make_response(data) response.headers.set("Content-Type", CONTENT_TYPE_MAP.get(ext, f"application/{ext}")) diff --git a/api/utils/api_utils.py b/api/utils/api_utils.py index bfdb6ec72af..326fb62bc66 100644 --- a/api/utils/api_utils.py +++ b/api/utils/api_utils.py @@ -29,7 +29,8 @@ from quart import ( Response, jsonify, - request + request, + has_app_context, ) from werkzeug.exceptions import BadRequest as WerkzeugBadRequest @@ -48,9 +49,15 @@ from common.connection_utils import timeout from common.constants import RetCode from common import settings +from common.misc_utils import thread_pool_exec requests.models.complexjson.dumps = functools.partial(json.dumps, cls=CustomJSONEncoder) +def _safe_jsonify(payload: dict): + if has_app_context(): + return jsonify(payload) + return payload + async def _coerce_request_data() -> dict: """Fetch JSON body with sane defaults; fallback to form data.""" @@ -119,7 +126,7 @@ def get_data_error_result(code=RetCode.DATA_ERROR, message="Sorry! Data missing! continue else: response[key] = value - return jsonify(response) + return _safe_jsonify(response) def server_error_response(e): @@ -225,7 +232,7 @@ async def wrapper(*args, **kwargs): def get_json_result(code: RetCode = RetCode.SUCCESS, message="success", data=None): response = {"code": code, "message": message, "data": data} - return jsonify(response) + return _safe_jsonify(response) def apikey_required(func): @@ -246,16 +253,16 @@ async def decorated_function(*args, **kwargs): def build_error_result(code=RetCode.FORBIDDEN, message="success"): response = {"code": code, "message": message} - response = jsonify(response) - response.status_code = code + response = _safe_jsonify(response) + if hasattr(response, "status_code"): + response.status_code = code return response def construct_json_result(code: RetCode = RetCode.SUCCESS, message="success", data=None): if data is None: - return jsonify({"code": code, "message": message}) - else: - return jsonify({"code": code, "message": message, "data": data}) + return _safe_jsonify({"code": code, "message": message}) + return _safe_jsonify({"code": code, "message": message, "data": data}) def token_required(func): @@ -314,7 +321,7 @@ def get_result(code=RetCode.SUCCESS, message="", data=None, total=None): else: response["message"] = message or "Error" - return jsonify(response) + return _safe_jsonify(response) def get_error_data_result( @@ -328,7 +335,7 @@ def get_error_data_result( continue else: response[key] = value - return jsonify(response) + return _safe_jsonify(response) def get_error_argument_result(message="Invalid arguments"): @@ -693,7 +700,7 @@ async def _is_strong_enough(): nonlocal chat_model, embedding_model if embedding_model: await asyncio.wait_for( - asyncio.to_thread(embedding_model.encode, ["Are you strong enough!?"]), + thread_pool_exec(embedding_model.encode, ["Are you strong enough!?"]), timeout=10 ) diff --git a/common/misc_utils.py b/common/misc_utils.py index ae56fe5c484..3458861bf76 100644 --- a/common/misc_utils.py +++ b/common/misc_utils.py @@ -14,15 +14,20 @@ # limitations under the License. # +import asyncio import base64 +import functools import hashlib -import uuid -import requests -import threading +import logging +import os import subprocess import sys -import os -import logging +import threading +import uuid + +from concurrent.futures import ThreadPoolExecutor + +import requests def get_uuid(): return uuid.uuid1().hex @@ -106,3 +111,22 @@ def pip_install_torch(): logging.info("Installing pytorch") pkg_names = ["torch>=2.5.0,<3.0.0"] subprocess.check_call([sys.executable, "-m", "pip", "install", *pkg_names]) + + +def _thread_pool_executor(): + max_workers_env = os.getenv("THREAD_POOL_MAX_WORKERS", "128") + try: + max_workers = int(max_workers_env) + except ValueError: + max_workers = 128 + if max_workers < 1: + max_workers = 1 + return ThreadPoolExecutor(max_workers=max_workers) + + +async def thread_pool_exec(func, *args, **kwargs): + loop = asyncio.get_running_loop() + if kwargs: + func = functools.partial(func, *args, **kwargs) + return await loop.run_in_executor(_thread_pool_executor(), func) + return await loop.run_in_executor(_thread_pool_executor(), func, *args) diff --git a/deepdoc/parser/pdf_parser.py b/deepdoc/parser/pdf_parser.py index 613787b4803..86e44468ef8 100644 --- a/deepdoc/parser/pdf_parser.py +++ b/deepdoc/parser/pdf_parser.py @@ -43,6 +43,10 @@ from rag.prompts.generator import vision_llm_describe_prompt from common import settings + + +from common.misc_utils import thread_pool_exec + LOCK_KEY_pdfplumber = "global_shared_lock_pdfplumber" if LOCK_KEY_pdfplumber not in sys.modules: sys.modules[LOCK_KEY_pdfplumber] = threading.Lock() @@ -1114,7 +1118,7 @@ async def __img_ocr(i, id, img, chars, limiter): if limiter: async with limiter: - await asyncio.to_thread(self.__ocr, i + 1, img, chars, zoomin, id) + await thread_pool_exec(self.__ocr, i + 1, img, chars, zoomin, id) else: self.__ocr(i + 1, img, chars, zoomin, id) diff --git a/deepdoc/vision/t_ocr.py b/deepdoc/vision/t_ocr.py index d3b33b12244..58ada1b15e4 100644 --- a/deepdoc/vision/t_ocr.py +++ b/deepdoc/vision/t_ocr.py @@ -18,6 +18,10 @@ import logging import os import sys + + +from common.misc_utils import thread_pool_exec + sys.path.insert( 0, os.path.abspath( @@ -64,9 +68,9 @@ async def __ocr_thread(i, id, img, limiter = None): if limiter: async with limiter: print(f"Task {i} use device {id}") - await asyncio.to_thread(__ocr, i, id, img) + await thread_pool_exec(__ocr, i, id, img) else: - await asyncio.to_thread(__ocr, i, id, img) + await thread_pool_exec(__ocr, i, id, img) async def __ocr_launcher(): diff --git a/docker/.env b/docker/.env index c939cc8d559..791650e0466 100644 --- a/docker/.env +++ b/docker/.env @@ -269,3 +269,7 @@ DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 # RAGFLOW_CRYPTO_ENABLED=true # RAGFLOW_CRYPTO_ALGORITHM=aes-256-cbc # one of aes-256-cbc, aes-128-cbc, sm4-cbc # RAGFLOW_CRYPTO_KEY=ragflow-crypto-key + + +# Used for ThreadPoolExecutor +THREAD_POOL_MAX_WORKERS=128 \ No newline at end of file diff --git a/graphrag/entity_resolution.py b/graphrag/entity_resolution.py index a21a66aad64..ec65e84b709 100644 --- a/graphrag/entity_resolution.py +++ b/graphrag/entity_resolution.py @@ -32,6 +32,8 @@ from api.db.services.task_service import has_canceled from common.exceptions import TaskCanceledException +from common.misc_utils import thread_pool_exec + DEFAULT_RECORD_DELIMITER = "##" DEFAULT_ENTITY_INDEX_DELIMITER = "<|>" DEFAULT_RESOLUTION_RESULT_DELIMITER = "&&" @@ -211,7 +213,7 @@ async def _resolve_candidate(self, candidate_resolution_i: tuple[str, list[tuple timeout_seconds = 280 if os.environ.get("ENABLE_TIMEOUT_ASSERTION") else 1000000000 try: response = await asyncio.wait_for( - asyncio.to_thread( + thread_pool_exec( self._chat, text, [{"role": "user", "content": "Output:"}], diff --git a/graphrag/general/community_reports_extractor.py b/graphrag/general/community_reports_extractor.py index a9b5026d840..9a01f98c661 100644 --- a/graphrag/general/community_reports_extractor.py +++ b/graphrag/general/community_reports_extractor.py @@ -1,5 +1,8 @@ # Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License + +from common.misc_utils import thread_pool_exec + """ Reference: - [graphrag](https://github.com/microsoft/graphrag) @@ -26,7 +29,6 @@ from graphrag.utils import perform_variable_replacements, dict_has_keys_with_types, chat_limiter from common.token_utils import num_tokens_from_string - @dataclass class CommunityReportsResult: """Community reports result class definition.""" @@ -102,7 +104,7 @@ async def extract_community_report(community): async with chat_limiter: try: timeout = 180 if enable_timeout_assertion else 1000000000 - response = await asyncio.wait_for(asyncio.to_thread(self._chat,text,[{"role": "user", "content": "Output:"}],{},task_id),timeout=timeout) + response = await asyncio.wait_for(thread_pool_exec(self._chat,text,[{"role": "user", "content": "Output:"}],{},task_id),timeout=timeout) except asyncio.TimeoutError: logging.warning("extract_community_report._chat timeout, skipping...") return diff --git a/graphrag/general/extractor.py b/graphrag/general/extractor.py index 9164b4e275c..899845a83d3 100644 --- a/graphrag/general/extractor.py +++ b/graphrag/general/extractor.py @@ -38,6 +38,7 @@ set_llm_cache, split_string_by_multi_markers, ) +from common.misc_utils import thread_pool_exec from rag.llm.chat_model import Base as CompletionLLM from rag.prompts.generator import message_fit_in from common.exceptions import TaskCanceledException @@ -339,5 +340,5 @@ async def _handle_entity_relation_summary(self, entity_or_relation_name: str, de raise TaskCanceledException(f"Task {task_id} was cancelled during summary handling") async with chat_limiter: - summary = await asyncio.to_thread(self._chat, "", [{"role": "user", "content": use_prompt}], {}, task_id) + summary = await thread_pool_exec(self._chat, "", [{"role": "user", "content": use_prompt}], {}, task_id) return summary diff --git a/graphrag/general/graph_extractor.py b/graphrag/general/graph_extractor.py index f2bc7949f43..c769acd941c 100644 --- a/graphrag/general/graph_extractor.py +++ b/graphrag/general/graph_extractor.py @@ -1,11 +1,13 @@ # Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License + +from common.misc_utils import thread_pool_exec + """ Reference: - [graphrag](https://github.com/microsoft/graphrag) """ -import asyncio import re from typing import Any from dataclasses import dataclass @@ -107,7 +109,7 @@ async def _process_single_content(self, chunk_key_dp: tuple[str, str], chunk_seq } hint_prompt = perform_variable_replacements(self._extraction_prompt, variables=variables) async with chat_limiter: - response = await asyncio.to_thread(self._chat,hint_prompt,[{"role": "user", "content": "Output:"}],{},task_id) + response = await thread_pool_exec(self._chat,hint_prompt,[{"role": "user", "content": "Output:"}],{},task_id) token_count += num_tokens_from_string(hint_prompt + response) results = response or "" @@ -117,7 +119,7 @@ async def _process_single_content(self, chunk_key_dp: tuple[str, str], chunk_seq for i in range(self._max_gleanings): history.append({"role": "user", "content": CONTINUE_PROMPT}) async with chat_limiter: - response = await asyncio.to_thread(self._chat, "", history, {}) + response = await thread_pool_exec(self._chat, "", history, {}) token_count += num_tokens_from_string("\n".join([m["content"] for m in history]) + response) results += response or "" @@ -127,7 +129,7 @@ async def _process_single_content(self, chunk_key_dp: tuple[str, str], chunk_seq history.append({"role": "assistant", "content": response}) history.append({"role": "user", "content": LOOP_PROMPT}) async with chat_limiter: - continuation = await asyncio.to_thread(self._chat, "", history) + continuation = await thread_pool_exec(self._chat, "", history) token_count += num_tokens_from_string("\n".join([m["content"] for m in history]) + response) if continuation != "Y": break diff --git a/graphrag/general/index.py b/graphrag/general/index.py index ea5d733259a..632d3749488 100644 --- a/graphrag/general/index.py +++ b/graphrag/general/index.py @@ -39,6 +39,7 @@ set_graph, tidy_graph, ) +from common.misc_utils import thread_pool_exec from rag.nlp import rag_tokenizer, search from rag.utils.redis_conn import RedisDistributedLock from common import settings @@ -460,8 +461,8 @@ async def generate_subgraph( "removed_kwd": "N", } cid = chunk_id(chunk) - await asyncio.to_thread(settings.docStoreConn.delete,{"knowledge_graph_kwd": "subgraph", "source_id": doc_id},search.index_name(tenant_id),kb_id,) - await asyncio.to_thread(settings.docStoreConn.insert,[{"id": cid, **chunk}],search.index_name(tenant_id),kb_id,) + await thread_pool_exec(settings.docStoreConn.delete,{"knowledge_graph_kwd": "subgraph", "source_id": doc_id},search.index_name(tenant_id),kb_id,) + await thread_pool_exec(settings.docStoreConn.insert,[{"id": cid, **chunk}],search.index_name(tenant_id),kb_id,) now = asyncio.get_running_loop().time() callback(msg=f"generated subgraph for doc {doc_id} in {now - start:.2f} seconds.") return subgraph @@ -592,10 +593,10 @@ async def extract_community( chunk["content_sm_ltks"] = rag_tokenizer.fine_grained_tokenize(chunk["content_ltks"]) chunks.append(chunk) - await asyncio.to_thread(settings.docStoreConn.delete,{"knowledge_graph_kwd": "community_report", "kb_id": kb_id},search.index_name(tenant_id),kb_id,) + await thread_pool_exec(settings.docStoreConn.delete,{"knowledge_graph_kwd": "community_report", "kb_id": kb_id},search.index_name(tenant_id),kb_id,) es_bulk_size = 4 for b in range(0, len(chunks), es_bulk_size): - doc_store_result = await asyncio.to_thread(settings.docStoreConn.insert,chunks[b : b + es_bulk_size],search.index_name(tenant_id),kb_id,) + doc_store_result = await thread_pool_exec(settings.docStoreConn.insert,chunks[b : b + es_bulk_size],search.index_name(tenant_id),kb_id,) if doc_store_result: error_message = f"Insert chunk error: {doc_store_result}, please check log file and Elasticsearch/Infinity status!" raise Exception(error_message) diff --git a/graphrag/general/mind_map_extractor.py b/graphrag/general/mind_map_extractor.py index 3988b5bc7f7..f221e89f9b6 100644 --- a/graphrag/general/mind_map_extractor.py +++ b/graphrag/general/mind_map_extractor.py @@ -29,6 +29,7 @@ from functools import reduce from common.token_utils import num_tokens_from_string +from common.misc_utils import thread_pool_exec @dataclass class MindMapResult: @@ -185,7 +186,7 @@ async def _process_document( } text = perform_variable_replacements(self._mind_map_prompt, variables=variables) async with chat_limiter: - response = await asyncio.to_thread(self._chat,text,[{"role": "user", "content": "Output:"}],{}) + response = await thread_pool_exec(self._chat,text,[{"role": "user", "content": "Output:"}],{}) response = re.sub(r"```[^\n]*", "", response) logging.debug(response) logging.debug(self._todict(markdown_to_json.dictify(response))) diff --git a/graphrag/light/graph_extractor.py b/graphrag/light/graph_extractor.py index 569cf7ed3ac..027589ca9e2 100644 --- a/graphrag/light/graph_extractor.py +++ b/graphrag/light/graph_extractor.py @@ -1,11 +1,13 @@ # Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License + +from common.misc_utils import thread_pool_exec + """ Reference: - [graphrag](https://github.com/microsoft/graphrag) """ -import asyncio import logging import re from dataclasses import dataclass @@ -19,7 +21,6 @@ from rag.llm.chat_model import Base as CompletionLLM from common.token_utils import num_tokens_from_string - @dataclass class GraphExtractionResult: """Unipartite graph extraction result class definition.""" @@ -82,12 +83,12 @@ async def _process_single_content(self, chunk_key_dp: tuple[str, str], chunk_seq if self.callback: self.callback(msg=f"Start processing for {chunk_key}: {content[:25]}...") async with chat_limiter: - final_result = await asyncio.to_thread(self._chat,"",[{"role": "user", "content": hint_prompt}],gen_conf,task_id) + final_result = await thread_pool_exec(self._chat,"",[{"role": "user", "content": hint_prompt}],gen_conf,task_id) token_count += num_tokens_from_string(hint_prompt + final_result) history = pack_user_ass_to_openai_messages(hint_prompt, final_result, self._continue_prompt) for now_glean_index in range(self._max_gleanings): async with chat_limiter: - glean_result = await asyncio.to_thread(self._chat,"",history,gen_conf,task_id) + glean_result = await thread_pool_exec(self._chat,"",history,gen_conf,task_id) history.extend([{"role": "assistant", "content": glean_result}]) token_count += num_tokens_from_string("\n".join([m["content"] for m in history]) + hint_prompt + self._continue_prompt) final_result += glean_result @@ -96,7 +97,7 @@ async def _process_single_content(self, chunk_key_dp: tuple[str, str], chunk_seq history.extend([{"role": "user", "content": self._if_loop_prompt}]) async with chat_limiter: - if_loop_result = await asyncio.to_thread(self._chat,"",history,gen_conf,task_id) + if_loop_result = await thread_pool_exec(self._chat,"",history,gen_conf,task_id) token_count += num_tokens_from_string("\n".join([m["content"] for m in history]) + if_loop_result + self._if_loop_prompt) if_loop_result = if_loop_result.strip().strip('"').strip("'").lower() if if_loop_result != "yes": diff --git a/graphrag/utils.py b/graphrag/utils.py index 118e5ccf67c..1c2b3cbea33 100644 --- a/graphrag/utils.py +++ b/graphrag/utils.py @@ -1,5 +1,8 @@ # Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License + +from common.misc_utils import thread_pool_exec + """ Reference: - [graphrag](https://github.com/microsoft/graphrag) @@ -316,7 +319,7 @@ async def graph_node_to_chunk(kb_id, embd_mdl, ent_name, meta, chunks): async with chat_limiter: timeout = 3 if enable_timeout_assertion else 30000000 ebd, _ = await asyncio.wait_for( - asyncio.to_thread(embd_mdl.encode, [ent_name]), + thread_pool_exec(embd_mdl.encode, [ent_name]), timeout=timeout ) ebd = ebd[0] @@ -370,7 +373,7 @@ async def graph_edge_to_chunk(kb_id, embd_mdl, from_ent_name, to_ent_name, meta, async with chat_limiter: timeout = 3 if enable_timeout_assertion else 300000000 ebd, _ = await asyncio.wait_for( - asyncio.to_thread( + thread_pool_exec( embd_mdl.encode, [txt + f": {meta['description']}"] ), @@ -390,7 +393,7 @@ async def does_graph_contains(tenant_id, kb_id, doc_id): "knowledge_graph_kwd": ["graph"], "removed_kwd": "N", } - res = await asyncio.to_thread( + res = await thread_pool_exec( settings.docStoreConn.search, fields, [], condition, [], OrderByExpr(), 0, 1, search.index_name(tenant_id), [kb_id] @@ -436,7 +439,7 @@ async def set_graph(tenant_id: str, kb_id: str, embd_mdl, graph: nx.Graph, chang global chat_limiter start = asyncio.get_running_loop().time() - await asyncio.to_thread( + await thread_pool_exec( settings.docStoreConn.delete, {"knowledge_graph_kwd": ["graph", "subgraph"]}, search.index_name(tenant_id), @@ -444,7 +447,7 @@ async def set_graph(tenant_id: str, kb_id: str, embd_mdl, graph: nx.Graph, chang ) if change.removed_nodes: - await asyncio.to_thread( + await thread_pool_exec( settings.docStoreConn.delete, {"knowledge_graph_kwd": ["entity"], "entity_kwd": sorted(change.removed_nodes)}, search.index_name(tenant_id), @@ -455,7 +458,7 @@ async def set_graph(tenant_id: str, kb_id: str, embd_mdl, graph: nx.Graph, chang async def del_edges(from_node, to_node): async with chat_limiter: - await asyncio.to_thread( + await thread_pool_exec( settings.docStoreConn.delete, {"knowledge_graph_kwd": ["relation"], "from_entity_kwd": from_node, "to_entity_kwd": to_node}, search.index_name(tenant_id), @@ -556,7 +559,7 @@ async def del_edges(from_node, to_node): for b in range(0, len(chunks), es_bulk_size): timeout = 3 if enable_timeout_assertion else 30000000 doc_store_result = await asyncio.wait_for( - asyncio.to_thread( + thread_pool_exec( settings.docStoreConn.insert, chunks[b : b + es_bulk_size], search.index_name(tenant_id), @@ -650,7 +653,7 @@ async def rebuild_graph(tenant_id, kb_id, exclude_rebuild=None): flds = ["knowledge_graph_kwd", "content_with_weight", "source_id"] bs = 256 for i in range(0, 1024 * bs, bs): - es_res = await asyncio.to_thread( + es_res = await thread_pool_exec( settings.docStoreConn.search, flds, [], {"kb_id": kb_id, "knowledge_graph_kwd": ["subgraph"]}, [], OrderByExpr(), i, bs, search.index_name(tenant_id), [kb_id] diff --git a/rag/flow/parser/parser.py b/rag/flow/parser/parser.py index a88443b7e49..b2cc15c4f32 100644 --- a/rag/flow/parser/parser.py +++ b/rag/flow/parser/parser.py @@ -40,6 +40,10 @@ from rag.utils.base64_image import image2id + + +from common.misc_utils import thread_pool_exec + class ParserParam(ProcessParamBase): def __init__(self): super().__init__() @@ -845,7 +849,7 @@ async def _invoke(self, **kwargs): for p_type, conf in self._param.setups.items(): if from_upstream.name.split(".")[-1].lower() not in conf.get("suffix", []): continue - await asyncio.to_thread(function_map[p_type], name, blob) + await thread_pool_exec(function_map[p_type], name, blob) done = True break diff --git a/rag/flow/tokenizer/tokenizer.py b/rag/flow/tokenizer/tokenizer.py index f723e992f6f..617c3e62a03 100644 --- a/rag/flow/tokenizer/tokenizer.py +++ b/rag/flow/tokenizer/tokenizer.py @@ -12,7 +12,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import asyncio import logging import random import re @@ -31,6 +30,7 @@ from rag.svr.task_executor import embed_limiter from common.token_utils import truncate +from common.misc_utils import thread_pool_exec class TokenizerParam(ProcessParamBase): def __init__(self): @@ -84,7 +84,7 @@ def batch_encode(txts): cnts_ = np.array([]) for i in range(0, len(texts), settings.EMBEDDING_BATCH_SIZE): async with embed_limiter: - vts, c = await asyncio.to_thread(batch_encode,texts[i : i + settings.EMBEDDING_BATCH_SIZE],) + vts, c = await thread_pool_exec(batch_encode,texts[i : i + settings.EMBEDDING_BATCH_SIZE],) if len(cnts_) == 0: cnts_ = vts else: diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py index edb74b214ed..f7ee30a6f16 100644 --- a/rag/llm/chat_model.py +++ b/rag/llm/chat_model.py @@ -34,8 +34,9 @@ from rag.llm import FACTORY_DEFAULT_BASE_URL, LITELLM_PROVIDER_PREFIX, SupportedLiteLLMProvider from rag.nlp import is_chinese, is_english - # Error message constants + +from common.misc_utils import thread_pool_exec class LLMErrorCode(StrEnum): ERROR_RATE_LIMIT = "RATE_LIMIT_EXCEEDED" ERROR_AUTHENTICATION = "AUTH_ERROR" @@ -309,7 +310,7 @@ async def async_chat_with_tools(self, system: str, history: list, gen_conf: dict name = tool_call.function.name try: args = json_repair.loads(tool_call.function.arguments) - tool_response = await asyncio.to_thread(self.toolcall_session.tool_call, name, args) + tool_response = await thread_pool_exec(self.toolcall_session.tool_call, name, args) history = self._append_history(history, tool_call, tool_response) ans += self._verbose_tool_use(name, args, tool_response) except Exception as e: @@ -402,7 +403,7 @@ async def async_chat_streamly_with_tools(self, system: str, history: list, gen_c try: args = json_repair.loads(tool_call.function.arguments) yield self._verbose_tool_use(name, args, "Begin to call...") - tool_response = await asyncio.to_thread(self.toolcall_session.tool_call, name, args) + tool_response = await thread_pool_exec(self.toolcall_session.tool_call, name, args) history = self._append_history(history, tool_call, tool_response) yield self._verbose_tool_use(name, args, tool_response) except Exception as e: @@ -1462,7 +1463,7 @@ async def async_chat_with_tools(self, system: str, history: list, gen_conf: dict name = tool_call.function.name try: args = json_repair.loads(tool_call.function.arguments) - tool_response = await asyncio.to_thread(self.toolcall_session.tool_call, name, args) + tool_response = await thread_pool_exec(self.toolcall_session.tool_call, name, args) history = self._append_history(history, tool_call, tool_response) ans += self._verbose_tool_use(name, args, tool_response) except Exception as e: @@ -1562,7 +1563,7 @@ async def async_chat_streamly_with_tools(self, system: str, history: list, gen_c try: args = json_repair.loads(tool_call.function.arguments) yield self._verbose_tool_use(name, args, "Begin to call...") - tool_response = await asyncio.to_thread(self.toolcall_session.tool_call, name, args) + tool_response = await thread_pool_exec(self.toolcall_session.tool_call, name, args) history = self._append_history(history, tool_call, tool_response) yield self._verbose_tool_use(name, args, tool_response) except Exception as e: diff --git a/rag/llm/cv_model.py b/rag/llm/cv_model.py index 707bfef9e3b..9fdd9680a5d 100644 --- a/rag/llm/cv_model.py +++ b/rag/llm/cv_model.py @@ -14,7 +14,6 @@ # limitations under the License. # -import asyncio import base64 import json import logging @@ -36,6 +35,10 @@ from rag.prompts.generator import vision_llm_describe_prompt + + +from common.misc_utils import thread_pool_exec + class Base(ABC): def __init__(self, **kwargs): # Configure retry parameters @@ -648,7 +651,7 @@ def describe_with_prompt(self, image, prompt=None): async def async_chat(self, system, history, gen_conf, images=None, **kwargs): try: - response = await asyncio.to_thread(self.client.chat, model=self.model_name, messages=self._form_history(system, history, images), options=self._clean_conf(gen_conf), keep_alive=self.keep_alive) + response = await thread_pool_exec(self.client.chat, model=self.model_name, messages=self._form_history(system, history, images), options=self._clean_conf(gen_conf), keep_alive=self.keep_alive) ans = response["message"]["content"].strip() return ans, response["eval_count"] + response.get("prompt_eval_count", 0) @@ -658,7 +661,7 @@ async def async_chat(self, system, history, gen_conf, images=None, **kwargs): async def async_chat_streamly(self, system, history, gen_conf, images=None, **kwargs): ans = "" try: - response = await asyncio.to_thread(self.client.chat, model=self.model_name, messages=self._form_history(system, history, images), stream=True, options=self._clean_conf(gen_conf), keep_alive=self.keep_alive) + response = await thread_pool_exec(self.client.chat, model=self.model_name, messages=self._form_history(system, history, images), stream=True, options=self._clean_conf(gen_conf), keep_alive=self.keep_alive) for resp in response: if resp["done"]: yield resp.get("prompt_eval_count", 0) + resp.get("eval_count", 0) @@ -796,7 +799,7 @@ async def async_chat(self, system, history, gen_conf, images=None, video_bytes=N try: size = len(video_bytes) if video_bytes else 0 logging.info(f"[GeminiCV] async_chat called with video: filename={filename} size={size}") - summary, summary_num_tokens = await asyncio.to_thread(self._process_video, video_bytes, filename) + summary, summary_num_tokens = await thread_pool_exec(self._process_video, video_bytes, filename) return summary, summary_num_tokens except Exception as e: logging.info(f"[GeminiCV] async_chat video error: {e}") @@ -952,7 +955,7 @@ def describe_with_prompt(self, image, prompt=None): async def async_chat(self, system, history, gen_conf, images=None, **kwargs): try: - response = await asyncio.to_thread(self._request, self._form_history(system, history, images), gen_conf) + response = await thread_pool_exec(self._request, self._form_history(system, history, images), gen_conf) return (response["choices"][0]["message"]["content"].strip(), total_token_count_from_response(response)) except Exception as e: return "**ERROR**: " + str(e), 0 @@ -960,7 +963,7 @@ async def async_chat(self, system, history, gen_conf, images=None, **kwargs): async def async_chat_streamly(self, system, history, gen_conf, images=None, **kwargs): total_tokens = 0 try: - response = await asyncio.to_thread(self._request, self._form_history(system, history, images), gen_conf) + response = await thread_pool_exec(self._request, self._form_history(system, history, images), gen_conf) cnt = response["choices"][0]["message"]["content"] total_tokens += total_token_count_from_response(response) for resp in cnt: diff --git a/rag/nlp/search.py b/rag/nlp/search.py index 54d46b9c801..08c1c5c08fb 100644 --- a/rag/nlp/search.py +++ b/rag/nlp/search.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import asyncio import json import logging import re @@ -30,6 +29,7 @@ from common.constants import PAGERANK_FLD, TAG_FLD from common import settings +from common.misc_utils import thread_pool_exec def index_name(uid): return f"ragflow_{uid}" @@ -51,7 +51,7 @@ class SearchResult: group_docs: list[list] | None = None async def get_vector(self, txt, emb_mdl, topk=10, similarity=0.1): - qv, _ = await asyncio.to_thread(emb_mdl.encode_queries, txt) + qv, _ = await thread_pool_exec(emb_mdl.encode_queries, txt) shape = np.array(qv).shape if len(shape) > 1: raise Exception( @@ -115,7 +115,7 @@ async def search(self, req, idx_names: str | list[str], matchText, keywords = self.qryr.question(qst, min_match=0.3) if emb_mdl is None: matchExprs = [matchText] - res = await asyncio.to_thread(self.dataStore.search, src, highlightFields, filters, matchExprs, orderBy, offset, limit, + res = await thread_pool_exec(self.dataStore.search, src, highlightFields, filters, matchExprs, orderBy, offset, limit, idx_names, kb_ids, rank_feature=rank_feature) total = self.dataStore.get_total(res) logging.debug("Dealer.search TOTAL: {}".format(total)) @@ -128,7 +128,7 @@ async def search(self, req, idx_names: str | list[str], fusionExpr = FusionExpr("weighted_sum", topk, {"weights": "0.05,0.95"}) matchExprs = [matchText, matchDense, fusionExpr] - res = await asyncio.to_thread(self.dataStore.search, src, highlightFields, filters, matchExprs, orderBy, offset, limit, + res = await thread_pool_exec(self.dataStore.search, src, highlightFields, filters, matchExprs, orderBy, offset, limit, idx_names, kb_ids, rank_feature=rank_feature) total = self.dataStore.get_total(res) logging.debug("Dealer.search TOTAL: {}".format(total)) @@ -136,12 +136,12 @@ async def search(self, req, idx_names: str | list[str], # If result is empty, try again with lower min_match if total == 0: if filters.get("doc_id"): - res = await asyncio.to_thread(self.dataStore.search, src, [], filters, [], orderBy, offset, limit, idx_names, kb_ids) + res = await thread_pool_exec(self.dataStore.search, src, [], filters, [], orderBy, offset, limit, idx_names, kb_ids) total = self.dataStore.get_total(res) else: matchText, _ = self.qryr.question(qst, min_match=0.1) matchDense.extra_options["similarity"] = 0.17 - res = await asyncio.to_thread(self.dataStore.search, src, highlightFields, filters, [matchText, matchDense, fusionExpr], + res = await thread_pool_exec(self.dataStore.search, src, highlightFields, filters, [matchText, matchDense, fusionExpr], orderBy, offset, limit, idx_names, kb_ids, rank_feature=rank_feature) total = self.dataStore.get_total(res) diff --git a/rag/raptor.py b/rag/raptor.py index 2d3ccfa7de5..867911d2295 100644 --- a/rag/raptor.py +++ b/rag/raptor.py @@ -32,6 +32,7 @@ set_embed_cache, set_llm_cache, ) +from common.misc_utils import thread_pool_exec class RecursiveAbstractiveProcessing4TreeOrganizedRetrieval: @@ -56,7 +57,7 @@ def __init__( @timeout(60 * 20) async def _chat(self, system, history, gen_conf): - cached = await asyncio.to_thread(get_llm_cache, self._llm_model.llm_name, system, history, gen_conf) + cached = await thread_pool_exec(get_llm_cache, self._llm_model.llm_name, system, history, gen_conf) if cached: return cached @@ -67,7 +68,7 @@ async def _chat(self, system, history, gen_conf): response = re.sub(r"^.*", "", response, flags=re.DOTALL) if response.find("**ERROR**") >= 0: raise Exception(response) - await asyncio.to_thread(set_llm_cache,self._llm_model.llm_name,system,response,history,gen_conf) + await thread_pool_exec(set_llm_cache,self._llm_model.llm_name,system,response,history,gen_conf) return response except Exception as exc: last_exc = exc @@ -79,14 +80,14 @@ async def _chat(self, system, history, gen_conf): @timeout(20) async def _embedding_encode(self, txt): - response = await asyncio.to_thread(get_embed_cache, self._embd_model.llm_name, txt) + response = await thread_pool_exec(get_embed_cache, self._embd_model.llm_name, txt) if response is not None: return response - embds, _ = await asyncio.to_thread(self._embd_model.encode, [txt]) + embds, _ = await thread_pool_exec(self._embd_model.encode, [txt]) if len(embds) < 1 or len(embds[0]) < 1: raise Exception("Embedding error: ") embds = embds[0] - await asyncio.to_thread(set_embed_cache, self._embd_model.llm_name, txt, embds) + await thread_pool_exec(set_embed_cache, self._embd_model.llm_name, txt, embds) return embds def _get_optimal_clusters(self, embeddings: np.ndarray, random_state: int, task_id: str = ""): diff --git a/rag/svr/task_executor.py b/rag/svr/task_executor.py index 15db3a8a76f..3b4f37dafd0 100644 --- a/rag/svr/task_executor.py +++ b/rag/svr/task_executor.py @@ -14,6 +14,10 @@ # limitations under the License. import time + + +from common.misc_utils import thread_pool_exec + start_ts = time.time() import asyncio @@ -231,7 +235,7 @@ async def collect(): async def get_storage_binary(bucket, name): - return await asyncio.to_thread(settings.STORAGE_IMPL.get, bucket, name) + return await thread_pool_exec(settings.STORAGE_IMPL.get, bucket, name) @timeout(60 * 80, 1) @@ -262,7 +266,7 @@ async def build_chunks(task, progress_callback): try: async with chunk_limiter: - cks = await asyncio.to_thread( + cks = await thread_pool_exec( chunker.chunk, task["name"], binary=binary, @@ -578,7 +582,7 @@ async def embedding(docs, mdl, parser_config=None, callback=None): tk_count = 0 if len(tts) == len(cnts): - vts, c = await asyncio.to_thread(mdl.encode, tts[0:1]) + vts, c = await thread_pool_exec(mdl.encode, tts[0:1]) tts = np.tile(vts[0], (len(cnts), 1)) tk_count += c @@ -590,7 +594,7 @@ def batch_encode(txts): cnts_ = np.array([]) for i in range(0, len(cnts), settings.EMBEDDING_BATCH_SIZE): async with embed_limiter: - vts, c = await asyncio.to_thread(batch_encode, cnts[i: i + settings.EMBEDDING_BATCH_SIZE]) + vts, c = await thread_pool_exec(batch_encode, cnts[i: i + settings.EMBEDDING_BATCH_SIZE]) if len(cnts_) == 0: cnts_ = vts else: @@ -676,7 +680,7 @@ def batch_encode(txts): prog = 0.8 for i in range(0, len(texts), settings.EMBEDDING_BATCH_SIZE): async with embed_limiter: - vts, c = await asyncio.to_thread(batch_encode, texts[i: i + settings.EMBEDDING_BATCH_SIZE]) + vts, c = await thread_pool_exec(batch_encode, texts[i: i + settings.EMBEDDING_BATCH_SIZE]) if len(vects) == 0: vects = vts else: @@ -897,16 +901,16 @@ async def insert_chunks(task_id, task_tenant_id, task_dataset_id, chunks, progre mothers.append(mom_ck) for b in range(0, len(mothers), settings.DOC_BULK_SIZE): - await asyncio.to_thread(settings.docStoreConn.insert, mothers[b:b + settings.DOC_BULK_SIZE], - search.index_name(task_tenant_id), task_dataset_id) + await thread_pool_exec(settings.docStoreConn.insert, mothers[b:b + settings.DOC_BULK_SIZE], + search.index_name(task_tenant_id), task_dataset_id, ) task_canceled = has_canceled(task_id) if task_canceled: progress_callback(-1, msg="Task has been canceled.") return False for b in range(0, len(chunks), settings.DOC_BULK_SIZE): - doc_store_result = await asyncio.to_thread(settings.docStoreConn.insert, chunks[b:b + settings.DOC_BULK_SIZE], - search.index_name(task_tenant_id), task_dataset_id) + doc_store_result = await thread_pool_exec(settings.docStoreConn.insert, chunks[b:b + settings.DOC_BULK_SIZE], + search.index_name(task_tenant_id), task_dataset_id, ) task_canceled = has_canceled(task_id) if task_canceled: progress_callback(-1, msg="Task has been canceled.") @@ -923,7 +927,7 @@ async def insert_chunks(task_id, task_tenant_id, task_dataset_id, chunks, progre TaskService.update_chunk_ids(task_id, chunk_ids_str) except DoesNotExist: logging.warning(f"do_handle_task update_chunk_ids failed since task {task_id} is unknown.") - doc_store_result = await asyncio.to_thread(settings.docStoreConn.delete, {"id": chunk_ids}, + doc_store_result = await thread_pool_exec(settings.docStoreConn.delete, {"id": chunk_ids}, search.index_name(task_tenant_id), task_dataset_id, ) tasks = [] for chunk_id in chunk_ids: @@ -1167,13 +1171,13 @@ async def _maybe_insert_chunks(_chunks): finally: if has_canceled(task_id): try: - exists = await asyncio.to_thread( + exists = await thread_pool_exec( settings.docStoreConn.index_exist, search.index_name(task_tenant_id), task_dataset_id, ) if exists: - await asyncio.to_thread( + await thread_pool_exec( settings.docStoreConn.delete, {"doc_id": task_doc_id}, search.index_name(task_tenant_id), diff --git a/rag/utils/base64_image.py b/rag/utils/base64_image.py index ecdf24387bf..74938349242 100644 --- a/rag/utils/base64_image.py +++ b/rag/utils/base64_image.py @@ -14,7 +14,6 @@ # limitations under the License. # -import asyncio import base64 import logging from functools import partial @@ -22,6 +21,10 @@ from PIL import Image + + +from common.misc_utils import thread_pool_exec + test_image_base64 = "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAA6ElEQVR4nO3QwQ3AIBDAsIP9d25XIC+EZE8QZc18w5l9O+AlZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBT+IYAHHLHkdEgAAAABJRU5ErkJggg==" test_image = base64.b64decode(test_image_base64) @@ -58,13 +61,13 @@ def encode_image(): buf.seek(0) return buf.getvalue() - jpeg_binary = await asyncio.to_thread(encode_image) + jpeg_binary = await thread_pool_exec(encode_image) if jpeg_binary is None: del d["image"] return async with minio_limiter: - await asyncio.to_thread( + await thread_pool_exec( lambda: storage_put_func(bucket=bucket, fnm=objname, binary=jpeg_binary) ) From 80612bc992ace09922014fe8c43ffc032abf8670 Mon Sep 17 00:00:00 2001 From: balibabu Date: Tue, 20 Jan 2026 13:38:54 +0800 Subject: [PATCH 157/335] Refactor: Replace antd with shadcn (#12718) ### What problem does this PR solve? Refactor: Replace antd with shadcn ### Type of change - [x] Refactoring --- web/src/components/api-service/hooks.ts | 2 +- web/src/components/copy-to-clipboard.tsx | 13 +- web/src/components/editable-cell.tsx | 98 ----- .../floating-chat-widget-markdown.tsx | 88 +++-- web/src/components/indented-tree/modal.tsx | 30 -- web/src/components/llm-select/index.tsx | 67 ---- .../components/llm-setting-items/index.tsx | 350 ------------------ web/src/components/svg-icon.tsx | 12 +- web/src/layouts/index.tsx | 37 -- .../components/chunk-toolbar/index.tsx | 223 ----------- .../parsed-result/add-knowledge/index.tsx | 74 ---- .../components/chunk-toolbar/index.tsx | 223 ----------- 12 files changed, 61 insertions(+), 1156 deletions(-) delete mode 100644 web/src/components/editable-cell.tsx delete mode 100644 web/src/components/indented-tree/modal.tsx delete mode 100644 web/src/components/llm-select/index.tsx delete mode 100644 web/src/components/llm-setting-items/index.tsx delete mode 100644 web/src/layouts/index.tsx delete mode 100644 web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/components/chunk-toolbar/index.tsx delete mode 100644 web/src/pages/chunk/parsed-result/add-knowledge/index.tsx delete mode 100644 web/src/pages/dataflow-result/components/chunk-toolbar/index.tsx diff --git a/web/src/components/api-service/hooks.ts b/web/src/components/api-service/hooks.ts index 7b87877a420..922fc522e89 100644 --- a/web/src/components/api-service/hooks.ts +++ b/web/src/components/api-service/hooks.ts @@ -11,8 +11,8 @@ import { } from '@/hooks/use-user-setting-request'; import { IStats } from '@/interfaces/database/chat'; import { useQueryClient } from '@tanstack/react-query'; -import { message } from 'antd'; import { useCallback } from 'react'; +import message from '../ui/message'; export const useOperateApiKey = (idKey: string, dialogId?: string) => { const { removeToken } = useRemoveSystemToken(); diff --git a/web/src/components/copy-to-clipboard.tsx b/web/src/components/copy-to-clipboard.tsx index 50db6843531..38b2128d473 100644 --- a/web/src/components/copy-to-clipboard.tsx +++ b/web/src/components/copy-to-clipboard.tsx @@ -1,8 +1,8 @@ import { useTranslate } from '@/hooks/common-hooks'; import { CheckOutlined, CopyOutlined } from '@ant-design/icons'; -import { Tooltip } from 'antd'; import { useState } from 'react'; import { CopyToClipboard as Clipboard, Props } from 'react-copy-to-clipboard'; +import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip'; const CopyToClipboard = ({ text }: Props) => { const [copied, setCopied] = useState(false); @@ -16,10 +16,13 @@ const CopyToClipboard = ({ text }: Props) => { }; return ( - - - {copied ? : } - + + + + {copied ? : } + + + {copied ? t('copied') : t('copy')} ); }; diff --git a/web/src/components/editable-cell.tsx b/web/src/components/editable-cell.tsx deleted file mode 100644 index f2ad85708ce..00000000000 --- a/web/src/components/editable-cell.tsx +++ /dev/null @@ -1,98 +0,0 @@ -import { Form, FormInstance, Input, InputRef, Typography } from 'antd'; -import { omit } from 'lodash'; -import React, { useContext, useEffect, useRef, useState } from 'react'; - -const EditableContext = React.createContext | null>(null); -const { Text } = Typography; - -interface EditableRowProps { - index: number; -} - -interface Item { - key: string; - name: string; - age: string; - address: string; -} - -export const EditableRow: React.FC = ({ ...props }) => { - const [form] = Form.useForm(); - return ( - - - - - - ); -}; - -interface EditableCellProps { - title: React.ReactNode; - editable: boolean; - children: React.ReactNode; - dataIndex: keyof Item; - record: Item; - handleSave: (record: Item) => void; -} - -export const EditableCell: React.FC = ({ - title, - editable, - children, - dataIndex, - record, - handleSave, - ...restProps -}) => { - const [editing, setEditing] = useState(false); - const inputRef = useRef(null); - const form = useContext(EditableContext)!; - - useEffect(() => { - if (editing) { - inputRef.current!.focus(); - } - }, [editing]); - - const toggleEdit = () => { - setEditing(!editing); - form.setFieldsValue({ [dataIndex]: record[dataIndex] }); - }; - - const save = async () => { - try { - const values = await form.validateFields(); - - toggleEdit(); - handleSave({ ...record, ...values }); - } catch (errInfo) { - console.log('Save failed:', errInfo); - } - }; - - let childNode = children; - - if (editable) { - childNode = editing ? ( - - - - ) : ( -
    - {children} -
    - ); - } - - return {childNode}; -}; diff --git a/web/src/components/floating-chat-widget-markdown.tsx b/web/src/components/floating-chat-widget-markdown.tsx index 8d7227a336b..89aa51663f9 100644 --- a/web/src/components/floating-chat-widget-markdown.tsx +++ b/web/src/components/floating-chat-widget-markdown.tsx @@ -15,12 +15,12 @@ import { } from '@/utils/chat'; import { getExtension } from '@/utils/document-util'; import { InfoCircleOutlined } from '@ant-design/icons'; -import { Button, Flex, Popover, Tooltip } from 'antd'; import classNames from 'classnames'; import DOMPurify from 'dompurify'; import 'katex/dist/katex.min.css'; import { omit } from 'lodash'; import { pipe } from 'lodash/fp'; +import { Info } from 'lucide-react'; import { useCallback, useEffect, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import Markdown from 'react-markdown'; @@ -37,6 +37,9 @@ import remarkMath from 'remark-math'; import { visitParents } from 'unist-util-visit-parents'; import styles from './floating-chat-widget-markdown.module.less'; import { useIsDarkTheme } from './theme-provider'; +import { Button } from './ui/button'; +import { Popover, PopoverContent, PopoverTrigger } from './ui/popover'; +import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip'; const getChunkIndex = (match: string) => Number(match.replace(/\[|\]/g, '')); @@ -161,19 +164,19 @@ const FloatingChatWidgetMarkdown = ({ className="flex gap-2 widget-citation-content" > {imageId && ( - + + + + - } - > - + )}
    @@ -184,7 +187,7 @@ const FloatingChatWidgetMarkdown = ({ className="max-h-[250px] overflow-y-auto text-xs leading-relaxed p-2 bg-gray-50 dark:bg-gray-800 rounded prose-sm" >
    {documentId && ( - +
    {fileThumbnail ? ( )} - + + + + + {!documentUrl && fileExtension !== 'pdf' ? 'Document link unavailable' - : document.doc_name - } - > - + : document.doc_name} + - +
    )}
    @@ -236,8 +240,11 @@ const FloatingChatWidgetMarkdown = ({ if (!info) { return ( - - + + + + + Reference unavailable ); } @@ -262,8 +269,11 @@ const FloatingChatWidgetMarkdown = ({ } return ( - - + + + + + {getPopoverContent(chunkIndex)} ); }); diff --git a/web/src/components/indented-tree/modal.tsx b/web/src/components/indented-tree/modal.tsx deleted file mode 100644 index d7d7a4a218f..00000000000 --- a/web/src/components/indented-tree/modal.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { useTranslation } from 'react-i18next'; -import IndentedTree from './indented-tree'; - -import { useFetchKnowledgeGraph } from '@/hooks/use-knowledge-request'; -import { IModalProps } from '@/interfaces/common'; -import { Modal } from 'antd'; - -const IndentedTreeModal = ({ - visible, - hideModal, -}: IModalProps & { documentId: string }) => { - const { data } = useFetchKnowledgeGraph(); - const { t } = useTranslation(); - - return ( - -
    - -
    -
    - ); -}; - -export default IndentedTreeModal; diff --git a/web/src/components/llm-select/index.tsx b/web/src/components/llm-select/index.tsx deleted file mode 100644 index 93a81b94f9d..00000000000 --- a/web/src/components/llm-select/index.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { LlmModelType } from '@/constants/knowledge'; -import { useComposeLlmOptionsByModelTypes } from '@/hooks/use-llm-request'; -import { Popover as AntPopover, Select as AntSelect } from 'antd'; -import LlmSettingItems from '../llm-setting-items'; - -interface IProps { - id?: string; - value?: string; - onInitialValue?: (value: string, option: any) => void; - onChange?: (value: string, option: any) => void; - disabled?: boolean; -} - -const LLMSelect = ({ - id, - value, - onInitialValue, - onChange, - disabled, -}: IProps) => { - const modelOptions = useComposeLlmOptionsByModelTypes([ - LlmModelType.Chat, - LlmModelType.Image2text, - ]); - - if (onInitialValue && value) { - for (const modelOption of modelOptions) { - for (const option of modelOption.options) { - if (option.value === value) { - onInitialValue(value, option); - break; - } - } - } - } - - const content = ( -
    - -
    - ); - - return ( - - - - ); -}; - -export default LLMSelect; diff --git a/web/src/components/llm-setting-items/index.tsx b/web/src/components/llm-setting-items/index.tsx deleted file mode 100644 index cf007bf445e..00000000000 --- a/web/src/components/llm-setting-items/index.tsx +++ /dev/null @@ -1,350 +0,0 @@ -import { - LlmModelType, - ModelVariableType, - settledModelVariableMap, -} from '@/constants/knowledge'; -import { Flex, Form, InputNumber, Select, Slider, Switch, Tooltip } from 'antd'; -import camelCase from 'lodash/camelCase'; - -import { useTranslate } from '@/hooks/common-hooks'; -import { useComposeLlmOptionsByModelTypes } from '@/hooks/use-llm-request'; -import { setChatVariableEnabledFieldValuePage } from '@/utils/chat'; -import { QuestionCircleOutlined } from '@ant-design/icons'; -import { useCallback, useMemo } from 'react'; -import styles from './index.module.less'; - -interface IProps { - prefix?: string; - formItemLayout?: any; - handleParametersChange?(value: ModelVariableType): void; - onChange?(value: string, option: any): void; -} - -const LlmSettingItems = ({ prefix, formItemLayout = {}, onChange }: IProps) => { - const form = Form.useFormInstance(); - const { t } = useTranslate('chat'); - const parameterOptions = Object.values(ModelVariableType).map((x) => ({ - label: t(camelCase(x)), - value: x, - })); - - const handleParametersChange = useCallback( - (value: ModelVariableType) => { - const variable = settledModelVariableMap[value]; - let nextVariable: Record = variable; - if (prefix) { - nextVariable = { [prefix]: variable }; - } - const variableCheckBoxFieldMap = setChatVariableEnabledFieldValuePage(); - form.setFieldsValue({ ...nextVariable, ...variableCheckBoxFieldMap }); - }, - [form, prefix], - ); - - const memorizedPrefix = useMemo(() => (prefix ? [prefix] : []), [prefix]); - - const modelOptions = useComposeLlmOptionsByModelTypes([ - LlmModelType.Chat, - LlmModelType.Image2text, - ]); - - return ( - <> - - } - allowClear - onChange={handleInputChange} - onBlur={handleSearchBlur} - value={searchString} - /> - ) : ( - -
    - {isShowSearchBox ? ( - } - allowClear - onChange={handleInputChange} - onBlur={handleSearchBlur} - value={searchString} - /> - ) : ( - + {selectionMode && selectedCount > 0 ? ( + // Selection mode with items selected: show return and delete +
    + + + + +
    + ) : ( + // Default or selection mode without selection: show plus and batch delete +
    + + +
    + )}
    -
    {x.name}
    - - - +
    + {selectionMode && ( + e.stopPropagation()} + onMouseDown={(e) => e.stopPropagation()} + > + toggleSelection(x.id)} + /> + + )} +
    {x.name}
    +
    + {!selectionMode && ( + + + + )}
    ))} From 5a7026cf552d7d8631c6440bbd0208e92ab0eda4 Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Wed, 21 Jan 2026 11:31:26 +0800 Subject: [PATCH 167/335] Feat: Improve metadata logic (#12730) ### What problem does this PR solve? Feat: Improve metadata logic ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- web/src/components/dynamic-form.tsx | 4 +- web/src/components/ui/input-date.tsx | 108 +++++ web/src/components/ui/input-select.tsx | 308 ++++++++++++--- web/src/hooks/logic-hooks.ts | 1 - web/src/locales/en.ts | 6 +- web/src/locales/zh.ts | 4 + .../metedata/hooks/use-manage-modal.ts | 358 +++++++++-------- .../metedata/hooks/use-manage-values-modal.ts | 103 ++--- .../dataset/components/metedata/interface.ts | 18 +- .../metedata/manage-modal-column.tsx | 372 ++++++++++++++++++ .../components/metedata/manage-modal.tsx | 352 +++-------------- .../metedata/manage-values-modal.tsx | 205 +++++++--- web/src/pages/dataset/dataset/index.tsx | 107 +++-- .../dataset/use-bulk-operate-dataset.tsx | 7 +- .../dataset/use-dataset-table-columns.tsx | 14 +- web/src/services/knowledge-service.ts | 20 +- 16 files changed, 1320 insertions(+), 667 deletions(-) create mode 100644 web/src/components/ui/input-date.tsx create mode 100644 web/src/pages/dataset/components/metedata/manage-modal-column.tsx diff --git a/web/src/components/dynamic-form.tsx b/web/src/components/dynamic-form.tsx index 1900d579401..3dd869690b5 100644 --- a/web/src/components/dynamic-form.tsx +++ b/web/src/components/dynamic-form.tsx @@ -834,6 +834,7 @@ const DynamicForm = { useImperativeHandle( ref, () => ({ + form: form, submit: () => { form.handleSubmit((values) => { const filteredValues = filterActiveValues(values); @@ -938,7 +939,6 @@ const DynamicForm = { ) as ( props: DynamicFormProps & { ref?: React.Ref }, ) => React.ReactElement, - SavingButton: ({ submitLoading, buttonText, @@ -1015,4 +1015,6 @@ const DynamicForm = { }, }; +DynamicForm.Root.displayName = 'DynamicFormRoot'; + export { DynamicForm }; diff --git a/web/src/components/ui/input-date.tsx b/web/src/components/ui/input-date.tsx new file mode 100644 index 00000000000..4e8daa4952b --- /dev/null +++ b/web/src/components/ui/input-date.tsx @@ -0,0 +1,108 @@ +import { Calendar } from '@/components/originui/calendar'; +import { Input } from '@/components/ui/input'; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from '@/components/ui/popover'; +import { cn } from '@/lib/utils'; +import { Locale } from 'date-fns'; +import dayjs from 'dayjs'; +import { Calendar as CalendarIcon } from 'lucide-react'; +import * as React from 'react'; + +interface DateInputProps extends Omit< + React.InputHTMLAttributes, + 'value' | 'onChange' +> { + value?: Date; + onChange?: (date: Date | undefined) => void; + showTimeSelect?: boolean; + dateFormat?: string; + timeFormat?: string; + showTimeSelectOnly?: boolean; + showTimeInput?: boolean; + timeInputLabel?: string; + locale?: Locale; // Support for internationalization +} + +const DateInput = React.forwardRef( + ( + { + className, + value, + onChange, + dateFormat = 'DD/MM/YYYY', + timeFormat = 'HH:mm:ss', + showTimeSelect = false, + showTimeSelectOnly = false, + showTimeInput = false, + timeInputLabel = '', + ...props + }, + ref, + ) => { + const [open, setOpen] = React.useState(false); + + const handleDateSelect = (date: Date | undefined) => { + onChange?.(date); + setOpen(false); + }; + + // Determine display format based on the type of date picker + let displayFormat = dateFormat; + if (showTimeSelect) { + displayFormat = `${dateFormat} ${timeFormat}`; + } else if (showTimeSelectOnly) { + displayFormat = timeFormat; + } + + // Format the date according to the specified format + const formattedValue = React.useMemo(() => { + return value && !isNaN(value.getTime()) + ? dayjs(value).format(displayFormat) + : ''; + }, [value, displayFormat]); + + return ( +
    + + +
    + + +
    +
    + + + +
    +
    + ); + }, +); + +DateInput.displayName = 'DateInput'; + +export { DateInput }; diff --git a/web/src/components/ui/input-select.tsx b/web/src/components/ui/input-select.tsx index 9c70999444a..5134118654d 100644 --- a/web/src/components/ui/input-select.tsx +++ b/web/src/components/ui/input-select.tsx @@ -1,5 +1,6 @@ import { Input } from '@/components/ui/input'; import { cn } from '@/lib/utils'; +import { isEmpty } from 'lodash'; import { X } from 'lucide-react'; import * as React from 'react'; import { useTranslation } from 'react-i18next'; @@ -17,10 +18,12 @@ export interface InputSelectOption { export interface InputSelectProps { /** Options for the select component */ options?: InputSelectOption[]; - /** Selected values - string for single select, array for multi select */ - value?: string | string[]; + /** Selected values - type depends on the input type */ + value?: string | string[] | number | number[] | Date | Date[]; /** Callback when value changes */ - onChange?: (value: string | string[]) => void; + onChange?: ( + value: string | string[] | number | number[] | Date | Date[], + ) => void; /** Placeholder text */ placeholder?: string; /** Additional class names */ @@ -29,6 +32,8 @@ export interface InputSelectProps { style?: React.CSSProperties; /** Whether to allow multiple selections */ multi?: boolean; + /** Type of input: text, number, date, or datetime */ + type?: 'text' | 'number' | 'date' | 'datetime'; } const InputSelect = React.forwardRef( @@ -41,6 +46,7 @@ const InputSelect = React.forwardRef( className, style, multi = false, + type = 'text', }, ref, ) => { @@ -50,36 +56,108 @@ const InputSelect = React.forwardRef( const inputRef = React.useRef(null); const { t } = useTranslation(); - // Normalize value to array for consistent handling - const normalizedValue = Array.isArray(value) ? value : value ? [value] : []; + // Normalize value to array for consistent handling based on type + const normalizedValue = React.useMemo(() => { + if (Array.isArray(value)) { + return value; + } else if (value !== undefined && value !== null) { + if (type === 'number') { + return typeof value === 'number' ? [value] : [Number(value)]; + } else if (type === 'date' || type === 'datetime') { + return value instanceof Date ? [value] : [new Date(value as any)]; + } else { + return typeof value === 'string' ? [value] : [String(value)]; + } + } else { + return []; + } + }, [value, type]); /** * Removes a tag from the selected values * @param tagValue - The value of the tag to remove */ - const handleRemoveTag = (tagValue: string) => { - const newValue = normalizedValue.filter((v) => v !== tagValue); + const handleRemoveTag = (tagValue: any) => { + let newValue: any[]; + + if (type === 'number') { + newValue = (normalizedValue as number[]).filter((v) => v !== tagValue); + } else if (type === 'date' || type === 'datetime') { + newValue = (normalizedValue as Date[]).filter( + (v) => v.getTime() !== tagValue.getTime(), + ); + } else { + newValue = (normalizedValue as string[]).filter((v) => v !== tagValue); + } + // Return single value if not multi-select, otherwise return array - onChange?.(multi ? newValue : newValue[0] || ''); + let result: string | number | Date | string[] | number[] | Date[]; + if (multi) { + result = newValue; + } else { + if (type === 'number') { + result = newValue[0] || 0; + } else if (type === 'date' || type === 'datetime') { + result = newValue[0] || new Date(); + } else { + result = newValue[0] || ''; + } + } + + onChange?.(result); }; /** * Adds a tag to the selected values * @param optionValue - The value of the tag to add */ - const handleAddTag = (optionValue: string) => { - let newValue: string[]; + const handleAddTag = (optionValue: any) => { + let newValue: any[]; if (multi) { // For multi-select, add to array if not already included - if (!normalizedValue.includes(optionValue)) { - newValue = [...normalizedValue, optionValue]; - onChange?.(newValue); + if (type === 'number') { + const numValue = + typeof optionValue === 'number' ? optionValue : Number(optionValue); + if ( + !(normalizedValue as number[]).includes(numValue) && + !isNaN(numValue) + ) { + newValue = [...(normalizedValue as number[]), numValue]; + onChange?.(newValue as number[]); + } + } else if (type === 'date' || type === 'datetime') { + const dateValue = + optionValue instanceof Date ? optionValue : new Date(optionValue); + if ( + !(normalizedValue as Date[]).some( + (d) => d.getTime() === dateValue.getTime(), + ) + ) { + newValue = [...(normalizedValue as Date[]), dateValue]; + onChange?.(newValue as Date[]); + } + } else { + if (!(normalizedValue as string[]).includes(optionValue)) { + newValue = [...(normalizedValue as string[]), optionValue]; + onChange?.(newValue as string[]); + } } } else { // For single-select, replace the value - newValue = [optionValue]; - onChange?.(optionValue); + if (type === 'number') { + const numValue = + typeof optionValue === 'number' ? optionValue : Number(optionValue); + if (!isNaN(numValue)) { + onChange?.(numValue); + } + } else if (type === 'date' || type === 'datetime') { + const dateValue = + optionValue instanceof Date ? optionValue : new Date(optionValue); + onChange?.(dateValue); + } else { + onChange?.(optionValue); + } } setInputValue(''); @@ -89,16 +167,7 @@ const InputSelect = React.forwardRef( const handleInputChange = (e: React.ChangeEvent) => { const newValue = e.target.value; setInputValue(newValue); - setOpen(newValue.length > 0); // Open popover when there's input - - // If input matches an option exactly, add it - const matchedOption = options.find( - (opt) => opt.label.toLowerCase() === newValue.toLowerCase(), - ); - - if (matchedOption && !normalizedValue.includes(matchedOption.value)) { - handleAddTag(matchedOption.value); - } + setOpen(!!newValue); // Open popover when there's input }; const handleKeyDown = (e: React.KeyboardEvent) => { @@ -111,9 +180,37 @@ const InputSelect = React.forwardRef( const newValue = [...normalizedValue]; newValue.pop(); // Return single value if not multi-select, otherwise return array - onChange?.(multi ? newValue : newValue[0] || ''); + let result: string | number | Date | string[] | number[] | Date[]; + if (multi) { + result = newValue; + } else { + if (type === 'number') { + result = newValue[0] || 0; + } else if (type === 'date' || type === 'datetime') { + result = newValue[0] || new Date(); + } else { + result = newValue[0] || ''; + } + } + + onChange?.(result); } else if (e.key === 'Enter' && inputValue.trim() !== '') { e.preventDefault(); + + let valueToAdd: any; + + if (type === 'number') { + const numValue = Number(inputValue); + if (isNaN(numValue)) return; // Don't add invalid numbers + valueToAdd = numValue; + } else if (type === 'date' || type === 'datetime') { + const dateValue = new Date(inputValue); + if (isNaN(dateValue.getTime())) return; // Don't add invalid dates + valueToAdd = dateValue; + } else { + valueToAdd = inputValue; + } + // Add input value as a new tag if it doesn't exist in options const matchedOption = options.find( (opt) => opt.label.toLowerCase() === inputValue.toLowerCase(), @@ -124,10 +221,16 @@ const InputSelect = React.forwardRef( } else { // If not in options, create a new tag with the input value if ( - !normalizedValue.includes(inputValue) && + !normalizedValue.some((v) => + type === 'number' + ? Number(v) === Number(valueToAdd) + : type === 'date' || type === 'datetime' + ? new Date(v as any).getTime() === valueToAdd.getTime() + : String(v) === valueToAdd, + ) && inputValue.trim() !== '' ) { - handleAddTag(inputValue); + handleAddTag(valueToAdd); } } } else if (e.key === 'Escape') { @@ -160,26 +263,68 @@ const InputSelect = React.forwardRef( // Filter options to exclude already selected ones (only for multi-select) const availableOptions = multi - ? options.filter((option) => !normalizedValue.includes(option.value)) + ? options.filter( + (option) => + !normalizedValue.some((v) => + type === 'number' + ? Number(v) === Number(option.value) + : type === 'date' || type === 'datetime' + ? new Date(v as any).getTime() === + new Date(option.value).getTime() + : String(v) === option.value, + ), + ) : options; const filteredOptions = availableOptions.filter( (option) => !inputValue || - option.label.toLowerCase().includes(inputValue.toLowerCase()), + option.label + .toLowerCase() + .includes(inputValue.toString().toLowerCase()), ); // If there are no matching options but there is an input value, create a new option with the input value - const hasMatchingOptions = filteredOptions.length > 0; - const showInputAsOption = - inputValue && - !hasMatchingOptions && - !normalizedValue.includes(inputValue); + const showInputAsOption = React.useMemo(() => { + if (!inputValue) return false; + + const hasLabelMatch = options.some( + (option) => + option.label.toLowerCase() === inputValue.toString().toLowerCase(), + ); + + let isAlreadySelected = false; + if (type === 'number') { + const numValue = Number(inputValue); + isAlreadySelected = + !isNaN(numValue) && (normalizedValue as number[]).includes(numValue); + } else if (type === 'date' || type === 'datetime') { + const dateValue = new Date(inputValue); + isAlreadySelected = + !isNaN(dateValue.getTime()) && + (normalizedValue as Date[]).some( + (d) => d.getTime() === dateValue.getTime(), + ); + } else { + isAlreadySelected = (normalizedValue as string[]).includes(inputValue); + } + console.log( + 'showInputAsOption', + hasLabelMatch, + isAlreadySelected, + inputValue.toString().trim(), + ); + return ( + !hasLabelMatch && + !isAlreadySelected && + inputValue.toString().trim() !== '' + ); + }, [inputValue, options, normalizedValue, type]); const triggerElement = (
    ( > {/* Render selected tags - only show tags if multi is true or if single select has a value */} {multi && - normalizedValue.map((tagValue) => { - const option = options.find((opt) => opt.value === tagValue) || { - value: tagValue, - label: tagValue, + normalizedValue.map((tagValue, index) => { + const option = options.find((opt) => + type === 'number' + ? Number(opt.value) === Number(tagValue) + : type === 'date' || type === 'datetime' + ? new Date(opt.value).getTime() === + new Date(tagValue).getTime() + : String(opt.value) === String(tagValue), + ) || { + value: String(tagValue), + label: String(tagValue), }; + return (
    {option.label} @@ -215,11 +368,22 @@ const InputSelect = React.forwardRef( })} {/* For single select, show the selected value as text instead of a tag */} - {!multi && normalizedValue[0] && ( -
    + {!multi && !isEmpty(normalizedValue[0]) && ( +
    - {options.find((opt) => opt.value === normalizedValue[0])?.label || - normalizedValue[0]} + {options.find((opt) => + type === 'number' + ? Number(opt.value) === Number(normalizedValue[0]) + : type === 'date' || type === 'datetime' + ? new Date(opt.value).getTime() === + new Date(normalizedValue[0]).getTime() + : String(opt.value) === String(normalizedValue[0]), + )?.label || + (type === 'number' + ? String(normalizedValue[0]) + : type === 'date' || type === 'datetime' + ? new Date(normalizedValue[0] as any).toLocaleString() + : String(normalizedValue[0]))}
    + )} +
    + + ); + })} + {hasMore && !expanded && ( +
    ...
    + )} +
    +
    + ); + }, + }, + { + accessorKey: 'action', + header: () => {t('knowledgeDetails.metadata.action')}, + meta: { + cellClassName: 'w-12', + }, + cell: ({ row }) => ( +
    + + +
    + ), + }, + ]; + + if (!isShowDescription) { + return cols.filter((col) => { + if ('accessorKey' in col && col.accessorKey === 'description') { + return false; + } + return true; + }); + } + return cols; + }, [ + handleDeleteSingleRow, + t, + handleDeleteSingleValue, + isShowDescription, + isDeleteSingleValue, + handleEditValueRow, + metadataType, + expanded, + editingValue, + saveEditedValue, + showTypeColumn, + ]); + + return { + columns, + deleteDialogContent, + }; +}; diff --git a/web/src/pages/dataset/components/metedata/manage-modal.tsx b/web/src/pages/dataset/components/metedata/manage-modal.tsx index 68053b6bd8a..79ff390cb83 100644 --- a/web/src/pages/dataset/components/metedata/manage-modal.tsx +++ b/web/src/pages/dataset/components/metedata/manage-modal.tsx @@ -1,3 +1,4 @@ +import { BulkOperateBar } from '@/components/bulk-operate-bar'; import { ConfirmDeleteDialog, ConfirmDeleteDialogNode, @@ -5,7 +6,6 @@ import { import { EmptyType } from '@/components/empty/constant'; import Empty from '@/components/empty/empty'; import { Button } from '@/components/ui/button'; -import { Input } from '@/components/ui/input'; import { Modal } from '@/components/ui/modal/modal'; import { Switch } from '@/components/ui/switch'; import { @@ -18,9 +18,9 @@ import { } from '@/components/ui/table'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { useSetModalState } from '@/hooks/common-hooks'; +import { useRowSelection } from '@/hooks/logic-hooks/use-row-selection'; import { Routes } from '@/routes'; import { - ColumnDef, flexRender, getCoreRowModel, getFilteredRowModel, @@ -28,28 +28,22 @@ import { getSortedRowModel, useReactTable, } from '@tanstack/react-table'; -import { - ListChevronsDownUp, - ListChevronsUpDown, - Plus, - Settings, - Trash2, -} from 'lucide-react'; +import { Plus, Trash2 } from 'lucide-react'; import { useCallback, useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useHandleMenuClick } from '../../sidebar/hooks'; import { - MetadataDeleteMap, - MetadataType, getMetadataValueTypeLabel, - isMetadataValueTypeWithEnum, + MetadataType, useManageMetaDataModal, + useOperateData, } from './hooks/use-manage-modal'; import { IBuiltInMetadataItem, IManageModalProps, IMetaDataTableData, } from './interface'; +import { useMetadataColumns } from './manage-modal-column'; import { ManageValuesModal } from './manage-values-modal'; type MetadataSettingsTab = 'generation' | 'built-in'; @@ -71,6 +65,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => { isVerticalShowValue = true, builtInMetadata, success, + documentIds, } = props; const { t } = useTranslation(); const [valueData, setValueData] = useState({ @@ -80,25 +75,11 @@ export const ManageMetadataModal = (props: IManageModalProps) => { valueType: 'string', }); - const [expanded, setExpanded] = useState(true); const [activeTab, setActiveTab] = useState('generation'); const [currentValueIndex, setCurrentValueIndex] = useState(0); const [builtInSelection, setBuiltInSelection] = useState< IBuiltInMetadataItem[] >([]); - const [deleteDialogContent, setDeleteDialogContent] = useState({ - visible: false, - title: '', - name: '', - warnText: '', - onOk: () => {}, - onCancel: () => {}, - }); - const [editingValue, setEditingValue] = useState<{ - field: string; - value: string; - newValue: string; - } | null>(null); const { tableData, @@ -108,7 +89,13 @@ export const ManageMetadataModal = (props: IManageModalProps) => { handleSave, addUpdateValue, addDeleteValue, - } = useManageMetaDataModal(originalTableData, metadataType, otherData); + handleDeleteBatchRow, + } = useManageMetaDataModal( + originalTableData, + metadataType, + otherData, + documentIds, + ); const { handleMenuClick } = useHandleMenuClick(); const [shouldSave, setShouldSave] = useState(false); const { @@ -116,20 +103,12 @@ export const ManageMetadataModal = (props: IManageModalProps) => { showModal: showManageValuesModal, hideModal: hideManageValuesModal, } = useSetModalState(); - const hideDeleteModal = () => { - setDeleteDialogContent({ - visible: false, - title: '', - name: '', - warnText: '', - onOk: () => {}, - onCancel: () => {}, - }); - }; const isSettingsMode = metadataType === MetadataType.Setting || - metadataType === MetadataType.SingleFileSetting; + metadataType === MetadataType.SingleFileSetting || + metadataType === MetadataType.UpdateSingle; + const showTypeColumn = isSettingsMode; const builtInRows = useMemo( () => [ @@ -183,31 +162,6 @@ export const ManageMetadataModal = (props: IManageModalProps) => { [builtInSelection], ); - const handleEditValue = (field: string, value: string) => { - setEditingValue({ field, value, newValue: value }); - }; - - const saveEditedValue = useCallback(() => { - if (editingValue) { - setTableData((prev) => { - return prev.map((row) => { - if (row.field === editingValue.field) { - const updatedValues = row.values.map((v) => - v === editingValue.value ? editingValue.newValue : v, - ); - return { ...row, values: updatedValues }; - } - return row; - }); - }); - setEditingValue(null); - setShouldSave(true); - } - }, [editingValue, setTableData]); - - const cancelEditValue = () => { - setEditingValue(null); - }; const handAddValueRow = () => { setValueData({ field: '', @@ -226,229 +180,19 @@ export const ManageMetadataModal = (props: IManageModalProps) => { }, [showManageValuesModal], ); - - const columns: ColumnDef[] = useMemo(() => { - const cols: ColumnDef[] = [ - { - accessorKey: 'field', - header: () => {t('knowledgeDetails.metadata.field')}, - cell: ({ row }) => ( -
    - {row.getValue('field')} -
    - ), - }, - ...(showTypeColumn - ? ([ - { - accessorKey: 'valueType', - header: () => Type, - cell: ({ row }) => ( -
    - {getMetadataValueTypeLabel( - row.original.valueType as IMetaDataTableData['valueType'], - )} -
    - ), - }, - ] as ColumnDef[]) - : []), - { - accessorKey: 'description', - header: () => {t('knowledgeDetails.metadata.description')}, - cell: ({ row }) => ( -
    - {row.getValue('description')} -
    - ), - }, - { - accessorKey: 'values', - header: () => ( -
    - {t('knowledgeDetails.metadata.values')} -
    { - setExpanded(!expanded); - }} - > - {expanded ? ( - - ) : ( - - )} - {expanded} -
    -
    - ), - cell: ({ row }) => { - const values = row.getValue('values') as Array; - const supportsEnum = isMetadataValueTypeWithEnum( - row.original.valueType, - ); - - if (!supportsEnum || !Array.isArray(values) || values.length === 0) { - return
    ; - } - - const displayedValues = expanded ? values : values.slice(0, 2); - const hasMore = Array.isArray(values) && values.length > 2; - - return ( -
    -
    - {displayedValues?.map((value: string) => { - const isEditing = - editingValue && - editingValue.field === row.getValue('field') && - editingValue.value === value; - - return isEditing ? ( -
    - - setEditingValue({ - ...editingValue, - newValue: e.target.value, - }) - } - onBlur={saveEditedValue} - onKeyDown={(e) => { - if (e.key === 'Enter') { - saveEditedValue(); - } else if (e.key === 'Escape') { - cancelEditValue(); - } - }} - autoFocus - // className="text-sm min-w-20 max-w-32 outline-none bg-transparent px-1 py-0.5" - /> -
    - ) : ( - - )} -
    - - ); - })} - {hasMore && !expanded && ( -
    ...
    - )} -
    -
    - ); - }, - }, - { - accessorKey: 'action', - header: () => {t('knowledgeDetails.metadata.action')}, - meta: { - cellClassName: 'w-12', - }, - cell: ({ row }) => ( -
    - - -
    - ), - }, - ]; - if (!isShowDescription) { - return cols.filter((col) => col.accessorKey !== 'description'); - } - return cols; - }, [ - handleDeleteSingleRow, - t, + const { rowSelection, rowSelectionIsEmpty, setRowSelection, selectedCount } = + useRowSelection(); + const { columns, deleteDialogContent } = useMetadataColumns({ + isDeleteSingleValue: !!isDeleteSingleValue, + metadataType, + setTableData, handleDeleteSingleValue, - isShowDescription, - isDeleteSingleValue, + handleDeleteSingleRow, handleEditValueRow, - metadataType, - expanded, - editingValue, - saveEditedValue, + isShowDescription, showTypeColumn, - ]); + setShouldSave, + }); const table = useReactTable({ data: tableData as IMetaDataTableData[], @@ -457,7 +201,11 @@ export const ManageMetadataModal = (props: IManageModalProps) => { getPaginationRowModel: getPaginationRowModel(), getSortedRowModel: getSortedRowModel(), getFilteredRowModel: getFilteredRowModel(), + onRowSelectionChange: setRowSelection, manualPagination: true, + state: { + rowSelection, + }, }); const handleSaveValues = (data: IMetaDataTableData) => { @@ -506,7 +254,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => { handleSave({ callback: () => {}, builtInMetadata: builtInSelection }); setShouldSave(false); }, 0); - + console.log('shouldSave'); return () => clearTimeout(timer); } }, [tableData, shouldSave, handleSave, builtInSelection]); @@ -515,6 +263,25 @@ export const ManageMetadataModal = (props: IManageModalProps) => { return tableData.map((item) => item.field); }, [tableData]); + const { handleDelete } = useOperateData({ + rowSelection, + list: tableData, + handleDeleteBatchRow, + }); + + const operateList = [ + { + id: 'delete', + label: t('common.delete'), + icon: , + onClick: async () => { + await handleDelete(); + // if (code === 0) { + // setRowSelection({}); + // } + }, + }, + ]; return ( <> { callback: hideModal, builtInMetadata: builtInSelection, }); - console.log('data', res); success?.(res); }} > @@ -559,15 +325,25 @@ export const ManageMetadataModal = (props: IManageModalProps) => { )}
    - {metadataType === MetadataType.Setting ? ( + + {rowSelectionIsEmpty || ( + + )} + {metadataType === MetadataType.Setting || + metadataType === MetadataType.SingleFileSetting ? ( setActiveTab(v as MetadataSettingsTab)} > - Generation + + {t('knowledgeDetails.metadata.generation')} + - {t('knowledgeConfiguration.builtIn')} + {t('knowledgeDetails.metadata.builtIn')} diff --git a/web/src/pages/dataset/components/metedata/manage-values-modal.tsx b/web/src/pages/dataset/components/metedata/manage-values-modal.tsx index 2498dd887bd..70be2b3ca96 100644 --- a/web/src/pages/dataset/components/metedata/manage-values-modal.tsx +++ b/web/src/pages/dataset/components/metedata/manage-values-modal.tsx @@ -2,49 +2,87 @@ import { ConfirmDeleteDialog, ConfirmDeleteDialogNode, } from '@/components/confirm-delete-dialog'; +import { DynamicForm, FormFieldType } from '@/components/dynamic-form'; import EditTag from '@/components/edit-tag'; import { Button } from '@/components/ui/button'; -import { FormLabel } from '@/components/ui/form'; import { Input } from '@/components/ui/input'; +import { DateInput } from '@/components/ui/input-date'; import { Modal } from '@/components/ui/modal/modal'; -import { RAGFlowSelect } from '@/components/ui/select'; -import { Textarea } from '@/components/ui/textarea'; +import { formatPureDate } from '@/utils/date'; +import dayjs from 'dayjs'; import { Plus, Trash2 } from 'lucide-react'; -import { memo } from 'react'; +import { memo, useMemo, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { - isMetadataValueTypeWithEnum, - metadataValueTypeOptions, -} from './hooks/use-manage-modal'; +import { metadataValueTypeOptions } from './hooks/use-manage-modal'; import { useManageValues } from './hooks/use-manage-values-modal'; -import { IManageValuesProps } from './interface'; +import { IManageValuesProps, MetadataValueType } from './interface'; // Create a separate input component, wrapped with memo to avoid unnecessary re-renders const ValueInputItem = memo( ({ item, index, + type, onValueChange, onDelete, onBlur, }: { item: string; index: number; - onValueChange: (index: number, value: string) => void; + type: MetadataValueType; + onValueChange: (index: number, value: string, isUpdate?: boolean) => void; onDelete: (index: number) => void; onBlur: (index: number) => void; }) => { + const value = useMemo(() => { + if (type === 'time') { + if (item) { + try { + // Using dayjs to parse date strings in various formats including DD/MM/YYYY + const parsedDate = dayjs(item, [ + 'YYYY-MM-DD', + 'DD/MM/YYYY', + 'MM/DD/YYYY', + 'DD-MM-YYYY', + 'MM-DD-YYYY', + ]); + + if (!parsedDate.isValid()) { + console.error('Invalid date format:', item); + return undefined; // Return current date as fallback + } + return parsedDate.toDate(); + } catch (error) { + console.error('Error parsing date:', item, error); + return undefined; // Return current date as fallback + } + } + return undefined; + } + return item; + }, [item, type]); return (
    - onValueChange(index, e.target.value)} - onBlur={() => onBlur(index)} - /> + {type === 'time' && ( + { + onValueChange(index, formatPureDate(value), true); + }} + /> + )} + {type !== 'time' && ( + onValueChange(index, e.target.value)} + onBlur={() => onBlur(index)} + /> + )}
    )} - {isEditField && ( -
    -
    {t('knowledgeDetails.metadata.fieldName')}
    -
    - { - const value = e.target?.value || ''; - if (/^[a-zA-Z_]*$/.test(value)) { - handleChange('field', value); - } - }} - /> -
    {valueError.field}
    -
    -
    - )} - {isShowType && ( -
    -
    Type
    - handleChange('valueType', value)} - /> -
    - )} - {isShowDescription && ( -
    - - {t('knowledgeDetails.metadata.description')} - -
    - - -
    - - - - \ No newline at end of file diff --git a/intergrations/extension_chrome/popup.js b/intergrations/extension_chrome/popup.js deleted file mode 100644 index 0a8bdaba0ad..00000000000 --- a/intergrations/extension_chrome/popup.js +++ /dev/null @@ -1,24 +0,0 @@ -document.addEventListener("DOMContentLoaded", () => { - chrome.storage.sync.get(["baseURL", "from", "auth", "sharedID"], (result) => { - if (result.baseURL && result.sharedID && result.from && result.auth) { - const iframeSrc = `${result.baseURL}chat/share?shared_id=${result.sharedID}&from=${result.from}&auth=${result.auth}`; - const iframe = document.querySelector("iframe"); - iframe.src = iframeSrc; - } - }); - chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { - chrome.scripting.executeScript( - { - target: { tabId: tabs[0].id }, - files: ["content.js"], - }, - (results) => { - if (results && results[0]) { - const getHtml = document.getElementById("getHtml"); - getHtml.value = results[0].result; - - } - } - ); - }); -}); diff --git a/intergrations/extension_chrome/styles/options.css b/intergrations/extension_chrome/styles/options.css deleted file mode 100644 index 1e3ded67517..00000000000 --- a/intergrations/extension_chrome/styles/options.css +++ /dev/null @@ -1,91 +0,0 @@ -#ragflow { - font-family: "Segoe UI", Arial, sans-serif; - margin: 0; - padding: 0; - display: flex; - justify-content: center; - align-items: center; - height: 600px; -} - -#ragflow .window { - display: flex; - flex-direction: column; - justify-content: space-between; - flex: 1; - overflow: hidden; -} -#ragflow #form-config { - background-color: #fff; - box-shadow: 0 0 15px rgba(0, 0, 0, 0.3); - display: flex; - flex-direction: column; - justify-content: space-between; - overflow: hidden; -} - -#ragflow .header { - background-color: #fff; - padding: 4px; - display: flex; - justify-content: space-between; - align-items: center; - flex-direction: row; -} - -#ragflow .header .title { - font-size: 16px; -} - -#ragflow .header .logo { - width: 100px; /* Adjust size as needed */ - height: auto; - margin-right: 10px; -} - -#ragflow .content { - padding: 20px; - display: flex; - flex-direction: column; - justify-content: space-between; -} - -#ragflow label { - font-weight: bold; - margin-bottom: 5px; -} - -#ragflow input, -#ragflow select { - width: 100%; - padding: 8px; - margin-bottom: 15px; - border: 1px solid #ccc; - border-radius: 5px; - box-sizing: border-box; -} - -#ragflow button { - background-color: #0078d4; - color: #fff; - padding: 10px; - border: none; - border-radius: 5px; - cursor: pointer; - font-size: 14px; -} - -#ragflow button:hover { - background-color: #005bb5; -} - -#ragflow #config-button { - display: flex; - position: absolute; - top: 2px; - right: 2px; - font-size: 22px; -} -#ragflow #config-button:hover { - cursor: pointer; -} diff --git a/intergrations/extension_chrome/styles/popup.css b/intergrations/extension_chrome/styles/popup.css deleted file mode 100644 index 90134f8ad9d..00000000000 --- a/intergrations/extension_chrome/styles/popup.css +++ /dev/null @@ -1,20 +0,0 @@ -#ragflow { - font-family: "Segoe UI", Arial, sans-serif; - margin: 0; - padding: 0; - display: flex; - justify-content: center; - align-items: center; - width: 320px; -} - -#ragflow .window { - display: flex; - flex-direction: column; - justify-content: space-between; - flex: 1; - overflow: hidden; -} -#ragflow #output { - position: absolute; -} \ No newline at end of file diff --git a/intergrations/chatgpt-on-wechat/plugins/README.md b/tools/chatgpt-on-wechat/plugins/README.md similarity index 100% rename from intergrations/chatgpt-on-wechat/plugins/README.md rename to tools/chatgpt-on-wechat/plugins/README.md diff --git a/intergrations/chatgpt-on-wechat/plugins/__init__.py b/tools/chatgpt-on-wechat/plugins/__init__.py similarity index 100% rename from intergrations/chatgpt-on-wechat/plugins/__init__.py rename to tools/chatgpt-on-wechat/plugins/__init__.py diff --git a/intergrations/chatgpt-on-wechat/plugins/config.json b/tools/chatgpt-on-wechat/plugins/config.json similarity index 100% rename from intergrations/chatgpt-on-wechat/plugins/config.json rename to tools/chatgpt-on-wechat/plugins/config.json diff --git a/intergrations/chatgpt-on-wechat/plugins/ragflow_chat.py b/tools/chatgpt-on-wechat/plugins/ragflow_chat.py similarity index 100% rename from intergrations/chatgpt-on-wechat/plugins/ragflow_chat.py rename to tools/chatgpt-on-wechat/plugins/ragflow_chat.py diff --git a/intergrations/chatgpt-on-wechat/plugins/requirements.txt b/tools/chatgpt-on-wechat/plugins/requirements.txt similarity index 100% rename from intergrations/chatgpt-on-wechat/plugins/requirements.txt rename to tools/chatgpt-on-wechat/plugins/requirements.txt diff --git a/intergrations/firecrawl/INSTALLATION.md b/tools/firecrawl/INSTALLATION.md similarity index 100% rename from intergrations/firecrawl/INSTALLATION.md rename to tools/firecrawl/INSTALLATION.md diff --git a/intergrations/firecrawl/README.md b/tools/firecrawl/README.md similarity index 100% rename from intergrations/firecrawl/README.md rename to tools/firecrawl/README.md diff --git a/intergrations/firecrawl/__init__.py b/tools/firecrawl/__init__.py similarity index 100% rename from intergrations/firecrawl/__init__.py rename to tools/firecrawl/__init__.py diff --git a/intergrations/firecrawl/example_usage.py b/tools/firecrawl/example_usage.py similarity index 100% rename from intergrations/firecrawl/example_usage.py rename to tools/firecrawl/example_usage.py diff --git a/intergrations/firecrawl/firecrawl_config.py b/tools/firecrawl/firecrawl_config.py similarity index 100% rename from intergrations/firecrawl/firecrawl_config.py rename to tools/firecrawl/firecrawl_config.py diff --git a/intergrations/firecrawl/firecrawl_connector.py b/tools/firecrawl/firecrawl_connector.py similarity index 100% rename from intergrations/firecrawl/firecrawl_connector.py rename to tools/firecrawl/firecrawl_connector.py diff --git a/intergrations/firecrawl/firecrawl_processor.py b/tools/firecrawl/firecrawl_processor.py similarity index 100% rename from intergrations/firecrawl/firecrawl_processor.py rename to tools/firecrawl/firecrawl_processor.py diff --git a/intergrations/firecrawl/firecrawl_ui.py b/tools/firecrawl/firecrawl_ui.py similarity index 100% rename from intergrations/firecrawl/firecrawl_ui.py rename to tools/firecrawl/firecrawl_ui.py diff --git a/intergrations/firecrawl/integration.py b/tools/firecrawl/integration.py similarity index 100% rename from intergrations/firecrawl/integration.py rename to tools/firecrawl/integration.py diff --git a/intergrations/firecrawl/ragflow_integration.py b/tools/firecrawl/ragflow_integration.py similarity index 100% rename from intergrations/firecrawl/ragflow_integration.py rename to tools/firecrawl/ragflow_integration.py diff --git a/intergrations/firecrawl/requirements.txt b/tools/firecrawl/requirements.txt similarity index 100% rename from intergrations/firecrawl/requirements.txt rename to tools/firecrawl/requirements.txt From fabbfcab909ecc952ffc0eeca0c271404e25b9e3 Mon Sep 17 00:00:00 2001 From: 6ba3i <112825897+6ba3i@users.noreply.github.com> Date: Mon, 9 Feb 2026 14:56:10 +0800 Subject: [PATCH 318/335] Fix: failing p3 test for SDK/HTTP APIs (#13062) ### What problem does this PR solve? Adjust highlight parsing, add row-count SQL override, tweak retrieval thresholding, and update tests with engine-aware skips/utilities. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/sdk/doc.py | 12 ++++- api/db/services/dialog_service.py | 24 +++++++++- rag/nlp/search.py | 4 +- .../test_retrieval_chunks.py | 5 +- .../test_list_chunks.py | 9 ++++ .../test_retrieval_chunks.py | 10 ++-- .../test_update_dataset.py | 7 +++ .../test_create_memory.py | 1 + .../test_list_message.py | 3 ++ test/testcases/utils/engine_utils.py | 47 +++++++++++++++++++ 10 files changed, 110 insertions(+), 12 deletions(-) create mode 100644 test/testcases/utils/engine_utils.py diff --git a/api/apps/sdk/doc.py b/api/apps/sdk/doc.py index 44cb0773599..d8b81dce7ee 100644 --- a/api/apps/sdk/doc.py +++ b/api/apps/sdk/doc.py @@ -1549,10 +1549,18 @@ async def retrieval_test(tenant_id): similarity_threshold = float(req.get("similarity_threshold", 0.2)) vector_similarity_weight = float(req.get("vector_similarity_weight", 0.3)) top = int(req.get("top_k", 1024)) - if req.get("highlight") == "False" or req.get("highlight") == "false": + highlight_val = req.get("highlight", None) + if highlight_val is None: highlight = False + elif isinstance(highlight_val, bool): + highlight = highlight_val + elif isinstance(highlight_val, str): + if highlight_val.lower() in ["true", "false"]: + highlight = highlight_val.lower() == "true" + else: + return get_error_data_result("`highlight` should be a boolean") else: - highlight = True + return get_error_data_result("`highlight` should be a boolean") try: tenant_ids = list(set([kb.tenant_id for kb in kbs])) e, kb = KnowledgebaseService.get_by_id(kb_ids[0]) diff --git a/api/db/services/dialog_service.py b/api/db/services/dialog_service.py index 3940a8a2faf..66025d13ef8 100644 --- a/api/db/services/dialog_service.py +++ b/api/db/services/dialog_service.py @@ -606,10 +606,21 @@ async def use_sql(question, field_map, tenant_id, chat_mdl, quota=True, kb_ids=N table_name = base_table logging.debug(f"use_sql: Using ES/OS table name: {table_name}") + def is_row_count_question(q: str) -> bool: + q = (q or "").lower() + if not re.search(r"\bhow many rows\b|\bnumber of rows\b|\brow count\b", q): + return False + return bool(re.search(r"\bdataset\b|\btable\b|\bspreadsheet\b|\bexcel\b", q)) + # Generate engine-specific SQL prompts if doc_engine == "infinity": # Build Infinity prompts with JSON extraction context json_field_names = list(field_map.keys()) + row_count_override = ( + f"SELECT COUNT(*) AS rows FROM {table_name}" + if is_row_count_question(question) + else None + ) sys_prompt = """You are a Database Administrator. Write SQL for a table with JSON 'chunk_data' column. JSON Extraction: json_extract_string(chunk_data, '$.FieldName') @@ -641,6 +652,11 @@ async def use_sql(question, field_map, tenant_id, chat_mdl, quota=True, kb_ids=N elif doc_engine == "oceanbase": # Build OceanBase prompts with JSON extraction context json_field_names = list(field_map.keys()) + row_count_override = ( + f"SELECT COUNT(*) AS rows FROM {table_name}" + if is_row_count_question(question) + else None + ) sys_prompt = """You are a Database Administrator. Write SQL for a table with JSON 'chunk_data' column. JSON Extraction: json_extract_string(chunk_data, '$.FieldName') @@ -671,6 +687,7 @@ async def use_sql(question, field_map, tenant_id, chat_mdl, quota=True, kb_ids=N ) else: # Build ES/OS prompts with direct field access + row_count_override = None sys_prompt = """You are a Database Administrator. Write SQL queries. RULES: @@ -693,8 +710,11 @@ async def use_sql(question, field_map, tenant_id, chat_mdl, quota=True, kb_ids=N tried_times = 0 async def get_table(): - nonlocal sys_prompt, user_prompt, question, tried_times - sql = await chat_mdl.async_chat(sys_prompt, [{"role": "user", "content": user_prompt}], {"temperature": 0.06}) + nonlocal sys_prompt, user_prompt, question, tried_times, row_count_override + if row_count_override: + sql = row_count_override + else: + sql = await chat_mdl.async_chat(sys_prompt, [{"role": "user", "content": user_prompt}], {"temperature": 0.06}) logging.debug(f"use_sql: Raw SQL from LLM: {repr(sql[:500])}") # Remove think blocks if present (format: ...) sql = re.sub(r"\n.*?\n\s*", "", sql, flags=re.DOTALL) diff --git a/rag/nlp/search.py b/rag/nlp/search.py index d6cd6de510d..a36a8d967a8 100644 --- a/rag/nlp/search.py +++ b/rag/nlp/search.py @@ -434,7 +434,9 @@ async def retrieval( sorted_idx = np.argsort(sim_np * -1) - valid_idx = [int(i) for i in sorted_idx if sim_np[i] >= similarity_threshold] + # When vector_similarity_weight is 0, similarity_threshold is not meaningful for term-only scores. + post_threshold = 0.0 if vector_similarity_weight <= 0 else similarity_threshold + valid_idx = [int(i) for i in sorted_idx if sim_np[i] >= post_threshold] filtered_count = len(valid_idx) ranks["total"] = int(filtered_count) diff --git a/test/testcases/test_http_api/test_chunk_management_within_dataset/test_retrieval_chunks.py b/test/testcases/test_http_api/test_chunk_management_within_dataset/test_retrieval_chunks.py index 4a05d29bacf..2c94f2d30e7 100644 --- a/test/testcases/test_http_api/test_chunk_management_within_dataset/test_retrieval_chunks.py +++ b/test/testcases/test_http_api/test_chunk_management_within_dataset/test_retrieval_chunks.py @@ -272,7 +272,7 @@ def test_keyword(self, HttpApiAuth, add_chunks, payload, expected_code, expected [ ({"highlight": True}, 0, True, ""), ({"highlight": "True"}, 0, True, ""), - pytest.param({"highlight": False}, 0, False, "", marks=pytest.mark.skip(reason="issues/6648")), + ({"highlight": False}, 0, False, ""), ({"highlight": "False"}, 0, False, ""), pytest.param({"highlight": None}, 0, False, "", marks=pytest.mark.skip(reason="issues/6648")), ], @@ -282,8 +282,7 @@ def test_highlight(self, HttpApiAuth, add_chunks, payload, expected_code, expect payload.update({"question": "chunk", "dataset_ids": [dataset_id]}) res = retrieval_chunks(HttpApiAuth, payload) assert res["code"] == expected_code - doc_engine = os.environ.get("DOC_ENGINE", "elasticsearch").lower() - if expected_highlight and doc_engine != "infinity": + if expected_highlight: for chunk in res["data"]["chunks"]: assert "highlight" in chunk else: diff --git a/test/testcases/test_sdk_api/test_chunk_management_within_dataset/test_list_chunks.py b/test/testcases/test_sdk_api/test_chunk_management_within_dataset/test_list_chunks.py index e29378528fb..4174d3fb14b 100644 --- a/test/testcases/test_sdk_api/test_chunk_management_within_dataset/test_list_chunks.py +++ b/test/testcases/test_sdk_api/test_chunk_management_within_dataset/test_list_chunks.py @@ -18,6 +18,7 @@ import pytest from common import batch_add_chunks +from utils.engine_utils import get_doc_engine class TestChunksList: @@ -84,6 +85,12 @@ def test_page_size(self, add_chunks, params, expected_page_size, expected_messag ) def test_keywords(self, add_chunks, params, expected_page_size): _, document, _ = add_chunks + if params.get("keywords") == "ragflow": + doc_engine = get_doc_engine(document.rag) + if doc_engine == "infinity" and expected_page_size == 1: + pytest.skip("issues/6509") + if doc_engine != "infinity" and expected_page_size == 5: + pytest.skip("issues/6509") chunks = document.list_chunks(**params) assert len(chunks) == expected_page_size, str(chunks) @@ -99,6 +106,8 @@ def test_keywords(self, add_chunks, params, expected_page_size): ) def test_id(self, add_chunks, chunk_id, expected_page_size, expected_message): _, document, chunks = add_chunks + if callable(chunk_id) and get_doc_engine(document.rag) == "infinity": + pytest.skip("issues/6499") chunk_ids = [chunk.id for chunk in chunks] if callable(chunk_id): params = {"id": chunk_id(chunk_ids)} diff --git a/test/testcases/test_sdk_api/test_chunk_management_within_dataset/test_retrieval_chunks.py b/test/testcases/test_sdk_api/test_chunk_management_within_dataset/test_retrieval_chunks.py index 2834cfba91e..9e62b309189 100644 --- a/test/testcases/test_sdk_api/test_chunk_management_within_dataset/test_retrieval_chunks.py +++ b/test/testcases/test_sdk_api/test_chunk_management_within_dataset/test_retrieval_chunks.py @@ -18,6 +18,8 @@ import pytest +DOC_ENGINE = (os.getenv("DOC_ENGINE") or "").lower() + class TestChunksRetrieval: @pytest.mark.p1 @@ -159,25 +161,25 @@ def test_vector_similarity_weight(self, client, add_chunks, payload, expected_pa {"top_k": 1}, 4, "", - marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") in ["infinity", "opensearch"], reason="Infinity"), + marks=pytest.mark.skipif(DOC_ENGINE in ["infinity", "opensearch"], reason="Infinity"), ), pytest.param( {"top_k": 1}, 1, "", - marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") in [None, "opensearch", "elasticsearch"], reason="elasticsearch"), + marks=pytest.mark.skipif(DOC_ENGINE in ["", "opensearch", "elasticsearch"], reason="elasticsearch"), ), pytest.param( {"top_k": -1}, 4, "must be greater than 0", - marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") in ["infinity", "opensearch"], reason="Infinity"), + marks=pytest.mark.skipif(DOC_ENGINE in ["infinity", "opensearch"], reason="Infinity"), ), pytest.param( {"top_k": -1}, 4, "3014", - marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") in [None, "opensearch", "elasticsearch"], reason="elasticsearch"), + marks=pytest.mark.skipif(DOC_ENGINE in ["", "opensearch", "elasticsearch"], reason="elasticsearch"), ), pytest.param( {"top_k": "a"}, diff --git a/test/testcases/test_sdk_api/test_dataset_mangement/test_update_dataset.py b/test/testcases/test_sdk_api/test_dataset_mangement/test_update_dataset.py index e39b42374de..942e3b5fffb 100644 --- a/test/testcases/test_sdk_api/test_dataset_mangement/test_update_dataset.py +++ b/test/testcases/test_sdk_api/test_dataset_mangement/test_update_dataset.py @@ -25,6 +25,7 @@ from utils.file_utils import create_image_file from utils.hypothesis_utils import valid_names from configs import DEFAULT_PARSER_CONFIG +from utils.engine_utils import get_doc_engine class TestRquest: @pytest.mark.p2 @@ -332,6 +333,8 @@ def test_chunk_method_none(self, add_dataset_func): @pytest.mark.p2 @pytest.mark.parametrize("pagerank", [0, 50, 100], ids=["min", "mid", "max"]) def test_pagerank(self, client, add_dataset_func, pagerank): + if get_doc_engine(client) == "infinity": + pytest.skip("#8208") dataset = add_dataset_func dataset.update({"pagerank": pagerank}) assert dataset.pagerank == pagerank, str(dataset) @@ -342,6 +345,8 @@ def test_pagerank(self, client, add_dataset_func, pagerank): @pytest.mark.skipif(os.getenv("DOC_ENGINE") == "infinity", reason="#8208") @pytest.mark.p2 def test_pagerank_set_to_0(self, client, add_dataset_func): + if get_doc_engine(client) == "infinity": + pytest.skip("#8208") dataset = add_dataset_func dataset.update({"pagerank": 50}) assert dataset.pagerank == 50, str(dataset) @@ -358,6 +363,8 @@ def test_pagerank_set_to_0(self, client, add_dataset_func): @pytest.mark.skipif(os.getenv("DOC_ENGINE") != "infinity", reason="#8208") @pytest.mark.p2 def test_pagerank_infinity(self, client, add_dataset_func): + if get_doc_engine(client) != "infinity": + pytest.skip("#8208") dataset = add_dataset_func with pytest.raises(Exception) as exception_info: dataset.update({"pagerank": 50}) diff --git a/test/testcases/test_sdk_api/test_memory_management/test_create_memory.py b/test/testcases/test_sdk_api/test_memory_management/test_create_memory.py index c1852b119d4..2c9a3e7c7d5 100644 --- a/test/testcases/test_sdk_api/test_memory_management/test_create_memory.py +++ b/test/testcases/test_sdk_api/test_memory_management/test_create_memory.py @@ -81,6 +81,7 @@ def test_name_invalid(self, client, name, expected_message): @pytest.mark.p2 @given(name=valid_names()) + @settings(deadline=None) def test_type_invalid(self, client, name): payload = { "name": name, diff --git a/test/testcases/test_sdk_api/test_message_management/test_list_message.py b/test/testcases/test_sdk_api/test_message_management/test_list_message.py index d7cdb7ed3b3..fc7578353d4 100644 --- a/test/testcases/test_sdk_api/test_message_management/test_list_message.py +++ b/test/testcases/test_sdk_api/test_message_management/test_list_message.py @@ -19,6 +19,7 @@ import pytest from ragflow_sdk import RAGFlow, Memory from configs import INVALID_API_TOKEN, HOST_ADDRESS +from utils.engine_utils import get_doc_engine class TestAuthorization: @@ -88,6 +89,8 @@ def test_filter_agent_id(self, client): @pytest.mark.p2 @pytest.mark.skipif(os.getenv("DOC_ENGINE") == "infinity", reason="Not support.") def test_search_keyword(self, client): + if get_doc_engine(client) == "infinity": + pytest.skip("Not support.") memory_id = self.memory_id session_ids = self.session_ids session_id = random.choice(session_ids) diff --git a/test/testcases/utils/engine_utils.py b/test/testcases/utils/engine_utils.py new file mode 100644 index 00000000000..8a54bed212b --- /dev/null +++ b/test/testcases/utils/engine_utils.py @@ -0,0 +1,47 @@ +# +# Copyright 2025 The InfiniFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import os +import requests + +_DOC_ENGINE_CACHE = None + + +def get_doc_engine(rag=None) -> str: + """Return lower-cased doc_engine from env, or from /system/status if env is unset.""" + global _DOC_ENGINE_CACHE + env = (os.getenv("DOC_ENGINE") or "").strip().lower() + if env: + _DOC_ENGINE_CACHE = env + return env + if _DOC_ENGINE_CACHE: + return _DOC_ENGINE_CACHE + if rag is None: + return "" + try: + api_url = getattr(rag, "api_url", "") + if "/api/" in api_url: + base_url, version = api_url.rsplit("/api/", 1) + status_url = f"{base_url}/{version}/system/status" + else: + status_url = f"{api_url}/system/status" + headers = getattr(rag, "authorization_header", {}) + res = requests.get(status_url, headers=headers).json() + engine = str(res.get("data", {}).get("doc_engine", {}).get("type", "")).lower() + if engine: + _DOC_ENGINE_CACHE = engine + return engine + except Exception: + return "" From 25a32c198d83f861770fafca47d27f5645843ca7 Mon Sep 17 00:00:00 2001 From: Magicbook1108 Date: Mon, 9 Feb 2026 17:51:22 +0800 Subject: [PATCH 319/335] Fix: gemini model names (#13073) ### What problem does this PR solve? Fix: gemini model names #13053 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- conf/llm_factories.json | 75 +++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 40 deletions(-) diff --git a/conf/llm_factories.json b/conf/llm_factories.json index 1face892a78..be9e7322d77 100644 --- a/conf/llm_factories.json +++ b/conf/llm_factories.json @@ -1474,58 +1474,53 @@ "rank": "980", "llm": [ { - "llm_name": "gemini-3-pro-preview", - "tags": "LLM,CHAT,1M,IMAGE2TEXT", - "max_tokens": 1048576, - "model_type": "image2text", - "is_tools": true - }, - { - "llm_name": "gemini-2.5-flash", - "tags": "LLM,CHAT,1024K,IMAGE2TEXT", - "max_tokens": 1048576, - "model_type": "image2text", - "is_tools": true + "llm_name": "gemini-3-pro-preview", + "tags": "LLM,CHAT,1M,IMAGE2TEXT", + "max_tokens": 1048576, + "model_type": "image2text", + "is_tools": true }, { - "llm_name": "gemini-2.5-pro", - "tags": "LLM,CHAT,IMAGE2TEXT,1024K", - "max_tokens": 1048576, - "model_type": "image2text", - "is_tools": true + "llm_name": "gemini-2.5-flash", + "tags": "LLM,CHAT,1024K,IMAGE2TEXT", + "max_tokens": 1048576, + "model_type": "image2text", + "is_tools": true }, { - "llm_name": "gemini-2.5-flash-lite", - "tags": "LLM,CHAT,1024K,IMAGE2TEXT", - "max_tokens": 1048576, - "model_type": "image2text", - "is_tools": true + "llm_name": "gemini-2.5-pro", + "tags": "LLM,CHAT,IMAGE2TEXT,1024K", + "max_tokens": 1048576, + "model_type": "image2text", + "is_tools": true }, { - "llm_name": "gemini-2.0-flash", - "tags": "LLM,CHAT,1024K", - "max_tokens": 1048576, - "model_type": "image2text", - "is_tools": true + "llm_name": "gemini-2.5-flash-lite", + "tags": "LLM,CHAT,1024K,IMAGE2TEXT", + "max_tokens": 1048576, + "model_type": "image2text", + "is_tools": true }, { - "llm_name": "gemini-2.0-flash-lite", - "tags": "LLM,CHAT,1024K", - "max_tokens": 1048576, - "model_type": "image2text", - "is_tools": true + "llm_name": "gemini-2.0-flash", + "tags": "LLM,CHAT,1024K", + "max_tokens": 1048576, + "model_type": "image2text", + "is_tools": true }, { - "llm_name": "text-embedding-004", - "tags": "TEXT EMBEDDING", - "max_tokens": 2048, - "model_type": "embedding" + "llm_name": "gemini-2.0-flash-lite", + "tags": "LLM,CHAT,1024K", + "max_tokens": 1048576, + "model_type": "image2text", + "is_tools": true }, + { - "llm_name": "embedding-001", - "tags": "TEXT EMBEDDING", - "max_tokens": 2048, - "model_type": "embedding" + "llm_name": "gemini-embedding-001", + "tags": "TEXT EMBEDDING", + "max_tokens": 2048, + "model_type": "embedding" } ] }, From 4bc622b4097a2c5ae44a4cd782a3978d302746ec Mon Sep 17 00:00:00 2001 From: qinling0210 <88864212+qinling0210@users.noreply.github.com> Date: Mon, 9 Feb 2026 17:56:59 +0800 Subject: [PATCH 320/335] Fix parameter of calling self.dataStore.get() and warning info during parser (#13068) ### What problem does this PR solve? Fix parameter of calling self.dataStore.get() and warning info during parser https://github.com/infiniflow/ragflow/issues/13036 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/app/table.py | 5 ++--- rag/nlp/search.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/rag/app/table.py b/rag/app/table.py index 106f06a4c81..f521ab23d6a 100644 --- a/rag/app/table.py +++ b/rag/app/table.py @@ -304,9 +304,8 @@ def _is_empty_row(self, row_data): def trans_datatime(s): try: return datetime_parse(s.strip()).strftime("%Y-%m-%d %H:%M:%S") - except Exception as e: - logging.warning(f"Failed to parse date from {s}, error: {e}") - pass + except Exception: + return None def trans_bool(s): diff --git a/rag/nlp/search.py b/rag/nlp/search.py index a36a8d967a8..0d9bd096e6d 100644 --- a/rag/nlp/search.py +++ b/rag/nlp/search.py @@ -627,7 +627,7 @@ async def retrieval_by_toc(self, query: str, chunks: list[dict], tenant_ids: lis if cid in id2idx: chunks[id2idx[cid]]["similarity"] += sim continue - chunk = self.dataStore.get(cid, idx_nms, kb_ids) + chunk = self.dataStore.get(cid, idx_nms[0], kb_ids) if not chunk: continue d = { @@ -677,7 +677,7 @@ def retrieval_by_children(self, chunks: list[dict], tenant_ids: list[str]): vector_size = 1024 for id, cks in mom_chunks.items(): - chunk = self.dataStore.get(id, idx_nms, [ck["kb_id"] for ck in cks]) + chunk = self.dataStore.get(id, idx_nms[0], [ck["kb_id"] for ck in cks]) d = { "chunk_id": id, "content_ltks": " ".join([ck["content_ltks"] for ck in cks]), From a2dda8fb70b620a2cfcc9aed5e22dd034600c49e Mon Sep 17 00:00:00 2001 From: Neel Harsola <81899840+skylarkoo7@users.noreply.github.com> Date: Mon, 9 Feb 2026 17:03:05 +0530 Subject: [PATCH 321/335] Fix: enable chat input resizing (#12998) ## Summary - add resizable support to shared textarea component - enable vertical resizing for chat inputs in chat and share surfaces - preserve autosize behavior while honoring manual resize height ## Test plan - not run (not requested) Fixes #12803 --------- Co-authored-by: Cursor --- web/src/components/message-input/next.tsx | 3 ++ web/src/components/ui/textarea.tsx | 48 ++++++++++++++++--- web/src/pages/agent/chat/box.tsx | 1 + web/src/pages/agent/share/index.tsx | 1 + .../chat/chat-box/multiple-chat-box.tsx | 1 + .../chat/chat-box/single-chat-box.tsx | 1 + web/src/pages/next-chats/share/index.tsx | 1 + 7 files changed, 50 insertions(+), 6 deletions(-) diff --git a/web/src/components/message-input/next.tsx b/web/src/components/message-input/next.tsx index f1f3fcb5e9e..b68bc85a305 100644 --- a/web/src/components/message-input/next.tsx +++ b/web/src/components/message-input/next.tsx @@ -56,6 +56,7 @@ interface NextMessageInputProps { removeFile?(file: File): void; showReasoning?: boolean; showInternet?: boolean; + resize?: 'none' | 'vertical' | 'horizontal' | 'both'; } export function NextMessageInput({ @@ -65,6 +66,7 @@ export function NextMessageInput({ sendLoading, disabled, showUploadIcon = true, + resize = 'none', onUpload, onInputChange, stopOutputMessage, @@ -211,6 +213,7 @@ export function NextMessageInput({ disabled={isUploading || disabled || sendLoading} onKeyDown={handleKeyDown} autoSize={{ minRows: 1, maxRows: 8 }} + resize={resize} />
    diff --git a/web/src/components/ui/textarea.tsx b/web/src/components/ui/textarea.tsx index ffb34cf9796..08fd8a6ed6b 100644 --- a/web/src/components/ui/textarea.tsx +++ b/web/src/components/ui/textarea.tsx @@ -16,25 +16,37 @@ interface TextareaProps minRows?: number; maxRows?: number; }; + resize?: 'none' | 'vertical' | 'horizontal' | 'both'; } const Textarea = forwardRef( - ({ className, autoSize, ...props }, ref) => { + ({ className, autoSize, resize = 'none', ...props }, ref) => { const textareaRef = useRef(null); + const manualHeightRef = useRef(null); + const isAdjustingRef = useRef(false); const getLineHeight = (element: HTMLElement): number => { const style = window.getComputedStyle(element); return parseInt(style.lineHeight, 10) || 20; }; const adjustHeight = useCallback(() => { - if (!textareaRef.current) return; + if (!textareaRef.current || !autoSize) return; const lineHeight = getLineHeight(textareaRef.current); const maxHeight = (autoSize?.maxRows || 3) * lineHeight; + + isAdjustingRef.current = true; textareaRef.current.style.height = 'auto'; requestAnimationFrame(() => { if (!textareaRef.current) return; const scrollHeight = textareaRef.current.scrollHeight; - textareaRef.current.style.height = `${Math.min(scrollHeight, maxHeight)}px`; + const desiredHeight = Math.min(scrollHeight, maxHeight); + const manualHeight = manualHeightRef.current; + const nextHeight = + manualHeight && manualHeight > desiredHeight + ? manualHeight + : desiredHeight; + textareaRef.current.style.height = `${nextHeight}px`; + isAdjustingRef.current = false; }); }, [autoSize]); @@ -51,18 +63,42 @@ const Textarea = forwardRef( ref.current = textareaRef.current; } }, [ref]); + useEffect(() => { + if (!textareaRef.current || !autoSize || resize === 'none') { + manualHeightRef.current = null; + return; + } + const element = textareaRef.current; + let prevHeight = element.getBoundingClientRect().height; + const observer = new ResizeObserver((entries) => { + if (isAdjustingRef.current) return; + const entry = entries[0]; + if (!entry) return; + const nextHeight = entry.contentRect.height; + if (Math.abs(nextHeight - prevHeight) > 1) { + manualHeightRef.current = nextHeight; + } + prevHeight = nextHeight; + }); + observer.observe(element); + return () => observer.disconnect(); + }, [autoSize, resize]); + + const resizable = resize !== 'none'; + return ( From 586a9e05a75dd071ddaa8006cdf889d8261e2ed3 Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Tue, 10 Feb 2026 16:12:59 +0800 Subject: [PATCH 329/335] Fix: Memory log style (#13090) ### What problem does this PR solve? Fix: Memory log style ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- .../dataset-overview/overview-table.tsx | 4 +- web/src/pages/dataset/process-log-modal.tsx | 8 +- .../memory/memory-message/message-table.tsx | 139 ++++++------------ 3 files changed, 57 insertions(+), 94 deletions(-) diff --git a/web/src/pages/dataset/dataset-overview/overview-table.tsx b/web/src/pages/dataset/dataset-overview/overview-table.tsx index a3be9ebf48f..3d7dfe3b0af 100644 --- a/web/src/pages/dataset/dataset-overview/overview-table.tsx +++ b/web/src/pages/dataset/dataset-overview/overview-table.tsx @@ -44,7 +44,7 @@ import { ArrowUpDown, ClipboardList, Eye, MonitorUp } from 'lucide-react'; import { FC, useMemo, useState } from 'react'; import { useParams } from 'react-router'; import { RunningStatus } from '../dataset/constant'; -import ProcessLogModal from '../process-log-modal'; +import ProcessLogModal, { ILogInfo } from '../process-log-modal'; import { LogTabs, ProcessingType, ProcessingTypeMap } from './dataset-common'; import { DocumentLog, FileLogsTableProps, IFileLogItem } from './interface'; @@ -474,7 +474,7 @@ const FileLogsTable: FC = ({ title={active === LogTabs.FILE_LOGS ? t('fileLogs') : t('datasetLog')} visible={isModalVisible} onCancel={() => setIsModalVisible(false)} - logInfo={logInfo} + logInfo={logInfo as unknown as ILogInfo} /> )}
    diff --git a/web/src/pages/dataset/process-log-modal.tsx b/web/src/pages/dataset/process-log-modal.tsx index 3ecc911535b..03282b4d35e 100644 --- a/web/src/pages/dataset/process-log-modal.tsx +++ b/web/src/pages/dataset/process-log-modal.tsx @@ -9,6 +9,7 @@ import { import { RunningStatusMap } from '@/constants/knowledge'; import { useTranslate } from '@/hooks/common-hooks'; import React, { useMemo } from 'react'; +import { useTranslation } from 'react-i18next'; import reactStringReplace from 'react-string-replace'; import { RunningStatus } from './dataset/constant'; export interface ILogInfo { @@ -35,6 +36,7 @@ interface ProcessLogModalProps { onCancel: () => void; logInfo: ILogInfo; title: string; + translateKey?: string; } const InfoItem: React.FC<{ @@ -85,8 +87,10 @@ const ProcessLogModal: React.FC = ({ onCancel, logInfo: initData, title, + translateKey, }) => { - const { t } = useTranslate('knowledgeDetails'); + const { t } = useTranslate(translateKey || 'knowledgeDetails'); + const { t: tc } = useTranslation(); const blackKeyList = ['']; const logInfo = useMemo(() => { return initData; @@ -99,7 +103,7 @@ const ProcessLogModal: React.FC = ({ onCancel={onCancel} footer={
    - +
    } className="process-log-modal" diff --git a/web/src/pages/memory/memory-message/message-table.tsx b/web/src/pages/memory/memory-message/message-table.tsx index ecbf413ebd8..2ee6e80b856 100644 --- a/web/src/pages/memory/memory-message/message-table.tsx +++ b/web/src/pages/memory/memory-message/message-table.tsx @@ -5,15 +5,6 @@ import { import { EmptyType } from '@/components/empty/constant'; import Empty from '@/components/empty/empty'; import { Button } from '@/components/ui/button'; -import { - Dialog, - DialogClose, - DialogContent, - DialogFooter, - DialogHeader, - DialogTitle, - DialogTrigger, -} from '@/components/ui/dialog'; import { Modal } from '@/components/ui/modal/modal'; import { RAGFlowPagination } from '@/components/ui/ragflow-pagination'; import { Switch } from '@/components/ui/switch'; @@ -25,9 +16,13 @@ import { TableHeader, TableRow, } from '@/components/ui/table'; +import { RunningStatus } from '@/constants/knowledge'; import { Pagination } from '@/interfaces/common'; import { cn } from '@/lib/utils'; -import { replaceText } from '@/pages/dataset/process-log-modal'; +import ProcessLogModal, { + ILogInfo, + replaceText, +} from '@/pages/dataset/process-log-modal'; import { MemoryOptions } from '@/pages/memories/constants'; import { ColumnDef, @@ -72,11 +67,11 @@ const columnHelper = createColumnHelper(); function getTaskStatus(progress: number) { if (progress >= 1) { - return 'success'; + return RunningStatus.DONE; } else if (progress > 0 && progress < 1) { - return 'running'; + return RunningStatus.RUNNING; } else { - return 'failed'; + return RunningStatus.FAIL; } } @@ -110,6 +105,21 @@ export function MemoryTable({ const disabledRowFunc = (row: Row) => { return row.original.forget_at !== 'None' && !!row.original.forget_at; }; + + const [isModalVisible, setIsModalVisible] = useState(false); + const [logInfo, setLogInfo] = useState(); + const showLog = (row: Row) => { + const task = row.original.task; + const logDetail = { + startTime: dayjs(task.create_time) + .locale(document.documentElement.lang) + .format('MM/DD/YYYY HH:mm:ss'), + status: getTaskStatus(task.progress), + details: task.progress_msg, + } as unknown as ILogInfo; + setLogInfo(logDetail); + setIsModalVisible(true); + }; // Define columns for the memory table const columns: ColumnDef[] = useMemo( () => [ @@ -233,83 +243,22 @@ export function MemoryTable({ const taskStatus = getTaskStatus(task.progress); return ( - - - - - - - - {t('memory.taskLogDialog.title')} - - -
    -
    -
    - {t('memory.taskLogDialog.startTime')} -
    -
    - {dayjs(task.create_time) - .locale(document.documentElement.lang) - .format('MM/DD/YYYY HH:mm:ss')} -
    - -
    - {t('memory.taskLogDialog.status')} -
    -
    -
    -
    - {t(`memory.taskLogDialog.${taskStatus}`)} -
    -
    -
    - -
    -
    - {t('memory.taskLogDialog.details')} -
    -
    -
    -
    -                          {task.progress_msg}
    -                        
    -
    -
    -
    -
    - - - - - - -
    -
    + ); }, }), @@ -506,6 +455,16 @@ export function MemoryTable({ )} + {isModalVisible && ( + setIsModalVisible(false)} + translateKey="memory.taskLogDialog" + logInfo={logInfo as unknown as ILogInfo} + /> + )} +
    Date: Tue, 10 Feb 2026 16:13:21 +0800 Subject: [PATCH 330/335] Refa: boost OpenAI-compatible reranker UX (#13087) ### What problem does this PR solve? boost OpenAI-compatible reranker UX. ### Type of change - [x] Refactoring --- rag/llm/rerank_model.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rag/llm/rerank_model.py b/rag/llm/rerank_model.py index 4dac44f2b3a..d9a4a740592 100644 --- a/rag/llm/rerank_model.py +++ b/rag/llm/rerank_model.py @@ -196,10 +196,11 @@ class OpenAI_APIRerank(Base): _FACTORY_NAME = "OpenAI-API-Compatible" def __init__(self, key, model_name, base_url): - if base_url.find("/rerank") == -1: - self.base_url = urljoin(base_url, "/rerank") + normalized_base_url = (base_url or "").strip() + if "/rerank" in normalized_base_url: + self.base_url = normalized_base_url.rstrip("/") else: - self.base_url = base_url + self.base_url = urljoin(f"{normalized_base_url.rstrip('/')}/", "rerank").rstrip("/") self.headers = {"Content-Type": "application/json", "Authorization": f"Bearer {key}"} self.model_name = model_name.split("___")[0] From 4341d81e29c05b16b7578dcf3ca3695979733197 Mon Sep 17 00:00:00 2001 From: writinwaters <93570324+writinwaters@users.noreply.github.com> Date: Tue, 10 Feb 2026 16:25:56 +0800 Subject: [PATCH 331/335] Refact: Updated UI tips. (#13093) ### What problem does this PR solve? Updated UI tips. ### Type of change - [x] Refactoring --- docs/guides/dataset/extract_table_of_contents.md | 2 +- web/src/locales/en.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guides/dataset/extract_table_of_contents.md b/docs/guides/dataset/extract_table_of_contents.md index 0b6a70f14ce..fc86f78f466 100644 --- a/docs/guides/dataset/extract_table_of_contents.md +++ b/docs/guides/dataset/extract_table_of_contents.md @@ -32,7 +32,7 @@ The system's default chat model is used to summarize clustered content. Before p 3. To use this technique during retrieval, do either of the following: - In the **Chat setting** panel of your chat app, switch on the **PageIndex** toggle. - - If you are using an agent, click the **Retrieval** agent component to specify the dataset(s) and switch on the **Page Index** toggle. + - If you are using an Agent, click the **Retrieval** agent component to specify the dataset(s) and switch on the **PageIndex** toggle. ## Frequently asked questions diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index f54a27dac31..43bb024a5a0 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -885,7 +885,7 @@ This auto-tagging feature enhances retrieval by adding another layer of domain-s cancel: 'Cancel', chatSetting: 'Chat setting', tocEnhance: 'PageIndex', - tocEnhanceTip: ` During the parsing of the document, table of contents information was generated (see the 'Enable Table of Contents Extraction' option in the General method). This allows the large model to return table of contents items relevant to the user's query, thereby using these items to retrieve related chunks and apply weighting to these chunks during the sorting process. This approach is derived from mimicking the behavioral logic of how humans search for knowledge in books.`, + tocEnhanceTip: ` During the parsing of the document, table of contents information was generated (see the 'Enable Table of Contents Extraction' option in the General method). This allows the large model to return table of contents items relevant to the user's query, thereby using these items to retrieve related chunks and apply weighting to these chunks during the sorting process. This approach mimics human information-searching behavior in books.`, batchDeleteSessions: 'Batch delete', deleteSelectedConfirm: 'Delete the selected {count} session(s)?', }, From 6f785e06a4f6b438d468327a9afbec5e83250c5c Mon Sep 17 00:00:00 2001 From: akie <103188271+zpf121@users.noreply.github.com> Date: Tue, 10 Feb 2026 17:04:45 +0800 Subject: [PATCH 332/335] Fix issue #13084 (#13088) When match_expressions contains coroutine objects (from GraphRAG's Dealer.get_vector()), the code cannot identify this type because it only checks for MatchTextExpr, MatchDenseExpr, or FusionExpr. As a result: score_func remains initialized as an empty string "" This empty string is appended to the output list The output list is passed to Infinity SDK's table_instance.output() method Infinity's SQL parser (via sqlglot) fails to parse the empty string, throwing a ParseError --- api/db/services/canvas_service.py | 2 +- rag/utils/infinity_conn.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/db/services/canvas_service.py b/api/db/services/canvas_service.py index ee0710a09d9..99cb1990044 100644 --- a/api/db/services/canvas_service.py +++ b/api/db/services/canvas_service.py @@ -203,7 +203,7 @@ async def completion(tenant_id, agent_id, session_id=None, **kwargs): conv.message = [] if not isinstance(conv.dsl, str): conv.dsl = json.dumps(conv.dsl, ensure_ascii=False) - canvas = Canvas(conv.dsl, tenant_id, agent_id, custom_header=custom_header) + canvas = Canvas(conv.dsl, tenant_id, agent_id, canvas_id=agent_id, custom_header=custom_header) else: e, cvs = UserCanvasService.get_by_id(agent_id) assert e, "Agent not found." diff --git a/rag/utils/infinity_conn.py b/rag/utils/infinity_conn.py index aa18d044ba6..59773052e0d 100644 --- a/rag/utils/infinity_conn.py +++ b/rag/utils/infinity_conn.py @@ -134,11 +134,11 @@ def search( score_column = "SIMILARITY" break if match_expressions: - if score_func not in output: + if score_func and score_func not in output: output.append(score_func) if PAGERANK_FLD not in output: output.append(PAGERANK_FLD) - output = [f for f in output if f != "_score"] + output = [f for f in output if f and f != "_score"] if limit <= 0: # ElasticSearch default limit is 10000 limit = 10000 @@ -272,7 +272,7 @@ def search( df_list.append(kb_res) self.connPool.release_conn(inf_conn) res = self.concat_dataframes(df_list, output) - if match_expressions: + if match_expressions and score_column: res["_score"] = res[score_column] + res[PAGERANK_FLD] res = res.sort_values(by="_score", ascending=False).reset_index(drop=True) res = res.head(limit) From d938b4787700f503e7364fd5ed456f523e1bfff3 Mon Sep 17 00:00:00 2001 From: Lynn Date: Tue, 10 Feb 2026 17:05:34 +0800 Subject: [PATCH 333/335] Fix: judge table name prefix before migrate (#13094) ### What problem does this PR solve? Judge table created with current infinity mapping before migrate db. #13089 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- common/doc_store/infinity_conn_base.py | 6 +++++- memory/utils/infinity_conn.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/doc_store/infinity_conn_base.py b/common/doc_store/infinity_conn_base.py index 294192bd61d..327f518f5a1 100644 --- a/common/doc_store/infinity_conn_base.py +++ b/common/doc_store/infinity_conn_base.py @@ -33,12 +33,13 @@ class InfinityConnectionBase(DocStoreConnection): - def __init__(self, mapping_file_name: str = "infinity_mapping.json", logger_name: str = "ragflow.infinity_conn"): + def __init__(self, mapping_file_name: str = "infinity_mapping.json", logger_name: str = "ragflow.infinity_conn", table_name_prefix: str="ragflow_"): from common.doc_store.infinity_conn_pool import INFINITY_CONN self.dbName = settings.INFINITY.get("db_name", "default_db") self.mapping_file_name = mapping_file_name self.logger = logging.getLogger(logger_name) + self.table_name_prefix = table_name_prefix infinity_uri = settings.INFINITY["uri"] if ":" in infinity_uri: host, port = infinity_uri.split(":") @@ -77,6 +78,9 @@ def _migrate_db(self, inf_conn): schema = json.load(f) table_names = inf_db.list_tables().table_names for table_name in table_names: + if not table_name.startswith(self.table_name_prefix): + # Skip tables not created by me + continue inf_table = inf_db.get_table(table_name) index_names = inf_table.list_indexes().index_names if "q_vec_idx" not in index_names: diff --git a/memory/utils/infinity_conn.py b/memory/utils/infinity_conn.py index c7998542e3a..826fbadfbee 100644 --- a/memory/utils/infinity_conn.py +++ b/memory/utils/infinity_conn.py @@ -30,7 +30,7 @@ @singleton class InfinityConnection(InfinityConnectionBase): def __init__(self): - super().__init__(mapping_file_name="message_infinity_mapping.json") + super().__init__(mapping_file_name="message_infinity_mapping.json", table_name_prefix="memory_") """ Dataframe and fields convert From 392ec99651da78f6a8e1a2f60fe4818a95a8651d Mon Sep 17 00:00:00 2001 From: Liu An Date: Tue, 10 Feb 2026 17:24:03 +0800 Subject: [PATCH 334/335] Docs: Update version references to v0.24.0 in READMEs and docs (#13095) ### What problem does this PR solve? - Update version tags in README files (including translations) from v0.23.1 to v0.24.0 - Modify Docker image references and documentation to reflect new version - Update version badges and image descriptions - Maintain consistency across all language variants of README files ### Type of change - [x] Documentation Update --- README.md | 6 +++--- README_id.md | 6 +++--- README_ja.md | 6 +++--- README_ko.md | 6 +++--- README_pt_br.md | 6 +++--- README_tzh.md | 6 +++--- README_zh.md | 6 +++--- admin/client/README.md | 2 +- admin/client/pyproject.toml | 2 +- admin/client/uv.lock | 2 +- docker/.env | 6 +++--- docker/README.md | 2 +- docs/configurations.md | 2 +- docs/develop/build_docker_image.mdx | 2 +- docs/guides/admin/ragflow_cli.md | 4 ++-- docs/guides/dataset/configure_knowledge_base.md | 2 +- docs/guides/manage_files.md | 2 +- docs/guides/upgrade_ragflow.mdx | 10 +++++----- docs/quickstart.mdx | 6 +++--- helm/values.yaml | 2 +- pyproject.toml | 2 +- sdk/python/pyproject.toml | 2 +- sdk/python/uv.lock | 2 +- test/README.md | 2 +- uv.lock | 2 +- 25 files changed, 48 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 30781d57d78..b95fcddc772 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Static Badge - docker pull infiniflow/ragflow:v0.23.1 + docker pull infiniflow/ragflow:v0.24.0 Latest Release @@ -188,12 +188,12 @@ releases! 🌟 > All Docker images are built for x86 platforms. We don't currently offer Docker images for ARM64. > If you are on an ARM64 platform, follow [this guide](https://ragflow.io/docs/dev/build_docker_image) to build a Docker image compatible with your system. -> The command below downloads the `v0.23.1` edition of the RAGFlow Docker image. See the following table for descriptions of different RAGFlow editions. To download a RAGFlow edition different from `v0.23.1`, update the `RAGFLOW_IMAGE` variable accordingly in **docker/.env** before using `docker compose` to start the server. +> The command below downloads the `v0.24.0` edition of the RAGFlow Docker image. See the following table for descriptions of different RAGFlow editions. To download a RAGFlow edition different from `v0.24.0`, update the `RAGFLOW_IMAGE` variable accordingly in **docker/.env** before using `docker compose` to start the server. ```bash $ cd ragflow/docker - # git checkout v0.23.1 + # git checkout v0.24.0 # Optional: use a stable tag (see releases: https://github.com/infiniflow/ragflow/releases) # This step ensures the **entrypoint.sh** file in the code matches the Docker image version. diff --git a/README_id.md b/README_id.md index c974884f88e..c3cfdfcc5d1 100644 --- a/README_id.md +++ b/README_id.md @@ -22,7 +22,7 @@ Lencana Daring - docker pull infiniflow/ragflow:v0.23.1 + docker pull infiniflow/ragflow:v0.24.0 Rilis Terbaru @@ -188,12 +188,12 @@ Coba demo kami di [https://demo.ragflow.io](https://demo.ragflow.io). > Semua gambar Docker dibangun untuk platform x86. Saat ini, kami tidak menawarkan gambar Docker untuk ARM64. > Jika Anda menggunakan platform ARM64, [silakan gunakan panduan ini untuk membangun gambar Docker yang kompatibel dengan sistem Anda](https://ragflow.io/docs/dev/build_docker_image). -> Perintah di bawah ini mengunduh edisi v0.23.1 dari gambar Docker RAGFlow. Silakan merujuk ke tabel berikut untuk deskripsi berbagai edisi RAGFlow. Untuk mengunduh edisi RAGFlow yang berbeda dari v0.23.1, perbarui variabel RAGFLOW_IMAGE di docker/.env sebelum menggunakan docker compose untuk memulai server. +> Perintah di bawah ini mengunduh edisi v0.24.0 dari gambar Docker RAGFlow. Silakan merujuk ke tabel berikut untuk deskripsi berbagai edisi RAGFlow. Untuk mengunduh edisi RAGFlow yang berbeda dari v0.24.0, perbarui variabel RAGFLOW_IMAGE di docker/.env sebelum menggunakan docker compose untuk memulai server. ```bash $ cd ragflow/docker - # git checkout v0.23.1 + # git checkout v0.24.0 # Opsional: gunakan tag stabil (lihat releases: https://github.com/infiniflow/ragflow/releases) # This steps ensures the **entrypoint.sh** file in the code matches the Docker image version. diff --git a/README_ja.md b/README_ja.md index 34067bb9843..afff19bc8fd 100644 --- a/README_ja.md +++ b/README_ja.md @@ -22,7 +22,7 @@ Static Badge - docker pull infiniflow/ragflow:v0.23.1 + docker pull infiniflow/ragflow:v0.24.0 Latest Release @@ -168,12 +168,12 @@ > 現在、公式に提供されているすべての Docker イメージは x86 アーキテクチャ向けにビルドされており、ARM64 用の Docker イメージは提供されていません。 > ARM64 アーキテクチャのオペレーティングシステムを使用している場合は、[このドキュメント](https://ragflow.io/docs/dev/build_docker_image)を参照して Docker イメージを自分でビルドしてください。 -> 以下のコマンドは、RAGFlow Docker イメージの v0.23.1 エディションをダウンロードします。異なる RAGFlow エディションの説明については、以下の表を参照してください。v0.23.1 とは異なるエディションをダウンロードするには、docker/.env ファイルの RAGFLOW_IMAGE 変数を適宜更新し、docker compose を使用してサーバーを起動してください。 +> 以下のコマンドは、RAGFlow Docker イメージの v0.24.0 エディションをダウンロードします。異なる RAGFlow エディションの説明については、以下の表を参照してください。v0.24.0 とは異なるエディションをダウンロードするには、docker/.env ファイルの RAGFLOW_IMAGE 変数を適宜更新し、docker compose を使用してサーバーを起動してください。 ```bash $ cd ragflow/docker - # git checkout v0.23.1 + # git checkout v0.24.0 # 任意: 安定版タグを利用 (一覧: https://github.com/infiniflow/ragflow/releases) # この手順は、コード内の entrypoint.sh ファイルが Docker イメージのバージョンと一致していることを確認します。 diff --git a/README_ko.md b/README_ko.md index ac3b7bb914f..91978a72a5d 100644 --- a/README_ko.md +++ b/README_ko.md @@ -22,7 +22,7 @@ Static Badge - docker pull infiniflow/ragflow:v0.23.1 + docker pull infiniflow/ragflow:v0.24.0 Latest Release @@ -170,12 +170,12 @@ > 모든 Docker 이미지는 x86 플랫폼을 위해 빌드되었습니다. 우리는 현재 ARM64 플랫폼을 위한 Docker 이미지를 제공하지 않습니다. > ARM64 플랫폼을 사용 중이라면, [시스템과 호환되는 Docker 이미지를 빌드하려면 이 가이드를 사용해 주세요](https://ragflow.io/docs/dev/build_docker_image). - > 아래 명령어는 RAGFlow Docker 이미지의 v0.23.1 버전을 다운로드합니다. 다양한 RAGFlow 버전에 대한 설명은 다음 표를 참조하십시오. v0.23.1과 다른 RAGFlow 버전을 다운로드하려면, docker/.env 파일에서 RAGFLOW_IMAGE 변수를 적절히 업데이트한 후 docker compose를 사용하여 서버를 시작하십시오. + > 아래 명령어는 RAGFlow Docker 이미지의 v0.24.0 버전을 다운로드합니다. 다양한 RAGFlow 버전에 대한 설명은 다음 표를 참조하십시오. v0.24.0과 다른 RAGFlow 버전을 다운로드하려면, docker/.env 파일에서 RAGFLOW_IMAGE 변수를 적절히 업데이트한 후 docker compose를 사용하여 서버를 시작하십시오. ```bash $ cd ragflow/docker - # git checkout v0.23.1 + # git checkout v0.24.0 # Optional: use a stable tag (see releases: https://github.com/infiniflow/ragflow/releases) # 이 단계는 코드의 entrypoint.sh 파일이 Docker 이미지 버전과 일치하도록 보장합니다. diff --git a/README_pt_br.md b/README_pt_br.md index 4552499c392..8fa5b6692e1 100644 --- a/README_pt_br.md +++ b/README_pt_br.md @@ -22,7 +22,7 @@ Badge Estático - docker pull infiniflow/ragflow:v0.23.1 + docker pull infiniflow/ragflow:v0.24.0 Última Versão @@ -188,12 +188,12 @@ Experimente nossa demo em [https://demo.ragflow.io](https://demo.ragflow.io). > Todas as imagens Docker são construídas para plataformas x86. Atualmente, não oferecemos imagens Docker para ARM64. > Se você estiver usando uma plataforma ARM64, por favor, utilize [este guia](https://ragflow.io/docs/dev/build_docker_image) para construir uma imagem Docker compatível com o seu sistema. - > O comando abaixo baixa a edição`v0.23.1` da imagem Docker do RAGFlow. Consulte a tabela a seguir para descrições de diferentes edições do RAGFlow. Para baixar uma edição do RAGFlow diferente da `v0.23.1`, atualize a variável `RAGFLOW_IMAGE` conforme necessário no **docker/.env** antes de usar `docker compose` para iniciar o servidor. + > O comando abaixo baixa a edição`v0.24.0` da imagem Docker do RAGFlow. Consulte a tabela a seguir para descrições de diferentes edições do RAGFlow. Para baixar uma edição do RAGFlow diferente da `v0.24.0`, atualize a variável `RAGFLOW_IMAGE` conforme necessário no **docker/.env** antes de usar `docker compose` para iniciar o servidor. ```bash $ cd ragflow/docker - # git checkout v0.23.1 + # git checkout v0.24.0 # Opcional: use uma tag estável (veja releases: https://github.com/infiniflow/ragflow/releases) # Esta etapa garante que o arquivo entrypoint.sh no código corresponda à versão da imagem do Docker. diff --git a/README_tzh.md b/README_tzh.md index 329f104ddf8..d46d06077ce 100644 --- a/README_tzh.md +++ b/README_tzh.md @@ -22,7 +22,7 @@ Static Badge - docker pull infiniflow/ragflow:v0.23.1 + docker pull infiniflow/ragflow:v0.24.0 Latest Release @@ -187,12 +187,12 @@ > 所有 Docker 映像檔都是為 x86 平台建置的。目前,我們不提供 ARM64 平台的 Docker 映像檔。 > 如果您使用的是 ARM64 平台,請使用 [這份指南](https://ragflow.io/docs/dev/build_docker_image) 來建置適合您系統的 Docker 映像檔。 -> 執行以下指令會自動下載 RAGFlow Docker 映像 `v0.23.1`。請參考下表查看不同 Docker 發行版的說明。如需下載不同於 `v0.23.1` 的 Docker 映像,請在執行 `docker compose` 啟動服務之前先更新 **docker/.env** 檔案內的 `RAGFLOW_IMAGE` 變數。 +> 執行以下指令會自動下載 RAGFlow Docker 映像 `v0.24.0`。請參考下表查看不同 Docker 發行版的說明。如需下載不同於 `v0.24.0` 的 Docker 映像,請在執行 `docker compose` 啟動服務之前先更新 **docker/.env** 檔案內的 `RAGFLOW_IMAGE` 變數。 ```bash $ cd ragflow/docker - # git checkout v0.23.1 + # git checkout v0.24.0 # 可選:使用穩定版標籤(查看發佈:https://github.com/infiniflow/ragflow/releases) # 此步驟確保程式碼中的 entrypoint.sh 檔案與 Docker 映像版本一致。 diff --git a/README_zh.md b/README_zh.md index 3241c0202fa..5b194daa0ff 100644 --- a/README_zh.md +++ b/README_zh.md @@ -22,7 +22,7 @@ Static Badge - docker pull infiniflow/ragflow:v0.23.1 + docker pull infiniflow/ragflow:v0.24.0 Latest Release @@ -188,12 +188,12 @@ > 请注意,目前官方提供的所有 Docker 镜像均基于 x86 架构构建,并不提供基于 ARM64 的 Docker 镜像。 > 如果你的操作系统是 ARM64 架构,请参考[这篇文档](https://ragflow.io/docs/dev/build_docker_image)自行构建 Docker 镜像。 - > 运行以下命令会自动下载 RAGFlow Docker 镜像 `v0.23.1`。请参考下表查看不同 Docker 发行版的描述。如需下载不同于 `v0.23.1` 的 Docker 镜像,请在运行 `docker compose` 启动服务之前先更新 **docker/.env** 文件内的 `RAGFLOW_IMAGE` 变量。 + > 运行以下命令会自动下载 RAGFlow Docker 镜像 `v0.24.0`。请参考下表查看不同 Docker 发行版的描述。如需下载不同于 `v0.24.0` 的 Docker 镜像,请在运行 `docker compose` 启动服务之前先更新 **docker/.env** 文件内的 `RAGFLOW_IMAGE` 变量。 ```bash $ cd ragflow/docker - # git checkout v0.23.1 + # git checkout v0.24.0 # 可选:使用稳定版本标签(查看发布:https://github.com/infiniflow/ragflow/releases) # 这一步确保代码中的 entrypoint.sh 文件与 Docker 镜像的版本保持一致。 diff --git a/admin/client/README.md b/admin/client/README.md index 1f77a45d696..2090a214402 100644 --- a/admin/client/README.md +++ b/admin/client/README.md @@ -48,7 +48,7 @@ It consists of a server-side Service and a command-line client (CLI), both imple 1. Ensure the Admin Service is running. 2. Install ragflow-cli. ```bash - pip install ragflow-cli==0.23.1 + pip install ragflow-cli==0.24.0 ``` 3. Launch the CLI client: ```bash diff --git a/admin/client/pyproject.toml b/admin/client/pyproject.toml index 94413c057ed..4b5e2cd31b8 100644 --- a/admin/client/pyproject.toml +++ b/admin/client/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ragflow-cli" -version = "0.23.1" +version = "0.24.0" description = "Admin Service's client of [RAGFlow](https://github.com/infiniflow/ragflow). The Admin Service provides user management and system monitoring. " authors = [{ name = "Lynn", email = "lynn_inf@hotmail.com" }] license = { text = "Apache License, Version 2.0" } diff --git a/admin/client/uv.lock b/admin/client/uv.lock index 7e38b7144c0..6a0fa57faf2 100644 --- a/admin/client/uv.lock +++ b/admin/client/uv.lock @@ -196,7 +196,7 @@ wheels = [ [[package]] name = "ragflow-cli" -version = "0.23.1" +version = "0.24.0" source = { virtual = "." } dependencies = [ { name = "beartype" }, diff --git a/docker/.env b/docker/.env index ef8edbcb62a..7e1bdf801bc 100644 --- a/docker/.env +++ b/docker/.env @@ -154,11 +154,11 @@ ADMIN_SVR_HTTP_PORT=9381 SVR_MCP_PORT=9382 # The RAGFlow Docker image to download. v0.22+ doesn't include embedding models. -RAGFLOW_IMAGE=infiniflow/ragflow:v0.23.1 +RAGFLOW_IMAGE=infiniflow/ragflow:v0.24.0 # If you cannot download the RAGFlow Docker image: -# RAGFLOW_IMAGE=swr.cn-north-4.myhuaweicloud.com/infiniflow/ragflow:v0.23.1 -# RAGFLOW_IMAGE=registry.cn-hangzhou.aliyuncs.com/infiniflow/ragflow:v0.23.1 +# RAGFLOW_IMAGE=swr.cn-north-4.myhuaweicloud.com/infiniflow/ragflow:v0.24.0 +# RAGFLOW_IMAGE=registry.cn-hangzhou.aliyuncs.com/infiniflow/ragflow:v0.24.0 # # - For the `nightly` edition, uncomment either of the following: # RAGFLOW_IMAGE=swr.cn-north-4.myhuaweicloud.com/infiniflow/ragflow:nightly diff --git a/docker/README.md b/docker/README.md index 4c2eb71f197..c6422bad8c7 100644 --- a/docker/README.md +++ b/docker/README.md @@ -79,7 +79,7 @@ The [.env](./.env) file contains important environment variables for Docker. - `SVR_HTTP_PORT` The port used to expose RAGFlow's HTTP API service to the host machine, allowing **external** access to the service running inside the Docker container. Defaults to `9380`. - `RAGFLOW-IMAGE` - The Docker image edition. Defaults to `infiniflow/ragflow:v0.23.1`. The RAGFlow Docker image does not include embedding models. + The Docker image edition. Defaults to `infiniflow/ragflow:v0.24.0`. The RAGFlow Docker image does not include embedding models. > [!TIP] diff --git a/docs/configurations.md b/docs/configurations.md index e935c9405a1..2b274c8e9b2 100644 --- a/docs/configurations.md +++ b/docs/configurations.md @@ -103,7 +103,7 @@ RAGFlow utilizes MinIO as its object storage solution, leveraging its scalabilit - `SVR_HTTP_PORT` The port used to expose RAGFlow's HTTP API service to the host machine, allowing **external** access to the service running inside the Docker container. Defaults to `9380`. - `RAGFLOW-IMAGE` - The Docker image edition. Defaults to `infiniflow/ragflow:v0.23.1` (the RAGFlow Docker image without embedding models). + The Docker image edition. Defaults to `infiniflow/ragflow:v0.24.0` (the RAGFlow Docker image without embedding models). :::tip NOTE If you cannot download the RAGFlow Docker image, try the following mirrors. diff --git a/docs/develop/build_docker_image.mdx b/docs/develop/build_docker_image.mdx index db70dec216a..6cb2dede439 100644 --- a/docs/develop/build_docker_image.mdx +++ b/docs/develop/build_docker_image.mdx @@ -49,7 +49,7 @@ After building the infiniflow/ragflow:nightly image, you are ready to launch a f 1. Edit Docker Compose Configuration -Open the `docker/.env` file. Find the `RAGFLOW_IMAGE` setting and change the image reference from `infiniflow/ragflow:v0.23.1` to `infiniflow/ragflow:nightly` to use the pre-built image. +Open the `docker/.env` file. Find the `RAGFLOW_IMAGE` setting and change the image reference from `infiniflow/ragflow:v0.24.0` to `infiniflow/ragflow:nightly` to use the pre-built image. 2. Launch the Service diff --git a/docs/guides/admin/ragflow_cli.md b/docs/guides/admin/ragflow_cli.md index 73db779a9d8..f682d6be64d 100644 --- a/docs/guides/admin/ragflow_cli.md +++ b/docs/guides/admin/ragflow_cli.md @@ -16,7 +16,7 @@ The RAGFlow CLI is a command-line-based system administration tool that offers a 2. Install ragflow-cli. ```bash - pip install ragflow-cli==0.23.1 + pip install ragflow-cli==0.24.0 ``` 3. Launch the CLI client: @@ -439,7 +439,7 @@ show_version +-----------------------+ | version | +-----------------------+ -| v0.23.1-24-g6f60e9f9e | +| v0.24.0-24-g6f60e9f9e | +-----------------------+ ``` diff --git a/docs/guides/dataset/configure_knowledge_base.md b/docs/guides/dataset/configure_knowledge_base.md index 8c7c9db6246..92fc1fec9ae 100644 --- a/docs/guides/dataset/configure_knowledge_base.md +++ b/docs/guides/dataset/configure_knowledge_base.md @@ -135,7 +135,7 @@ See [Run retrieval test](./run_retrieval_test.md) for details. ## Search for dataset -As of RAGFlow v0.23.1, the search feature is still in a rudimentary form, supporting only dataset search by name. +As of RAGFlow v0.24.0, the search feature is still in a rudimentary form, supporting only dataset search by name. ![search dataset](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/search_datasets.jpg) diff --git a/docs/guides/manage_files.md b/docs/guides/manage_files.md index 33b843d2e43..bbb5b5ec143 100644 --- a/docs/guides/manage_files.md +++ b/docs/guides/manage_files.md @@ -89,4 +89,4 @@ RAGFlow's file management allows you to download an uploaded file: ![download_file](https://github.com/infiniflow/ragflow/assets/93570324/cf3b297f-7d9b-4522-bf5f-4f45743e4ed5) -> As of RAGFlow v0.23.1, bulk download is not supported, nor can you download an entire folder. +> As of RAGFlow v0.24.0, bulk download is not supported, nor can you download an entire folder. diff --git a/docs/guides/upgrade_ragflow.mdx b/docs/guides/upgrade_ragflow.mdx index 2169dac0a40..ef43384ddce 100644 --- a/docs/guides/upgrade_ragflow.mdx +++ b/docs/guides/upgrade_ragflow.mdx @@ -62,16 +62,16 @@ To upgrade RAGFlow, you must upgrade **both** your code **and** your Docker imag git pull ``` -3. Switch to the latest, officially published release, e.g., `v0.23.1`: +3. Switch to the latest, officially published release, e.g., `v0.24.0`: ```bash - git checkout -f v0.23.1 + git checkout -f v0.24.0 ``` 4. Update **ragflow/docker/.env**: ```bash - RAGFLOW_IMAGE=infiniflow/ragflow:v0.23.1 + RAGFLOW_IMAGE=infiniflow/ragflow:v0.24.0 ``` 5. Update the RAGFlow image and restart RAGFlow: @@ -92,10 +92,10 @@ No, you do not need to. Upgrading RAGFlow in itself will *not* remove your uploa 1. From an environment with Internet access, pull the required Docker image. 2. Save the Docker image to a **.tar** file. ```bash - docker save -o ragflow.v0.23.1.tar infiniflow/ragflow:v0.23.1 + docker save -o ragflow.v0.24.0.tar infiniflow/ragflow:v0.24.0 ``` 3. Copy the **.tar** file to the target server. 4. Load the **.tar** file into Docker: ```bash - docker load -i ragflow.v0.23.1.tar + docker load -i ragflow.v0.24.0.tar ``` diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx index 9add93ab4f1..e1de5fe184a 100644 --- a/docs/quickstart.mdx +++ b/docs/quickstart.mdx @@ -48,7 +48,7 @@ This section provides instructions on setting up the RAGFlow server on Linux. If `vm.max_map_count`. This value sets the maximum number of memory map areas a process may have. Its default value is 65530. While most applications require fewer than a thousand maps, reducing this value can result in abnormal behaviors, and the system will throw out-of-memory errors when a process reaches the limitation. - RAGFlow v0.23.1 uses Elasticsearch or [Infinity](https://github.com/infiniflow/infinity) for multiple recall. Setting the value of `vm.max_map_count` correctly is crucial to the proper functioning of the Elasticsearch component. + RAGFlow v0.24.0 uses Elasticsearch or [Infinity](https://github.com/infiniflow/infinity) for multiple recall. Setting the value of `vm.max_map_count` correctly is crucial to the proper functioning of the Elasticsearch component. Date: Wed, 4 Mar 2026 14:42:53 +0000 Subject: [PATCH 335/335] Switch from elasticsearch to infinity doc engine --- helm-azimuth/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-azimuth/values.yaml b/helm-azimuth/values.yaml index ace62522440..a544c3eba5b 100644 --- a/helm-azimuth/values.yaml +++ b/helm-azimuth/values.yaml @@ -11,7 +11,7 @@ zenithClient: ragflow: env: # Elasticsearch seems more stable than other options for now - DOC_ENGINE: elasticsearch + DOC_ENGINE: infinity # Clean up redis volumes when Azimuth app is uninstalled redis: