mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-03 21:02:40 +02:00
feat: improved agent streaming
This commit is contained in:
parent
afb4b09cde
commit
c110f5b955
60 changed files with 8068 additions and 303 deletions
|
|
@ -46,6 +46,11 @@ export interface MessageRecord {
|
|||
author_display_name?: string | null;
|
||||
author_avatar_url?: string | null;
|
||||
token_usage?: TokenUsageSummary | null;
|
||||
// Per-turn correlation id from ``configurable.turn_id`` at streaming
|
||||
// time (added in migration 136). Used by the per-turn revert
|
||||
// endpoint and edit-from-arbitrary-position. Nullable on legacy
|
||||
// rows that predate the column.
|
||||
turn_id?: string | null;
|
||||
}
|
||||
|
||||
export interface ThreadListResponse {
|
||||
|
|
@ -123,10 +128,20 @@ export async function getThreadMessages(threadId: number): Promise<ThreadHistory
|
|||
|
||||
/**
|
||||
* Append a message to a thread.
|
||||
*
|
||||
* ``turn_id`` is the per-turn correlation id streamed by the backend
|
||||
* via ``data-turn-info``. Persisting it lets later edits locate the
|
||||
* matching LangGraph checkpoint without HumanMessage scanning. Older
|
||||
* callers can still omit it for back-compat.
|
||||
*/
|
||||
export async function appendMessage(
|
||||
threadId: number,
|
||||
message: { role: "user" | "assistant" | "system"; content: unknown; token_usage?: unknown }
|
||||
message: {
|
||||
role: "user" | "assistant" | "system";
|
||||
content: unknown;
|
||||
token_usage?: unknown;
|
||||
turn_id?: string | null;
|
||||
}
|
||||
): Promise<MessageRecord> {
|
||||
return baseApiService.post<MessageRecord>(`/api/v1/threads/${threadId}/messages`, undefined, {
|
||||
body: message,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue