Refactor assistant message

This commit is contained in:
Saoud Rizwan
2024-10-06 04:14:52 -04:00
parent 05eab1f22f
commit 7ee0a58f9b
3 changed files with 4 additions and 3 deletions

View File

@@ -36,8 +36,7 @@ import { calculateApiCost } from "../utils/cost"
import { fileExistsAtPath } from "../utils/fs" import { fileExistsAtPath } from "../utils/fs"
import { arePathsEqual, getReadablePath } from "../utils/path" import { arePathsEqual, getReadablePath } from "../utils/path"
import { parseMentions } from "./mentions" import { parseMentions } from "./mentions"
import { AssistantMessageContent, ToolParamName, ToolUseName } from "./assistant-message" import { AssistantMessageContent, parseAssistantMessage, ToolParamName, ToolUseName } from "./assistant-message"
import { parseAssistantMessage } from "./assistant-message/parse-assistant-message"
import { formatResponse } from "./prompts/responses" import { formatResponse } from "./prompts/responses"
import { addCustomInstructions, SYSTEM_PROMPT } from "./prompts/system" import { addCustomInstructions, SYSTEM_PROMPT } from "./prompts/system"
import { truncateHalfConversation } from "./sliding-window" import { truncateHalfConversation } from "./sliding-window"

View File

@@ -1,5 +1,7 @@
export type AssistantMessageContent = TextContent | ToolUse export type AssistantMessageContent = TextContent | ToolUse
export { parseAssistantMessage } from "./parse-assistant-message"
export interface TextContent { export interface TextContent {
type: "text" type: "text"
content: string content: string

View File

@@ -6,7 +6,7 @@ import {
toolParamNames, toolParamNames,
toolUseNames, toolUseNames,
ToolUseName, ToolUseName,
} from "./AssistantMessage" } from "."
export function parseAssistantMessage(assistantMessage: string) { export function parseAssistantMessage(assistantMessage: string) {
let contentBlocks: AssistantMessageContent[] = [] let contentBlocks: AssistantMessageContent[] = []