fix: eliminate one-frame flash of title without form content in data source pages (#17214)

This commit is contained in:
euvre
2026-07-22 19:06:38 +08:00
committed by GitHub
parent 32ddf59ac6
commit a40d5f841b
6 changed files with 208 additions and 218 deletions

View File

@@ -129,7 +129,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
@@ -157,7 +157,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.
@@ -182,29 +182,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},"parent_child":{"use_parent_child":False,"children_delimiter":"\\n"}}`.
- `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
@@ -262,9 +262,9 @@ rag_object.delete_datasets(delete_all=True)
```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,
@@ -361,25 +361,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<string>`
The chunking method for the dataset. Available options:
- `"chunk_method"`: (*Body parameter*), `enum<string>`
The chunking method for the dataset. Available options:
- `"naive"`: General (default)
- `"book"`: Book
- `"email"`: Email
@@ -429,7 +429,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
@@ -475,29 +475,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},"parent_child":{"use_parent_child":False,"children_delimiter":"\\n"}}`.
- `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
@@ -630,27 +630,27 @@ A `Document` object contains the following attributes:
- `"FAIL"`
- `status`: `string` 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`=`"picture"`:
- `chunk_method`=`"picture"`:
`None`
- `chunk_method`=`"one"`:
- `chunk_method`=`"one"`:
`None`
- `chunk_method`=`"email"`:
- `chunk_method`=`"email"`:
`None`
#### Examples
@@ -776,9 +776,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.
---
@@ -1075,11 +1075,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`
@@ -1112,7 +1112,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.
@@ -1244,7 +1244,7 @@ A dictionary containing the attributes to be updated. Supported keys include:
- `"dataset_ids"`: `list[string]` A list of unique identifiers for the datasets associated with the assistant.
- `"llm_id"`: `string` The unique identifier or name of the LLM to be used.
- `"llm_setting"`: `dict` Configuration for LLM generation parameters:
- `"temperature"`: `float` Controls the randomness of the model's output.
- `"temperature"`: `float` Controls the randomness of the model's output.
- `"top_p"`: `float` Sets the nucleus sampling threshold.
- `"presence_penalty"`: `float` Penalizes tokens based on whether they have already appeared in the text.
- `"frequency_penalty"`: `float` Penalizes tokens based on their existing frequency in the text.
@@ -1322,9 +1322,9 @@ rag_object.delete_chats(delete_all=True)
```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 = None,
name: str | None = None,
@@ -1625,27 +1625,27 @@ 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` `string`
- `id` `string`
The chunk ID.
- `content` `string`
- `content` `string`
The content of the chunk.
- `img_id` `string`
- `img_id` `string`
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` `string`
- `document_id` `string`
The ID of the referenced document.
- `document_name` `string`
- `document_name` `string`
The name of the referenced document.
- `document_metadata` `dict`
- `document_metadata` `dict`
Optional document metadata, returned only when `extra_body.reference_metadata.include` is `true`.
- `position` `list[str]`
- `position` `list[str]`
The location information of the chunk within the referenced document.
- `dataset_id` `string`
- `dataset_id` `string`
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
@@ -1656,7 +1656,7 @@ from ragflow_sdk import RAGFlow
rag_object = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>: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?")
@@ -1664,7 +1664,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)
@@ -1768,27 +1768,27 @@ 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` `string`
- `id` `string`
The chunk ID.
- `content` `string`
- `content` `string`
The content of the chunk.
- `image_id` `string`
- `image_id` `string`
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` `string`
- `document_id` `string`
The ID of the referenced document.
- `document_name` `string`
- `document_name` `string`
The name of the referenced document.
- `document_metadata` `dict`
- `document_metadata` `dict`
Optional document metadata, returned only when `extra_body.reference_metadata.include` is `true`.
- `position` `list[str]`
- `position` `list[str]`
The location information of the chunk within the referenced document.
- `dataset_id` `string`
- `dataset_id` `string`
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
@@ -1807,7 +1807,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)
@@ -1845,9 +1845,9 @@ print(message.reference)
```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]
@@ -1946,9 +1946,9 @@ agent.delete_sessions(delete_all=True)
```python
RAGFlow.list_agents(
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
) -> List[Agent]
```
@@ -2162,9 +2162,9 @@ rag_object.delete_agent("58af890a2a8911f0a71a11b922ed82d6")
```python
Ragflow.create_memory(
name: str,
memory_type: list[str],
embd_id: str,
name: str,
memory_type: list[str],
embd_id: str,
llm_id: str
) -> Memory
```
@@ -2180,7 +2180,7 @@ The unique name of the memory to create. It must adhere to the following require
- Basic Multilingual Plane (BMP) only
- Maximum 128 characters
##### memory_type: `list[str]`, *Required*
##### memory_type: `list[str]`, *Required*
Specifies the types of memory to extract. Available options:
@@ -2244,7 +2244,7 @@ Configurations to update. Available configurations:
- Basic Multilingual Plane (BMP) only
- Maximum 128 characters, *Optional*
- `avatar`: `string`, *Optional*
- `avatar`: `string`, *Optional*
The updated base64 encoding of the avatar.
@@ -2319,11 +2319,11 @@ memory_object.update({"name": "New_name"})
```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,
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
```
@@ -2364,7 +2364,7 @@ The name of memory to retrieve, supports fuzzy search.
#### Returns
Success: A dict of `Memory` object list and total count.
Success: A dict of `Memory` object list and total count.
```json
{"memory_list": list[Memory], "total_count": int}
@@ -2453,9 +2453,9 @@ rag_object.delete_memory("your memory_id")
```python
Memory.list_memory_messages(
agent_id: str | list[str]=None,
keywords: str=None,
page: int=1,
agent_id: str | list[str]=None,
keywords: str=None,
page: int=1,
page_size: int=50
) -> dict
```
@@ -2482,7 +2482,7 @@ The number of messages on each page. Defaults to `50`.
#### Returns
Success: a dict of messages and meta info.
Success: a dict of messages and meta info.
```json
{"messages": {"message_list": [{message dict}], "total_count": int}, "storage_type": "table"}
@@ -2507,11 +2507,11 @@ memory_obejct.list_memory_messages()
```python
Ragflow.add_message(
memory_id: list[str],
agent_id: str,
session_id: str,
user_input: str,
agent_response: str,
memory_id: list[str],
agent_id: str,
session_id: str,
user_input: str,
agent_response: str,
user_id: str = ""
) -> str
```
@@ -2646,13 +2646,13 @@ memory_object.update_message_status(message_id, True)
```python
Ragflow.search_message(
query: str,
memory_id: list[str],
agent_id: str=None,
query: str,
memory_id: list[str],
agent_id: str=None,
session_id: str=None,
user_id: str=None,
similarity_threshold: float=0.2,
keywords_similarity_weight: float=0.7,
similarity_threshold: float=0.2,
keywords_similarity_weight: float=0.7,
top_n: int=10
) -> list[dict]
```
@@ -2719,9 +2719,9 @@ rag_object.search_message("your question", ["your memory_id"])
```python
Ragflow.get_recent_messages(
memory_id: list[str],
agent_id: str=None,
session_id: str=None,
memory_id: list[str],
agent_id: str=None,
session_id: str=None,
limit: int=10
) -> list[dict]
```