fix: restore coding history and quota feedback
This commit is contained in:
@@ -6,8 +6,8 @@ import type {
|
||||
ConversationToolNode,
|
||||
PublicUsage,
|
||||
} from '../contracts';
|
||||
import { isAIGatewayUserContextMissing } from '../../../shared/ai-gateway-error-details';
|
||||
import type { PiRpcEvent } from './rpc-client';
|
||||
import { projectPiProviderFailure } from './provider-failure';
|
||||
import { subagentDetailsOfResult } from '../subagent-protocol';
|
||||
import {
|
||||
isProductToolName,
|
||||
@@ -45,17 +45,6 @@ function retryFailure(message: string) {
|
||||
};
|
||||
}
|
||||
|
||||
function providerFailure(message: unknown) {
|
||||
if (typeof message === 'string' && isAIGatewayUserContextMissing(message)) {
|
||||
return {
|
||||
code: 'CODING_PROVIDER_AUTH_REQUIRED' as const,
|
||||
message: '模型服务身份上下文无效,请重试;若仍失败请重新登录。',
|
||||
recoverable: true,
|
||||
};
|
||||
}
|
||||
return retryFailure('模型服务请求失败,请稍后重试。');
|
||||
}
|
||||
|
||||
function asRecord(value: unknown): Record<string, unknown> | null {
|
||||
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
||||
? value as Record<string, unknown>
|
||||
@@ -294,7 +283,7 @@ export class PiEventProjector {
|
||||
...run,
|
||||
status: 'error',
|
||||
terminalReason: 'failed',
|
||||
error: providerFailure(event.finalError),
|
||||
error: projectPiProviderFailure(event.finalError),
|
||||
},
|
||||
}];
|
||||
}
|
||||
@@ -485,7 +474,7 @@ export class PiEventProjector {
|
||||
...snapshot.run,
|
||||
status: 'error',
|
||||
terminalReason: 'failed',
|
||||
error: providerFailure(assistant.errorMessage),
|
||||
error: projectPiProviderFailure(assistant.errorMessage),
|
||||
},
|
||||
}];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user