|
|
@@ -26,16 +26,25 @@
|
|
|
<a-form-item field="name" label="智能体名称">
|
|
|
<a-input v-model="form.name" placeholder="请输入名称" />
|
|
|
</a-form-item>
|
|
|
- <a-form-item label="智能体图标">
|
|
|
+ <a-form-item label="智能体图标" required>
|
|
|
<a-space direction="vertical" :style="{ width: '100%' }">
|
|
|
- <Upload
|
|
|
+ <!-- <Upload
|
|
|
v-if="avatarShow"
|
|
|
:action="uploadAction"
|
|
|
:limit="1"
|
|
|
:url="form.icon ? httpUrl + form.icon : ''"
|
|
|
@update:fileList="updateFileList"
|
|
|
@success="handleSuccess"
|
|
|
- ></Upload>
|
|
|
+ ></Upload> -->
|
|
|
+ <div class="upload-empty" v-if="!props.target_icon.length" @click="handleUploadIcon">
|
|
|
+ <icon-plus class="icon"></icon-plus>
|
|
|
+ </div>
|
|
|
+ <img
|
|
|
+ class="upload-img"
|
|
|
+ v-else
|
|
|
+ :src="getIconIntelligent(props.target_icon)"
|
|
|
+ @click="handleUploadIcon"
|
|
|
+ />
|
|
|
</a-space>
|
|
|
</a-form-item>
|
|
|
<a-form-item label="空回复">
|
|
|
@@ -263,18 +272,26 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { onMounted, onBeforeMount, reactive, ref, nextTick, onUnmounted, onBeforeUnmount, computed } from 'vue';
|
|
|
+import { onMounted, reactive, ref, nextTick, onUnmounted, computed, onActivated } from 'vue';
|
|
|
+import { Message } from '@arco-design/web-vue';
|
|
|
+import { getIconIntelligent } from '../../common/icon-map.js';
|
|
|
import { queryKbList, queryModelList, createRgFlow } from '../../../apis/rgflow-dify';
|
|
|
import { createDialog } from '../../../apis/intelligent';
|
|
|
import { getKnowledgeList } from '../../../apis/knowledge';
|
|
|
-import { dialogType } from '../../../views/manage/common';
|
|
|
+import { dialogType } from '../../../views/manage/common.js';
|
|
|
import useLoading from './loading';
|
|
|
import Upload from './Upload.vue';
|
|
|
-import { Message } from '@arco-design/web-vue';
|
|
|
+
|
|
|
// import { dialogSet } from '@/api/Agent';
|
|
|
|
|
|
-const props = defineProps(['show_rg_config', 'typeAngint', 'formData']);
|
|
|
-const emit = defineEmits(['queryList', 'update:show_rg_config', 'updateIntelligentList']);
|
|
|
+const props = defineProps(['show_rg_config', 'typeAngint', 'formData', 'target_icon']);
|
|
|
+const emit = defineEmits([
|
|
|
+ 'queryList',
|
|
|
+ 'update:show_rg_config',
|
|
|
+ 'updateIntelligentList',
|
|
|
+ 'show_select_icon',
|
|
|
+ 'clearSelectIcon'
|
|
|
+]);
|
|
|
|
|
|
const { loading, setLoading } = useLoading(true);
|
|
|
const visible = computed(() => props.show_rg_config);
|
|
|
@@ -360,7 +377,7 @@ const imageUrls = ref([]);
|
|
|
|
|
|
const updateFileList = (newFileList) => {
|
|
|
fileList.value = newFileList;
|
|
|
- console.log(newFileList, 88);
|
|
|
+ // console.log(newFileList, 88);
|
|
|
};
|
|
|
|
|
|
const handleSuccess = (urls) => {
|
|
|
@@ -395,8 +412,12 @@ const rules = {
|
|
|
]
|
|
|
};
|
|
|
|
|
|
+const handleUploadIcon = () => {
|
|
|
+ emit('show_select_icon');
|
|
|
+};
|
|
|
+
|
|
|
const handleSubmit = ({ values, errors }) => {
|
|
|
- console.log('values:', values, '\nerrors:', errors);
|
|
|
+ // console.log('values:', values, '\nerrors:', errors);
|
|
|
if (!errors) {
|
|
|
}
|
|
|
};
|
|
|
@@ -408,6 +429,7 @@ const handleCancel = () => {
|
|
|
form.name = '';
|
|
|
emit('update:show_rg_config', false);
|
|
|
emit('queryList');
|
|
|
+ emit('clearSelectIcon');
|
|
|
};
|
|
|
|
|
|
const handleOpened = (el) => {
|
|
|
@@ -437,7 +459,6 @@ const handleOpened = (el) => {
|
|
|
});
|
|
|
};
|
|
|
const createOwnDialog = async (data, title) => {
|
|
|
- console.log(data, 'data');
|
|
|
const res = await createDialog(data);
|
|
|
if (res.code == 200) {
|
|
|
Message.success(title);
|
|
|
@@ -455,9 +476,6 @@ const handleBeforeOk = async (done) => {
|
|
|
formRef2.value.validate().then((res) => {
|
|
|
// console.log('res:', res)
|
|
|
});
|
|
|
- // TODO: 先写死知识库和模型
|
|
|
- // form.kb_ids = ['5e96cc5aad3111ef93990242ac130006'];
|
|
|
- form.llm_id = 'qwen-2.5-72b-instruct___OpenAI-API@OpenAI-API-Compatible';
|
|
|
if (form.name && form.kb_ids.length > 0 && form.prompt_config.system && form.llm_id) {
|
|
|
let title = '创建成功';
|
|
|
let formNew = { ...form };
|
|
|
@@ -496,8 +514,8 @@ const handleBeforeOk = async (done) => {
|
|
|
id: res.data.id,
|
|
|
name: form.name,
|
|
|
description: '',
|
|
|
- icon: form.icon,
|
|
|
- dialogType: dialogType.RAGFLOW_TYPE,
|
|
|
+ icon: props.target_icon,
|
|
|
+ dialogType: dialogType.RAGFLOW,
|
|
|
mode: 'ragflow'
|
|
|
};
|
|
|
// TODO: 调用自己系统的新增
|
|
|
@@ -533,7 +551,7 @@ const editClick = (data) => {
|
|
|
max_tokens.value = true;
|
|
|
}
|
|
|
Object.assign(form, props.formData);
|
|
|
- console.log(form, '表单数据');
|
|
|
+ // console.log(form, '表单数据');
|
|
|
});
|
|
|
};
|
|
|
|
|
|
@@ -567,7 +585,10 @@ const queryModel = async () => {
|
|
|
for (const key in data.data) {
|
|
|
if (Object.hasOwnProperty.call(data.data, key)) {
|
|
|
const element = data.data[key];
|
|
|
- arrObj[key] = element.filter((item) => item.available === true && item.model_type === 'chat');
|
|
|
+ // console.log(element, 'element');
|
|
|
+ // arrObj[key] = element.filter((item) => item.available === true && item.model_type === 'chat');
|
|
|
+ // 先注释掉model_type过滤 加上暂无可用数据
|
|
|
+ arrObj[key] = element.filter((item) => item.available === true);
|
|
|
}
|
|
|
}
|
|
|
modelList.value = arrObj;
|
|
|
@@ -603,20 +624,32 @@ const knowledgeData = async () => {
|
|
|
setLoading(false);
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
-onBeforeMount(() => {
|
|
|
+onMounted(() => {
|
|
|
queryModel();
|
|
|
knowledgeData();
|
|
|
});
|
|
|
-onMounted(() => {});
|
|
|
-
|
|
|
-onBeforeUnmount(() => {});
|
|
|
|
|
|
defineExpose({
|
|
|
editClick
|
|
|
});
|
|
|
</script>
|
|
|
<style scoped>
|
|
|
+.upload-empty {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ width: 44px;
|
|
|
+ height: 44px;
|
|
|
+ border-radius: 5px;
|
|
|
+ border: 1px dashed var(--color-neutral-6);
|
|
|
+ cursor: pointer;
|
|
|
+ .icon {
|
|
|
+ color: var(--color-neutral-6);
|
|
|
+ }
|
|
|
+}
|
|
|
+.upload-img {
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
:deep .arco-tabs-nav-tab-list {
|
|
|
width: 100%;
|
|
|
|