对话流实现 文件上传
This commit is contained in:
@@ -55,6 +55,21 @@
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="联网功能">
|
||||
<div class="internet-switch-container">
|
||||
<el-switch
|
||||
v-model="internetEnabled"
|
||||
active-text="启用联网"
|
||||
inactive-text="关闭联网"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
/>
|
||||
<div class="internet-description">
|
||||
启用后,AI助手可以访问互联网获取实时信息
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
@@ -90,11 +105,20 @@ const configForm = ref<AiAgentConfig>({
|
||||
name: '',
|
||||
avatar: '',
|
||||
systemPrompt: '',
|
||||
connectInternet: 0,
|
||||
modelName: '',
|
||||
modelProvider: 'dify',
|
||||
status: 1
|
||||
});
|
||||
|
||||
// 联网开关(用于双向绑定)
|
||||
const internetEnabled = computed({
|
||||
get: () => configForm.value.connectInternet || 0,
|
||||
set: (val) => {
|
||||
configForm.value.connectInternet = val;
|
||||
}
|
||||
});
|
||||
|
||||
// 状态
|
||||
const saving = ref(false);
|
||||
const loading = ref(false);
|
||||
@@ -119,9 +143,9 @@ async function loadConfig() {
|
||||
loading.value = true;
|
||||
// 获取启用的智能体列表
|
||||
const result = await aiAgentConfigApi.listEnabledAgents();
|
||||
if (result.success && result.data && result.data.length > 0) {
|
||||
if (result.success && result.dataList && result.dataList.length > 0) {
|
||||
// 使用第一个启用的智能体
|
||||
Object.assign(configForm.value, result.data[0]);
|
||||
Object.assign(configForm.value, result.dataList[0]);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载配置失败:', error);
|
||||
@@ -391,12 +415,33 @@ async function handleReset() {
|
||||
}
|
||||
}
|
||||
|
||||
.internet-switch-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
|
||||
.internet-description {
|
||||
font-size: 13px;
|
||||
color: #6B7240;
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-switch) {
|
||||
--el-switch-on-color: #E7000B;
|
||||
|
||||
.el-switch__label {
|
||||
font-size: 14px;
|
||||
color: #0A0A0A;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
&.is-checked .el-switch__label--left {
|
||||
color: #6B7240;
|
||||
}
|
||||
|
||||
&:not(.is-checked) .el-switch__label--right {
|
||||
color: #6B7240;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user