mirror of
https://github.com/aiclientproxy/proxycast.git
synced 2026-09-24 23:10:56 +08:00
fix: resolve TypeScript type error in useAgentTools
- Add null check for fallbackPromptKey before using as Map key - Wrap logic in conditional to ensure type safety Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -94,16 +94,16 @@ export function useAgentTools(options: UseAgentToolsOptions) {
|
||||
|
||||
if (pendingAction?.isFallback) {
|
||||
const fallbackPromptKey = resolveActionPromptKey(pendingAction);
|
||||
const resolvedAction = pendingActions.find((item) => {
|
||||
if (item.requestId === pendingAction.requestId) return false;
|
||||
if (item.isFallback) return false;
|
||||
if (item.actionType !== pendingAction.actionType) return false;
|
||||
if (!fallbackPromptKey) return false;
|
||||
return resolveActionPromptKey(item) === fallbackPromptKey;
|
||||
});
|
||||
if (fallbackPromptKey) {
|
||||
const resolvedAction = pendingActions.find((item) => {
|
||||
if (item.requestId === pendingAction.requestId) return false;
|
||||
if (item.isFallback) return false;
|
||||
if (item.actionType !== pendingAction.actionType) return false;
|
||||
return resolveActionPromptKey(item) === fallbackPromptKey;
|
||||
});
|
||||
|
||||
if (!resolvedAction) {
|
||||
queuedFallbackResponsesRef.current.set(fallbackPromptKey, {
|
||||
if (!resolvedAction) {
|
||||
queuedFallbackResponsesRef.current.set(fallbackPromptKey, {
|
||||
...response,
|
||||
actionType,
|
||||
requestId: pendingAction.requestId,
|
||||
@@ -156,6 +156,7 @@ export function useAgentTools(options: UseAgentToolsOptions) {
|
||||
|
||||
effectiveRequestId = resolvedAction.requestId;
|
||||
acknowledgedRequestIds.add(resolvedAction.requestId);
|
||||
}
|
||||
}
|
||||
|
||||
await runtime.respondToAction({
|
||||
|
||||
Reference in New Issue
Block a user