🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(model-runtime): pass userId in RouteAttemptResult callback (#12562)
YuTengjing9b5b4d25796e
diff --git a/packages/model-runtime/src/core/RouterRuntime/createRuntime.ts b/packages/model-runtime/src/core/RouterRuntime/createRuntime.tsindex 774a23680cc..cf219093999 100644--- a/packages/model-runtime/src/core/RouterRuntime/createRuntime.ts+++ b/packages/model-runtime/src/core/RouterRuntime/createRuntime.ts@@ -4,35 +4,34 @@import type { GoogleGenAIOptions } from '@google/genai';import type { ChatModelCard } from '@lobechat/types';import debug from 'debug';-import OpenAI, { ClientOptions } from 'openai';-import { Stream } from 'openai/streaming';+import type { ClientOptions } from 'openai';+import type OpenAI from 'openai';+import type { Stream } from 'openai/streaming';import { LobeOpenAI } from '../../providers/openai';import { LobeVertexAI } from '../../providers/vertexai';-import {+import type {+ ChatCompletionErrorPayload,+ ChatMethodOptions,+ ChatStreamCallbacks,+ ChatStreamPayload,CreateImagePayload,CreateImageResponse,CreateVideoPayload,CreateVideoResponse,+ EmbeddingsOptions,+ EmbeddingsPayload,GenerateObjectOptions,GenerateObjectPayload,HandleCreateVideoWebhookPayload,HandleCreateVideoWebhookResult,ILobeAgentRuntimeErrorType,-} from '../../types';-import {- type ChatCompletionErrorPayload,- ChatMethodOptions,- ChatStreamCallbacks,- ChatStreamPayload,- EmbeddingsOptions,- EmbeddingsPayload,TextToSpeechPayload,} from '../../types';import { postProcessModelList } from '../../utils/postProcessModelList';import { safeParseJSON } from '../../utils/safeParseJSON';-import { LobeRuntimeAI } from '../BaseAI';-import {+import type { LobeRuntimeAI } from '../BaseAI';+import type {CreateImageOptions,CreateVideoOptions,CustomClientOptions,@@ -96,6 +95,7 @@ export interface RouteAttemptResult {remark?: string;routerId?: string;success: boolean;+ userId?: string;}export interface CreateRouterRuntimeOptions<T extends Record<string, any> = any> {@@ -350,6 +350,7 @@ export const createRouterRuntime = ({remark,routerId: matchedRouter.id,success: true,+ userId: this._options.userId,}).catch((e) => {log('onRouteAttempt callback error: %O', e);@@ -370,6 +371,7 @@ export const createRouterRuntime = ({remark,routerId: matchedRouter.id,success: false,+ userId: this._options.userId,}).catch((e) => {log('onRouteAttempt callback error: %O', e);