mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-06-02 00:57:41 +08:00
feat: web console support wecom_bot config
This commit is contained in:
@@ -813,6 +813,11 @@ function escapeHtml(str) {
|
|||||||
return div.innerHTML;
|
return div.innerHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ChannelsHandler_maskSecret(val) {
|
||||||
|
if (!val || val.length <= 8) return val;
|
||||||
|
return val.slice(0, 4) + '*'.repeat(val.length - 8) + val.slice(-4);
|
||||||
|
}
|
||||||
|
|
||||||
function formatToolArgs(args) {
|
function formatToolArgs(args) {
|
||||||
if (!args || Object.keys(args).length === 0) return '(none)';
|
if (!args || Object.keys(args).length === 0) return '(none)';
|
||||||
try {
|
try {
|
||||||
@@ -1737,7 +1742,14 @@ function submitAddChannel() {
|
|||||||
.then(data => {
|
.then(data => {
|
||||||
if (data.status === 'success') {
|
if (data.status === 'success') {
|
||||||
const ch = channelsData.find(c => c.name === chName);
|
const ch = channelsData.find(c => c.name === chName);
|
||||||
if (ch) ch.active = true;
|
if (ch) {
|
||||||
|
ch.active = true;
|
||||||
|
(ch.fields || []).forEach(f => {
|
||||||
|
if (updates[f.key] !== undefined) {
|
||||||
|
f.value = f.type === 'secret' ? ChannelsHandler_maskSecret(updates[f.key]) : updates[f.key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
renderActiveChannels();
|
renderActiveChannels();
|
||||||
} else {
|
} else {
|
||||||
if (btn) { btn.disabled = false; btn.textContent = t('channels_connect_btn'); }
|
if (btn) { btn.disabled = false; btn.textContent = t('channels_connect_btn'); }
|
||||||
|
|||||||
@@ -602,6 +602,15 @@ class ChannelsHandler:
|
|||||||
{"key": "dingtalk_client_secret", "label": "Client Secret", "type": "secret"},
|
{"key": "dingtalk_client_secret", "label": "Client Secret", "type": "secret"},
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
("wecom_bot", {
|
||||||
|
"label": {"zh": "企微智能机器人", "en": "WeCom Bot"},
|
||||||
|
"icon": "fa-robot",
|
||||||
|
"color": "emerald",
|
||||||
|
"fields": [
|
||||||
|
{"key": "wecom_bot_id", "label": "Bot ID", "type": "text"},
|
||||||
|
{"key": "wecom_bot_secret", "label": "Secret", "type": "secret"},
|
||||||
|
],
|
||||||
|
}),
|
||||||
("wechatcom_app", {
|
("wechatcom_app", {
|
||||||
"label": {"zh": "企微自建应用", "en": "WeCom App"},
|
"label": {"zh": "企微自建应用", "en": "WeCom App"},
|
||||||
"icon": "fa-building",
|
"icon": "fa-building",
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
"feishu_app_secret": "",
|
"feishu_app_secret": "",
|
||||||
"dingtalk_client_id": "",
|
"dingtalk_client_id": "",
|
||||||
"dingtalk_client_secret":"",
|
"dingtalk_client_secret":"",
|
||||||
|
"wecom_bot_id": "",
|
||||||
|
"wecom_bot_secret": "",
|
||||||
"agent": true,
|
"agent": true,
|
||||||
"agent_max_context_tokens": 40000,
|
"agent_max_context_tokens": 40000,
|
||||||
"agent_max_context_turns": 20,
|
"agent_max_context_turns": 20,
|
||||||
|
|||||||
@@ -153,7 +153,6 @@ available_setting = {
|
|||||||
# 企微智能机器人配置(长连接模式)
|
# 企微智能机器人配置(长连接模式)
|
||||||
"wecom_bot_id": "", # 企微智能机器人BotID
|
"wecom_bot_id": "", # 企微智能机器人BotID
|
||||||
"wecom_bot_secret": "", # 企微智能机器人长连接Secret
|
"wecom_bot_secret": "", # 企微智能机器人长连接Secret
|
||||||
|
|
||||||
# chatgpt指令自定义触发词
|
# chatgpt指令自定义触发词
|
||||||
"clear_memory_commands": ["#清除记忆"], # 重置会话指令,必须以#开头
|
"clear_memory_commands": ["#清除记忆"], # 重置会话指令,必须以#开头
|
||||||
# channel配置
|
# channel配置
|
||||||
|
|||||||
Reference in New Issue
Block a user