diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index e54cdd4e..aefa77d0 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -31,6 +31,9 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + with: + driver-opts: | + network=host - name: Login to GitHub Container Registry uses: docker/login-action@v3 @@ -60,6 +63,10 @@ jobs: tags: | ${{ env.IS_VERSION == 'true' && format('ghcr.io/{0}:server_{1},ghcr.io/{0}:server_latest', github.repository, env.VERSION) || format('ghcr.io/{0}:server_latest', github.repository) }} platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: | + BUILDKIT_PROGRESS=plain # 构建 manager-api 镜像 - name: Build and push manager-web @@ -70,4 +77,8 @@ jobs: push: true tags: | ${{ env.IS_VERSION == 'true' && format('ghcr.io/{0}:web_{1},ghcr.io/{0}:web_latest', github.repository, env.VERSION) || format('ghcr.io/{0}:web_latest', github.repository) }} - platforms: linux/amd64,linux/arm64 \ No newline at end of file + platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: | + BUILDKIT_PROGRESS=plain \ No newline at end of file diff --git a/Dockerfile-server b/Dockerfile-server index 6e87f7c0..a12fbb11 100644 --- a/Dockerfile-server +++ b/Dockerfile-server @@ -3,10 +3,17 @@ FROM python:3.10-slim AS builder WORKDIR /app +# 配置pip使用国内镜像源(阿里云)并设置超时和重试 +RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ && \ + pip config set global.trusted-host mirrors.aliyun.com && \ + pip config set global.timeout 120 && \ + pip config set install.retries 5 + COPY main/xiaozhi-server/requirements.txt . -# 安装Python依赖 -RUN pip install --no-cache-dir -r requirements.txt +# 安装Python依赖,使用并行下载 +RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \ + pip install --no-cache-dir -r requirements.txt --default-timeout=120 --retries 5 # 第二阶段:生产镜像 FROM python:3.10-slim diff --git a/Dockerfile-web b/Dockerfile-web index 35c25ed2..a347a88e 100644 --- a/Dockerfile-web +++ b/Dockerfile-web @@ -18,12 +18,12 @@ FROM bellsoft/liberica-runtime-container:jre-21-glibc # 安装Nginx和字体库 RUN apk update && \ - apk add --no-cache nginx bash && \ - apk add --no-cache fontconfig ttf-dejavu msttcorefonts-installer && \ + apk add --no-cache nginx bash fontconfig ttf-dejavu && \ + apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ msttcorefonts-installer || true && \ rm -rf /var/cache/apk/* # 更新字体缓存 -RUN printf 'YES\n' | update-ms-fonts && fc-cache -f -v +RUN (printf 'YES\n' | update-ms-fonts || true) && fc-cache -f -v # 配置Nginx COPY docs/docker/nginx.conf /etc/nginx/nginx.conf diff --git a/README.md b/README.md index b9145d1b..862e989a 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,9 @@

-By Professor Siyuan Liu Research and Development Group ( South China University of Technology) +Spearheaded by Professor Siyuan Liu's Team (South China University of Technology)
-刘思源教授团队研发(华南理工大学) +刘思源教授团队主导研发(华南理工大学)
华南理工大学

@@ -94,7 +94,7 @@ By Professor Siyuan Liu Research and Development Group ( South China University - + 自定义音色 @@ -197,6 +197,7 @@ By Professor Siyuan Liu Research and Development Group ( South China University ``` 智控台地址: https://2662r3426b.vicp.fun +智控台(h5版): https://2662r3426b.vicp.fun/h5/index.html 服务测试工具: https://2662r3426b.vicp.fun/test/ OTA接口地址: https://2662r3426b.vicp.fun/xiaozhi/ota/ @@ -282,6 +283,8 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/ | dify 接口调用 | Dify | - | | fastgpt 接口调用 | Fastgpt | - | | coze 接口调用 | Coze | - | +| xinference 接口调用 | Xinference | - | +| homeassistant 接口调用 | HomeAssistant | - | 实际上,任何支持 openai 接口调用的 LLM 均可接入使用。 @@ -301,8 +304,8 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/ | 使用方式 | 支持平台 | 免费平台 | |:---:|:---:|:---:| -| 接口调用 | EdgeTTS、火山引擎豆包TTS、腾讯云、阿里云TTS、CosyVoiceSiliconflow、TTS302AI、CozeCnTTS、GizwitsTTS、ACGNTTS、OpenAITTS、灵犀流式TTS | 灵犀流式TTS、EdgeTTS、CosyVoiceSiliconflow(部分) | -| 本地服务 | FishSpeech、GPT_SOVITS_V2、GPT_SOVITS_V3、MinimaxTTS | FishSpeech、GPT_SOVITS_V2、GPT_SOVITS_V3、MinimaxTTS | +| 接口调用 | EdgeTTS、火山引擎豆包TTS、腾讯云、阿里云TTS、阿里云流式TTS、CosyVoiceSiliconflow、TTS302AI、CozeCnTTS、GizwitsTTS、ACGNTTS、OpenAITTS、灵犀流式TTS、MinimaxTTS、火山双流式TTS | 灵犀流式TTS、EdgeTTS、CosyVoiceSiliconflow(部分) | +| 本地服务 | FishSpeech、GPT_SOVITS_V2、GPT_SOVITS_V3、Index-TTS、PaddleSpeech | Index-TTS、PaddleSpeech、FishSpeech、GPT_SOVITS_V2、GPT_SOVITS_V3 | --- @@ -319,7 +322,7 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/ | 使用方式 | 支持平台 | 免费平台 | |:---:|:---:|:---:| | 本地使用 | FunASR、SherpaASR | FunASR、SherpaASR | -| 接口调用 | DoubaoASR、FunASRServer、TencentASR、AliyunASR | FunASRServer | +| 接口调用 | DoubaoASR、Doubao流式ASR、FunASRServer、TencentASR、AliyunASR、Aliyun流式ASR、百度ASR、OpenAI ASR | FunASRServer | --- @@ -337,6 +340,7 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/ |:------:|:---------------:|:----:|:---------:|:--:| | Memory | mem0ai | 接口调用 | 1000次/月额度 | | | Memory | mem_local_short | 本地总结 | 免费 | | +| Memory | nomem | 无记忆模式 | 免费 | | --- @@ -346,6 +350,7 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/ |:------:|:-------------:|:----:|:-------:|:---------------------:| | Intent | intent_llm | 接口调用 | 根据LLM收费 | 通过大模型识别意图,通用性强 | | Intent | function_call | 接口调用 | 根据LLM收费 | 通过大模型函数调用完成意图,速度快,效果好 | +| Intent | nointent | 无意图模式 | 免费 | 不进行意图识别,直接返回对话结果 | --- @@ -356,8 +361,10 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/ | | [百聆语音对话机器人](https://github.com/wwbin2017/bailing) | 本项目受[百聆语音对话机器人](https://github.com/wwbin2017/bailing)启发,并在其基础上实现 | | | [十方融海](https://www.tenclass.com/) | 感谢[十方融海](https://www.tenclass.com/)为小智生态制定了标准的通讯协议、多设备兼容性方案及高并发场景实践示范;为本项目提供了全链路技术文档支持 | | | [玄凤科技](https://github.com/Eric0308) | 感谢[玄凤科技](https://github.com/Eric0308)贡献函数调用框架、MCP通信协议及插件化调用机制的实现代码,通过标准化的指令调度体系与动态扩展能力,显著提升了前端设备(IoT)的交互效率和功能延展性 | +| | [huangjunsen](https://github.com/huangjunsen0406) | 感谢[huangjunsen](https://github.com/huangjunsen0406) 贡献`智控台移动端`模块,实现了跨平台移动设备的高效控制与实时交互,大幅提升了系统在移动场景下的操作便捷性和管理效率 | | | [汇远设计](http://ui.kwd988.net/) | 感谢[汇远设计](http://ui.kwd988.net/)为本项目提供专业视觉解决方案,用其服务超千家企业的设计实战经验,赋能本项目产品用户体验 | | | [西安勤人信息科技](https://www.029app.com/) | 感谢[西安勤人信息科技](https://www.029app.com/)深化本项目视觉体系,确保整体设计风格在多场景应用中的一致性和扩展性 | +| | [代码贡献者](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors) | 感谢[所有代码贡献者](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors)贡献者,你们的付出让项目更加健壮和强大。 | diff --git a/README_en.md b/README_en.md index 38b63f58..5432eae8 100644 --- a/README_en.md +++ b/README_en.md @@ -38,9 +38,9 @@ Supports MCP endpoints and voiceprint recognition

-By Professor Siyuan Liu Research and Development Group (South China University of Technology) +Spearheaded by Professor Siyuan Liu's Team (South China University of Technology)
-刘思源教授团队研发(华南理工大学) +刘思源教授团队主导研发(华南理工大学)
South China University of Technology

@@ -93,7 +93,7 @@ Want to see the usage effects? Click the videos below 🎥 -
+ Custom voice timbre @@ -194,6 +194,7 @@ This project provides two deployment methods. Please choose based on your specif ``` Intelligent Control Console Address: https://2662r3426b.vicp.fun +Intelligent Control Console Address (H5): https://2662r3426b.vicp.fun/h5/index.html Service Test Tool: https://2662r3426b.vicp.fun/test/ OTA Interface Address: https://2662r3426b.vicp.fun/xiaozhi/ota/ @@ -352,8 +353,10 @@ In fact, any VLLM that supports OpenAI interface calls can be integrated and use | | [Bailing Voice Dialogue Robot](https://github.com/wwbin2017/bailing) | This project is inspired by [Bailing Voice Dialogue Robot](https://github.com/wwbin2017/bailing) and implemented on its basis | | | [Tenclass](https://www.tenclass.com/) | Thanks to [Tenclass](https://www.tenclass.com/) for formulating standard communication protocols, multi-device compatibility solutions, and high-concurrency scenario practice demonstrations for the Xiaozhi ecosystem; providing full-link technical documentation support for this project | | | [Xuanfeng Technology](https://github.com/Eric0308) | Thanks to [Xuanfeng Technology](https://github.com/Eric0308) for contributing function calling framework, MCP communication protocol, and plugin-based calling mechanism implementation code. Through standardized instruction scheduling system and dynamic expansion capabilities, it significantly improves the interaction efficiency and functional extensibility of frontend devices (IoT) | +| | [huangjunsen](https://github.com/huangjunsen0406) | Thanks to [huangjunsen](https://github.com/huangjunsen0406) for contributing the `Smart Control Console Mobile` module, which enables efficient control and real-time interaction across mobile devices, significantly enhancing the system's operational convenience and management efficiency in mobile scenarios. | | | [Huiyuan Design](http://ui.kwd988.net/) | Thanks to [Huiyuan Design](http://ui.kwd988.net/) for providing professional visual solutions for this project, using their design practical experience serving over a thousand enterprises to empower this project's product user experience | | | [Xi'an Qinren Information Technology](https://www.029app.com/) | Thanks to [Xi'an Qinren Information Technology](https://www.029app.com/) for deepening this project's visual system, ensuring consistency and extensibility of overall design style in multi-scenario applications | +| | [Code Contributors](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors) | Thanks to [all code contributors](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors), your efforts have made the project more robust and powerful. | diff --git a/docker-setup.sh b/docker-setup.sh index 938917f4..8b2f1274 100755 --- a/docker-setup.sh +++ b/docker-setup.sh @@ -46,7 +46,7 @@ cat << "EOF" \/ \__,_||_| |_||_||_||_| \__,_| |_| \_| \__,_||_| |_||_| \__,_| \__,_| EOF echo -e "\e[0m" # 重置颜色 -echo -e "\e[1;36m 小智服务端全量部署一键安装脚本 Ver 0.2 \e[0m\n" +echo -e "\e[1;36m 小智服务端全量部署一键安装脚本 Ver 0.2 2025年8月20日更新 \e[0m\n" sleep 1 @@ -376,7 +376,7 @@ done echo "服务端启动成功!正在完成配置..." echo "正在启动服务..." - docker compose -f docker-compose_all.yml up -d + docker compose -f /opt/xiaozhi-server/docker-compose_all.yml up -d echo "服务启动完成!" ) @@ -402,13 +402,12 @@ fi # 获取并显示地址信息 LOCAL_IP=$(hostname -I | awk '{print $1}') -WEBSOCKET_ADDR=$(docker logs xiaozhi-esp32-server 2>&1 | tac | grep -m 1 -E -o "ws://[^ ]+") -VISION_ADDR=$(docker logs xiaozhi-esp32-server 2>&1 | tac | grep -m 1 "视觉" | grep -m 1 -E -o "http://[^ ]+") +# 修复日志文件获取不到ws的问题,改为硬编码 whiptail --title "安装完成!" --msgbox "\ 服务端相关地址如下:\n\ 管理后台访问地址: http://$LOCAL_IP:8002\n\ OTA 地址: http://$LOCAL_IP:8002/xiaozhi/ota/\n\ -视觉分析接口地址: $VISION_ADDR\n\ -WebSocket 地址: $WEBSOCKET_ADDR\n\ -\n安装完毕!感谢您的使用!\n按Enter键退出..." 16 70 \ No newline at end of file +视觉分析接口地址: http://$LOCAL_IP:8003/mcp/vision/explain\n\ +WebSocket 地址: ws://$LOCAL_IP:8000/xiaozhi/v1/\n\ +\n安装完毕!感谢您的使用!\n按Enter键退出..." 16 70 diff --git a/docs/Deployment_all.md b/docs/Deployment_all.md index f93a266e..96b3d75c 100644 --- a/docs/Deployment_all.md +++ b/docs/Deployment_all.md @@ -7,11 +7,13 @@ docker镜像已支持x86架构、arm64架构的CPU,支持在国产操作系统 如果您的电脑还没安装docker,可以按照这里的教程安装:[docker安装](https://www.runoob.com/docker/ubuntu-docker-install.html) -docker 安装全模块有两种方式,你可以[1.1使用懒人脚本](#1.1 懒人脚本)(作者[@VanillaNahida](https://github.com/VanillaNahida))自动帮你下载所需的文件和配置文件,你可以使用[1.2手动部署](#1.2 手动部署)从零搭建。 +docker 安装全模块有两种方式,你可以[使用懒人脚本](./Deployment_all.md#11-懒人脚本)(作者[@VanillaNahida](https://github.com/VanillaNahida)) +脚本会自动帮你下载所需的文件和配置文件,你也可以使用[手动部署](./Deployment_all.md#12-手动部署)从零搭建。 + + ### 1.1 懒人脚本 - -你可以使用以下命令一键安装全模块版小智服务端: +部署简便,可以参考[视频教程](https://www.bilibili.com/video/BV17bbvzHExd/) ,文字版教程如下: > [!NOTE] > 暂且只支持Ubuntu服务器一键部署,其他系统未尝试,可能会有一些奇怪的bug @@ -474,7 +476,8 @@ ws://你电脑局域网的ip:8000/xiaozhi/v1/ 4、[如何部署MCP接入点](./mcp-endpoint-enable.md)
5、[如何接入MCP接入点](./mcp-endpoint-integration.md)
6、[如何开启声纹识别](./voiceprint-integration.md)
-10、[新闻插件源配置指南](./newsnow_plugin_config.md)
+7、[新闻插件源配置指南](./newsnow_plugin_config.md)
+8、[天气插件使用指南](./weather-integration.md)
## 语音克隆、本地语音部署相关教程 1、[如何部署集成index-tts本地语音](./index-stream-integration.md)
2、[如何部署集成fish-speech本地语音](./fish-speech-integration.md)
diff --git a/docs/images/demo6.png b/docs/images/demo6.png index 18d8f5f3..dc4edbeb 100644 Binary files a/docs/images/demo6.png and b/docs/images/demo6.png differ diff --git a/docs/images/logo_contributors.png b/docs/images/logo_contributors.png new file mode 100644 index 00000000..5e8febeb Binary files /dev/null and b/docs/images/logo_contributors.png differ diff --git a/docs/images/logo_junsen.png b/docs/images/logo_junsen.png new file mode 100644 index 00000000..ded09f20 Binary files /dev/null and b/docs/images/logo_junsen.png differ diff --git a/docs/paddlespeech-deploy.md b/docs/paddlespeech-deploy.md index 6584efff..17030fab 100644 --- a/docs/paddlespeech-deploy.md +++ b/docs/paddlespeech-deploy.md @@ -75,7 +75,7 @@ TTS: sample_rate: 24000 # 采样率 [websocket默认24000,http默认0 自动选择] speed: 1.0 # 语速,1.0 表示正常语速,>1 表示加快,<1 表示减慢 volume: 1.0 # 音量,1.0 表示正常音量,>1 表示增大,<1 表示减小 - save_path: ./streaming_tts.wav # 服务器生成的语音文件保存路径 + save_path: # 保存路径 ``` ### 3.启动xiaozhi服务 ```py diff --git a/docs/performance_tester.md b/docs/performance_tester.md index abe57458..85987120 100644 --- a/docs/performance_tester.md +++ b/docs/performance_tester.md @@ -1,8 +1,8 @@ -# 语音识别、大语言模型、非流式语音合成、视觉模型的性能测试工具使用指南 +# 语音识别、大语言模型、非流式语音合成、流式语音合成、视觉模型的性能测试工具使用指南 1.在main/xiaozhi-server目录下创建data目录 2.在data目录下创建.config.yaml文件 -3.在.data/config.yaml中,写入你的语音识别、大语言模型、非流式语音合成、视觉模型的参数 +3.在.data/config.yaml中,写入你的语音识别、大语言模型、流式语音合成、视觉模型的参数 例如: ``` LLM: diff --git a/docs/weather-integration.md b/docs/weather-integration.md new file mode 100644 index 00000000..3b6ca2b6 --- /dev/null +++ b/docs/weather-integration.md @@ -0,0 +1,64 @@ +# 天气插件使用指南 + +## 概述 + +天气插件 `get_weather` 是小智ESP32语音助手的核心功能之一,支持通过语音查询全国各地的天气信息。插件基于和风天气API,提供实时天气和7天天气预报功能。 + +## API Key 申请指南 + +### 1. 注册和风天气账号 + +1. 访问 [和风天气控制台](https://console.qweather.com/) +2. 注册账号并完成邮箱验证 +3. 登录控制台 + +### 2. 创建应用获取API Key + +1. 进入控制台后,点击右侧["项目管理"](https://console.qweather.com/project?lang=zh) → "创建项目" +2. 填写项目信息: + - **项目名称**:如"小智语音助手" +3. 点击保存 +4. 项目创建完成后,在该项目中点击"创建凭据" +5. 填写凭据信息: + - **凭据名称**:如"小智语音助手" + - **身份认证方式**:选择"API Key" +6. 点击保存 +7. 在凭据中复制`API Key`,这是第一个关键的配置信息 + +### 3. 获取API Host + +1. 在控制台中点击["设置"](https://console.qweather.com/setting?lang=zh) → "API Host" +2. 查看分配给你的专属`API Host`地址,这个是第二个关键的配置信息 + +以上操作,会得到两个重要的配置信息:`API Key`和`API Host` + +## 配置方式(任选一种) + +### 方式1. 如果你使用了智控台部署(推荐) + +1. 登录智控台 +2. 进入"角色配置"页面 +3. 选择要配置的智能体 +4. 点击"编辑功能"按钮 +5. 在右侧参数配置区域找到"天气查询"插件 +6. 勾选"天气查询" +7. 将复制过来的第一个关键配置`API Key`,填入到`天气插件 API 密钥`里 +8. 将复制过来的第二个关键配置`API Host`,填入到`开发者 API Host`里 +9. 保存配置,再保存智能体配置 + +### 方式2. 如果你只是单模块xiaozhi-server部署 + +在 `data/.config.yaml` 中配置: + +1. 将复制过来的第一个关键配置`API Key`,填入到`api_key`里 +2. 将复制过来的第二个关键配置`API Host`,填入到`api_host`里 +3. 将你所在的城市填入到`default_location`里,例如`广州` + +```yaml +plugins: + get_weather: + api_key: "你的和风天气API密钥" + api_host: "你的和风天气API主机地址" + default_location: "你的默认查询城市" +``` + diff --git a/main/manager-api/src/main/java/xiaozhi/common/constant/Constant.java b/main/manager-api/src/main/java/xiaozhi/common/constant/Constant.java index bf747600..afd7addf 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/constant/Constant.java +++ b/main/manager-api/src/main/java/xiaozhi/common/constant/Constant.java @@ -237,7 +237,7 @@ public interface Constant { /** * 版本号 */ - public static final String VERSION = "0.7.5"; + public static final String VERSION = "0.7.7"; /** * 无效固件URL diff --git a/main/manager-mobile/src/pages/agent/tools.vue b/main/manager-mobile/src/pages/agent/tools.vue index 88ca36fc..4e710b19 100644 --- a/main/manager-mobile/src/pages/agent/tools.vue +++ b/main/manager-mobile/src/pages/agent/tools.vue @@ -28,6 +28,11 @@ const agentId = computed(() => pluginStore.currentAgentId) const mcpAddress = ref('') const mcpTools = ref([]) +// 初始化时从本地存储加载MCP地址 +if (uni.getStorageSync('cachedMcpAddress_' + agentId.value)) { + mcpAddress.value = uni.getStorageSync('cachedMcpAddress_' + agentId.value) +} + // 参数编辑相关 const showParamDialog = ref(false) const currentFunction = ref(null) @@ -56,12 +61,23 @@ async function mergeFunctions() { ) if (agentId.value) { - const [address, tools] = await Promise.all([ - getMcpAddress(agentId.value), - getMcpTools(agentId.value), - ]) - mcpAddress.value = address - mcpTools.value = tools || [] + // 优先获取并显示MCP地址 + try { + const address = await getMcpAddress(agentId.value) + mcpAddress.value = address + // 缓存到本地存储,下次打开页面可以立即显示 + uni.setStorageSync('cachedMcpAddress_' + agentId.value, address) + } catch (error) { + console.error('获取MCP地址失败:', error) + } + + // 异步获取MCP工具列表,不阻塞UI显示 + try { + const tools = await getMcpTools(agentId.value) + mcpTools.value = tools || [] + } catch (error) { + console.error('获取MCP工具列表失败:', error) + } } } diff --git a/main/manager-mobile/src/pages/settings/index.vue b/main/manager-mobile/src/pages/settings/index.vue index cef02761..8b50f928 100644 --- a/main/manager-mobile/src/pages/settings/index.vue +++ b/main/manager-mobile/src/pages/settings/index.vue @@ -27,6 +27,7 @@ const cacheInfo = reactive({ // 服务端地址设置 const baseUrlInput = ref('') +const urlError = ref('') // 系统信息(保留) const systemInfo = computed(() => { @@ -52,10 +53,58 @@ function getCacheInfo() { } } +// 验证URL格式 +function validateUrl() { + urlError.value = '' + + if (!baseUrlInput.value) { + return + } + + if (!/^https?:\/\/.+\/xiaozhi$/.test(baseUrlInput.value)) { + urlError.value = '请输入有效的服务端地址(以 http 或 https 开头,并以 /xiaozhi 结尾)' + } +} + +// 测试服务端地址 +async function testServerBaseUrl() { + // 先清除错误信息 + urlError.value = '' + + if (!baseUrlInput.value || !/^https?:\/\/.+\/xiaozhi$/.test(baseUrlInput.value)) { + return false + } + + try { + const response = await uni.request({ + url: `${baseUrlInput.value}/api/ping`, + method: 'GET', + timeout: 3000 + }) + + if (response.statusCode === 200) { + return true + } else { + toast.error('无效地址,请检查服务端是否启动或网络连接是否正常') + return false + } + } catch (error) { + console.error('测试服务端地址失败:', error) + toast.error('无效地址,请检查服务端是否启动或网络连接是否正常') + return false + } +} + // 保存服务端地址 -function saveServerBaseUrl() { - if (!baseUrlInput.value || !/^https?:\/\//.test(baseUrlInput.value)) { - toast.warning('请输入有效的服务端地址(以 http 或 https 开头)') +async function saveServerBaseUrl() { + if (!baseUrlInput.value || !/^https?:\/\/.+\/xiaozhi$/.test(baseUrlInput.value)) { + toast.warning('请输入有效的服务端地址(以 http 或 https 开头,并以 /xiaozhi 结尾)') + return + } + + // 测试地址有效性 + const isServerValid = await testServerBaseUrl() + if (!isServerValid) { return } setServerBaseUrlOverride(baseUrlInput.value) @@ -173,7 +222,7 @@ function showAbout() { title: `关于${import.meta.env.VITE_APP_TITLE}`, content: `${import.meta.env.VITE_APP_TITLE}\n\n基于 Vue.js 3 + uni-app 构建的跨平台移动端管理应用,为小智ESP32智能硬件提供设备管理、智能体配置等功能。\n\n© 2025 xiaozhi-esp32-server`, title: `关于小智智控台`, - content: `小智智控台\n\n基于 Vue.js 3 + uni-app 构建的跨平台移动端管理应用,为小智智控台ESP32智能硬件提供设备管理、智能体配置等功能。\n\n© 2025 xiaozhi-esp32-server 0.7.5`, + content: `小智智控台\n\n基于 Vue.js 3 + uni-app 构建的跨平台移动端管理应用,为小智ESP32智能硬件提供设备管理、智能体配置等功能。\n\n© 2025 xiaozhi-esp32-server 0.7.7`, showCancel: false, confirmText: '确定', }) @@ -201,7 +250,6 @@ onMounted(async () => { - @@ -214,20 +262,15 @@ onMounted(async () => { - - + input-class="text-[28rpx] text-[#232338]" @input="validateUrl" @blur="validateUrl" /> + + {{ urlError }} + @@ -319,6 +362,7 @@ onMounted(async () => { + diff --git a/main/manager-web/src/components/FunctionDialog.vue b/main/manager-web/src/components/FunctionDialog.vue index 76c69c8e..f8adfef7 100644 --- a/main/manager-web/src/components/FunctionDialog.vue +++ b/main/manager-web/src/components/FunctionDialog.vue @@ -698,15 +698,10 @@ export default { font-size: 14px; height: 36px; box-sizing: border-box; - background-color: #f5f5f5; -} -::v-deep .el-input__inner { - background-color: #f5f5f5; - padding-right: 80px; -} - -.url-input { + ::v-deep .el-input__inner { + background-color: #f5f5f5 !important; + } ::v-deep .el-input__suffix { right: 0; diff --git a/main/manager-web/src/components/ModelEditDialog.vue b/main/manager-web/src/components/ModelEditDialog.vue index 0bc2f7cf..ec29c30e 100644 --- a/main/manager-web/src/components/ModelEditDialog.vue +++ b/main/manager-web/src/components/ModelEditDialog.vue @@ -3,7 +3,7 @@ class="center-dialog" >
- 修改模型 + {{ modelData.duplicateMode ? '创建副本' : '修改模型' }}