mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
refactor: remove unnecessary assertion (#2579)
This commit is contained in:
committed by
GitHub
parent
65a58c3b03
commit
9ae2595bfd
@@ -282,21 +282,9 @@ export class CoreToolScheduler {
|
||||
|
||||
// currentCall is a non-terminal state here and should have startTime and tool.
|
||||
const existingStartTime = currentCall.startTime;
|
||||
const toolInstance = (
|
||||
currentCall as
|
||||
| ValidatingToolCall
|
||||
| ScheduledToolCall
|
||||
| ExecutingToolCall
|
||||
| WaitingToolCall
|
||||
).tool;
|
||||
const toolInstance = currentCall.tool;
|
||||
|
||||
const outcome = (
|
||||
currentCall as
|
||||
| ValidatingToolCall
|
||||
| ScheduledToolCall
|
||||
| ExecutingToolCall
|
||||
| WaitingToolCall
|
||||
).outcome;
|
||||
const outcome = currentCall.outcome;
|
||||
|
||||
switch (newStatus) {
|
||||
case 'success': {
|
||||
@@ -579,7 +567,7 @@ export class CoreToolScheduler {
|
||||
callsToExecute.forEach((toolCall) => {
|
||||
if (toolCall.status !== 'scheduled') return;
|
||||
|
||||
const scheduledCall = toolCall as ScheduledToolCall;
|
||||
const scheduledCall = toolCall;
|
||||
const { callId, name: toolName } = scheduledCall.request;
|
||||
this.setStatusInternal(callId, 'executing');
|
||||
|
||||
@@ -591,7 +579,7 @@ export class CoreToolScheduler {
|
||||
}
|
||||
this.toolCalls = this.toolCalls.map((tc) =>
|
||||
tc.request.callId === callId && tc.status === 'executing'
|
||||
? { ...(tc as ExecutingToolCall), liveOutput: outputChunk }
|
||||
? { ...tc, liveOutput: outputChunk }
|
||||
: tc,
|
||||
);
|
||||
this.notifyToolCallsUpdate();
|
||||
|
||||
@@ -542,7 +542,7 @@ export class GeminiChat {
|
||||
automaticFunctionCallingHistory.length > 0
|
||||
) {
|
||||
this.history.push(
|
||||
...extractCuratedHistory(automaticFunctionCallingHistory!),
|
||||
...extractCuratedHistory(automaticFunctionCallingHistory),
|
||||
);
|
||||
} else {
|
||||
this.history.push(userInput);
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { GroundingMetadata } from '@google/genai';
|
||||
import { SchemaValidator } from '../utils/schemaValidator.js';
|
||||
import {
|
||||
BaseTool,
|
||||
@@ -255,9 +254,7 @@ ${textContent}
|
||||
|
||||
let responseText = getResponseText(response) || '';
|
||||
const urlContextMeta = response.candidates?.[0]?.urlContextMetadata;
|
||||
const groundingMetadata = response.candidates?.[0]?.groundingMetadata as
|
||||
| GroundingMetadata
|
||||
| undefined;
|
||||
const groundingMetadata = response.candidates?.[0]?.groundingMetadata;
|
||||
const sources = groundingMetadata?.groundingChunks as
|
||||
| GroundingChunkItem[]
|
||||
| undefined;
|
||||
|
||||
@@ -75,10 +75,7 @@ export function allowEditorTypeInSandbox(editor: EditorType): boolean {
|
||||
*/
|
||||
export function isEditorAvailable(editor: string | undefined): boolean {
|
||||
if (editor && isValidEditorType(editor)) {
|
||||
return (
|
||||
checkHasEditorType(editor as EditorType) &&
|
||||
allowEditorTypeInSandbox(editor as EditorType)
|
||||
);
|
||||
return checkHasEditorType(editor) && allowEditorTypeInSandbox(editor);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user