diff --git a/package.json b/package.json index 84575f9..24385c7 100644 --- a/package.json +++ b/package.json @@ -260,7 +260,7 @@ "name": "ChatGPT", "description": "消息交互支持与ChatGPT对话。", "labels": "消息通知,识别", - "version": "1.3", + "version": "1.3.1", "icon": "Chatgpt_A.png", "author": "jxxghp", "level": 1 diff --git a/package.v2.json b/package.v2.json index 4f245aa..7b6de8e 100644 --- a/package.v2.json +++ b/package.v2.json @@ -91,11 +91,12 @@ "name": "ChatGPT", "description": "消息交互支持与ChatGPT对话。", "labels": "消息通知,识别", - "version": "2.1.0", + "version": "2.1.1", "icon": "Chatgpt_A.png", "author": "jxxghp", "level": 1, "history": { + "v2.1.1": "兼容/v1后仍有路径的接口", "v2.1.0": "优化辅助识别提示词", "v2.0.1": "修复辅助识别", "v2.0": "适配MoviePilot V2 版本,采用链式事件机制" diff --git a/plugins.v2/chatgpt/__init__.py b/plugins.v2/chatgpt/__init__.py index aaf1a45..dde6567 100644 --- a/plugins.v2/chatgpt/__init__.py +++ b/plugins.v2/chatgpt/__init__.py @@ -16,7 +16,7 @@ class ChatGPT(_PluginBase): # 插件图标 plugin_icon = "Chatgpt_A.png" # 插件版本 - plugin_version = "2.1.0" + plugin_version = "2.1.1" # 插件作者 plugin_author = "jxxghp" # 作者主页 @@ -32,6 +32,7 @@ class ChatGPT(_PluginBase): openai = None _enabled = False _proxy = False + _compatible = False _recognize = False _openai_url = None _openai_key = None @@ -41,6 +42,7 @@ class ChatGPT(_PluginBase): if config: self._enabled = config.get("enabled") self._proxy = config.get("proxy") + self._compatible = config.get("compatible") self._recognize = config.get("recognize") self._openai_url = config.get("openai_url") self._openai_key = config.get("openai_key") @@ -48,7 +50,7 @@ class ChatGPT(_PluginBase): if self._openai_url and self._openai_key: self.openai = OpenAi(api_key=self._openai_key, api_url=self._openai_url, proxy=settings.PROXY if self._proxy else None, - model=self._model) + model=self._model, compatible=bool(self._compatible) def get_state(self) -> bool: return self._enabled @@ -103,6 +105,22 @@ class ChatGPT(_PluginBase): } ] }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 4 + }, + 'content': [ + { + 'component': 'VSwitch', + 'props': { + 'model': 'compatible', + 'label': '兼容模式', + } + } + ] + }, { 'component': 'VCol', 'props': { @@ -203,6 +221,7 @@ class ChatGPT(_PluginBase): ], { "enabled": False, "proxy": False, + "compatible": False, "recognize": False, "openai_url": "https://api.openai.com", "openai_key": "", diff --git a/plugins.v2/chatgpt/openai.py b/plugins.v2/chatgpt/openai.py index 0703036..139ecc9 100644 --- a/plugins.v2/chatgpt/openai.py +++ b/plugins.v2/chatgpt/openai.py @@ -13,10 +13,13 @@ class OpenAi: _api_url: str = None _model: str = "gpt-3.5-turbo" - def __init__(self, api_key: str = None, api_url: str = None, proxy: dict = None, model: str = None): + def __init__(self, api_key: str = None, api_url: str = None, proxy: dict = None, model: str = None, compatible: bool = False): self._api_key = api_key self._api_url = api_url - openai.api_base = self._api_url + "/v1" + if compatible: + openai.api_base = self._api_url + else: + openai.api_base = self._api_url + "/v1" openai.api_key = self._api_key if proxy and proxy.get("https"): openai.proxy = proxy.get("https") diff --git a/plugins/chatgpt/__init__.py b/plugins/chatgpt/__init__.py index 52d3560..d9ed4e8 100644 --- a/plugins/chatgpt/__init__.py +++ b/plugins/chatgpt/__init__.py @@ -16,7 +16,7 @@ class ChatGPT(_PluginBase): # 插件图标 plugin_icon = "Chatgpt_A.png" # 插件版本 - plugin_version = "1.3" + plugin_version = "1.3.1" # 插件作者 plugin_author = "jxxghp" # 作者主页 @@ -32,6 +32,7 @@ class ChatGPT(_PluginBase): openai = None _enabled = False _proxy = False + _compatible = False _recognize = False _openai_url = None _openai_key = None @@ -41,6 +42,7 @@ class ChatGPT(_PluginBase): if config: self._enabled = config.get("enabled") self._proxy = config.get("proxy") + self._compatible = config.get("compatible") self._recognize = config.get("recognize") self._openai_url = config.get("openai_url") self._openai_key = config.get("openai_key") @@ -48,7 +50,7 @@ class ChatGPT(_PluginBase): if self._openai_url and self._openai_key: self.openai = OpenAi(api_key=self._openai_key, api_url=self._openai_url, proxy=settings.PROXY if self._proxy else None, - model=self._model) + model=self._model, compatible=bool(self._compatible)) def get_state(self) -> bool: return self._enabled @@ -103,6 +105,22 @@ class ChatGPT(_PluginBase): } ] }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 4 + }, + 'content': [ + { + 'component': 'VSwitch', + 'props': { + 'model': 'compatible', + 'label': '兼容模式', + } + } + ] + }, { 'component': 'VCol', 'props': { @@ -203,6 +221,7 @@ class ChatGPT(_PluginBase): ], { "enabled": False, "proxy": False, + "compatible": False, "recognize": False, "openai_url": "https://api.openai.com", "openai_key": "", diff --git a/plugins/chatgpt/openai.py b/plugins/chatgpt/openai.py index 937ecea..f0d3d61 100644 --- a/plugins/chatgpt/openai.py +++ b/plugins/chatgpt/openai.py @@ -13,10 +13,13 @@ class OpenAi: _api_url: str = None _model: str = "gpt-3.5-turbo" - def __init__(self, api_key: str = None, api_url: str = None, proxy: dict = None, model: str = None): + def __init__(self, api_key: str = None, api_url: str = None, proxy: dict = None, model: str = None, compatible: bool = False): self._api_key = api_key self._api_url = api_url - openai.api_base = self._api_url + "/v1" + if compatible: + openai.api_base = self._api_url + else: + openai.api_base = self._api_url + "/v1" openai.api_key = self._api_key if proxy and proxy.get("https"): openai.proxy = proxy.get("https")