From c24e711741ef63116f231f8e9e643f02ae4b5c62 Mon Sep 17 00:00:00 2001 From: Loris Jautakas <59267852+lorisj@users.noreply.github.com> Date: Fri, 13 Jun 2025 14:32:35 -0400 Subject: [PATCH] fix(stage) Player2 api typo, also replace error role with user role when calling api (#207) * fix player2 api and replace error role with user for api calls * Update packages/stage-ui/src/stores/llm.ts Co-authored-by: Neko --------- Co-authored-by: Neko --- packages/stage-ui/src/stores/llm.ts | 3 ++- packages/stage-ui/src/stores/providers.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/stage-ui/src/stores/llm.ts b/packages/stage-ui/src/stores/llm.ts index d8add23b6..616b98333 100644 --- a/packages/stage-ui/src/stores/llm.ts +++ b/packages/stage-ui/src/stores/llm.ts @@ -21,7 +21,8 @@ export const useLLM = defineStore('llm', () => { return await streamText({ ...chatProvider.chat(model), maxSteps: 10, - messages, + // TODO: proper format for other error messages. + messages: messages.map(msg => ({ ...msg, content: (msg.role as string === 'error' ? `User encountered error: ${msg.content}` : msg.content), role: (msg.role as string === 'error' ? 'user' : msg.role) } as Message)), headers, tools: [ ...await mcp(), diff --git a/packages/stage-ui/src/stores/providers.ts b/packages/stage-ui/src/stores/providers.ts index 4d08d47b0..5a27f27cf 100644 --- a/packages/stage-ui/src/stores/providers.ts +++ b/packages/stage-ui/src/stores/providers.ts @@ -903,7 +903,7 @@ export const useProvidersStore = defineStore('providers', () => { baseUrl: 'http://localhost:4315/v1/', }, createProvider: (config) => { - return createPlayer2((config.baseURL as string).trim()) + return createPlayer2((config.baseUrl as string).trim()) }, capabilities: { listModels: async () => [