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

@@ -50,7 +50,7 @@ What is stored in the memory:
### Memory size
The default capacity allocated to the memory and the corresponding embeddings in bytes. Defaults to `5242880` (5MB).
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.
@@ -74,7 +74,7 @@ Manually forgotten memory entries are completely excluded from the results retur
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
## Enhance Agent context
Under [Retrieval](../agent/agent_component_reference/retrieval.mdx) and [Message](../agent/agent_component_reference/message.md) 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.

View File

@@ -4216,8 +4216,8 @@ curl --request POST \
Optional model override when a specific chat model should be used for this request.
- `"pass_all_history_messages"`: (*Body Parameter*), `boolean`
When `chat_id` and `session_id` are provided, defaults to `false`, so the server uses stored session history and only the latest user message from the request. Set to `true` to replace/use the submitted full `messages` history, and overrides the stored session history.
- `"legacy"`: (*Body Parameter*), `boolean`
Defaults to `false`. Enables backward compatibility with RAGFlow v0.23.0 for streaming responses. When set to `true`:
- `"legacy"`: (*Body Parameter*), `boolean`
Defaults to `false`. Enables backward compatibility with RAGFlow v0.23.0 for streaming responses. When set to `true`:
- Cumulative output: The `"answer"` field in each chunk returns the entire text generated so far, rather than just the new tokens (deltas).
- No reasoning markers: The `start_to_think` and `end_to_think` signals are stripped from the stream.
@@ -4801,7 +4801,7 @@ curl --request POST \
Variables specified in the **Begin** component.
- `"user_id"`: (*Body parameter*), `string`
The optional user-defined ID. Valid *only* when no `session_id` is provided.
- `"chat_template_kwargs"`: (*Body parameter*), `object`
- `"chat_template_kwargs"`: (*Body parameter*), `object`
Optional passthrough parameters for the underlying LLM's chat template. Commonly used to toggle thinking/reasoning modes on supported models (e.g., `{"enable_thinking": false}`).
:::tip NOTE
@@ -4926,19 +4926,19 @@ curl --request POST \
##### Request parameters
- `"agent_id"`: (*Body parameter*), `string`, *Required*
- `"agent_id"`: (*Body parameter*), `string`, *Required*
The ID of the associated agent.
- `"messages"`: (*Body parameter*), `list[object]`, *Required*
- `"messages"`: (*Body parameter*), `list[object]`, *Required*
OpenAI-style chat messages.
- `"openai-compatible"`: (*Body parameter*), `boolean`, *Required*
- `"openai-compatible"`: (*Body parameter*), `boolean`, *Required*
Must be `true` to enable OpenAI-compatible responses.
- `"stream"`: (*Body parameter*), `boolean`
- `"stream"`: (*Body parameter*), `boolean`
Whether to return streaming chunks.
- `"session_id"`: (*Body parameter*), `string`
- `"session_id"`: (*Body parameter*), `string`
Optional existing session ID.
- `"model"`: (*Body parameter*), `string`
- `"model"`: (*Body parameter*), `string`
Optional compatibility field. The server still routes by `agent_id`.
- `"chat_template_kwargs"`: (*Body parameter*), `object`
- `"chat_template_kwargs"`: (*Body parameter*), `object`
Optional passthrough parameters for the underlying LLM's chat template. Commonly used to toggle thinking/reasoning modes on supported models (e.g., `{"enable_thinking": false}`).
##### Response
@@ -7709,7 +7709,7 @@ or
##### Request example
```bash
curl --request POST \
curl --request POST \
--url http://{address}/api/v1/folders/{folder_id}/commits \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
@@ -7721,9 +7721,9 @@ This endpoint also supports:
]
}'
```
##### Request parameters
- `"message"`: (*Body parameter*), `string`, *Required*
The commit message describing the changes.
- `"files"`: (*Body parameter*), `list[object]`, *Required*
@@ -7744,9 +7744,9 @@ curl --request POST \
```json
{
"code": 0,
"code": 0,
"data": {
"id": "commit_uuid",
"id": "commit_uuid",
"folder_id": "folder_uuid",
"parent_id": null,
"message": "update config files",
@@ -7797,7 +7797,7 @@ Failure:
##### Request example
```bash
curl --request GET \
curl --request GET \
--url 'http://{address}/api/v1/folders/{folder_id}/commits?page=1&page_size=15' \
--header 'Authorization: Bearer <YOUR_API_KEY>'
```
@@ -7824,13 +7824,13 @@ curl --request GET \
"total": 2,
"page": 1,
"page_size": 15,
"commits": [
"commits": [
{
"id": "commit_uuid",
"id": "commit_uuid",
"folder_id": "folder_uuid",
"parent_id": null,
"parent_id": null,
"message": "first commit",
"author_id": "user_uuid",
"author_id": "user_uuid",
"file_count": 3,
"create_time": 1718200000000
}
@@ -7865,7 +7865,7 @@ Success:
--header 'Authorization: Bearer <YOUR_API_KEY>'
```
##### Request parameters
##### Request parameters
- `"folder_id"`: (*Path parameter*), `string`, *Required*
The folder ID.
@@ -7887,9 +7887,9 @@ curl --request GET \
"author_id": "user_uuid",
"file_count": 2,
"create_time": 1718200000000,
"files": [
"files": [
{
"file_id": "file_uuid",
"file_id": "file_uuid",
"operation": "add",
"old_hash": null,
"new_hash": "abcd1234",
@@ -7936,7 +7936,7 @@ Failure:
--header 'Authorization: Bearer <YOUR_API_KEY>'
```
#### Response
#### Response
Success:
@@ -7985,7 +7985,7 @@ Success:
##### Request example
```bash
curl --request GET \
curl --request GET \
--url 'http://{address}/api/v1/folders/{folder_id}/commits/diff?from=from_commit_id&to=to_commit_id' \
--header 'Authorization: Bearer <YOUR_API_KEY>'
```
@@ -7997,9 +7997,9 @@ Also available at:
- `"to"`: (*Query parameter*), `string`, *Required*
The target commit ID.
#### Response
#### Response
Success:
Success:
```json
{
@@ -8012,9 +8012,9 @@ curl --request GET \
"old_hash": "abc123",
"new_hash": "def456",
"old_location": ".objects/abc123",
"new_location": ".objects/def456"
"new_location": ".objects/def456"
}
]
]
}
```
@@ -8053,7 +8053,7 @@ Failure:
--header 'Authorization: Bearer <YOUR_API_KEY>'
```
#### Response
#### Response
Success:
@@ -8106,7 +8106,7 @@ Success:
--header 'Authorization: Bearer <YOUR_API_KEY>'
```
#### Response
#### Response
Success:
@@ -8174,7 +8174,7 @@ Success:
--header 'Authorization: Bearer <YOUR_API_KEY>'
```
#### Response
#### Response
Success:

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]
```

View File

@@ -186,7 +186,7 @@ The integration includes robust error handling for:
## 🤝 **Contributing**
This integration was created as part of the [Firecrawl bounty program](https://github.com/firecrawl/firecrawl/issues/2167).
This integration was created as part of the [Firecrawl bounty program](https://github.com/firecrawl/firecrawl/issues/2167).
### Development
1. Fork the RAGFlow repository
@@ -213,4 +213,4 @@ This integration was developed as part of the Firecrawl bounty program to bridge
**Ready for RAGFlow Integration!** 🚀
This integration enables RAGFlow users to easily import web content into their knowledge retrieval systems, expanding the ecosystem for both Firecrawl and RAGFlow.
This integration enables RAGFlow users to easily import web content into their knowledge retrieval systems, expanding the ecosystem for both Firecrawl and RAGFlow.

View File

@@ -1,7 +1,7 @@
import { DynamicForm, FormFieldConfig } from '@/components/dynamic-form';
import { Modal } from '@/components/ui/modal/modal';
import { IModalProps } from '@/interfaces/common';
import { useEffect, useState } from 'react';
import { useMemo } from 'react';
import { FieldValues } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
import {
@@ -21,17 +21,27 @@ const AddDataSourceModal = ({
onOk,
}: IModalProps<FieldValues> & { sourceData?: IDataSorceInfo }) => {
const { t } = useTranslation();
const [fields, setFields] = useState<FormFieldConfig[]>([]);
useEffect(() => {
if (sourceData) {
setFields([
...getDataSourceFormBaseFields(t),
...getDataSourceFieldsWithExtras(t, sourceData.id as any),
] as FormFieldConfig[]);
const fields = useMemo<FormFieldConfig[]>(() => {
if (!sourceData) {
return [];
}
return [
...getDataSourceFormBaseFields(t),
...getDataSourceFieldsWithExtras(t, sourceData.id as any),
] as FormFieldConfig[];
}, [sourceData, t]);
const defaultValues = useMemo<FieldValues>(
() =>
mergeDataSourceFormValues(
DataSourceFormDefaultValues[
sourceData?.id as keyof typeof DataSourceFormDefaultValues
] as FieldValues,
getCommonExtraDefaultValues(),
) as FieldValues,
[sourceData],
);
const handleOk = async (values?: FieldValues) => {
await onOk?.(values);
hideModal?.();
@@ -58,14 +68,7 @@ const AddDataSourceModal = ({
onSubmit={(data) => {
console.log(data);
}}
defaultValues={
mergeDataSourceFormValues(
DataSourceFormDefaultValues[
sourceData?.id as keyof typeof DataSourceFormDefaultValues
] as FieldValues,
getCommonExtraDefaultValues(),
) as FieldValues
}
defaultValues={defaultValues}
labelClassName="font-normal"
>
<div className=" absolute bottom-0 right-0 left-0 flex items-center justify-end w-full gap-2 py-6 px-6">

View File

@@ -44,13 +44,7 @@ const SourceDetailPage = () => {
}
}, [detail, dataSourceInfo]);
const [fields, setFields] = useState<FormFieldConfig[]>([]);
const [isDirty, setIsDirty] = useState(false);
const [defaultValues, setDefaultValues] = useState<FieldValues>(
DataSourceFormDefaultValues[
detail?.source as keyof typeof DataSourceFormDefaultValues
] as FieldValues,
);
const customFields = useMemo(() => {
return [
@@ -115,6 +109,38 @@ const SourceDetailPage = () => {
];
}, [t]);
const fields = useMemo<FormFieldConfig[]>(() => {
if (!detail) {
return [];
}
const baseFields = getDataSourceFormBaseFields(t).map((field) =>
field.name === 'name' ? { ...field, disabled: true } : { ...field },
);
const allFields = [
...baseFields,
...getDataSourceFieldsWithExtras(t, detail.source as any),
...customFields,
] as FormFieldConfig[];
return allFields.map((field) => ({
...field,
horizontal: true,
onChange: undefined,
}));
}, [detail, customFields, t]);
const defaultValues = useMemo<FieldValues>(() => {
if (!detail) {
return {};
}
return mergeDataSourceFormValues(
DataSourceFormDefaultValues[
detail.source as keyof typeof DataSourceFormDefaultValues
] as FieldValues,
getCommonExtraDefaultValues(),
detail as FieldValues,
);
}, [detail]);
const { addLoading, handleAddOk } = useAddDataSource({ isEdit: true });
const { loading: testLoading, handleTest } = useTestDataSource();
@@ -171,47 +197,8 @@ const SourceDetailPage = () => {
}, [actionMode, t]);
useEffect(() => {
const baseFields = getDataSourceFormBaseFields(t).map((field) => {
if (field.name === 'name') {
return {
...field,
disabled: true,
};
} else {
return {
...field,
};
}
});
if (detail) {
const fields = [
...baseFields,
...getDataSourceFieldsWithExtras(t, detail.source as any),
...customFields,
] as FormFieldConfig[];
const newFields = fields.map((field) => {
return {
...field,
horizontal: true,
onChange: undefined,
};
});
setFields(newFields);
const defaultValueTemp = {
...mergeDataSourceFormValues(
DataSourceFormDefaultValues[
detail?.source as keyof typeof DataSourceFormDefaultValues
] as FieldValues,
getCommonExtraDefaultValues(),
detail as FieldValues,
),
};
setDefaultValues(defaultValueTemp);
setIsDirty(false);
}
}, [detail, customFields, onSubmit, t]);
setIsDirty(false);
}, [detail]);
useEffect(() => {
const instance = formRef.current;