-
Notifications
You must be signed in to change notification settings - Fork 2
Update knowledge.py #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev/main
Are you sure you want to change the base?
Conversation
上传文件接口中增加对callback_url、job_id、callback_secret参数 修改UploadResponse模型,增加job_id、file_id、status字段 改进上传文件的处理流程,支持回调通知机制
- 在upload_file函数中增加对callback_url、job_id、callback_secret参数支持 - 改进后台索引处理,支持回调通知机制 - 增加HTTP客户端(httpx)用于发送回调请求 - 实现回调通知功能_send_callback
| logger.error(f"Background indexing failed for file_id: {doc_id}, error: {error_message}") | ||
| callback_payload = { | ||
| "file_id": doc_id, | ||
| "rag_file_id": doc_id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the difference b/t file_id and rag_file_id?
| finally: | ||
| logger.debug(f"Background indexing semaphore released for file_id: {doc_id}") | ||
| if callback_url and callback_payload is not None: | ||
| payload_with_job = dict(callback_payload) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this line? To create a hard copy? if so why not directly use copy()
| callback_secret=callback_secret, | ||
| ) | ||
|
|
||
| async def _send_callback( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- if the user is under a NAT, how to make sure this callback_url is available from the server?
- For this function my feeling is, its invasion is a little bit strong. My idea is to shield application layer from access layer kind of stuff, for example: http related thing. Instead of setting the function here, is it better to move it to api layer?
c34499c to
a9d1b9c
Compare
上传文件接口中增加对callback_url、job_id、callback_secret参数
修改UploadResponse模型,增加job_id、file_id、status字段
改进上传文件的处理流程,支持回调通知机制