@@ -167,7 +167,7 @@ pip3 install -r requirements-optional.txt | |||||
**4.其他配置** | **4.其他配置** | ||||
+ `model`: 模型名称,目前支持 `gpt-3.5-turbo`, `gpt-4o`, `gpt-4-turbo`, `gpt-4`, `wenxin` , `claude` , `gemini`, `glm-4`, `xunfei`, `moonshot` | |||||
+ `model`: 模型名称,目前支持 `gpt-3.5-turbo`, `gpt-4o`, `gpt-4-turbo`, `gpt-4`, `wenxin` , `claude` , `gemini`, `glm-4`, `xunfei`, `moonshot`等,全部模型名称参考`common/const.py`文件 | |||||
+ `temperature`,`frequency_penalty`,`presence_penalty`: Chat API接口参数,详情参考[OpenAI官方文档。](https://platform.openai.com/docs/api-reference/chat) | + `temperature`,`frequency_penalty`,`presence_penalty`: Chat API接口参数,详情参考[OpenAI官方文档。](https://platform.openai.com/docs/api-reference/chat) | ||||
+ `proxy`:由于目前 `openai` 接口国内无法访问,需配置代理客户端的地址,详情参考 [#351](https://github.com/zhayujie/chatgpt-on-wechat/issues/351) | + `proxy`:由于目前 `openai` 接口国内无法访问,需配置代理客户端的地址,详情参考 [#351](https://github.com/zhayujie/chatgpt-on-wechat/issues/351) | ||||
+ 对于图像生成,在满足个人或群组触发条件外,还需要额外的关键词前缀来触发,对应配置 `image_create_prefix ` | + 对于图像生成,在满足个人或群组触发条件外,还需要额外的关键词前缀来触发,对应配置 `image_create_prefix ` | ||||
@@ -1,6 +1,8 @@ | |||||
# encoding:utf-8 | # encoding:utf-8 | ||||
import requests, json | |||||
import requests | |||||
import json | |||||
from common import const | |||||
from bot.bot import Bot | from bot.bot import Bot | ||||
from bot.session_manager import SessionManager | from bot.session_manager import SessionManager | ||||
from bridge.context import ContextType | from bridge.context import ContextType | ||||
@@ -16,9 +18,12 @@ class BaiduWenxinBot(Bot): | |||||
def __init__(self): | def __init__(self): | ||||
super().__init__() | super().__init__() | ||||
wenxin_model = conf().get("baidu_wenxin_model") or "eb-instant" | |||||
if conf().get("model") and conf().get("model") == "wenxin-4": | |||||
wenxin_model = conf().get("baidu_wenxin_model") or "completions" | |||||
if conf().get("model") and conf().get("model") == const.WEN_XIN: | |||||
wenxin_model = "completions" | |||||
if conf().get("model") and conf().get("model") == const.WEN_XIN_4: | |||||
wenxin_model = "completions_pro" | wenxin_model = "completions_pro" | ||||
self.sessions = SessionManager(BaiduWenxinSession, model=wenxin_model) | self.sessions = SessionManager(BaiduWenxinSession, model=wenxin_model) | ||||
def reply(self, query, context=None): | def reply(self, query, context=None): | ||||
@@ -1,18 +1,16 @@ | |||||
# bot_type | # bot_type | ||||
OPEN_AI = "openAI" | OPEN_AI = "openAI" | ||||
CHATGPT = "chatGPT" | CHATGPT = "chatGPT" | ||||
BAIDU = "baidu" | |||||
BAIDU = "baidu" # 百度文心一言模型 | |||||
XUNFEI = "xunfei" | XUNFEI = "xunfei" | ||||
CHATGPTONAZURE = "chatGPTOnAzure" | CHATGPTONAZURE = "chatGPTOnAzure" | ||||
LINKAI = "linkai" | LINKAI = "linkai" | ||||
CLAUDEAI = "claude" | |||||
CLAUDEAPI= "claudeAPI" | |||||
QWEN = "qwen" | |||||
CLAUDEAI = "claude" # 使用cookie的历史模型 | |||||
CLAUDEAPI= "claudeAPI" # 通过Claude api调用模型 | |||||
QWEN = "qwen" # 旧版通义模型 | |||||
QWEN_DASHSCOPE = "dashscope" # 通义新版sdk和api key | |||||
QWEN_DASHSCOPE = "dashscope" | |||||
QWEN_TURBO = "qwen-turbo" | |||||
QWEN_PLUS = "qwen-plus" | |||||
QWEN_MAX = "qwen-max" | |||||
GEMINI = "gemini" | GEMINI = "gemini" | ||||
ZHIPU_AI = "glm-4" | ZHIPU_AI = "glm-4" | ||||
@@ -22,22 +20,48 @@ MOONSHOT = "moonshot" | |||||
# model | # model | ||||
CLAUDE3 = "claude-3-opus-20240229" | CLAUDE3 = "claude-3-opus-20240229" | ||||
GPT35 = "gpt-3.5-turbo" | GPT35 = "gpt-3.5-turbo" | ||||
GPT4 = "gpt-4" | |||||
GPT35_0125 = "gpt-3.5-turbo-0125" | |||||
GPT35_1106 = "gpt-3.5-turbo-1106" | |||||
GPT_4o = "gpt-4o" | GPT_4o = "gpt-4o" | ||||
LINKAI_35 = "linkai-3.5" | |||||
LINKAI_4_TURBO = "linkai-4-turbo" | |||||
LINKAI_4o = "linkai-4o" | |||||
GPT4_TURBO_PREVIEW = "gpt-4-turbo-2024-04-09" | |||||
GPT4_TURBO = "gpt-4-turbo" | |||||
GPT4_TURBO_PREVIEW = "gpt-4-turbo-preview" | |||||
GPT4_TURBO_04_09 = "gpt-4-turbo-2024-04-09" | GPT4_TURBO_04_09 = "gpt-4-turbo-2024-04-09" | ||||
GPT4_TURBO_01_25 = "gpt-4-0125-preview" | GPT4_TURBO_01_25 = "gpt-4-0125-preview" | ||||
GPT4_TURBO_11_06 = "gpt-4-1106-preview" | |||||
GPT4_VISION_PREVIEW = "gpt-4-vision-preview" | GPT4_VISION_PREVIEW = "gpt-4-vision-preview" | ||||
GPT4 = "gpt-4" | |||||
GPT4_32k = "gpt-4-32k" | |||||
GPT4_06_13 = "gpt-4-0613" | |||||
GPT4_32k_06_13 = "gpt-4-32k-0613" | |||||
WHISPER_1 = "whisper-1" | WHISPER_1 = "whisper-1" | ||||
TTS_1 = "tts-1" | TTS_1 = "tts-1" | ||||
TTS_1_HD = "tts-1-hd" | TTS_1_HD = "tts-1-hd" | ||||
MODEL_LIST = ["gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-4", "wenxin", "wenxin-4", "xunfei", "claude", "claude-3-opus-20240229", "gpt-4-turbo", | |||||
"gpt-4-turbo-preview", "gpt-4-1106-preview", GPT4_TURBO_PREVIEW, GPT4_TURBO_01_25, GPT_4o, QWEN, GEMINI, ZHIPU_AI, MOONSHOT, | |||||
QWEN_TURBO, QWEN_PLUS, QWEN_MAX, LINKAI_35, LINKAI_4_TURBO, LINKAI_4o] | |||||
WEN_XIN = "wenxin" | |||||
WEN_XIN_4 = "wenxin-4" | |||||
QWEN_TURBO = "qwen-turbo" | |||||
QWEN_PLUS = "qwen-plus" | |||||
QWEN_MAX = "qwen-max" | |||||
LINKAI_35 = "linkai-3.5" | |||||
LINKAI_4_TURBO = "linkai-4-turbo" | |||||
LINKAI_4o = "linkai-4o" | |||||
MODEL_LIST = [ | |||||
GPT35, GPT35_0125, GPT35_1106, "gpt-3.5-turbo-16k", | |||||
GPT_4o, GPT4_TURBO, GPT4_TURBO_PREVIEW, GPT4_TURBO_01_25, GPT4_TURBO_11_06, GPT4, GPT4_32k, GPT4_06_13, GPT4_32k_06_13, | |||||
WEN_XIN, WEN_XIN_4, | |||||
XUNFEI, GEMINI, ZHIPU_AI, MOONSHOT, | |||||
"claude", "claude-3-haiku", "claude-3-sonnet", "claude-3-opus", "claude-3-opus-20240229", | |||||
"moonshot-v1-8k", "moonshot-v1-32k", "moonshot-v1-128k", | |||||
LINKAI_35, LINKAI_4_TURBO, LINKAI_4o, | |||||
QWEN, QWEN_TURBO, QWEN_PLUS, QWEN_MAX | |||||
] | |||||
# channel | # channel | ||||
FEISHU = "feishu" | FEISHU = "feishu" | ||||
@@ -17,7 +17,7 @@ available_setting = { | |||||
"open_ai_api_base": "https://api.openai.com/v1", | "open_ai_api_base": "https://api.openai.com/v1", | ||||
"proxy": "", # openai使用的代理 | "proxy": "", # openai使用的代理 | ||||
# chatgpt模型, 当use_azure_chatgpt为true时,其名称为Azure上model deployment名称 | # chatgpt模型, 当use_azure_chatgpt为true时,其名称为Azure上model deployment名称 | ||||
"model": "gpt-3.5-turbo", # 还支持 gpt-4, gpt-4-turbo, wenxin, xunfei, qwen | |||||
"model": "gpt-3.5-turbo", # 支持ChatGPT、Claude、Gemini、文心一言、通义千问、Kimi、讯飞星火、智谱、LinkAI等模型,模型具体名称详见common/const.py文件列出的模型 | |||||
"use_azure_chatgpt": False, # 是否使用azure的chatgpt | "use_azure_chatgpt": False, # 是否使用azure的chatgpt | ||||
"azure_deployment_id": "", # azure 模型部署名称 | "azure_deployment_id": "", # azure 模型部署名称 | ||||
"azure_api_version": "", # azure api版本 | "azure_api_version": "", # azure api版本 | ||||
@@ -83,7 +83,7 @@ available_setting = { | |||||
"qwen_agent_key": "", | "qwen_agent_key": "", | ||||
"qwen_app_id": "", | "qwen_app_id": "", | ||||
"qwen_node_id": "", # 流程编排模型用到的id,如果没有用到qwen_node_id,请务必保持为空字符串 | "qwen_node_id": "", # 流程编排模型用到的id,如果没有用到qwen_node_id,请务必保持为空字符串 | ||||
# 阿里灵积模型api key | |||||
# 阿里灵积(通义新版sdk)模型api key | |||||
"dashscope_api_key": "", | "dashscope_api_key": "", | ||||
# Google Gemini Api Key | # Google Gemini Api Key | ||||
"gemini_api_key": "", | "gemini_api_key": "", | ||||