v3.8.1发布,上传前端代码

This commit is contained in:
JEECG
2025-06-25 16:04:02 +08:00
parent 3d414aaec8
commit 0148f45979
120 changed files with 4783 additions and 486 deletions

View File

@ -20,7 +20,7 @@
<div class="flex text-status" v-if="item.metadata && item.metadata.length>0">
<span class="tag-input">输入</span>
<div v-for="(metaItem, index) in item.metadata">
<a-tag color="rgba(87,104,161,0.08)" class="tags-meadata">
<a-tag color="#f2f3f8" class="tags-meadata">
<span v-if="index<3" class="tag-text">{{ metaItem.field }}</span>
</a-tag>
</div>
@ -126,7 +126,7 @@
};
/**
* 加载知识库
* 加载AI流程
*/
function loadFlowData() {
let params = {
@ -135,7 +135,7 @@
column: 'createTime',
order: 'desc',
name: searchText.value,
status:'enable'
status: 'enable,release'
};
getAiFlowList(params).then((res) =>{
if(res){
@ -313,11 +313,11 @@
white-space: nowrap;
height: 20px;
font-size: 12px;
color: rgba(15, 21, 40,0.82);
color: #3a3f4f;
}
.tag-input{
align-self: center;
color: rgba(55,67,106,0.7);
color: #707a97;
font-size: 12px;
font-style: normal;
font-weight: 500;

View File

@ -2,7 +2,6 @@
<div class="p-2">
<BasicModal destroyOnClose @register="registerModal" :canFullscreen="false" width="600px" :title="title" @ok="handleOk" @cancel="handleCancel">
<div class="flex header">
<span>所选知识库必须使用相同的 Embedding 模型</span>
<a-input
@pressEnter="loadKnowledgeData"
class="header-search"
@ -19,7 +18,7 @@
<img class="checkbox-img" :src="knowledge" />
<span class="checkbox-name">{{ item.name }}</span>
</div>
<a-checkbox v-model:checked="item.checked" @click.stop class="quantum-checker"> </a-checkbox>
<a-checkbox v-model:checked="item.checked" @click.stop class="quantum-checker" @change="(e)=>handleChange(e,item)"> </a-checkbox>
</div>
</a-card>
</a-col>
@ -91,6 +90,7 @@
* 保存
*/
async function handleOk() {
console.log("知识库确定选中的值",knowledgeData.value);
emit('success', knowledgeIds.value, knowledgeData.value);
handleCancel();
}
@ -103,16 +103,17 @@
}
//复选框选中事件
const handleSelect = (item) => {
function handleSelect(item){
let id = item.id;
const target = appKnowledgeOption.value.find((item) => item.id === id);
if (target) {
target.checked = !target.checked;
}
//存放选中的知识库的id
if (knowledgeIds.value.length == 0) {
if (!knowledgeIds.value || knowledgeIds.value.length == 0) {
knowledgeIds.value.push(id);
knowledgeData.value.push(item);
console.log("知识库勾选或取消勾选复选框的值",knowledgeData.value);
return;
}
let findIndex = knowledgeIds.value.findIndex((item) => item === id);
@ -123,7 +124,8 @@
knowledgeIds.value.splice(findIndex, 1);
knowledgeData.value.splice(findIndex, 1);
}
};
console.log("知识库勾选或取消勾选复选框的值",knowledgeData.value);
}
/**
* 加载知识库
@ -176,6 +178,25 @@
});
}
/**
* 复选框选中事件
*
* @param e
* @param item
*/
function handleChange(e, item) {
if (e.target.checked) {
knowledgeIds.value.push(item.id);
knowledgeData.value.push(item);
} else {
let findIndex = knowledgeIds.value.findIndex((val) => val === item.id);
if (findIndex != -1) {
knowledgeIds.value.splice(findIndex, 1);
knowledgeData.value.splice(findIndex, 1);
}
}
}
return {
registerModal,
title,
@ -193,6 +214,7 @@
searchText,
loadKnowledgeData,
handleClearClick,
handleChange,
};
},
};
@ -222,7 +244,7 @@
.list-footer {
position: absolute;
bottom: 0;
left: 260px;
right: 10px;
}
.checkbox-card {
margin-bottom: 10px;

View File

@ -109,24 +109,80 @@
handleCancel();
}
//update-begin---author:wangshuai---date:2025-04-01---for:【QQYUN-11796】【AI】提示词生成器改成异步---
/**
* 生成
*/
function generatedPrompt() {
async function generatedPrompt() {
content.value = '';
loading.value = true;
promptGenerate({ prompt: prompt.value })
.then((res) => {
if (res.success) {
content.value = res.result;
let readableStream = await promptGenerate({ prompt: prompt.value }).catch(() => {
loading.value = false;
});
const reader = readableStream.getReader();
const decoder = new TextDecoder('UTF-8');
let buffer = '';
while (true) {
const { done, value } = await reader.read();
if (done) {
break;
}
let result = decoder.decode(value, { stream: true });
const lines = result.split('\n\n');
for (const line of lines) {
if (line.startsWith('data:')) {
const content = line.replace('data:', '').trim();
if(!content){
continue;
}
if(!content.endsWith('}')){
buffer = buffer + line;
continue;
}
buffer = "";
renderText(content)
} else {
if(!line) {
continue;
}
if(!line.endsWith('}')) {
buffer = buffer + line;
continue;
}
buffer = "";
renderText(line)
}
}
loading.value = false;
})
.catch(() => {
loading.value = false;
});
}
}
/**
* 渲染文本
*
* @param item
*/
function renderText(item) {
try {
let parse = JSON.parse(item);
if (parse.event == 'MESSAGE') {
content.value += parse.data.message;
if(loading.value){
loading.value = false;
}
}
if (parse.event == 'MESSAGE_END') {
loading.value = false;
}
if (parse.event == 'ERROR') {
content.value = parse.data.message?parse.data.message:'生成失败,请稍后重试!'
loading.value = false;
}
} catch (error) {
console.log('Error parsing update:', error);
}
}
//update-end---author:wangshuai---date:2025-04-01---for:【QQYUN-11796】【AI】提示词生成器改成异步---
/**
* 指令点击事件
*/

View File

@ -1,14 +1,24 @@
<template>
<div class="p-2">
<BasicModal destroyOnClose @register="registerModal" :canFullscreen="false" width="800px" :title="title" @ok="handleOk" @cancel="handleCancel">
<template #title>
<span style="display: flex">
{{title}}
<a-tooltip title="AI应用文档">
<a style="color: unset" href="https://help.jeecg.com/aigc/guide/app" target="_blank">
<Icon style="position:relative;left:2px;top:1px" icon="ant-design:question-circle-outlined"></Icon>
</a>
</a-tooltip>
</span>
</template>
<BasicForm @register="registerForm">
<template #typeSlot="{ model, field }">
<a-radio-group v-model:value="type" style="display: flex">
<a-radio-group v-model:value="model[field]" style="display: flex">
<a-card
v-for="item in appTypeOption"
style="margin-right: 10px; cursor: pointer; width: 100%"
@click="handleTypeClick(item.value)"
:style="type === item.value ? { borderColor: '#3370ff' } : {}"
@click="model[field] = item.value"
:style="model[field] === item.value ? { borderColor: '#3370ff' } : {}"
>
<a-radio :value="item.value">
<div class="type-title">{{ item.title }}</div>
@ -23,7 +33,7 @@
</template>
<script lang="ts">
import { ref, unref } from 'vue';
import { ref, unref, computed } from 'vue';
import BasicModal from '@/components/Modal/src/BasicModal.vue';
import { useModal, useModalInner } from '@/components/Modal';
@ -42,15 +52,13 @@
},
emits: ['success', 'register'],
setup(props, { emit }) {
const title = ref<string>('创建应用');
//保存或修改
const isUpdate = ref<boolean>(false);
const title = computed<string>(() => isUpdate.value ? '修改应用' : '创建应用');
//app类型
const appTypeOption = ref<any>([]);
//应用类型
const type = ref<string>('chatSimple');
//表单配置
const [registerForm, { validate, resetFields, setFieldsValue }] = useForm({
@ -63,7 +71,6 @@
//注册modal
const [registerModal, { closeModal, setModalProps }] = useModalInner(async (data) => {
await resetFields();
type.value = 'chatSimple';
//update-begin---author:wangshuai---date:2025-03-11---for: 【QQYUN-11324】8.修改弹窗head---
isUpdate.value = !!data?.isUpdate;
if (unref(isUpdate)) {
@ -71,6 +78,10 @@
await setFieldsValue({
...data.record,
});
} else {
await setFieldsValue({
type: 'chatSimple',
})
}
//update-end---author:wangshuai---date:2025-03-11---for:【QQYUN-11324】8.修改弹窗head---
setModalProps({ minHeight: 500, bodyStyle: { padding: '10px' } });
@ -83,7 +94,6 @@
try {
let values = await validate();
setModalProps({ confirmLoading: true });
values.type = type.value;
let result = await saveApp(values);
if (result) {
//关闭弹窗
@ -128,13 +138,6 @@
closeModal();
}
/**
* 应用类型点击事件
*/
function handleTypeClick(val) {
type.value = val;
}
return {
registerModal,
registerForm,
@ -142,8 +145,6 @@
handleOk,
handleCancel,
appTypeOption,
type,
handleTypeClick,
};
},
};

View File

@ -6,13 +6,20 @@
<div style="display: flex">
<img :src="getImage()" class="header-img"/>
<div class="header-name">{{formState.name}}</div>
<a-tooltip title="编辑">
<a-tooltip v-if="!isRelease" title="编辑">
<Icon icon="ant-design:edit-outlined" style="margin-left: 4px;cursor: pointer" color="#354052" size="20" @click="handleEdit"></Icon>
</a-tooltip>
</div>
<div>应用编排</div>
<div>
应用编排
<a-tooltip title="AI应用文档">
<a style="color: unset" href="https://help.jeecg.com/aigc/guide/app" target="_blank">
<Icon style="position:relative;left:2px;top:1px" icon="ant-design:question-circle-outlined"></Icon>
</a>
</a-tooltip>
</div>
<div style="display: flex">
<a-button @click="handleOk" style="margin-right: 30px" type="primary">保存</a-button>
<a-button v-if="!isRelease" @click="handleOk" style="margin-right: 30px" type="primary">保存</a-button>
</div>
</div>
</template>
@ -35,7 +42,7 @@
<template #label>
<div style="display: flex;justify-content: space-between;width: 100%;">
<span>关联流程</span>
<span @click="handleAddFlowClick" class="knowledge-txt">
<span v-if="!isRelease" @click="handleAddFlowClick" class="knowledge-txt">
<Icon icon="ant-design:plus-outlined" size="13" style="margin-right: 2px"></Icon>添加
</span>
</div>
@ -49,14 +56,14 @@
<div class="flex text-status" v-if="flowData.metadata && flowData.metadata.length>0">
<span class="tag-input">输入</span>
<div v-for="(metaItem, index) in flowData.metadata">
<a-tag color="rgba(87,104,161,0.08)" class="tags-meadata">
<a-tag color="#f2f3f8" class="tags-meadata">
<span v-if="index<5" class="tag-text">{{ metaItem.field }}</span>
</a-tag>
</div>
</div>
</div>
</div>
<Icon @click="handleDeleteFlow" icon="ant-design:close-outlined" size="20" class="knowledge-icon"></Icon>
<Icon v-if="!isRelease" @click="handleDeleteFlow" icon="ant-design:close-outlined" size="20" class="knowledge-icon"></Icon>
</div>
</a-card>
<div v-else class="data-empty-text">
@ -71,7 +78,7 @@
<template #label>
<div class="prompt-title-padding item-title space-between">
<span>提示词</span>
<a-button size="middle" @click="generatedPrompt" ghost>
<a-button v-if="!isRelease" size="middle" @click="generatedPrompt" ghost>
<span style="align-items: center;display:flex">
<svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M18.9839 1.85931C19.1612 1.38023 19.8388 1.38023 20.0161 1.85931L20.5021 3.17278C20.5578 3.3234 20.6766 3.44216 20.8272 3.49789L22.1407 3.98392C22.6198 4.1612 22.6198 4.8388 22.1407 5.01608L20.8272 5.50211C20.6766 5.55784 20.5578 5.6766 20.5021 5.82722L20.0161 7.14069C19.8388 7.61977 19.1612 7.61977 18.9839 7.14069L18.4979 5.82722C18.4422 5.6766 18.3234 5.55784 18.1728 5.50211L16.8593 5.01608C16.3802 4.8388 16.3802 4.1612 16.8593 3.98392L18.1728 3.49789C18.3234 3.44216 18.4422 3.3234 18.4979 3.17278L18.9839 1.85931zM13.5482 4.07793C13.0164 2.64069 10.9836 2.64069 10.4518 4.07793L8.99368 8.01834C8.82648 8.47021 8.47021 8.82648 8.01834 8.99368L4.07793 10.4518C2.64069 10.9836 2.64069 13.0164 4.07793 13.5482L8.01834 15.0063C8.47021 15.1735 8.82648 15.5298 8.99368 15.9817L10.4518 19.9221C10.9836 21.3593 13.0164 21.3593 13.5482 19.9221L15.0063 15.9817C15.1735 15.5298 15.5298 15.1735 15.9817 15.0063L19.9221 13.5482C21.3593 13.0164 21.3593 10.9836 19.9221 10.4518L15.9817 8.99368C15.5298 8.82648 15.1735 8.47021 15.0063 8.01834L13.5482 4.07793zM5.01608 16.8593C4.8388 16.3802 4.1612 16.3802 3.98392 16.8593L3.49789 18.1728C3.44216 18.3234 3.3234 18.4422 3.17278 18.4979L1.85931 18.9839C1.38023 19.1612 1.38023 19.8388 1.85931 20.0161L3.17278 20.5021C3.3234 20.5578 3.44216 20.6766 3.49789 20.8272L3.98392 22.1407C4.1612 22.6198 4.8388 22.6198 5.01608 22.1407L5.50211 20.8272C5.55784 20.6766 5.6766 20.5578 5.82722 20.5021L7.14069 20.0161C7.61977 19.8388 7.61977 19.1612 7.14069 18.9839L5.82722 18.4979C5.6766 18.4422 5.55784 18.3234 5.50211 18.1728L5.01608 16.8593z"></path></svg>
<span style="margin-left: 4px">生成</span>
@ -79,7 +86,7 @@
</a-button>
</div>
</template>
<a-textarea :rows="8" v-model:value="formState.prompt" placeholder="请输入提示词"/>
<a-textarea :disabled="isRelease" :rows="8" v-model:value="formState.prompt" placeholder="请输入提示词"/>
</a-form-item>
</div>
</a-col>
@ -90,7 +97,7 @@
<div class="prompt-title-padding item-title">开场白</div>
</template>
<div class="prologue-chunk-edit">
<j-markdown-editor :height="166" v-model:value="formState.prologue" @change="prologueTextAreaBlur" :preview="{ mode: 'view', action: [] }"></j-markdown-editor>
<j-markdown-editor :height="166" v-model:value="formState.prologue" :disabled="isRelease" @change="prologueTextAreaBlur" :preview="{ mode: 'view', action: [] }"></j-markdown-editor>
</div>
</a-form-item>
</div>
@ -101,7 +108,7 @@
<template #label>
<div class="prompt-title-padding item-title space-between">
<div class="item-title">预设问题</div>
<a-tooltip title="添加预设问题">
<a-tooltip v-if="!isRelease" title="添加预设问题">
<Icon icon="ant-design:plus-outlined" size="13" style="margin-right: 16px;cursor: pointer" @click="presetQuestionAddClick"></Icon>
</a-tooltip>
</div>
@ -110,9 +117,9 @@
<draggable :disabled="disabledDrag" item-key="key" v-model="presetQuestionList" @end="presetQuestionEnd">
<template #item="{ element:item }">
<div style="display: flex;width: 100%;margin-top: 10px">
<Icon icon="ant-design:holder-outlined" size="20"></Icon>
<a-input placeholder="输入预设问题" v-model:value="item.descr" style="margin-left: 10px;" @blur="onBlur(item)" @focus="onFocus(item)" @change="questionChange"></a-input>
<Icon style="cursor: pointer;margin-left: 10px" icon="ant-design:delete-outlined" @click="deleteQuestionClick(item.key)"></Icon>
<Icon v-if="!isRelease" icon="ant-design:holder-outlined" size="20"></Icon>
<a-input :disabled="isRelease" placeholder="输入预设问题" v-model:value="item.descr" style="margin-left: 10px;" @blur="onBlur(item)" @focus="onFocus(item)" @change="questionChange"></a-input>
<Icon v-if="!isRelease" style="cursor: pointer;margin-left: 10px" icon="ant-design:delete-outlined" @click="deleteQuestionClick(item.key)"></Icon>
</div>
</template>
</draggable>
@ -129,7 +136,7 @@
<template #label>
<div class="prompt-title-padding item-title space-between">
<div class="item-title">快捷指令</div>
<a-tooltip title="添加快捷指令">
<a-tooltip v-if="!isRelease" title="添加快捷指令">
<Icon icon="ant-design:plus-outlined" size="13" style="margin-right: 16px;cursor: pointer" @click="quickCommandAddClick"></Icon>
</a-tooltip>
</div>
@ -143,7 +150,7 @@
<svg v-else width="14px" height="14px" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M18.9839 1.85931C19.1612 1.38023 19.8388 1.38023 20.0161 1.85931L20.5021 3.17278C20.5578 3.3234 20.6766 3.44216 20.8272 3.49789L22.1407 3.98392C22.6198 4.1612 22.6198 4.8388 22.1407 5.01608L20.8272 5.50211C20.6766 5.55784 20.5578 5.6766 20.5021 5.82722L20.0161 7.14069C19.8388 7.61977 19.1612 7.61977 18.9839 7.14069L18.4979 5.82722C18.4422 5.6766 18.3234 5.55784 18.1728 5.50211L16.8593 5.01608C16.3802 4.8388 16.3802 4.1612 16.8593 3.98392L18.1728 3.49789C18.3234 3.44216 18.4422 3.3234 18.4979 3.17278L18.9839 1.85931zM13.5482 4.07793C13.0164 2.64069 10.9836 2.64069 10.4518 4.07793L8.99368 8.01834C8.82648 8.47021 8.47021 8.82648 8.01834 8.99368L4.07793 10.4518C2.64069 10.9836 2.64069 13.0164 4.07793 13.5482L8.01834 15.0063C8.47021 15.1735 8.82648 15.5298 8.99368 15.9817L10.4518 19.9221C10.9836 21.3593 13.0164 21.3593 13.5482 19.9221L15.0063 15.9817C15.1735 15.5298 15.5298 15.1735 15.9817 15.0063L19.9221 13.5482C21.3593 13.0164 21.3593 10.9836 19.9221 10.4518L15.9817 8.99368C15.5298 8.82648 15.1735 8.47021 15.0063 8.01834L13.5482 4.07793zM5.01608 16.8593C4.8388 16.3802 4.1612 16.3802 3.98392 16.8593L3.49789 18.1728C3.44216 18.3234 3.3234 18.4422 3.17278 18.4979L1.85931 18.9839C1.38023 19.1612 1.38023 19.8388 1.85931 20.0161L3.17278 20.5021C3.3234 20.5578 3.44216 20.6766 3.49789 20.8272L3.98392 22.1407C4.1612 22.6198 4.8388 22.6198 5.01608 22.1407L5.50211 20.8272C5.55784 20.6766 5.6766 20.5578 5.82722 20.5021L7.14069 20.0161C7.61977 19.8388 7.61977 19.1612 7.14069 18.9839L5.82722 18.4979C5.6766 18.4422 5.55784 18.3234 5.50211 18.1728L5.01608 16.8593z"></path></svg>
<div style="max-width: 400px;margin-left: 4px" class="ellipsis">{{item.name}}</div>
</div>
<div style="align-items: center" class="quick-command-icon">
<div v-if="!isRelease" style="align-items: center" class="quick-command-icon">
<a-tooltip title="编辑">
<Icon style="cursor: pointer;margin-left: 10px" icon="ant-design:edit-outlined" @click="editCommandClick(item)"></Icon>
</a-tooltip>
@ -167,13 +174,14 @@
<template #label>
<div style="display: flex;justify-content: space-between;width: 100%;margin-right: 2px">
<div class="item-title">AI模型</div>
<div @click="handleParamSettingClick('model')" class="knowledge-txt">
<div v-if="!isRelease" @click="handleParamSettingClick('model')" class="knowledge-txt">
<Icon icon="ant-design:setting-outlined" size="13" style="margin-right: 2px"></Icon>参数配置
</div>
</div>
</template>
<JDictSelectTag
v-model:value="formState.modelId"
:disabled="isRelease"
placeholder="请选择AI模型"
dict-code="airag_model where model_type = 'LLM',name,id"
style="width: 100%;"
@ -193,7 +201,7 @@
<template #label>
<div style="display: flex; justify-content: space-between; width: 100%;margin-left: 2px;">
<div class="item-title">知识库</div>
<div>
<div v-if="!isRelease">
<span @click="handleParamSettingClick('knowledge')" class="knowledge-txt">
<Icon icon="ant-design:setting-outlined" size="13" style="margin-right: 2px"></Icon>参数配置
</span>
@ -209,9 +217,10 @@
<div style="display: flex; width: 100%; justify-content: space-between">
<div>
<img class="knowledge-img" :src="knowledge" />
<span class="knowledge-name">{{ item.name }}</span>
<span class="knowledge-name" style="color: #e03e2d;text-decoration: line-through" v-if="item.type">{{ item.name }}</span>
<span class="knowledge-name" v-else>{{ item.name }}</span>
</div>
<Icon @click="handleDeleteKnowledge(item.id)" icon="ant-design:close-outlined" size="20" class="knowledge-icon"></Icon>
<Icon v-if="!isRelease" @click="handleDeleteKnowledge(item.id)" icon="ant-design:close-outlined" size="20" class="knowledge-icon"></Icon>
</div>
</a-card>
</a-col>
@ -228,10 +237,23 @@
<template #label>
<div style="margin-left: 2px">历史聊天记录</div>
</template>
<a-input-number v-model:value="formState.msgNum"></a-input-number>
<a-input-number :disabled="isRelease" v-model:value="formState.msgNum"></a-input-number>
</a-form-item>
</div>
</a-col>
<a-col :span="24" class="mt-10">
<div class="prologue-chunk">
<div style="margin-left: 2px">个性化设置</div>
<a-row>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" v-bind="validateInfos.multiSession">
<div style="display: flex;margin-top: 10px">
<div style="margin-left: 2px">多会话模式</div>
<a-switch :disabled="isRelease" v-model:checked="multiSessionChecked" checked-children="" un-checked-children="" @change="handleMultiSessionChange"></a-switch>
</div>
</a-form-item>
</a-row>
</div>
</a-col>
</a-row>
</a-form>
</a-col>
@ -284,7 +306,6 @@
import draggable from 'vuedraggable';
import { useMessage } from "@/hooks/web/useMessage";
import defaultFlowImg from "@/assets/images/ai/aiflow.png";
export default {
name: 'AiAppSettingModal',
components: {
@ -358,10 +379,15 @@
//快捷指令
const quickCommand = ref<any>('');
const { createMessage } = useMessage();
//多会话模式选中状态
const multiSessionChecked = ref<boolean>(true);
// 是否已发布
const isRelease = ref<boolean>(false);
//注册modal
const [registerModal, { closeModal, setModalProps }] = useModalInner(async (data) => {
appId.value = data.id;
isUpdate.value = !!data?.isUpdate;
isRelease.value = data?.status === 'release';
clearParam();
if (isUpdate.value) {
setTimeout(() => {
@ -371,14 +397,16 @@
//新增成功之后需要有id
queryById({ id: data.id }).then((res) => {
if (res.success) {
resetFields();
//赋值
Object.assign(formState, res.result);
formState.prompt = AiAppJson.prompt;
formState.prologue = AiAppJson.prologue;
formState.presetQuestion = JSON.stringify(AiAppJson.presetQuestion);
prologue.value = AiAppJson.prologue;
formState.prompt = cloneDeep(AiAppJson.prompt);
formState.prologue = cloneDeep(AiAppJson.prologue);
formState.presetQuestion = JSON.stringify(cloneDeep(AiAppJson.presetQuestion));
formState.msgNum = 1;
prologue.value = cloneDeep(AiAppJson.prologue);
presetQuestion.value = formState.presetQuestion;
presetQuestionList.value = AiAppJson.presetQuestion;
presetQuestionList.value = cloneDeep(AiAppJson.presetQuestion);
addRules(res.result.type)
}
});
@ -403,6 +431,7 @@
setModalProps({ confirmLoading: true });
formState.knowledgeIds = knowledgeIds.value;
await saveApp(formState);
emit('success')
} finally {
setModalProps({ confirmLoading: false });
}
@ -457,7 +486,9 @@
*/
function handleSuccess(knowledgeId, knowledgeData) {
knowledgeIds.value = cloneDeep(knowledgeId.join(','));
console.log("知识库id",knowledgeIds.value);
knowledgeDataList.value = cloneDeep(knowledgeData);
console.log("知识库的数据",knowledgeDataList.value);
formState.knowledgeIds = knowledgeIds.value;
}
@ -481,10 +512,30 @@
*/
function getKnowledgeDataList(ids) {
queryKnowledgeBathById({ ids: ids }).then((res) => {
if (res.success) {
knowledgeDataList.value = res.result;
//update-begin---author:wangshuai---date:2025-04-24---for:【QQYUN-12133】【AI】应用关联的知识库呗删除后再次进入应用看不到已删除的知识库并且无法清理掉知识库。---
if (res.success && res.result) {
let result = res.result;
let idArray = ids.split(",");
let arr = [];
for (const id of idArray) {
let filter = result.filter((item) => item.id === id);
if(filter && filter.length > 0) {
arr.push({ id: id, name: filter[0].name});
} else {
arr.push({ name: '该知识库已被删除', id: id,type: 'delete' })
}
}
knowledgeDataList.value = arr;
knowledgeIds.value = ids;
} else {
let arr = [];
for (const id of ids) {
arr.push({ name: '该知识库已被删除', id: id})
}
knowledgeDataList.value = arr;
knowledgeIds.value = ids;
}
//update-end---author:wangshuai---date:2025-04-24---for:【QQYUN-12133】【AI】应用关联的知识库呗删除后再次进入应用看不到已删除的知识库并且无法清理掉知识库。---
});
}
@ -497,7 +548,7 @@
/**
* 关闭弹窗触发列表刷新
*
*
* @param value
*/
function visibleChange(value) {
@ -508,7 +559,7 @@
/**
* 添加检验
*
*
* @param type
*/
function addRules(type){
@ -535,13 +586,13 @@
/**
* 参数配置确定回调事件
*
*
* @param value
*/
function handleParamsSettingOk(value){
metadata.value = value;
Object.assign(metadata.value,value)
if(value) {
formState.metadata = JSON.stringify(value);
formState.metadata = JSON.stringify(metadata.value);
}
}
@ -620,16 +671,16 @@
/**
* 应用编辑回调事件
*
*
* @param values
*/
function handelEditSuccess(values) {
formState.icon = values.icon ? values.icon:'';
formState.name = values.name ? values.name:'';
}
//=========== begin预设问题 ===========================
// 编辑状态不允许拖动
const disabledDrag = computed(()=>{
let list = presetQuestionList.value;
@ -641,7 +692,7 @@
}
return false;
});
/**
* 预设问题拖拽
*/
@ -652,7 +703,7 @@
/**
* 预设问题添加
*
*
* @param e
*/
function presetQuestionAddClick(e){
@ -662,11 +713,11 @@
}
const length = presetQuestionList.value.length;
presetQuestionList.value.push({key: length + 1, sort: length + 1, descr: ''})
}
}
/**
* 预设问题删除
*
*
* @param key
*/
function deleteQuestionClick(key){
@ -693,7 +744,7 @@
/**
* 预设问题值改变事件
*
*
*/
function questionChange() {
if(presetQuestionList.value && presetQuestionList.value.length>0){
@ -704,9 +755,9 @@
formState.presetQuestion = "";
}
}
//=========== end预设问题 ===========================
/**
* 清除参数
*/
@ -717,9 +768,10 @@
flowId.value = '';
flowData.value = null;
presetQuestion.value = '';
presetQuestionList.value = [];
presetQuestionList.value = [{ key:1, sort: 1, descr: '' }];
quickCommandList.value = [];
quickCommand.value = '';
multiSessionChecked.value = true;
}
/**
@ -735,13 +787,24 @@
data.msgNum = data.msgNum ? data.msgNum : 1;
if(data.metadata){
metadata.value = JSON.parse(data.metadata);
if(metadata.value?.multiSession){
multiSessionChecked.value = metadata.value.multiSession === '1';
}else{
multiSessionChecked.value = "1";
}
}
if(data.presetQuestion){
presetQuestion.value = data.presetQuestion;
presetQuestionList.value = JSON.parse(data.presetQuestion);
}
if(data.quickCommand){
quickCommandList.value = JSON.parse(data.quickCommand);
//update-begin---author:wangshuai---date:2025-04-08---for:【QQYUN-11939】ai应用 快捷指令 修改保存以后,再次打开还是原来的---
let parse = JSON.parse(data.quickCommand);
for (let i = 0; i < parse.length; i++) {
parse[i].key = (i+1).toString();
}
quickCommandList.value = parse;
//update-end---author:wangshuai---date:2025-04-08---for:【QQYUN-11939】ai应用 快捷指令 修改保存以后,再次打开还是原来的---
}
//赋值
Object.assign(formState, data);
@ -765,14 +828,14 @@
/**
* 提示词回调
*
*
* @param value
*/
function handleAiAppPromptOk(value) {
formState.prompt = value;
}
//============= end 提示词 ================================
//=============== begin 快捷指令 ============================
function quickCommandEnd() {
quickCommand.value = JSON.stringify(quickCommandList.value);
@ -780,7 +843,7 @@
}
/**
* 快捷指令新增呢个==点击事件
* 快捷指令新增点击事件
*/
function quickCommandAddClick(){
if(quickCommandList.value && quickCommandList.value.length > 4){
@ -788,8 +851,8 @@
return;
}
aiAppCommandModalOpen(true,{})
}
}
/**
* 快捷指令编辑点击事件
* @param item
@ -799,18 +862,21 @@
isUpdate: true,
record: item
})
}
}
/**
* 快捷指令添加回调事件
* @param value
*/
function handleAiAppCommandOk(value){
quickCommandList.value.push({ key: quickCommandList.value.length + 1, ...value });
//update-begin---author:wangshuai---date:2025-04-08---for:【QQYUN-11939】ai应用 快捷指令 修改保存以后,再次打开还是原来的---
value.key = (quickCommandList.value.length + 1).toString();
//update-end---author:wangshuai---date:2025-04-08---for:【QQYUN-11939】ai应用 快捷指令 修改保存以后,再次打开还是原来的---
quickCommandList.value.unshift({...value });
quickCommand.value = JSON.stringify(quickCommandList.value);
formState.quickCommand = quickCommand.value;
}
/**
* 快捷指令更新回调事件
* @param value
@ -819,6 +885,8 @@
let findIndex = quickCommandList.value.findIndex(item => item.key === value.key);
if(findIndex>-1){
quickCommandList.value[findIndex] = value;
quickCommand.value = JSON.stringify(quickCommandList.value);
formState.quickCommand = quickCommand.value;
}
}
@ -835,10 +903,23 @@
}
}
//=============== end 快捷指令 ============================
/**
* 复选框相中时的回调
*/
function handleMultiSessionChange(checked){
if(checked){
metadata.value.multiSession = "1";
}else{
metadata.value.multiSession = "0";
}
formState.metadata = JSON.stringify(metadata.value);
}
return {
registerModal,
title,
isRelease,
handleOk,
handleCancel,
appTypeOption,
@ -895,6 +976,8 @@
quickCommand,
getFlowImage,
metadata,
multiSessionChecked,
handleMultiSessionChange,
};
},
};
@ -997,7 +1080,7 @@
align-content: center;
}
.prompt-back{
background-color: rgba(238,244,255,1);
background-color: #eef4ff;
border-radius: 12px;
padding: 2px;
border: 1px solid #77B2F8;
@ -1019,8 +1102,8 @@
border-radius: 12px;
padding: 2px 10px 2px 10px;
box-sizing: border-box;
}
}
.prologue-chunk-edit{
background-color: #f2f4f7;
border-radius: 12px;
@ -1033,7 +1116,7 @@
:deep(.ant-form-item-label){
padding: 0 !important;
}
:deep(.ant-form-item-required){
margin-left: 4px !important;
}
@ -1052,7 +1135,7 @@
}
:deep(.vditor){
border: none;
}
}
:deep(.vditor-sv){
font-size: 14px;
}
@ -1100,7 +1183,7 @@
}
}
.data-empty-text{
color: rgba(32,41,69,0.6);
color: #757c8f;
margin-left: 10px;
}
.flow-icon{
@ -1123,11 +1206,11 @@
white-space: nowrap;
height: 20px;
font-size: 12px;
color: rgba(15, 21, 40,0.82);
color: #3a3f4f;
}
.tag-input{
align-self: center;
color: rgba(55,67,106,0.7);
color: #737c97;
font-size: 12px;
font-style: normal;
font-weight: 500;