mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 10:02:23 +00:00
Release v0.18.6
This commit is contained in:
parent
e26058a21c
commit
dba2674681
13 changed files with 57 additions and 45 deletions
|
|
@ -588,7 +588,7 @@ function createRunner(sandboxConfig: SandboxConfig, channelId: string, channelDi
|
|||
// Add attachment paths if any (convert to absolute paths in execution environment)
|
||||
if (ctx.message.attachments && ctx.message.attachments.length > 0) {
|
||||
const attachmentPaths = ctx.message.attachments.map((a) => `${workspacePath}/${a.local}`).join("\n");
|
||||
userMessage += `\n\nAttachments:\n${attachmentPaths}`;
|
||||
userMessage += `\n\n<slack_attachments>\n${attachmentPaths}\n</slack_attachments>`;
|
||||
}
|
||||
|
||||
// Debug: write context to last_prompt.jsonl
|
||||
|
|
|
|||
|
|
@ -604,7 +604,7 @@ export function syncLogToContext(channelDir: string, excludeAfterTs?: string): n
|
|||
}
|
||||
|
||||
// For deduplication, we need to track what's already in context
|
||||
// Read context and extract user message content
|
||||
// Read context and extract user message content (strip attachments section for comparison)
|
||||
const existingMessages = new Set<string>();
|
||||
if (existsSync(contextFile)) {
|
||||
const contextContent = readFileSync(contextFile, "utf-8");
|
||||
|
|
@ -613,9 +613,16 @@ export function syncLogToContext(channelDir: string, excludeAfterTs?: string): n
|
|||
try {
|
||||
const entry = JSON.parse(line);
|
||||
if (entry.type === "message" && entry.message?.role === "user") {
|
||||
const content =
|
||||
let content =
|
||||
typeof entry.message.content === "string" ? entry.message.content : entry.message.content?.[0]?.text;
|
||||
if (content) existingMessages.add(content);
|
||||
// Strip attachments section for comparison (live messages have it, log messages don't)
|
||||
if (content) {
|
||||
const attachmentsIdx = content.indexOf("\n\n<slack_attachments>\n");
|
||||
if (attachmentsIdx !== -1) {
|
||||
content = content.substring(0, attachmentsIdx);
|
||||
}
|
||||
existingMessages.add(content);
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue