chore: format

This commit is contained in:
Nate 2025-08-26 21:49:54 -07:00
parent b6e403b060
commit 2a7dfb84e5
3 changed files with 15 additions and 15 deletions

View file

@ -1,9 +1,7 @@
import { ModelConfig } from "@continuedev/config-yaml";
import { BaseLlmApi } from "@continuedev/openai-adapters";
import type { ChatHistoryItem } from "core/index.js";
import type {
ChatCompletionChunk,
} from "openai/resources/chat/completions.mjs";
import type { ChatCompletionChunk } from "openai/resources/chat/completions.mjs";
import { vi } from "vitest";
import { toolPermissionManager } from "./permissions/permissionManager.js";

View file

@ -2,11 +2,12 @@ import { ModelConfig } from "@continuedev/config-yaml";
import { BaseLlmApi } from "@continuedev/openai-adapters";
import type { ChatHistoryItem, ToolStatus } from "core/index.js";
import * as dotenv from "dotenv";
import type {
ChatCompletionTool,
} from "openai/resources.mjs";
import type { ChatCompletionTool } from "openai/resources.mjs";
import { convertFromUnifiedHistory, createHistoryItem } from "./messageConversion.js";
import {
convertFromUnifiedHistory,
createHistoryItem,
} from "./messageConversion.js";
import { filterExcludedTools } from "./permissions/index.js";
import {
getServiceSync,
@ -148,14 +149,17 @@ async function handleToolCalls(
toolResults.forEach((result, _index) => {
// Find the most recent assistant message with tool calls
const lastAssistantIndex = chatHistory.findLastIndex(
(item) => item.message.role === "assistant" && item.toolCallStates
(item) => item.message.role === "assistant" && item.toolCallStates,
);
if (lastAssistantIndex >= 0 && chatHistory[lastAssistantIndex].toolCallStates) {
if (
lastAssistantIndex >= 0 &&
chatHistory[lastAssistantIndex].toolCallStates
) {
const toolState = chatHistory[lastAssistantIndex].toolCallStates.find(
(ts) => ts.toolCallId === result.tool_call_id
(ts) => ts.toolCallId === result.tool_call_id,
);
if (toolState) {
toolState.status = hasRejection ? "canceled" : "done";
toolState.output = [

View file

@ -214,9 +214,7 @@ describe("tokenizer", () => {
},
});
const createChatHistory = (
tokenCount: number,
): ChatHistoryItem[] => {
const createChatHistory = (tokenCount: number): ChatHistoryItem[] => {
// Create a message that will result in approximately the desired token count
const content = "x".repeat(tokenCount * 4); // 4 chars per token
return [