feat(server): refactor for byok (#14911)

This commit is contained in:
DarkSky
2026-05-07 04:03:14 +08:00
committed by GitHub
parent 4e169ea5c7
commit eb9cc22502
115 changed files with 10369 additions and 1256 deletions
+9 -1
View File
@@ -458,6 +458,7 @@ type LlmRerankResponse = {
export type LlmToolLoopStreamEvent =
| { type: 'message_start'; id?: string; model?: string }
| { type: 'provider_selected'; provider_id: string }
| { type: 'text_delta'; text: string }
| { type: 'reasoning_delta'; text: string }
| {
@@ -537,7 +538,14 @@ function parseLlmEventJson(eventJson: string): LlmStreamEvent {
function parseLlmToolLoopStreamEvent(
eventJson: string
): LlmToolLoopStreamEvent {
return parseToolLoopStreamEvent(parseLlmEventJson(eventJson));
const event = parseLlmEventJson(eventJson);
if (
event.type === 'provider_selected' &&
typeof event.provider_id === 'string'
) {
return event;
}
return parseToolLoopStreamEvent(event);
}
export function llmMatchModelCapabilities(