qwen-alpha 1.0.14 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -137,9 +137,18 @@ async function messageHandler(ctx) {
|
|
|
137
137
|
text: prompt,
|
|
138
138
|
type: 'user_question',
|
|
139
139
|
});
|
|
140
|
-
|
|
141
|
-
// Добавляем ответ бота
|
|
142
|
-
//
|
|
140
|
+
|
|
141
|
+
// Добавляем ответ бота
|
|
142
|
+
const botMessageId = ctx.message.message_id + 1; // Приблизительно
|
|
143
|
+
sessionService.addMessage({
|
|
144
|
+
sessionId: session.session_id,
|
|
145
|
+
chatId,
|
|
146
|
+
messageId: botMessageId,
|
|
147
|
+
userId: 'bot',
|
|
148
|
+
text: responseText,
|
|
149
|
+
type: 'bot_response',
|
|
150
|
+
parent_id: ctx.message.message_id,
|
|
151
|
+
});
|
|
143
152
|
}
|
|
144
153
|
|
|
145
154
|
// Обновление статистики
|
|
@@ -84,15 +84,18 @@ class QwenService {
|
|
|
84
84
|
.map(msg => `${msg.role === 'assistant' ? 'Assistant' : 'User'}: ${msg.content}`)
|
|
85
85
|
.join('\n');
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
// Явно указываем что это продолжение диалога
|
|
88
|
+
fullPrompt = `Продолжи диалог. Контекст:\n${contextText}\n\nUser: ${code}`;
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
// Создаём временный файл с промптом
|
|
91
92
|
const tempFile = path.join(os.tmpdir(), `qwen-alpha-${Date.now()}-${Math.random().toString(36).substr(2, 9)}.txt`);
|
|
92
93
|
fs.writeFileSync(tempFile, fullPrompt, 'utf-8');
|
|
93
94
|
|
|
94
|
-
// Команда для Qwen
|
|
95
|
-
const command =
|
|
95
|
+
// Команда для Qwen — без системного промпта если есть контекст
|
|
96
|
+
const command = contextMessages.length > 0
|
|
97
|
+
? `cat '${tempFile}' | qwen -o json`
|
|
98
|
+
: `cat '${tempFile}' | qwen -p "Проанализируй код и дай рекомендации" -o json`;
|
|
96
99
|
|
|
97
100
|
logger.debug({ codeLength: code.length, contextLength: contextMessages.length, tempFile }, 'Running Qwen analysis');
|
|
98
101
|
|