feat: 补齐智能体对话思考和工具过程渲染
This commit is contained in:
1 parent
7a7d1f7fd8
commit
70a3212bce
12 files changed
+517
-31
No files matched your search
@@ -77,11 +77,26 @@ function projectRun(value: unknown): unknown {
|
||||
}
|
||||
function projectConversation(value: unknown): unknown {
|
||||
const source = object(value);
|
||||
return { ...projectSession(source), messages: list(source.messages, item => copy(item, ['id', 'role', 'content', 'request_id', 'run_id', 'created_at'])),
|
||||
return { ...projectSession(source), messages: list(source.messages, projectMessage),
|
||||
run: source.run == null ? null : projectRun(source.run),
|
||||
queued_requests: list(source.queued_requests, item => copy(item, ['request_id', 'thread_id', 'run_id', 'status', 'version'])),
|
||||
next_offset: source.next_offset ?? null };
|
||||
}
|
||||
function projectMessage(value: unknown): unknown {
|
||||
const source = object(value);
|
||||
return { ...copy(source, ['id', 'role', 'content', 'request_id', 'run_id', 'created_at', 'message_id', 'reasoning_content']),
|
||||
...(Array.isArray(source.tool_calls) ? { tool_calls: source.tool_calls.map(item => {
|
||||
const tool = object(item);
|
||||
return { ...copy(tool, ['id', 'name', 'args', 'status', 'error_message']),
|
||||
...(tool.tool_call_result == null ? {} : { tool_call_result: copy(tool.tool_call_result, ['content']) }) };
|
||||
}) } : {}),
|
||||
};
|
||||
}
|
||||
function projectHistory(value: unknown): unknown {
|
||||
const source = object(value);
|
||||
return { ...copy(source, ['thread_id', 'queued_requests', 'schedule_proposals', 'next_offset']),
|
||||
messages: list(source.messages, projectMessage), run: source.run == null ? null : projectRun(source.run) };
|
||||
}
|
||||
function projectFiles(value: unknown): unknown {
|
||||
const source = object(value);
|
||||
return { session_id: source.session_id, thread_id: source.thread_id ?? null,
|
||||
@@ -253,7 +268,7 @@ const operations: Record<keyof CloudAgentOperations, OperationSpec> = {
|
||||
saveBudget: { method: 'PUT', cloud: 'ws', path: '/agents/:slug/budget', body: ['request_limit_points', 'daily_limit_points'], output: budget },
|
||||
threads: { method: 'GET', path: '/threads', query: { slug: 'slug', offset: 'offset', archived: 'archived' }, output: ['threads', 'next_offset'] },
|
||||
createThread: { method: 'POST', path: '/agents/:slug/threads', body: ['thread_id', 'preview', 'expected_revision'], output: ['thread_id', 'client_thread_id'] },
|
||||
history: { method: 'GET', path: '/threads/:thread_id', query: { offset: 'offset' }, output: ['thread_id', 'messages', 'run', 'queued_requests', 'schedule_proposals', 'next_offset'] },
|
||||
history: { method: 'GET', path: '/threads/:thread_id', query: { offset: 'offset' }, output: ['thread_id', 'messages', 'run', 'queued_requests', 'schedule_proposals', 'next_offset'], project: projectHistory },
|
||||
viewed: { method: 'POST', path: '/threads/:thread_id/viewed', body: ['run_id'], output: ['viewed'] },
|
||||
submit: { method: 'POST', path: '/agents/:slug/requests', body: prompt, output: request },
|
||||
preview: { method: 'POST', path: '/agents/:slug/preview', body: prompt, output: request },
|
||||
|
||||
Reference in new issue
Block a user