|
|
@@ -32,8 +32,13 @@
|
|
|
@clearSelectIcon="clearSelectIcon"
|
|
|
>
|
|
|
</ModelAddItem>
|
|
|
- <ModelSelectIcon v-model:show_select_icon="show_select_icon" @sendIcon="sendIcon"></ModelSelectIcon>
|
|
|
- <!-- v-if="show_rg_config" -->
|
|
|
+ <ModelSelectIcon
|
|
|
+ v-model:show_select_icon="show_select_icon"
|
|
|
+ :target_icon="target_icon"
|
|
|
+ @sendIcon="sendIcon"
|
|
|
+ @clearTargetIcon="clearTargetIcon"
|
|
|
+ ></ModelSelectIcon
|
|
|
+ >>
|
|
|
<AgentConfig
|
|
|
v-model:show_rg_config="show_rg_config"
|
|
|
ref="editAgentKuai"
|
|
|
@@ -47,15 +52,17 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, reactive } from 'vue';
|
|
|
+import { ref, reactive, onUnmounted } from 'vue';
|
|
|
import { useRouter } from 'vue-router';
|
|
|
+import { Message } from '@arco-design/web-vue';
|
|
|
import ModalAddIntel from './ModalAddIntel.vue';
|
|
|
import ModelAddItem from './ModelAddItem.vue';
|
|
|
import ModelSelectIcon from './ModalSelectIcon.vue';
|
|
|
import AgentConfig from './rgflow/agentConfig.vue';
|
|
|
import { funcDebounce } from '../../utils/utils';
|
|
|
import { getRagFlowData } from '../../apis/rgflow-dify';
|
|
|
-import { bus_intelligentSearch, bus_intelligentEdit } from '../../base/event-bus';
|
|
|
+import { updateOwnIntelligentIcon } from '../../apis/intelligent';
|
|
|
+import { bus_intelligentSearch, bus_intelligentEdit, bus_intelligentIconEdit } from '../../base/event-bus';
|
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
@@ -71,6 +78,7 @@ const show_rg_config = ref(false);
|
|
|
const editAgentKuai = ref(null);
|
|
|
let add_type = ref('add');
|
|
|
let itemObj = reactive({});
|
|
|
+const edit_icon_data = ref(null);
|
|
|
|
|
|
// 搜索
|
|
|
const handleSearch = funcDebounce(
|
|
|
@@ -87,6 +95,7 @@ const handleCreate = () => {
|
|
|
// 创建rgflow智能体
|
|
|
const createRAGFLOWIntelligent = () => {
|
|
|
show_rg_config.value = true;
|
|
|
+ add_type.value = 'add';
|
|
|
};
|
|
|
const addIntelligent = (data) => {
|
|
|
//根据智能体类型,打开不同的配置面板data.type
|
|
|
@@ -97,8 +106,26 @@ const selectIcon = () => {
|
|
|
show_select_icon.value = true;
|
|
|
};
|
|
|
const sendIcon = (icon) => {
|
|
|
- console.log('sendIcon', icon);
|
|
|
target_icon.value = icon;
|
|
|
+ if (!edit_icon_data.value) return;
|
|
|
+ // 编辑
|
|
|
+ updateOwnIntelligentIcon(edit_icon_data.value.id, target_icon.value)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ Message.success('修改成功');
|
|
|
+ } else {
|
|
|
+ Message.error('修改失败');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ Message.error('修改失败');
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ target_icon.value = '';
|
|
|
+ // 更新知识库列表
|
|
|
+ bus_intelligentSearch.emit(searchText.value);
|
|
|
+ edit_icon_data.value = null;
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
const updateIntelligentList = () => {
|
|
|
@@ -140,12 +167,11 @@ bus_intelligentEdit.on((item) => {
|
|
|
// TODO: 编辑rgflow智能体
|
|
|
// itemObj = item;
|
|
|
show_rg_config.value = true;
|
|
|
- add_type = 'edit';
|
|
|
+ add_type.value = 'edit';
|
|
|
getRagFlowDataFunc(item);
|
|
|
|
|
|
break;
|
|
|
case '4':
|
|
|
- console.log(item);
|
|
|
// TODO: 进入Dify智能体配置
|
|
|
router.push({ path: '/intelligent/detail', query: { id: item.id, name: item.name, mode: item.mode } });
|
|
|
break;
|
|
|
@@ -153,6 +179,15 @@ bus_intelligentEdit.on((item) => {
|
|
|
console.log('暂不支持该智能体类型');
|
|
|
}
|
|
|
});
|
|
|
+bus_intelligentIconEdit.on((item) => {
|
|
|
+ show_select_icon.value = true;
|
|
|
+ edit_icon_data.value = item;
|
|
|
+ target_icon.value = item.icon;
|
|
|
+});
|
|
|
+onUnmounted(() => {
|
|
|
+ bus_intelligentEdit.off();
|
|
|
+ bus_intelligentIconEdit.off();
|
|
|
+});
|
|
|
</script>
|
|
|
<style scoped lang="css">
|
|
|
.arco-input-wrapper {
|