diff --git a/src/renderer/src/types/agent.ts b/src/renderer/src/types/agent.ts index 49702c20e4..1551612de3 100644 --- a/src/renderer/src/types/agent.ts +++ b/src/renderer/src/types/agent.ts @@ -200,9 +200,11 @@ export const CreateSessionResponseSchema = AgentSessionEntitySchema export type CreateSessionResponse = AgentSessionEntity export const AgentServerErrorSchema = z.object({ - message: z.string(), - type: z.string(), - code: z.string() + error: z.object({ + message: z.string(), + type: z.string(), + code: z.string() + }) }) export type AgentServerError = z.infer diff --git a/src/renderer/src/utils/api.ts b/src/renderer/src/utils/api.ts index 0fa892c131..15129397d5 100644 --- a/src/renderer/src/utils/api.ts +++ b/src/renderer/src/utils/api.ts @@ -75,7 +75,7 @@ export function splitApiKeyString(keyStr: string): string[] { } export const formatAgentServerError = (error: AgentServerError) => - `${t('common.error')}: ${error.code} ${error.message}` + `${t('common.error')}: ${error.error.code} ${error.error.message}` export const formatAxiosError = (error: AxiosError) => { if (!error.response) {