release: v2.0.6 - Intelligence & UX Optimization (2026-05-14)
This commit is contained in:
+27
-3
@@ -306,9 +306,24 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
}
|
||||
|
||||
const systemPrompt = buildTelegramSystemPrompt(!!contextBlock);
|
||||
const userMessage = contextBlock
|
||||
? `[SECOND BRAIN CONTEXT]\n${contextBlock}\n\n[USER MESSAGE]\n${text}`
|
||||
: text;
|
||||
// Per-chat conversation history — without this every inbound
|
||||
// is a fresh turn, so the user "tells the bot something" and
|
||||
// it gets immediately forgotten. We inline the recent N
|
||||
// exchanges into the user message because the AI service's
|
||||
// {system, user} surface doesn't carry a messages array.
|
||||
const { appendTelegramMessage, getRecentMessages, formatHistoryForPrompt } =
|
||||
await import('./integrations/telegram/conversationHistory');
|
||||
const history = getRecentMessages(chatId, 10);
|
||||
const historyBlock = formatHistoryForPrompt(history);
|
||||
const pieces: string[] = [];
|
||||
if (contextBlock) pieces.push(`[SECOND BRAIN CONTEXT]\n${contextBlock}`);
|
||||
if (historyBlock) pieces.push(historyBlock);
|
||||
pieces.push(`[USER MESSAGE]\n${text}`);
|
||||
const userMessage = pieces.join('\n\n');
|
||||
|
||||
// Persist the user's message *before* the AI call so failures
|
||||
// still leave a trail (next inbound will see what they said).
|
||||
appendTelegramMessage({ chatId, role: 'user', text, kind: 'user' });
|
||||
|
||||
try {
|
||||
const result = await telegramAi.chat({ system: systemPrompt, user: userMessage });
|
||||
@@ -330,6 +345,10 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
].join('\n');
|
||||
}
|
||||
|
||||
// Persist the assistant's reply so the *next* inbound sees
|
||||
// what we just said. Without this, the bot would forget its
|
||||
// own answer the moment the user follows up.
|
||||
appendTelegramMessage({ chatId, role: 'assistant', text: result.content, kind: 'reply' });
|
||||
// Telegram has a hard 4096 char/message limit. Long replies are
|
||||
// chunked and joined with a "(이어서)" hint so the user knows
|
||||
// multiple messages belong together.
|
||||
@@ -446,6 +465,11 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
await provider._detachArchitecture();
|
||||
vscode.window.showInformationMessage('Astra: Project architecture auto-attach turned off.');
|
||||
}),
|
||||
vscode.commands.registerCommand('g1nation.architecture.attach', async () => {
|
||||
if (!provider) return;
|
||||
await provider._attachArchitecture();
|
||||
vscode.window.showInformationMessage('Astra: Project architecture auto-attach turned on.');
|
||||
}),
|
||||
vscode.commands.registerCommand('g1nation.architecture.open', async () => {
|
||||
if (!provider) return;
|
||||
await provider._openArchitectureDoc();
|
||||
|
||||
Reference in New Issue
Block a user