Skip to content

Commit acaad82

Browse files
committed
2.0.3 新增移动云平台支持
1 parent e873804 commit acaad82

File tree

12 files changed

+169
-4
lines changed

12 files changed

+169
-4
lines changed

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
<h1 align="center">LM的Web会话管理方案<span style="color: #2454ff;">THChatUI</span><span style="font-size: 10px;">v2</span></h1>
1+
<h1 align="center">LM的Web会话管理方案<span style="color: #2454ff;">THChatUI</span>
2+
<span style="font-size: 10px;">v2.0.3</span></h1>
3+
4+
<div align="center">
25

36
[![GitHub](https://img.shields.io/badge/Demo-%F0%9F%9A%80%20GitHub-blue)](https://unagi-cq.github.io/THChatUI/#/) [![China](https://img.shields.io/badge/Demo-%F0%9F%9A%80%20China-red)](http://localchatui.wuxitianyouqi.com/#/) [![Docs](https://img.shields.io/badge/Document-%F0%9F%9A%80%20GitHub-blue)](https://unagi-cq.github.io/THChatUI/#/docs)
47

8+
</div>
9+
510

611
<p align="center">
712
嗨喽~朋友!🤖 欢迎使用THWebUI ,一个基于Vue2/Vue3和Element Plus的Web对话方案。项目持续集成与升级中,敬请期待更多功能与优化。
@@ -37,6 +42,7 @@ THChatUI V2 是一个专为**数据敏感型个人/组织/公司**设计的**开
3742
- 智谱AI
3843
- OpenAI(包括类OpenAI式服务)
3944
- 火山方舟(DeepSeek R1)
45+
- 移动云
4046
- 系统主题切换:支持浅色、深色、毛玻璃三种主题,支持自定义背景图片
4147
- 响应式设计:支持PC、移动端
4248
- 多模态:
@@ -262,6 +268,33 @@ location ^~ /ali/remote/
262268
add_header Cache-Control no-cache;
263269
}
264270
}
271+
272+
location ^~ /yidong/remote/
273+
{
274+
proxy_pass https://zhenze-huhehaote.cmecloud.cn;
275+
proxy_ssl_server_name on;
276+
proxy_set_header Host zhenze-huhehaote.cmecloud.cn;
277+
proxy_set_header X-Real-IP $remote_addr;
278+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
279+
proxy_set_header REMOTE-HOST $remote_addr;
280+
proxy_set_header Upgrade $http_upgrade;
281+
proxy_http_version 1.1;
282+
# proxy_hide_header Upgrade;
283+
284+
add_header X-Cache $upstream_cache_status;
285+
#Set Nginx Cache
286+
287+
set $static_file8WLuNoD1 0;
288+
if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
289+
{
290+
set $static_file8WLuNoD1 1;
291+
expires 1m;
292+
}
293+
if ( $static_file8WLuNoD1 = 0 )
294+
{
295+
add_header Cache-Control no-cache;
296+
}
297+
}
265298
```
266299
267300
> 【注】 本地运行调试时不需要额外配置。`/ali/remote/` `/baidu/remote/` 是和前端项目的vue.config.js文件里的代理前缀对应的。

thchat-ui/package-lock.json

Lines changed: 13 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

thchat-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "THChatUI",
3-
"version": "2.0.0",
3+
"version": "2.0.3",
44
"private": true,
55
"scripts": {
66
"serve": "vue-cli-service serve",
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* @fileoverview 移动云平台的HTTP调用。
3+
* 接口采用SSE请求方式,直接调会跨域,需要配代理,部署在服务器上之后也需要配置代理,详情可以参考本项目的文档
4+
*/
5+
import { fetchEventSource } from "@microsoft/fetch-event-source";
6+
import { preProcess } from "@/util/config"
7+
import store from '../../store';
8+
9+
// 移动云平台的接口地址
10+
const API_URLS = {
11+
llm: "/yidong/remote/inference-api/exp-api/inf-1337014908971847680/v1/chat/completions", // 暂时需要手动修改此时 未来会重构API KEY管理模块
12+
vim: "", // 预留图片理解模型接口
13+
igm: "" // 预留图生成模型接口
14+
};
15+
16+
/**
17+
* 调用移动云平台的接口
18+
* @param {string} prompt - 用户输入的问题
19+
* @param {Array} history - 历史对话消息
20+
* @param {Array} files - 文件列表
21+
* @param {AbortController} controller - 控制请求的取消
22+
* @param {Function} onopen - 连接成功回调
23+
* @param {Function} onmessage - 接收消息回调
24+
* @param {Function} onclose - 连接关闭回调
25+
* @param {Function} onerror - 错误处理回调
26+
*/
27+
export async function fetchAPI({
28+
prompt,
29+
history,
30+
files,
31+
controller,
32+
onopen,
33+
onmessage,
34+
onclose,
35+
onerror
36+
}) {
37+
const { setting } = store.state;
38+
const { model_config } = setting;
39+
const { version, pre_method, type } = model_config;
40+
const api_key = setting.api_key_map[setting.platform];
41+
42+
const url = API_URLS[type] || API_URLS.llm;
43+
44+
const requestConfig = {
45+
method: "POST",
46+
headers: {
47+
"Authorization": `Bearer ${api_key}`,
48+
'Content-Type': 'application/json',
49+
'Accept': 'text/event-stream'
50+
},
51+
body: JSON.stringify(preProcess(version, prompt, history, pre_method, files, false)),
52+
signal: controller.signal,
53+
onopen,
54+
onmessage,
55+
onclose,
56+
onerror,
57+
openWhenHidden: true
58+
};
59+
60+
return await fetchEventSource(url, requestConfig);
61+
}

thchat-ui/src/assets/docs/intro.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ THChatUI V2.0.0是一个专为**数据敏感型个人/组织/公司**设计的**
3030
- 讯飞星火
3131
- 智谱AI
3232
- OpenAI(包括类OpenAI式服务)
33+
- 火山方舟(DeepSeek R1)
34+
- 移动云
3335
- 系统主题切换:支持浅色、深色、毛玻璃三种主题,支持自定义背景图片
3436
- 响应式设计:支持PC、移动端
3537
- 多模态:

thchat-ui/src/assets/docs/quick_dev.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,33 @@ location ^~ /ali/remote/
178178
add_header Cache-Control no-cache;
179179
}
180180
}
181+
182+
location ^~ /yidong/remote/
183+
{
184+
proxy_pass https://zhenze-huhehaote.cmecloud.cn;
185+
proxy_ssl_server_name on;
186+
proxy_set_header Host zhenze-huhehaote.cmecloud.cn;
187+
proxy_set_header X-Real-IP $remote_addr;
188+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
189+
proxy_set_header REMOTE-HOST $remote_addr;
190+
proxy_set_header Upgrade $http_upgrade;
191+
proxy_http_version 1.1;
192+
# proxy_hide_header Upgrade;
193+
194+
add_header X-Cache $upstream_cache_status;
195+
#Set Nginx Cache
196+
197+
set $static_file8WLuNoD1 0;
198+
if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
199+
{
200+
set $static_file8WLuNoD1 1;
201+
expires 1m;
202+
}
203+
if ( $static_file8WLuNoD1 = 0 )
204+
{
205+
add_header Cache-Control no-cache;
206+
}
207+
}
181208
```
182209
183210
> 【注】 本地运行调试时不需要额外配置。`/ali/remote/` `/baidu/remote/` 是和前端项目的vue.config.js文件里的代理前缀对应的。

thchat-ui/src/assets/docs/tutorial.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
[申请月之暗面平台API KEY](https://platform.moonshot.cn/console/api-keys)
1010
[申请智谱平台API KEY](https://open.bigmodel.cn/usercenter/apikeys)
1111
[申请火山方舟平台API KEY](https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey)
12+
[申请移动云平台API KEY](https://ecloud.10086.cn/portal/act/AI)
1213

1314
对于OpenAI式的API KEY,通常我们并不是仅仅指OpenAI这家公司的ChatGPT的API KEY,而是指提供了OpenAI接口规范的所有服务商的URL、KEY、Model这三个参数。
1415

@@ -22,6 +23,12 @@
2223

2324
接入点需要在火山方舟平台[https://console.volcengine.com/ark/region:ark+cn-beijing/endpoint](https://console.volcengine.com/ark/region:ark+cn-beijing/endpoint)开通。
2425

26+
### 移动云平台使用模型的特别说明
27+
28+
除了要申请API KEY,还要去移动云官网申请Endpoint,修改`thchat-ui\src\api\Yidong_CMECloud\index.js`里面的代理路径。
29+
30+
这是由于移动云的模型名称默认是`default`,真正的信息全都集成在endpoint里面了。在未来的ThChtUI版本迭代中,会重构API KEY管理模块。
31+
2532
## 使用说明
2633

2734
如果你需要在本地部署THChatUI,请参考“快速开发”栏目。

thchat-ui/src/components/SendBox/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ export default {
236236
return import("@/api/OpenAI").then(module => module.fetchAPI);
237237
} else if (this.platform === 'TT_Volcengine') {
238238
return import("@/api/TT_Volcengine").then(module => module.fetchAPI);
239+
} else if (this.platform === 'Yidong_CMECloud') {
240+
return import("@/api/Yidong_CMECloud").then(module => module.fetchAPI);
239241
}
240242
},
241243

thchat-ui/src/store/setting.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const defaultSettings = {
2828
Xunfei_Spark: "",
2929
Zhipu_BigModel: "",
3030
TT_Volcengine: "",
31+
Yidong_CMECloud: "",
3132
OpenAI: {
3233
endpoint: "",
3334
api_key: "",

thchat-ui/src/util/config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,13 @@ module.exports = {
364364
{ type: "llm", name: "deepseek-r1", series: "volcengine", version: "", pre_method: "text_moonshot_zhipu", post_method: "delta_reasoning" }
365365
]
366366
},
367+
"Yidong_CMECloud":
368+
{
369+
platform_name: "移动云",
370+
list: [
371+
{ type: "llm", name: "default", series: "default", version: "default", pre_method: "text_moonshot_zhipu", post_method: "delta" }
372+
]
373+
},
367374
"OpenAI":
368375
{
369376
platform_name: "OpenAI",

0 commit comments

Comments
 (0)