Merge pull request #687 from Origin1699/default

This commit is contained in:
jxxghp
2025-02-20 17:48:49 +08:00
committed by GitHub
6 changed files with 55 additions and 10 deletions

View File

@@ -260,7 +260,7 @@
"name": "ChatGPT",
"description": "消息交互支持与ChatGPT对话。",
"labels": "消息通知,识别",
"version": "1.3",
"version": "1.3.1",
"icon": "Chatgpt_A.png",
"author": "jxxghp",
"level": 1

View File

@@ -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 版本,采用链式事件机制"

View File

@@ -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": "",

View File

@@ -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")

View File

@@ -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": "",

View File

@@ -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")