Update agent session API, to support uploading files while create a new session #5039
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Update the agent session API "POST /api/v1/agents/{agent_id}/sessions", to support uploading files while create a new session:
- currently, the API only supports requesting with a json body. If user wants to upload a doc or image when create session, like what is already supported on the web client, we need to update the API.
- if upload an image, ragflow will call image2text, and a user_id is needed for the image2text model. So we need to send user_id in the API request. As form-data is needed to upload files, not json body, seems we need to put the user_id in the url as an optional parameter (currently user_id is an optional in json body).
Type of change