-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Update history api to array #8890
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: master
Are you sure you want to change the base?
Conversation
04364f3
to
8e2f14f
Compare
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.
LGTM
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.
Looks good to me!
(Other than the failing |
- Add new /history_v2 endpoint that returns history in array format - Revert /history endpoint to original object format for backward compatibility - Add deprecation warnings to legacy /history endpoints - Add get_ordered_history() method to PromptQueue class - Add comprehensive tests for both history endpoints 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…se /history_v2/:prompt_id
2e13882
to
94684db
Compare
Rebasing off latest master |
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.
Looks good to me!
In the future though, once you've received some reviews, please merge master
in rather than rebasing. Rebasing (and the required force push associated with it) make it difficult to see what's changed or to reference old comments on code.
@@ -652,6 +652,22 @@ async def get_history_prompt_id(request): | |||
prompt_id = request.match_info.get("prompt_id", None) | |||
return web.json_response(self.prompt_queue.get_history(prompt_id=prompt_id)) | |||
|
|||
@routes.get("/history_v2") |
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.
use a better name like ordered_history
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.
I think the decision was to use this name because we're moving from the old endpoint later on cc: @webfiltered @guill to confirm
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.
Yeah, the intention was to deprecate the /history
endpoint eventually in favor of this one (so we don't have to maintain both).
I don't have a particularly strong opinion on the name though. Any of:
history_v2
history_info
workflow_history
user_history
prompt_history
ordered_history
seem reasonable to me.
|
||
return web.json_response(self.prompt_queue.get_ordered_history(max_items=max_items, offset=offset)) | ||
|
||
@routes.get("/history_v2/{prompt_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.
this is not necessary.
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.
I believe we agreed we'd update this endpoint as well cc: @guill @webfiltered
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.
Yeah, this was specifically my recommendation to avoid a case where people need to remember to use one endpoint for the list and one for individual items (which goes against normal REST principles). It's much easier if we're just able to say "move to this new endpoint as we'll be deprecating /history
eventually".
I don't have a strong opinion on the specific name we use, but do strongly feel we should keep this route to preserve consistency.
Use this and remove everything from execution.py |
Sounds good, I'll make this change |
Context
This PR refactors the /history_v2 API endpoints to improve scalability and usability by compacting responses, preparing for pagination support, and enhancing data clarity.
This PR
prompt
response by returning it as a JSON objectprompt
response by returning it as a JSON objectScreen recording
https://www.youtube.com/watch?v=6mpa0piPYMA
https://www.youtube.com/watch?v=kpsneO-xbFg