MCPcopy Create free account
hub / github.com/scriptscat/scriptcat / updateMessage

Method updateMessage

src/app/repo/agent_chat.ts:92–100  ·  view source on GitHub ↗
(message: ChatMessage)

Source from the content-addressed store, hash-verified

90
91 // 更新消息(按 id 匹配)
92 async updateMessage(message: ChatMessage): Promise<void> {
93 const messagesDir = await this.getChildDir(MESSAGES_DIR);
94 const messages = await this.readJsonFile<ChatMessage[]>(`${message.conversationId}.json`, [], messagesDir);
95 const index = messages.findIndex((m) => m.id === message.id);
96 if (index >= 0) {
97 messages[index] = message;
98 await this.writeJsonFile(`${message.conversationId}.json`, messages, messagesDir);
99 }
100 }
101
102 // 保存整个消息列表(用于批量更新)
103 async saveMessages(conversationId: string, messages: ChatMessage[]): Promise<void> {

Callers

nothing calls this directly

Calls 2

getChildDirMethod · 0.80
writeJsonFileMethod · 0.80

Tested by

no test coverage detected