From 7ee0a58f9bc28b7e81c4adfd6efc98d4de67f70b Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Sun, 6 Oct 2024 04:14:52 -0400 Subject: [PATCH] Refactor assistant message --- src/core/Cline.ts | 3 +-- src/core/assistant-message/index.ts | 2 ++ src/core/assistant-message/parse-assistant-message.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/Cline.ts b/src/core/Cline.ts index 7ad448c..d444f55 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -36,8 +36,7 @@ import { calculateApiCost } from "../utils/cost" import { fileExistsAtPath } from "../utils/fs" import { arePathsEqual, getReadablePath } from "../utils/path" import { parseMentions } from "./mentions" -import { AssistantMessageContent, ToolParamName, ToolUseName } from "./assistant-message" -import { parseAssistantMessage } from "./assistant-message/parse-assistant-message" +import { AssistantMessageContent, parseAssistantMessage, ToolParamName, ToolUseName } from "./assistant-message" import { formatResponse } from "./prompts/responses" import { addCustomInstructions, SYSTEM_PROMPT } from "./prompts/system" import { truncateHalfConversation } from "./sliding-window" diff --git a/src/core/assistant-message/index.ts b/src/core/assistant-message/index.ts index 328d94e..968f7e7 100644 --- a/src/core/assistant-message/index.ts +++ b/src/core/assistant-message/index.ts @@ -1,5 +1,7 @@ export type AssistantMessageContent = TextContent | ToolUse +export { parseAssistantMessage } from "./parse-assistant-message" + export interface TextContent { type: "text" content: string diff --git a/src/core/assistant-message/parse-assistant-message.ts b/src/core/assistant-message/parse-assistant-message.ts index 84e7cac..e38e8f6 100644 --- a/src/core/assistant-message/parse-assistant-message.ts +++ b/src/core/assistant-message/parse-assistant-message.ts @@ -6,7 +6,7 @@ import { toolParamNames, toolUseNames, ToolUseName, -} from "./AssistantMessage" +} from "." export function parseAssistantMessage(assistantMessage: string) { let contentBlocks: AssistantMessageContent[] = []