mirror of
https://github.com/d0zingcat/MoviePilot-Plugins.git
synced 2026-05-13 23:16:47 +00:00
fix ChatGPT
This commit is contained in:
@@ -91,12 +91,12 @@
|
||||
"name": "ChatGPT",
|
||||
"description": "消息交互支持与ChatGPT对话。",
|
||||
"labels": "消息通知,识别",
|
||||
"version": "2.0.2",
|
||||
"version": "2.1.0",
|
||||
"icon": "Chatgpt_A.png",
|
||||
"author": "jxxghp",
|
||||
"level": 1,
|
||||
"history": {
|
||||
"v2.0.2": "调整辅助识别提示词",
|
||||
"v2.1.0": "优化辅助识别提示词",
|
||||
"v2.0.1": "修复辅助识别",
|
||||
"v2.0": "适配MoviePilot V2 版本,采用链式事件机制"
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class ChatGPT(_PluginBase):
|
||||
# 插件图标
|
||||
plugin_icon = "Chatgpt_A.png"
|
||||
# 插件版本
|
||||
plugin_version = "2.0.2"
|
||||
plugin_version = "2.1.0"
|
||||
# 插件作者
|
||||
plugin_author = "jxxghp"
|
||||
# 作者主页
|
||||
@@ -247,7 +247,7 @@ class ChatGPT(_PluginBase):
|
||||
# 调用ChatGPT
|
||||
response = self.openai.get_media_name(filename=title)
|
||||
logger.info(f"ChatGPT返回结果:{response}")
|
||||
if response:
|
||||
if response and response.get("name"):
|
||||
event.event_data = {
|
||||
'title': title,
|
||||
'name': response.get("name"),
|
||||
@@ -255,8 +255,6 @@ class ChatGPT(_PluginBase):
|
||||
'season': response.get("season"),
|
||||
'episode': response.get("episode")
|
||||
}
|
||||
else:
|
||||
event.event_data = {}
|
||||
|
||||
def stop_service(self):
|
||||
"""
|
||||
|
||||
@@ -121,15 +121,15 @@ class OpenAi:
|
||||
return None
|
||||
result = ""
|
||||
try:
|
||||
_filename_prompt = "I will give you a movie/tvshow file name.You need to return a Json." \
|
||||
"\nPay attention to the correct identification of the film name." \
|
||||
"\n{\"name\":string,\"version\":string,\"part\":string,\"year\":string,\"resolution\":string,\"season\":number|null,\"episode\":number|null}"
|
||||
_filename_prompt = '接下来我会给你一个电影或电视剧的文件名,你需要识别文件名中的名称、版本、分段、年份、分瓣率、季集等信息,并按以下JSON格式返回:{"name":string,"version":string,"part":string,"year":string,"resolution":string,"season":number|null,"episode":number|null},特别注意返回结果需要严格附合JSON格式,不需要有任何其它的字符。'
|
||||
completion = self.__get_model(prompt=_filename_prompt, message=filename)
|
||||
result = completion.choices[0].message.content
|
||||
return json.loads(result)
|
||||
except Exception as e:
|
||||
print(f"{str(e)}:{result}")
|
||||
return {}
|
||||
return {
|
||||
"content": result,
|
||||
"errorMsg": str(e)
|
||||
}
|
||||
|
||||
def get_response(self, text: str, userid: str):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user