更新模型选择器以支持更多模型类型,重构输入栏以移除快捷指令和工作流功能,新增工作空间功能以支持文件预览和下载,优化工作流组件以增强节点数据处理的可选性和安全性。
This commit is contained in:
@@ -16,26 +16,6 @@
|
||||
<el-button circle class="tool-btn" @click="handleAttachment">
|
||||
<el-icon><Plus /></el-icon>
|
||||
</el-button>
|
||||
<el-dropdown trigger="click" @command="handleCommandSelect">
|
||||
<el-button class="pill-btn">快捷指令</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="rewrite">帮我润色这段文案</el-dropdown-item>
|
||||
<el-dropdown-item command="summary">总结当前对话重点</el-dropdown-item>
|
||||
<el-dropdown-item command="todo">整理下一步 TODO</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<el-dropdown trigger="click" @command="handleReplySelect">
|
||||
<el-button class="pill-btn">快捷回复</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="ok">收到,我马上处理</el-dropdown-item>
|
||||
<el-dropdown-item command="confirm">这个方向可以,继续</el-dropdown-item>
|
||||
<el-dropdown-item command="adjust">这个比例还要再调一下</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<el-dropdown trigger="click" @command="handleSkillSelect">
|
||||
<el-button class="pill-btn">
|
||||
{{ currentSkillDisplay }}
|
||||
@@ -49,18 +29,6 @@
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<el-dropdown trigger="click" @command="handleWorkflowSelect">
|
||||
<el-button class="pill-btn">
|
||||
{{ currentWorkflowDisplay }}
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="none">无</el-dropdown-item>
|
||||
<el-dropdown-item command="review-test">审查+测试</el-dropdown-item>
|
||||
<el-dropdown-item command="doc-then-code">文档再编码</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<el-button circle class="send-btn" :disabled="!message.trim()" @click="handleSend">
|
||||
@@ -84,7 +52,6 @@ interface Emits {
|
||||
const emit = defineEmits<Emits>();
|
||||
const message = ref('');
|
||||
const selectedSkill = ref('default');
|
||||
const selectedWorkflow = ref('none');
|
||||
|
||||
const skillLabels: Record<string, string> = {
|
||||
default: '选择技能',
|
||||
@@ -93,36 +60,12 @@ const skillLabels: Record<string, string> = {
|
||||
writing: '内容写作',
|
||||
};
|
||||
|
||||
const workflowLabels: Record<string, string> = {
|
||||
none: '选择工作流',
|
||||
'review-test': '审查+测试',
|
||||
'doc-then-code': '文档再编码',
|
||||
};
|
||||
|
||||
const currentSkillDisplay = computed(() => {
|
||||
return selectedSkill.value === 'default'
|
||||
? '选择技能'
|
||||
: skillLabels[selectedSkill.value];
|
||||
});
|
||||
|
||||
const currentWorkflowDisplay = computed(() => {
|
||||
return selectedWorkflow.value === 'none'
|
||||
? '选择工作流'
|
||||
: workflowLabels[selectedWorkflow.value];
|
||||
});
|
||||
|
||||
const quickCommands: Record<string, string> = {
|
||||
rewrite: '请帮我润色下面这段内容,保持原意并提升表达质感:',
|
||||
summary: '请总结我们当前对话的重点,并给出 3 条执行建议。',
|
||||
todo: '请把当前需求拆解成可执行的 TODO 列表。',
|
||||
};
|
||||
|
||||
const quickReplies: Record<string, string> = {
|
||||
ok: '收到,我马上处理。',
|
||||
confirm: '这个方向可以,继续。',
|
||||
adjust: '这个比例还要再调一下。',
|
||||
};
|
||||
|
||||
const skills: Record<string, string> = {
|
||||
default: '',
|
||||
'code-review': '[技能:代码审查] 请帮我审查下面这段代码,找出潜在问题并给出改进建议:\n',
|
||||
@@ -130,19 +73,12 @@ const skills: Record<string, string> = {
|
||||
writing: '[技能:内容写作] 请根据下面的需求帮我创作内容:\n',
|
||||
};
|
||||
|
||||
const workflows: Record<string, string> = {
|
||||
none: '',
|
||||
'review-test': '[工作流:审查+测试] 完成后请自动生成单元测试:\n',
|
||||
'doc-then-code': '[工作流:文档再编码] 请先编写接口文档,再实现代码:\n',
|
||||
};
|
||||
|
||||
const handleSend = (event?: KeyboardEvent) => {
|
||||
if (event) event.preventDefault();
|
||||
const msg = message.value.trim();
|
||||
if (!msg) return;
|
||||
const skillPrefix = skills[selectedSkill.value] || '';
|
||||
const workflowPrefix = workflows[selectedWorkflow.value] || '';
|
||||
const finalMessage = (skillPrefix + workflowPrefix + msg).trim();
|
||||
const finalMessage = (skillPrefix + msg).trim();
|
||||
emit('send', finalMessage);
|
||||
message.value = '';
|
||||
};
|
||||
@@ -151,29 +87,12 @@ const handleAttachment = () => {
|
||||
ElMessage.info('附件上传功能开发中...');
|
||||
};
|
||||
|
||||
const handleCommandSelect = (key: string | number | object) => {
|
||||
const k = String(key);
|
||||
message.value = quickCommands[k] || message.value;
|
||||
};
|
||||
|
||||
const handleReplySelect = (key: string | number | object) => {
|
||||
const k = String(key);
|
||||
message.value = quickReplies[k] || message.value;
|
||||
};
|
||||
|
||||
const handleSkillSelect = (key: string | number | object) => {
|
||||
selectedSkill.value = String(key);
|
||||
if (selectedSkill.value !== 'default') {
|
||||
ElMessage.success(`已选择技能:${skillLabels[selectedSkill.value]}`);
|
||||
}
|
||||
};
|
||||
|
||||
const handleWorkflowSelect = (key: string | number | object) => {
|
||||
selectedWorkflow.value = String(key);
|
||||
if (selectedWorkflow.value !== 'none') {
|
||||
ElMessage.success(`已选择工作流:${workflowLabels[selectedWorkflow.value]}`);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user