mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Add user_id for third-party system to record sessions. (#4206)
### What problem does this PR solve? ### Type of change - [x] New Feature (non-breaking change which adds functionality) - [x] Documentation Update --------- Co-authored-by: writinwaters <93570324+writinwaters@users.noreply.github.com>
This commit is contained in:
@ -1721,6 +1721,7 @@ Creates a session with a chat assistant.
|
||||
- `'Authorization: Bearer <YOUR_API_KEY>'`
|
||||
- Body:
|
||||
- `"name"`: `string`
|
||||
- `"user_id"`: `string`(optional)
|
||||
|
||||
##### Request example
|
||||
|
||||
@ -1741,6 +1742,8 @@ curl --request POST \
|
||||
The ID of the associated chat assistant.
|
||||
- `"name"`: (*Body parameter*), `string`
|
||||
The name of the chat session to create.
|
||||
- `"user_id"`: (*Body parameter*), `string`
|
||||
Optional user-defined ID.
|
||||
|
||||
#### Response
|
||||
|
||||
@ -1793,6 +1796,7 @@ Updates a session of a specified chat assistant.
|
||||
- `'Authorization: Bearer <YOUR_API_KEY>'`
|
||||
- Body:
|
||||
- `"name`: `string`
|
||||
- `"user_id`: `string`(optional)
|
||||
|
||||
##### Request example
|
||||
|
||||
@ -1815,6 +1819,8 @@ curl --request PUT \
|
||||
The ID of the session to update.
|
||||
- `"name"`: (*Body Parameter*), `string`
|
||||
The revised name of the session.
|
||||
- `"user_id"`: (*Body parameter*), `string`
|
||||
Optional user-defined ID.
|
||||
|
||||
#### Response
|
||||
|
||||
@ -1846,7 +1852,7 @@ Lists sessions associated with a specified chat assistant.
|
||||
#### Request
|
||||
|
||||
- Method: GET
|
||||
- URL: `/api/v1/chats/{chat_id}/sessions?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={session_name}&id={session_id}`
|
||||
- URL: `/api/v1/chats/{chat_id}/sessions?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={session_name}&id={session_id}&user_id={user_id}`
|
||||
- Headers:
|
||||
- `'Authorization: Bearer <YOUR_API_KEY>'`
|
||||
|
||||
@ -1876,6 +1882,8 @@ curl --request GET \
|
||||
The name of the chat session to retrieve.
|
||||
- `id`: (*Filter parameter*), `string`
|
||||
The ID of the chat session to retrieve.
|
||||
- `user_id`: (*Filter parameter*), `string`
|
||||
The optional user-defined ID passed in when creating session.
|
||||
|
||||
#### Response
|
||||
|
||||
@ -2000,7 +2008,8 @@ Asks a specified chat assistant a question to start an AI-powered conversation.
|
||||
- Body:
|
||||
- `"question"`: `string`
|
||||
- `"stream"`: `boolean`
|
||||
- `"session_id"`: `string`
|
||||
- `"session_id"`: `string`(optional)
|
||||
- `"user_id`: `string`(optional)
|
||||
|
||||
##### Request example
|
||||
|
||||
@ -2038,6 +2047,8 @@ curl --request POST \
|
||||
- `false`: Disable streaming.
|
||||
- `"session_id"`: (*Body Parameter*)
|
||||
The ID of session. If it is not provided, a new session will be generated.
|
||||
- `"user_id"`: (*Body parameter*), `string`
|
||||
The optional user-defined ID. Valid *only* when no `session_id` is provided.
|
||||
|
||||
#### Response
|
||||
|
||||
@ -2162,6 +2173,8 @@ Creates a session with an agent.
|
||||
- Body:
|
||||
- the required parameters:`str`
|
||||
- the optional parameters:`str`
|
||||
- `"user_id"`: `string`
|
||||
The optional user-defined ID.
|
||||
|
||||
##### Request example
|
||||
If `begin` component in the agent doesn't have required parameters:
|
||||
@ -2337,6 +2350,7 @@ Asks a specified agent a question to start an AI-powered conversation.
|
||||
- `"question"`: `string`
|
||||
- `"stream"`: `boolean`
|
||||
- `"session_id"`: `string`
|
||||
- `"user_id"`: `string`(optional)
|
||||
- other parameters: `string`
|
||||
##### Request example
|
||||
If the `begin` component doesn't have parameters, the following code will create a session.
|
||||
@ -2388,6 +2402,8 @@ curl --request POST \
|
||||
- `false`: Disable streaming.
|
||||
- `"session_id"`: (*Body Parameter*)
|
||||
The ID of the session. If it is not provided, a new session will be generated.
|
||||
- `"user_id"`: (*Body parameter*), `string`
|
||||
The optional user-defined ID. Valid *only* when no `session_id` is provided.
|
||||
- Other parameters: (*Body Parameter*)
|
||||
The parameters in the begin component.
|
||||
#### Response
|
||||
@ -2538,7 +2554,7 @@ Failure:
|
||||
|
||||
### List agent sessions
|
||||
|
||||
**GET** `/api/v1/agents/{agent_id}/sessions?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&id={session_id}`
|
||||
**GET** `/api/v1/agents/{agent_id}/sessions?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&id={session_id}&user_id={user_id}`
|
||||
|
||||
Lists sessions associated with a specified agent.
|
||||
|
||||
@ -2553,7 +2569,7 @@ Lists sessions associated with a specified agent.
|
||||
|
||||
```bash
|
||||
curl --request GET \
|
||||
--url http://{address}/api/v1/agents/{agent_id}/sessions?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&id={session_id} \
|
||||
--url http://{address}/api/v1/agents/{agent_id}/sessions?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&id={session_id}&user_id={user_id} \
|
||||
--header 'Authorization: Bearer <YOUR_API_KEY>'
|
||||
```
|
||||
|
||||
@ -2573,7 +2589,9 @@ curl --request GET \
|
||||
Indicates whether the retrieved sessions should be sorted in descending order. Defaults to `true`.
|
||||
- `id`: (*Filter parameter*), `string`
|
||||
The ID of the agent session to retrieve.
|
||||
|
||||
- `user_id`: (*Filter parameter*), `string`
|
||||
The optional user-defined ID passed in when creating session.
|
||||
|
||||
#### Response
|
||||
|
||||
Success:
|
||||
|
||||
Reference in New Issue
Block a user