feat: Add stop session functionality to chat API and UI

- Implemented a new API endpoint to stop ongoing chat sessions, allowing users to cancel message generation.
- Enhanced InputField component to include a stop button, enabling users to halt the assistant's response generation.
- Updated chat view to manage the assistant message ID and loading state effectively during stop events.
- Improved event handling in the backend to support stop events, ensuring proper session management and user feedback.
This commit is contained in:
wizardchen
2025-11-08 00:20:14 +08:00
parent 326a61696a
commit 6d26c9f85d
9 changed files with 477 additions and 22 deletions
+4
View File
@@ -46,4 +46,8 @@ export async function delSession(session_id: string) {
export async function getSession(session_id: string) {
return get(`/api/v1/sessions/${session_id}`);
}
export async function stopSession(session_id: string, message_id: string) {
return post(`/api/v1/sessions/${session_id}/stop`, { message_id });
}