push save MVP to 100%
This commit is contained in:
parent
3976670295
commit
859d506ea9
@ -2,6 +2,7 @@
|
||||
|
||||
## [main] 0.0.5
|
||||
- 支持对已经打开过的文件项目进行管理
|
||||
- 支持对用户对应服务器的调试工作内容进行保存(MVP 100%)
|
||||
|
||||
## [main] 0.0.4
|
||||
- 修复选择模型后点击确认跳转回 deepseek 的 bug
|
||||
|
@ -46,7 +46,7 @@
|
||||
| `all` | 支持同时调试多个 MCP Server | `MVP` | 0% | `P1` |
|
||||
| `all` | 支持通过大模型进行在线验证 | `迭代版本` | 100% | `Done` |
|
||||
| `all` | 支持 completion/complete 协议字段 | `MVP` | 0% | `P1` |
|
||||
| `all` | 支持对用户对应服务器的调试工作内容进行保存 | `MVP` | 80% | `P0` |
|
||||
| `all` | 支持对用户对应服务器的调试工作内容进行保存 | `迭代版本` | 100% | `Done` |
|
||||
| `render` | 高危操作权限确认 | `MVP` | 0% | `P1` |
|
||||
| `service` | 对于连接的 mcp server 进行热更新 | `MVP` | 0% | `P1` |
|
||||
| `service` | 系统配置信息云同步 | `MVP` | 0% | `P1` |
|
||||
|
@ -3,20 +3,20 @@
|
||||
<h3>{{ currentPrompt.name }}</h3>
|
||||
</div>
|
||||
<div class="prompt-reader-container">
|
||||
<el-form :model="formData" :rules="formRules" ref="formRef" label-position="top">
|
||||
<el-form :model="tabStorage.formData" :rules="formRules" ref="formRef" label-position="top">
|
||||
<el-form-item v-for="param in currentPrompt?.params" :key="param.name"
|
||||
:label="param.name" :prop="param.name">
|
||||
<el-input v-if="param.type === 'string'" v-model="formData[param.name]"
|
||||
<el-input v-if="param.type === 'string'" v-model="tabStorage.formData[param.name]"
|
||||
:placeholder="param.placeholder || `请输入${param.name}`"
|
||||
@keydown.enter.prevent="handleSubmit"
|
||||
/>
|
||||
|
||||
<el-input-number v-else-if="param.type === 'number'" v-model="formData[param.name]"
|
||||
<el-input-number v-else-if="param.type === 'number'" v-model="tabStorage.formData[param.name]"
|
||||
:placeholder="param.placeholder || `请输入${param.name}`"
|
||||
@keydown.enter.prevent="handleSubmit"
|
||||
/>
|
||||
|
||||
<el-switch v-else-if="param.type === 'boolean'" v-model="formData[param.name]" />
|
||||
<el-switch v-else-if="param.type === 'boolean'" v-model="tabStorage.formData[param.name]" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
@ -39,6 +39,7 @@ import { tabs } from '../panel';
|
||||
import { parsePromptTemplate, promptsManager, PromptStorage } from './prompts';
|
||||
import { CasualRestAPI, PromptsGetResponse } from '@/hook/type';
|
||||
import { useMessageBridge } from '@/api/message-bridge';
|
||||
import { getDefaultValue, normaliseJavascriptType } from '@/hook/mcp';
|
||||
|
||||
defineComponent({ name: 'prompt-reader' });
|
||||
|
||||
@ -54,9 +55,11 @@ const props = defineProps({
|
||||
const tab = tabs.content[props.tabId];
|
||||
const tabStorage = tab.storage as PromptStorage;
|
||||
|
||||
if (!tabStorage.formData) {
|
||||
tabStorage.formData = {};
|
||||
}
|
||||
|
||||
const formRef = ref<FormInstance>();
|
||||
// TODO: 将 formData 装入 tabStorage
|
||||
const formData = ref<Record<string, any>>({});
|
||||
const loading = ref(false);
|
||||
const responseData = ref<PromptsGetResponse>();
|
||||
|
||||
@ -93,11 +96,19 @@ const formRules = computed<FormRules>(() => {
|
||||
});
|
||||
|
||||
const initFormData = () => {
|
||||
formData.value = {}
|
||||
currentPrompt.value?.params.forEach(param => {
|
||||
formData.value[param.name] = param.type === 'number' ? 0 :
|
||||
param.type === 'boolean' ? false : ''
|
||||
})
|
||||
|
||||
if (!currentPrompt.value?.params) return;
|
||||
|
||||
const newSchemaDataForm: Record<string, number | boolean | string> = {};
|
||||
|
||||
currentPrompt.value.params.forEach(param => {
|
||||
newSchemaDataForm[param.name] = getDefaultValue(param);
|
||||
const originType = normaliseJavascriptType(typeof tabStorage.formData[param.name]);
|
||||
if (tabStorage.formData[param.name]!== undefined && originType === param.type) {
|
||||
newSchemaDataForm[param.name] = tabStorage.formData[param.name];
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
@ -114,7 +125,7 @@ function handleSubmit() {
|
||||
|
||||
bridge.postMessage({
|
||||
command: 'prompts/get',
|
||||
data: { promptId: currentPrompt.value.name, args: JSON.parse(JSON.stringify(formData.value)) }
|
||||
data: { promptId: currentPrompt.value.name, args: JSON.parse(JSON.stringify(tabStorage.formData)) }
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,9 @@ onMounted(() => {
|
||||
commandCancel = bridge.addCommandListener('prompts/list', (data: CasualRestAPI<PromptsListResponse>) => {
|
||||
promptsManager.templates = data.msg.prompts || [];
|
||||
|
||||
if (promptsManager.templates.length > 0) {
|
||||
const targetPrompt = promptsManager.templates.find(template => template.name === tabStorage.currentPromptName);
|
||||
|
||||
if (targetPrompt === undefined) {
|
||||
tabStorage.currentPromptName = promptsManager.templates[0].name;
|
||||
tabStorage.lastPromptGetResponse = undefined;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ export const promptsManager = reactive<{
|
||||
export interface PromptStorage {
|
||||
currentPromptName: string;
|
||||
lastPromptGetResponse?: PromptsGetResponse;
|
||||
formData: Record<string, number | boolean | string>;
|
||||
}
|
||||
|
||||
export function parsePromptTemplate(template: string): {
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"currentIndex": 2,
|
||||
"currentIndex": 0,
|
||||
"tabs": [
|
||||
{
|
||||
"name": "交互测试",
|
||||
@ -160,6 +160,29 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "提词",
|
||||
"icon": "icon-chat",
|
||||
"type": "blank",
|
||||
"componentIndex": 1,
|
||||
"storage": {
|
||||
"formData": {
|
||||
"message": "你好"
|
||||
},
|
||||
"currentPromptName": "translate",
|
||||
"lastPromptGetResponse": {
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": {
|
||||
"type": "text",
|
||||
"text": "请将下面的话语翻译成中文:\n\n你好"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user