mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-06-02 00:57:41 +08:00
Rename the WeCom customer-service channel and give it its own corp_id
field so users no longer have to share `wechatcom_corp_id` with the
self-built WeCom app channel.
Renames (channel-side):
- channel type / const: wechatcom_kf -> wechat_kf
- package dir: channel/wechatcom_kf/ -> channel/wechat_kf/
- python files / classes: WechatComKf* -> WechatKf*
- config keys: wechatcom_kf_{secret,token,aes_key,port} ->
wechat_kf_{secret,token,aes_key,port}; new wechat_kf_corp_id
- env vars: WECHATCOM_KF_* -> WECHAT_KF_*; new WECHAT_KF_CORP_ID
- log prefix / cursor file: [wechatcom_kf] -> [wechat_kf]
- web console CHANNEL_DEFS key + startup log line
Renames (docs):
- docs/channels/wecom-kf.mdx -> docs/channels/wechat-kf.mdx (zh/en/ja)
- update docs.json sidebar entries and all field names inside the docs
In addition, the Web Console "微信客服" entry now exposes its own
Corp ID field instead of reusing the wechatcom_app one, and includes
the screenshot of the visual config in the channel guide.
Web Console onboarding section is added (Tabs: Web Console / config
file) and the local URL `http://127.0.0.1:9899/` parenthetical is
dropped for consistency with other channel docs.
Co-authored-by: Cursor <cursoragent@cursor.com>
53 lines
1.9 KiB
Python
53 lines
1.9 KiB
Python
"""
|
|
channel factory
|
|
"""
|
|
from common import const
|
|
from .channel import Channel
|
|
|
|
|
|
def create_channel(channel_type) -> Channel:
|
|
"""
|
|
create a channel instance
|
|
:param channel_type: channel type code
|
|
:return: channel instance
|
|
"""
|
|
ch = Channel()
|
|
if channel_type == "terminal":
|
|
from channel.terminal.terminal_channel import TerminalChannel
|
|
ch = TerminalChannel()
|
|
elif channel_type == 'web':
|
|
from channel.web.web_channel import WebChannel
|
|
ch = WebChannel()
|
|
elif channel_type == "wechatmp":
|
|
from channel.wechatmp.wechatmp_channel import WechatMPChannel
|
|
ch = WechatMPChannel(passive_reply=True)
|
|
elif channel_type == "wechatmp_service":
|
|
from channel.wechatmp.wechatmp_channel import WechatMPChannel
|
|
ch = WechatMPChannel(passive_reply=False)
|
|
elif channel_type == "wechatcom_app":
|
|
from channel.wechatcom.wechatcomapp_channel import WechatComAppChannel
|
|
ch = WechatComAppChannel()
|
|
elif channel_type == const.WECHAT_KF:
|
|
from channel.wechat_kf.wechat_kf_channel import WechatKfChannel
|
|
ch = WechatKfChannel()
|
|
elif channel_type == const.FEISHU:
|
|
from channel.feishu.feishu_channel import FeiShuChanel
|
|
ch = FeiShuChanel()
|
|
elif channel_type == const.DINGTALK:
|
|
from channel.dingtalk.dingtalk_channel import DingTalkChanel
|
|
ch = DingTalkChanel()
|
|
elif channel_type == const.WECOM_BOT:
|
|
from channel.wecom_bot.wecom_bot_channel import WecomBotChannel
|
|
ch = WecomBotChannel()
|
|
elif channel_type == const.QQ:
|
|
from channel.qq.qq_channel import QQChannel
|
|
ch = QQChannel()
|
|
elif channel_type in (const.WEIXIN, "wx"):
|
|
from channel.weixin.weixin_channel import WeixinChannel
|
|
ch = WeixinChannel()
|
|
channel_type = const.WEIXIN
|
|
else:
|
|
raise RuntimeError
|
|
ch.channel_type = channel_type
|
|
return ch
|