feat: 对话功能开发
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user