feat: 对话功能开发
This commit is contained in:
@@ -72,10 +72,12 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useAppStore } from '@/stores/app';
|
||||
import { useHistoryStore } from '@/stores/history';
|
||||
import { Document, Plus, Promotion } from '@element-plus/icons-vue';
|
||||
|
||||
const router = useRouter();
|
||||
const appStore = useAppStore();
|
||||
const historyStore = useHistoryStore();
|
||||
const inputText = ref('');
|
||||
const isCreating = ref(false);
|
||||
@@ -91,6 +93,18 @@ 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 = '';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user