feat: 对话功能开发

This commit is contained in:
2026-04-12 13:05:52 +08:00
parent fad8c10e69
commit 7a5b6680f2
4 changed files with 18 additions and 11 deletions

View File

@@ -75,6 +75,7 @@ import { useRouter } from 'vue-router';
import { useAppStore } from '@/stores/app';
import { useHistoryStore } from '@/stores/history';
import { Document, Plus, Promotion } from '@element-plus/icons-vue';
import { ElMessage } from 'element-plus';
const router = useRouter();
const appStore = useAppStore();
@@ -84,6 +85,11 @@ const isCreating = ref(false);
// 处理发送消息
async function handleSend() {
// 检查 opencode 服务是否已启动
if (appStore.serviceStatus !== appStore.SERVICE_STATUS.RUNNING) {
ElMessage.warning('暂时没有运行的智能体');
return;
}
const text = inputText.value.trim();
if (!text || isCreating.value) return;
@@ -98,11 +104,9 @@ async function handleSend() {
// 跳转到对话页面,并将消息文本带入 query
router.push({
path: '/chat',
query: {
sessionId: session.id,
text: text,
},
name: 'Chat',
params: { id: session.id },
query: { text: text },
});
} catch (err) {
console.error('创建会话失败:', err);