feat: 对话功能开发
This commit is contained in:
@@ -93,25 +93,16 @@ async function handleSend() {
|
||||
const session = await historyStore.createSession(text);
|
||||
console.log('创建会话成功:', session);
|
||||
|
||||
// 异步发送消息
|
||||
try {
|
||||
await window.opencode.promptAsync(session.id, text);
|
||||
console.log('异步发送消息指令已发送');
|
||||
} catch (sendErr) {
|
||||
console.error('发送初始消息失败:', sendErr);
|
||||
// 如果服务未启动,尝试启动
|
||||
if (appStore.serviceStatus !== appStore.SERVICE_STATUS.RUNNING) {
|
||||
appStore.triggerStartService();
|
||||
}
|
||||
}
|
||||
|
||||
// 清空输入框
|
||||
inputText.value = '';
|
||||
|
||||
// 跳转到对话页面
|
||||
// 跳转到对话页面,并将消息文本带入 query
|
||||
router.push({
|
||||
path: '/chat',
|
||||
query: { sessionId: session.id },
|
||||
query: {
|
||||
sessionId: session.id,
|
||||
text: text,
|
||||
},
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('创建会话失败:', err);
|
||||
|
||||
Reference in New Issue
Block a user