mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-27 01:23:55 +08:00
updata:移动端添加语言切换功能
This commit is contained in:
@@ -4,6 +4,7 @@ import { computed, nextTick, onMounted, ref, watch } from 'vue'
|
||||
import { getAgentDetail, getModelOptions, getPluginFunctions, getRoleTemplates, getTTSVoices, updateAgent } from '@/api/agent/agent'
|
||||
import { usePluginStore } from '@/store'
|
||||
import { toast } from '@/utils/toast'
|
||||
import { t } from '@/i18n'
|
||||
|
||||
defineOptions({
|
||||
name: 'AgentEdit',
|
||||
@@ -37,14 +38,15 @@ const formData = ref<Partial<AgentDetail>>({
|
||||
|
||||
// 显示名称数据
|
||||
const displayNames = ref({
|
||||
vad: '请选择',
|
||||
asr: '请选择',
|
||||
llm: '请选择',
|
||||
vllm: '请选择',
|
||||
intent: '请选择',
|
||||
memory: '请选择',
|
||||
tts: '请选择',
|
||||
voiceprint: '请选择',
|
||||
// 显示名称数据
|
||||
vad: t('agent.pleaseSelect'),
|
||||
asr: t('agent.pleaseSelect'),
|
||||
llm: t('agent.pleaseSelect'),
|
||||
vllm: t('agent.pleaseSelect'),
|
||||
intent: t('agent.pleaseSelect'),
|
||||
memory: t('agent.pleaseSelect'),
|
||||
tts: t('agent.pleaseSelect'),
|
||||
voiceprint: t('agent.pleaseSelect'),
|
||||
})
|
||||
|
||||
// 角色模板数据
|
||||
@@ -143,7 +145,7 @@ async function loadAgentDetail() {
|
||||
}
|
||||
catch (error) {
|
||||
console.error('加载智能体详情失败:', error)
|
||||
toast.error('加载失败')
|
||||
toast.error(t('agent.loadFail'))
|
||||
}
|
||||
finally {
|
||||
loading.value = false
|
||||
@@ -358,12 +360,12 @@ function getModelDisplayName(modelType: string, modelId: string) {
|
||||
// 保存智能体
|
||||
async function saveAgent() {
|
||||
if (!formData.value.agentName?.trim()) {
|
||||
toast.warning('请输入助手昵称')
|
||||
toast.warning(t('agent.pleaseInputAgentName'))
|
||||
return
|
||||
}
|
||||
|
||||
if (!formData.value.systemPrompt?.trim()) {
|
||||
toast.warning('请输入角色介绍')
|
||||
toast.warning(t('agent.pleaseInputRoleDescription'))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -371,11 +373,11 @@ async function saveAgent() {
|
||||
saving.value = true
|
||||
await updateAgent(agentId.value, formData.value)
|
||||
|
||||
toast.success('保存成功')
|
||||
toast.success(t('agent.saveSuccess'))
|
||||
}
|
||||
catch (error) {
|
||||
console.error('保存失败:', error)
|
||||
toast.error('保存失败')
|
||||
toast.error(t('agent.saveFail'))
|
||||
}
|
||||
finally {
|
||||
saving.value = false
|
||||
@@ -441,10 +443,10 @@ onMounted(async () => {
|
||||
|
||||
<template>
|
||||
<view class="bg-[#f5f7fb] px-[20rpx]">
|
||||
<!-- 基础信息标题 -->
|
||||
<!--// 基础信息标题
|
||||
<view class="pb-[20rpx] first:pt-[20rpx]">
|
||||
<text class="text-[32rpx] text-[#232338] font-bold">
|
||||
基础信息
|
||||
{{ t('agent.basicInfo') }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
@@ -452,20 +454,20 @@ onMounted(async () => {
|
||||
<view class="mb-[24rpx] border border-[#eeeeee] rounded-[20rpx] bg-[#fbfbfb] p-[24rpx]" style="box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);">
|
||||
<view class="mb-[24rpx] last:mb-0">
|
||||
<text class="mb-[12rpx] block text-[28rpx] text-[#232338] font-medium">
|
||||
助手昵称
|
||||
</text>
|
||||
{{ t('agent.agentName') }}
|
||||
</text>
|
||||
<input
|
||||
v-model="formData.agentName"
|
||||
class="box-border h-[80rpx] w-full border border-[#eeeeee] rounded-[12rpx] bg-[#f5f7fb] p-[16rpx_20rpx] text-[28rpx] text-[#232338] leading-[1.4] outline-none focus:border-[#336cff] focus:bg-white placeholder:text-[#9d9ea3]"
|
||||
type="text"
|
||||
placeholder="请输入助手昵称"
|
||||
:placeholder="t('agent.inputAgentName')"
|
||||
>
|
||||
</view>
|
||||
|
||||
<view class="mb-[24rpx] last:mb-0">
|
||||
<text class="mb-[12rpx] block text-[28rpx] text-[#232338] font-medium">
|
||||
角色模式
|
||||
</text>
|
||||
{{ t('agent.roleMode') }}
|
||||
</text>
|
||||
<view class="mt-0 flex flex-wrap gap-[12rpx]">
|
||||
<view
|
||||
v-for="template in roleTemplates"
|
||||
@@ -483,12 +485,12 @@ onMounted(async () => {
|
||||
|
||||
<view class="mb-[24rpx] last:mb-0">
|
||||
<text class="mb-[12rpx] block text-[28rpx] text-[#232338] font-medium">
|
||||
角色介绍
|
||||
</text>
|
||||
{{ t('agent.roleDescription') }}
|
||||
</text>
|
||||
<textarea
|
||||
v-model="formData.systemPrompt"
|
||||
:maxlength="2000"
|
||||
placeholder="请输入角色介绍"
|
||||
:placeholder="t('agent.inputRoleDescription')"
|
||||
class="box-border h-[500rpx] w-full resize-none break-words break-all border border-[#eeeeee] rounded-[12rpx] bg-[#f5f7fb] p-[20rpx] text-[26rpx] text-[#232338] leading-[1.6] outline-none focus:border-[#336cff] focus:bg-white placeholder:text-[#9d9ea3]"
|
||||
/>
|
||||
<view class="mt-[8rpx] text-right text-[22rpx] text-[#9d9ea3]">
|
||||
@@ -500,7 +502,7 @@ onMounted(async () => {
|
||||
<!-- 模型配置标题 -->
|
||||
<view class="pb-[20rpx]">
|
||||
<text class="text-[32rpx] text-[#232338] font-bold">
|
||||
模型配置
|
||||
{{ t('agent.modelConfig') }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
@@ -509,7 +511,7 @@ onMounted(async () => {
|
||||
<view class="flex flex-col gap-[16rpx]">
|
||||
<view class="flex cursor-pointer items-center justify-between border border-[#eeeeee] rounded-[12rpx] bg-[#f5f7fb] p-[20rpx] transition-all duration-300 active:bg-[#eef3ff]" @click="openPicker('vad')">
|
||||
<text class="text-[28rpx] text-[#232338] font-medium">
|
||||
语音活动检测
|
||||
{{ t('agent.vad') }}
|
||||
</text>
|
||||
<text class="mx-[16rpx] flex-1 text-right text-[26rpx] text-[#65686f]">
|
||||
{{ displayNames.vad }}
|
||||
@@ -519,7 +521,7 @@ onMounted(async () => {
|
||||
|
||||
<view class="flex cursor-pointer items-center justify-between border border-[#eeeeee] rounded-[12rpx] bg-[#f5f7fb] p-[20rpx] transition-all duration-300 active:bg-[#eef3ff]" @click="openPicker('asr')">
|
||||
<text class="text-[28rpx] text-[#232338] font-medium">
|
||||
语音识别
|
||||
{{ t('agent.asr') }}
|
||||
</text>
|
||||
<text class="mx-[16rpx] flex-1 text-right text-[26rpx] text-[#65686f]">
|
||||
{{ displayNames.asr }}
|
||||
@@ -529,7 +531,7 @@ onMounted(async () => {
|
||||
|
||||
<view class="flex cursor-pointer items-center justify-between border border-[#eeeeee] rounded-[12rpx] bg-[#f5f7fb] p-[20rpx] transition-all duration-300 active:bg-[#eef3ff]" @click="openPicker('llm')">
|
||||
<text class="text-[28rpx] text-[#232338] font-medium">
|
||||
大语言模型
|
||||
{{ t('agent.llm') }}
|
||||
</text>
|
||||
<text class="mx-[16rpx] flex-1 text-right text-[26rpx] text-[#65686f]">
|
||||
{{ displayNames.llm }}
|
||||
@@ -539,7 +541,7 @@ onMounted(async () => {
|
||||
|
||||
<view class="flex cursor-pointer items-center justify-between border border-[#eeeeee] rounded-[12rpx] bg-[#f5f7fb] p-[20rpx] transition-all duration-300 active:bg-[#eef3ff]" @click="openPicker('vllm')">
|
||||
<text class="text-[28rpx] text-[#232338] font-medium">
|
||||
视觉大模型
|
||||
{{ t('agent.vllm') }}
|
||||
</text>
|
||||
<text class="mx-[16rpx] flex-1 text-right text-[26rpx] text-[#65686f]">
|
||||
{{ displayNames.vllm }}
|
||||
@@ -549,7 +551,7 @@ onMounted(async () => {
|
||||
|
||||
<view class="flex cursor-pointer items-center justify-between border border-[#eeeeee] rounded-[12rpx] bg-[#f5f7fb] p-[20rpx] transition-all duration-300 active:bg-[#eef3ff]" @click="openPicker('intent')">
|
||||
<text class="text-[28rpx] text-[#232338] font-medium">
|
||||
意图识别
|
||||
{{ t('agent.intent') }}
|
||||
</text>
|
||||
<text class="mx-[16rpx] flex-1 text-right text-[26rpx] text-[#65686f]">
|
||||
{{ displayNames.intent }}
|
||||
@@ -559,7 +561,7 @@ onMounted(async () => {
|
||||
|
||||
<view class="flex cursor-pointer items-center justify-between border border-[#eeeeee] rounded-[12rpx] bg-[#f5f7fb] p-[20rpx] transition-all duration-300 active:bg-[#eef3ff]" @click="openPicker('memory')">
|
||||
<text class="text-[28rpx] text-[#232338] font-medium">
|
||||
记忆
|
||||
{{ t('agent.memory') }}
|
||||
</text>
|
||||
<text class="mx-[16rpx] flex-1 text-right text-[26rpx] text-[#65686f]">
|
||||
{{ displayNames.memory }}
|
||||
@@ -572,7 +574,7 @@ onMounted(async () => {
|
||||
<!-- 语音设置标题 -->
|
||||
<view class="pb-[20rpx]">
|
||||
<text class="text-[32rpx] text-[#232338] font-bold">
|
||||
语音设置
|
||||
{{ t('agent.voiceSettings') }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
@@ -581,7 +583,7 @@ onMounted(async () => {
|
||||
<view class="flex flex-col gap-[16rpx]">
|
||||
<view class="flex cursor-pointer items-center justify-between border border-[#eeeeee] rounded-[12rpx] bg-[#f5f7fb] p-[20rpx] transition-all duration-300 active:bg-[#eef3ff]" @click="openPicker('tts')">
|
||||
<text class="text-[28rpx] text-[#232338] font-medium">
|
||||
语音合成
|
||||
{{ t('agent.tts') }}
|
||||
</text>
|
||||
<text class="mx-[16rpx] flex-1 text-right text-[26rpx] text-[#65686f]">
|
||||
{{ displayNames.tts }}
|
||||
@@ -591,7 +593,7 @@ onMounted(async () => {
|
||||
|
||||
<view class="flex cursor-pointer items-center justify-between border border-[#eeeeee] rounded-[12rpx] bg-[#f5f7fb] p-[20rpx] transition-all duration-300 active:bg-[#eef3ff]" @click="openPicker('voiceprint')">
|
||||
<text class="text-[28rpx] text-[#232338] font-medium">
|
||||
角色音色
|
||||
{{ t('agent.voiceprint') }}
|
||||
</text>
|
||||
<text class="mx-[16rpx] flex-1 text-right text-[26rpx] text-[#65686f]">
|
||||
{{ displayNames.voiceprint }}
|
||||
@@ -601,10 +603,10 @@ onMounted(async () => {
|
||||
|
||||
<view class="flex items-center justify-between border border-[#eeeeee] rounded-[12rpx] bg-[#f5f7fb] p-[20rpx]">
|
||||
<view class="text-[28rpx] text-[#232338] font-medium">
|
||||
插件
|
||||
{{ t('agent.plugins') }}
|
||||
</view>
|
||||
<view class="cursor-pointer rounded-[20rpx] bg-[rgba(51,108,255,0.1)] px-[24rpx] py-[12rpx] text-[24rpx] text-[#336cff] transition-all duration-300 active:bg-[#336cff] active:text-white" @click="handleTools">
|
||||
<text>编辑功能</text>
|
||||
<text>{{ t('agent.editFunctions') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -613,7 +615,7 @@ onMounted(async () => {
|
||||
<!-- 记忆历史标题 -->
|
||||
<view class="pb-[20rpx]">
|
||||
<text class="text-[32rpx] text-[#232338] font-bold">
|
||||
历史记忆
|
||||
{{ t('agent.historyMemory') }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
@@ -622,7 +624,7 @@ onMounted(async () => {
|
||||
<view class="mb-[24rpx] last:mb-0">
|
||||
<textarea
|
||||
v-model="formData.summaryMemory"
|
||||
placeholder="记忆内容"
|
||||
:placeholder="t('agent.memoryContent')"
|
||||
disabled
|
||||
class="box-border h-[500rpx] w-full resize-none break-words break-all border border-[#eeeeee] rounded-[12rpx] bg-[#f0f0f0] p-[20rpx] text-[26rpx] text-[#65686f] leading-[1.6] opacity-80 outline-none"
|
||||
/>
|
||||
@@ -638,7 +640,7 @@ onMounted(async () => {
|
||||
custom-class="w-full h-[80rpx] rounded-[16rpx] text-[30rpx] font-semibold bg-[#336cff] active:bg-[#2d5bd1]"
|
||||
@click="saveAgent"
|
||||
>
|
||||
{{ saving ? '保存中...' : '保存' }}
|
||||
{{ saving ? t('agent.saving') : t('agent.save') }}
|
||||
</wd-button>
|
||||
</view>
|
||||
<!-- 模型选择器 -->
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { t } from '@/i18n'
|
||||
import CustomTabs from '@/components/custom-tabs/index.vue'
|
||||
import ChatHistory from '@/pages/chat-history/index.vue'
|
||||
import DeviceManagement from '@/pages/device/index.vue'
|
||||
@@ -42,7 +43,6 @@ systemInfo = uni.getSystemInfoSync()
|
||||
safeAreaInsets = systemInfo.safeAreaInsets
|
||||
// #endif
|
||||
|
||||
|
||||
// 智能体ID
|
||||
const currentAgentId = ref('default')
|
||||
|
||||
@@ -65,25 +65,25 @@ const voiceprintRef = ref()
|
||||
// Tab 配置
|
||||
const tabList = [
|
||||
{
|
||||
label: '角色配置',
|
||||
label: t('agent.roleConfig'),
|
||||
value: 'agent-config',
|
||||
icon: '/static/tabbar/robot.png',
|
||||
activeIcon: '/static/tabbar/robot_activate.png',
|
||||
},
|
||||
{
|
||||
label: '设备管理',
|
||||
label: t('agent.deviceManagement'),
|
||||
value: 'device-management',
|
||||
icon: '/static/tabbar/device.png',
|
||||
activeIcon: '/static/tabbar/device_activate.png',
|
||||
},
|
||||
{
|
||||
label: '聊天记录',
|
||||
label: t('agent.chatHistory'),
|
||||
value: 'chat-history',
|
||||
icon: '/static/tabbar/chat.png',
|
||||
activeIcon: '/static/tabbar/chat_activate.png',
|
||||
},
|
||||
{
|
||||
label: '声纹管理',
|
||||
label: t('agent.voiceprintManagement'),
|
||||
value: 'voiceprint-management',
|
||||
icon: '/static/tabbar/microphone.png',
|
||||
activeIcon: '/static/tabbar/microphone_activate.png',
|
||||
@@ -160,7 +160,7 @@ onMounted(async () => {
|
||||
<template>
|
||||
<view class="h-screen flex flex-col bg-[#f5f7fb]">
|
||||
<!-- 导航栏 -->
|
||||
<wd-navbar title="智能体" safe-area-inset-top>
|
||||
<wd-navbar :title="t('agent.pageTitle')" safe-area-inset-top>
|
||||
<template #left>
|
||||
<wd-icon name="arrow-left" size="18" @click="goBack" />
|
||||
</template>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
"layout": "default",
|
||||
"style": {
|
||||
"navigationBarTitleText": "编辑功能",
|
||||
"navigationStyle": "custom",
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
</route>
|
||||
|
||||
@@ -12,12 +12,13 @@
|
||||
import { useMessage } from 'wot-design-uni'
|
||||
import { getMcpAddress, getMcpTools } from '@/api/agent/agent'
|
||||
import { usePluginStore } from '@/store'
|
||||
import { t } from '@/i18n'
|
||||
|
||||
const message = useMessage()
|
||||
const pluginStore = usePluginStore()
|
||||
|
||||
const segmentedList = ref<string[]>(['未选', '已选'])
|
||||
const currentSegmented = ref('未选')
|
||||
const segmentedList = ref<string[]>([t('agent.tools.notSelected'), t('agent.tools.selected')])
|
||||
const currentSegmented = ref(t('agent.tools.notSelected'))
|
||||
const notSelectedList = ref<any[]>([])
|
||||
const selectedList = ref<any[]>([])
|
||||
|
||||
@@ -191,7 +192,7 @@ function handleJsonChange(key: string, value: string, field: any) {
|
||||
}
|
||||
}
|
||||
catch {
|
||||
message.alert('JSON格式错误')
|
||||
message.alert(t('agent.tools.jsonFormatError'))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +221,7 @@ function goBack() {
|
||||
// 复制MCP地址
|
||||
function copyMcpAddress() {
|
||||
if (!mcpAddress.value) {
|
||||
message.alert('暂无MCP地址可复制')
|
||||
message.alert(t('agent.tools.noMcpAddressToCopy'))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -228,11 +229,11 @@ function copyMcpAddress() {
|
||||
data: mcpAddress.value,
|
||||
showToast: false,
|
||||
success: () => {
|
||||
message.alert('MCP地址已复制到剪贴板')
|
||||
},
|
||||
message.alert(t('agent.tools.mcpAddressCopied'))
|
||||
},
|
||||
fail: () => {
|
||||
message.alert('复制失败,请重试')
|
||||
},
|
||||
message.alert(t('agent.tools.copyFailed'))
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -248,7 +249,7 @@ function getFieldDisplayValue(field: any, value: any) {
|
||||
function getFieldRemark(field: any) {
|
||||
let description = field.label || ''
|
||||
if (field.default) {
|
||||
description += `(默认值:${field.default})`
|
||||
description += `(${t('agent.tools.defaultValue')}:${field.default})`
|
||||
}
|
||||
return description
|
||||
}
|
||||
@@ -284,7 +285,7 @@ onMounted(async () => {
|
||||
<!-- 内置插件区域 -->
|
||||
<view class="mt-[20rpx] flex flex-1 flex-col">
|
||||
<view class="text-[32rpx] text-[#333] font-medium">
|
||||
内置插件
|
||||
{{ t('agent.tools.builtInPlugins') }}
|
||||
</view>
|
||||
<view
|
||||
class="mt-[20rpx] box-border flex flex-1 flex-col rounded-[10rpx] bg-white p-[20rpx]"
|
||||
@@ -299,7 +300,7 @@ onMounted(async () => {
|
||||
<view class="mt-[20rpx] flex-1 overflow-hidden">
|
||||
<!-- 未选插件 -->
|
||||
<scroll-view
|
||||
v-if="currentSegmented === '未选'"
|
||||
v-if="currentSegmented === t('agent.tools.notSelected')"
|
||||
class="max-h-[600rpx] bg-transparent"
|
||||
scroll-y
|
||||
>
|
||||
@@ -307,7 +308,7 @@ onMounted(async () => {
|
||||
v-if="notSelectedList.length === 0"
|
||||
class="h-[400rpx] flex items-center justify-center"
|
||||
>
|
||||
<wd-status-tip image="content" tip="暂无更多插件" />
|
||||
<wd-status-tip image="content" tip="{{ t('agent.tools.noMorePlugins') }}" />
|
||||
</view>
|
||||
<view v-else class="p-[20rpx] space-y-[20rpx]">
|
||||
<view
|
||||
@@ -343,7 +344,7 @@ onMounted(async () => {
|
||||
v-if="selectedList.length === 0"
|
||||
class="h-[400rpx] flex items-center justify-center"
|
||||
>
|
||||
<wd-status-tip image="content" tip="请选择插件功能" />
|
||||
<wd-status-tip image="content" tip="{{ t('agent.tools.pleaseSelectPlugin') }}" />
|
||||
</view>
|
||||
<view v-else class="p-[20rpx] space-y-[20rpx]">
|
||||
<view
|
||||
@@ -359,7 +360,7 @@ onMounted(async () => {
|
||||
{{ func.name }}
|
||||
</view>
|
||||
<view class="text-[24rpx] text-[#1677ff]">
|
||||
点击配置参数
|
||||
{{ t('agent.tools.clickToConfigure') }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex space-x-[20rpx]">
|
||||
@@ -393,7 +394,7 @@ onMounted(async () => {
|
||||
<!-- MCP接入点区域 -->
|
||||
<view class="mt-[20rpx] flex flex-1 flex-col">
|
||||
<view class="text-[32rpx] text-[#333] font-medium">
|
||||
mcp接入点
|
||||
{{ t('agent.tools.mcpEndpoint') }}
|
||||
</view>
|
||||
<view
|
||||
class="mt-[20rpx] box-border flex flex-1 flex-col rounded-[10rpx] bg-white p-[20rpx]"
|
||||
@@ -406,11 +407,11 @@ onMounted(async () => {
|
||||
class="flex-1 rounded-[10rpx] bg-[#f5f7fb] p-[20rpx]"
|
||||
>
|
||||
<view
|
||||
class="ml-[20rpx] h-[70rpx] flex items-center justify-center rounded-[10rpx] bg-[#1677ff] px-[20rpx] text-[24rpx] text-white"
|
||||
@click="copyMcpAddress"
|
||||
>
|
||||
复制
|
||||
</view>
|
||||
class="ml-[20rpx] h-[70rpx] flex items-center justify-center rounded-[10rpx] bg-[#1677ff] px-[20rpx] text-[24rpx] text-white"
|
||||
@click="copyMcpAddress"
|
||||
>
|
||||
{{ t('agent.tools.copy') }}
|
||||
</view>
|
||||
</view>
|
||||
<!-- 工具列表 -->
|
||||
<view class="mt-[20rpx] flex-1 overflow-hidden">
|
||||
@@ -419,7 +420,7 @@ onMounted(async () => {
|
||||
v-if="mcpTools && mcpTools.length === 0"
|
||||
class="h-[400rpx] flex items-center justify-center"
|
||||
>
|
||||
<wd-status-tip image="content" tip="暂无工具" />
|
||||
<wd-status-tip image="content" :tip="t('agent.tools.noTools')" />
|
||||
</view>
|
||||
<view v-else class="p-[20rpx]">
|
||||
<view class="flex flex-wrap">
|
||||
@@ -441,7 +442,7 @@ onMounted(async () => {
|
||||
<!-- 参数编辑弹窗 -->
|
||||
<wd-action-sheet
|
||||
v-model="showParamDialog"
|
||||
:title="`参数配置 - ${currentFunction?.name || ''}`"
|
||||
:title="`${t('agent.tools.paramConfiguration')} - ${currentFunction?.name || ''}`"
|
||||
custom-header-class="h-[75vh]"
|
||||
@close="closeParamEdit"
|
||||
>
|
||||
@@ -460,7 +461,7 @@ onMounted(async () => {
|
||||
class="h-[400rpx] flex items-center justify-center"
|
||||
>
|
||||
<text class="text-[28rpx] text-[#999]">
|
||||
{{ currentFunction?.name }} 无需配置参数
|
||||
{{ currentFunction?.name }} {{ t('agent.tools.noParamsNeeded') }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
@@ -490,7 +491,7 @@ onMounted(async () => {
|
||||
v-model="tempParams[field.key]"
|
||||
class="box-border h-[80rpx] w-full border border-[#eeeeee] rounded-[12rpx] bg-[#f5f7fb] p-[16rpx_20rpx] text-[28rpx] text-[#232338] focus:border-[#336cff] focus:bg-white placeholder:text-[#9d9ea3]"
|
||||
type="text"
|
||||
:placeholder="`请输入${field.label}`"
|
||||
:placeholder="`${t('agent.tools.pleaseInput')}${field.label}`"
|
||||
@input="
|
||||
handleParamChange(field.key, $event.detail.value, field)
|
||||
"
|
||||
@@ -499,12 +500,12 @@ onMounted(async () => {
|
||||
<!-- 数组类型 -->
|
||||
<view v-else-if="field.type === 'array'">
|
||||
<text class="mb-[16rpx] block text-[24rpx] text-[#65686f]">
|
||||
每行输入一个项目
|
||||
{{ t('agent.tools.eachLineOneItem') }}
|
||||
</text>
|
||||
<textarea
|
||||
v-model="arrayTextCache[field.key]"
|
||||
class="box-border min-h-[200rpx] w-full border border-[#eeeeee] rounded-[12rpx] bg-[#f5f7fb] p-[20rpx] text-[26rpx] text-[#232338] leading-[1.6] focus:border-[#336cff] focus:bg-white placeholder:text-[#9d9ea3]"
|
||||
:placeholder="`请输入${field.label},每行一个`"
|
||||
:placeholder="`${t('agent.tools.pleaseInput')}${field.label},${t('agent.tools.eachLineOneItem')}`"
|
||||
@input="
|
||||
handleArrayChange(field.key, $event.detail.value, field)
|
||||
"
|
||||
@@ -514,12 +515,12 @@ onMounted(async () => {
|
||||
<!-- JSON类型 -->
|
||||
<view v-else-if="field.type === 'json'">
|
||||
<text class="mb-[16rpx] block text-[24rpx] text-[#65686f]">
|
||||
请输入有效的JSON格式
|
||||
{{ t('agent.tools.pleaseInputValidJson') }}
|
||||
</text>
|
||||
<textarea
|
||||
v-model="jsonTextCache[field.key]"
|
||||
class="box-border min-h-[300rpx] w-full border border-[#eeeeee] rounded-[12rpx] bg-[#f5f7fb] p-[20rpx] text-[26rpx] text-[#232338] leading-[1.6] font-mono focus:border-[#336cff] focus:bg-white placeholder:text-[#9d9ea3]"
|
||||
placeholder="请输入合法的JSON格式"
|
||||
:placeholder="t('agent.tools.pleaseInputValidJson')"
|
||||
@blur="
|
||||
handleJsonChange(field.key, $event.detail.value, field)
|
||||
"
|
||||
@@ -532,7 +533,7 @@ onMounted(async () => {
|
||||
v-model="tempParams[field.key]"
|
||||
class="box-border h-[80rpx] w-full border border-[#eeeeee] rounded-[12rpx] bg-[#f5f7fb] p-[16rpx_20rpx] text-[28rpx] text-[#232338] focus:border-[#336cff] focus:bg-white placeholder:text-[#9d9ea3]"
|
||||
type="number"
|
||||
:placeholder="`请输入${field.label}`"
|
||||
:placeholder="`${t('agent.tools.pleaseInput')}${field.label}`"
|
||||
@input="
|
||||
handleParamChange(
|
||||
field.key,
|
||||
@@ -549,10 +550,10 @@ onMounted(async () => {
|
||||
>
|
||||
<view class="flex-1">
|
||||
<text class="mb-[8rpx] block text-[28rpx] text-[#232338]">
|
||||
启用功能
|
||||
{{ t('agent.tools.enableFunction') }}
|
||||
</text>
|
||||
<text class="block text-[24rpx] text-[#65686f]">
|
||||
开启或关闭此功能
|
||||
{{ t('agent.tools.toggleFunction') }}
|
||||
</text>
|
||||
</view>
|
||||
<switch
|
||||
@@ -569,7 +570,7 @@ onMounted(async () => {
|
||||
v-model="tempParams[field.key]"
|
||||
class="box-border h-[80rpx] w-full border border-[#eeeeee] rounded-[12rpx] bg-[#f5f7fb] p-[16rpx_20rpx] text-[28rpx] text-[#232338] focus:border-[#336cff] focus:bg-white placeholder:text-[#9d9ea3]"
|
||||
type="text"
|
||||
:placeholder="`请输入${field.label}`"
|
||||
:placeholder="`${t('agent.tools.pleaseInput')}${field.label}`"
|
||||
@input="
|
||||
handleParamChange(field.key, $event.detail.value, field)
|
||||
"
|
||||
|
||||
Reference in New Issue
Block a user