mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-07-20 21:57:14 +08:00
fix: file size calc bug
This commit is contained in:
@@ -28,7 +28,7 @@ Demo made by [Visionn](https://www.wangpc.cc/)
|
|||||||
|
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
>**2023.09.01:** 增加 [企微个人号](https://github.com/zhayujie/chatgpt-on-wechat/pull/1385) 通道,[claude](https://github.com/zhayujie/chatgpt-on-wechat/pull/1382) 模型
|
>**2023.09.26:** 插件增加 文件/文章链接 一键总结和对话的功能,使用参考:插件说明
|
||||||
|
|
||||||
>**2023.08.08:** 接入百度文心一言模型,通过 [插件](https://github.com/zhayujie/chatgpt-on-wechat/tree/master/plugins/linkai) 支持 Midjourney 绘图
|
>**2023.08.08:** 接入百度文心一言模型,通过 [插件](https://github.com/zhayujie/chatgpt-on-wechat/tree/master/plugins/linkai) 支持 Midjourney 绘图
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
"summary": {
|
"summary": {
|
||||||
"enabled": true, # 文档总结和对话功能开关
|
"enabled": true, # 文档总结和对话功能开关
|
||||||
"group_enabled": true, # 是否支持群聊开启
|
"group_enabled": true, # 是否支持群聊开启
|
||||||
"max_file_size": 10000 # 文件的大小限制,单位KB,默认为10M,超过该大小直接忽略
|
"max_file_size": 5000 # 文件的大小限制,单位KB,默认为5M,超过该大小直接忽略
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -14,6 +14,6 @@
|
|||||||
"summary": {
|
"summary": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"group_enabled": true,
|
"group_enabled": true,
|
||||||
"max_file_size": 15000
|
"max_file_size": 5000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class LinkSummary:
|
|||||||
"file": open(file_path, "rb"),
|
"file": open(file_path, "rb"),
|
||||||
"name": file_path.split("/")[-1],
|
"name": file_path.split("/")[-1],
|
||||||
}
|
}
|
||||||
res = requests.post(url=self.base_url() + "/v1/summary/file", headers=self.headers(), files=file_body, timeout=(5, 180))
|
res = requests.post(url=self.base_url() + "/v1/summary/file", headers=self.headers(), files=file_body, timeout=(5, 300))
|
||||||
return self._parse_summary_res(res)
|
return self._parse_summary_res(res)
|
||||||
|
|
||||||
def summary_url(self, url: str):
|
def summary_url(self, url: str):
|
||||||
@@ -68,7 +68,7 @@ class LinkSummary:
|
|||||||
|
|
||||||
if (sum_config.get("max_file_size") and file_size > sum_config.get("max_file_size")) or file_size > 15000:
|
if (sum_config.get("max_file_size") and file_size > sum_config.get("max_file_size")) or file_size > 15000:
|
||||||
logger.warn(f"[LinkSum] file size exceeds limit, No processing, file_size={file_size}KB")
|
logger.warn(f"[LinkSum] file size exceeds limit, No processing, file_size={file_size}KB")
|
||||||
return True
|
return False
|
||||||
|
|
||||||
suffix = file_path.split(".")[-1]
|
suffix = file_path.split(".")[-1]
|
||||||
support_list = ["txt", "csv", "docx", "pdf", "md"]
|
support_list = ["txt", "csv", "docx", "pdf", "md"]
|
||||||
|
|||||||
Reference in New Issue
Block a user