Merge branch 'master' of github.com:binary-husky/chatgpt_academic
This commit is contained in:
commit
408b8403fe
@ -54,7 +54,7 @@ Latex论文一键校对 | [函数插件] 仿Grammarly对Latex文章进行语法
|
|||||||
⭐ChatGLM2微调模型 | 支持加载ChatGLM2微调模型,提供ChatGLM2微调辅助插件
|
⭐ChatGLM2微调模型 | 支持加载ChatGLM2微调模型,提供ChatGLM2微调辅助插件
|
||||||
更多LLM模型接入,支持[huggingface部署](https://huggingface.co/spaces/qingxu98/gpt-academic) | 加入Newbing接口(新必应),引入清华[Jittorllms](https://github.com/Jittor/JittorLLMs)支持[LLaMA](https://github.com/facebookresearch/llama)和[盘古α](https://openi.org.cn/pangu/)
|
更多LLM模型接入,支持[huggingface部署](https://huggingface.co/spaces/qingxu98/gpt-academic) | 加入Newbing接口(新必应),引入清华[Jittorllms](https://github.com/Jittor/JittorLLMs)支持[LLaMA](https://github.com/facebookresearch/llama)和[盘古α](https://openi.org.cn/pangu/)
|
||||||
⭐[void-terminal](https://github.com/binary-husky/void-terminal) pip包 | 脱离GUI,在Python中直接调用本项目的所有函数插件(开发中)
|
⭐[void-terminal](https://github.com/binary-husky/void-terminal) pip包 | 脱离GUI,在Python中直接调用本项目的所有函数插件(开发中)
|
||||||
⭐虚空终端插件 | 用自然语言,直接调度本项目其他插件
|
⭐虚空终端插件 | [函数插件] 用自然语言,直接调度本项目其他插件
|
||||||
更多新功能展示 (图像生成等) …… | 见本文档结尾处 ……
|
更多新功能展示 (图像生成等) …… | 见本文档结尾处 ……
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -149,11 +149,14 @@ python main.py
|
|||||||
|
|
||||||
### 安装方法II:使用Docker
|
### 安装方法II:使用Docker
|
||||||
|
|
||||||
|
[](https://github.com/binary-husky/gpt_academic/actions/workflows/build-with-audio-assistant.yml)
|
||||||
|
|
||||||
1. 仅ChatGPT(推荐大多数人选择,等价于docker-compose方案1)
|
1. 仅ChatGPT(推荐大多数人选择,等价于docker-compose方案1)
|
||||||
[](https://github.com/binary-husky/gpt_academic/actions/workflows/build-without-local-llms.yml)
|
[](https://github.com/binary-husky/gpt_academic/actions/workflows/build-without-local-llms.yml)
|
||||||
[](https://github.com/binary-husky/gpt_academic/actions/workflows/build-with-latex.yml)
|
[](https://github.com/binary-husky/gpt_academic/actions/workflows/build-with-latex.yml)
|
||||||
[](https://github.com/binary-husky/gpt_academic/actions/workflows/build-with-audio-assistant.yml)
|
[](https://github.com/binary-husky/gpt_academic/actions/workflows/build-with-audio-assistant.yml)
|
||||||
|
|
||||||
|
|
||||||
``` sh
|
``` sh
|
||||||
git clone --depth=1 https://github.com/binary-husky/gpt_academic.git # 下载项目
|
git clone --depth=1 https://github.com/binary-husky/gpt_academic.git # 下载项目
|
||||||
cd gpt_academic # 进入路径
|
cd gpt_academic # 进入路径
|
||||||
@ -252,7 +255,7 @@ Tip:不指定文件直接点击 `载入对话历史存档` 可以查看历史h
|
|||||||
|
|
||||||
3. 虚空终端(从自然语言输入中,理解用户意图+自动调用其他插件)
|
3. 虚空终端(从自然语言输入中,理解用户意图+自动调用其他插件)
|
||||||
|
|
||||||
- 步骤一:输入 “ 请调用插件翻译PDF论文,地址为https://www.nature.com/articles/s41586-019-1724-z.pdf ”
|
- 步骤一:输入 “ 请调用插件翻译PDF论文,地址为https://storage.googleapis.com/deepmind-media/alphago/AlphaGoNaturePaper.pdf ”
|
||||||
- 步骤二:点击“虚空终端”
|
- 步骤二:点击“虚空终端”
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
@ -5,7 +5,7 @@ def check_proxy(proxies):
|
|||||||
try:
|
try:
|
||||||
response = requests.get("https://ipapi.co/json/", proxies=proxies, timeout=4)
|
response = requests.get("https://ipapi.co/json/", proxies=proxies, timeout=4)
|
||||||
data = response.json()
|
data = response.json()
|
||||||
print(f'查询代理的地理位置,返回的结果是{data}')
|
# print(f'查询代理的地理位置,返回的结果是{data}')
|
||||||
if 'country_name' in data:
|
if 'country_name' in data:
|
||||||
country = data['country_name']
|
country = data['country_name']
|
||||||
result = f"代理配置 {proxies_https}, 代理所在地:{country}"
|
result = f"代理配置 {proxies_https}, 代理所在地:{country}"
|
||||||
|
@ -109,7 +109,7 @@ def arxiv_download(chatbot, history, txt):
|
|||||||
|
|
||||||
url_ = txt # https://arxiv.org/abs/1707.06690
|
url_ = txt # https://arxiv.org/abs/1707.06690
|
||||||
if not txt.startswith('https://arxiv.org/abs/'):
|
if not txt.startswith('https://arxiv.org/abs/'):
|
||||||
msg = f"解析arxiv网址失败, 期望格式例如: https://arxiv.org/abs/1707.06690。实际得到格式: {url_}"
|
msg = f"解析arxiv网址失败, 期望格式例如: https://arxiv.org/abs/1707.06690。实际得到格式: {url_}。"
|
||||||
yield from update_ui_lastest_msg(msg, chatbot=chatbot, history=history) # 刷新界面
|
yield from update_ui_lastest_msg(msg, chatbot=chatbot, history=history) # 刷新界面
|
||||||
return msg, None
|
return msg, None
|
||||||
# <-------------- set format ------------->
|
# <-------------- set format ------------->
|
||||||
@ -255,7 +255,7 @@ def Latex翻译中文并重新编译PDF(txt, llm_kwargs, plugin_kwargs, chatbot,
|
|||||||
project_folder = txt
|
project_folder = txt
|
||||||
else:
|
else:
|
||||||
if txt == "": txt = '空空如也的输入栏'
|
if txt == "": txt = '空空如也的输入栏'
|
||||||
report_execption(chatbot, history, a = f"解析项目: {txt}", b = f"找不到本地项目或无权访问: {txt}")
|
report_execption(chatbot, history, a = f"解析项目: {txt}", b = f"找不到本地项目或无法处理: {txt}")
|
||||||
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -593,7 +593,10 @@ def get_files_from_everything(txt, type): # type='.md'
|
|||||||
from toolbox import get_conf
|
from toolbox import get_conf
|
||||||
from toolbox import get_log_folder, gen_time_str
|
from toolbox import get_log_folder, gen_time_str
|
||||||
proxies, = get_conf('proxies')
|
proxies, = get_conf('proxies')
|
||||||
r = requests.get(txt, proxies=proxies)
|
try:
|
||||||
|
r = requests.get(txt, proxies=proxies)
|
||||||
|
except:
|
||||||
|
raise ConnectionRefusedError(f"无法下载资源{txt},请检查。")
|
||||||
path = os.path.join(get_log_folder(plugin_name='web_download'), gen_time_str()+type)
|
path = os.path.join(get_log_folder(plugin_name='web_download'), gen_time_str()+type)
|
||||||
with open(path, 'wb+') as f: f.write(r.content)
|
with open(path, 'wb+') as f: f.write(r.content)
|
||||||
project_folder = get_log_folder(plugin_name='web_download')
|
project_folder = get_log_folder(plugin_name='web_download')
|
||||||
|
@ -20,6 +20,11 @@ def get_avail_grobid_url():
|
|||||||
def parse_pdf(pdf_path, grobid_url):
|
def parse_pdf(pdf_path, grobid_url):
|
||||||
import scipdf # pip install scipdf_parser
|
import scipdf # pip install scipdf_parser
|
||||||
if grobid_url.endswith('/'): grobid_url = grobid_url.rstrip('/')
|
if grobid_url.endswith('/'): grobid_url = grobid_url.rstrip('/')
|
||||||
article_dict = scipdf.parse_pdf_to_dict(pdf_path, grobid_url=grobid_url)
|
try:
|
||||||
|
article_dict = scipdf.parse_pdf_to_dict(pdf_path, grobid_url=grobid_url)
|
||||||
|
except GROBID_OFFLINE_EXCEPTION:
|
||||||
|
raise GROBID_OFFLINE_EXCEPTION("GROBID服务不可用,请修改config中的GROBID_URL,可修改成本地GROBID服务。")
|
||||||
|
except:
|
||||||
|
raise RuntimeError("解析PDF失败,请检查PDF是否损坏。")
|
||||||
return article_dict
|
return article_dict
|
||||||
|
|
||||||
|
@ -24,10 +24,11 @@ def 批量翻译PDF文档(txt, llm_kwargs, plugin_kwargs, chatbot, history, syst
|
|||||||
try:
|
try:
|
||||||
import fitz
|
import fitz
|
||||||
import tiktoken
|
import tiktoken
|
||||||
|
import scipdf
|
||||||
except:
|
except:
|
||||||
report_execption(chatbot, history,
|
report_execption(chatbot, history,
|
||||||
a=f"解析项目: {txt}",
|
a=f"解析项目: {txt}",
|
||||||
b=f"导入软件依赖失败。使用该模块需要额外依赖,安装方法```pip install --upgrade pymupdf tiktoken```。")
|
b=f"导入软件依赖失败。使用该模块需要额外依赖,安装方法```pip install --upgrade pymupdf tiktoken scipdf_parser```。")
|
||||||
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -58,7 +59,6 @@ def 批量翻译PDF文档(txt, llm_kwargs, plugin_kwargs, chatbot, history, syst
|
|||||||
|
|
||||||
def 解析PDF_基于GROBID(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, grobid_url):
|
def 解析PDF_基于GROBID(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, grobid_url):
|
||||||
import copy
|
import copy
|
||||||
import tiktoken
|
|
||||||
TOKEN_LIMIT_PER_FRAGMENT = 1280
|
TOKEN_LIMIT_PER_FRAGMENT = 1280
|
||||||
generated_conclusion_files = []
|
generated_conclusion_files = []
|
||||||
generated_html_files = []
|
generated_html_files = []
|
||||||
@ -66,7 +66,7 @@ def 解析PDF_基于GROBID(file_manifest, project_folder, llm_kwargs, plugin_kwa
|
|||||||
for index, fp in enumerate(file_manifest):
|
for index, fp in enumerate(file_manifest):
|
||||||
chatbot.append(["当前进度:", f"正在连接GROBID服务,请稍候: {grobid_url}\n如果等待时间过长,请修改config中的GROBID_URL,可修改成本地GROBID服务。"]); yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
chatbot.append(["当前进度:", f"正在连接GROBID服务,请稍候: {grobid_url}\n如果等待时间过长,请修改config中的GROBID_URL,可修改成本地GROBID服务。"]); yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
||||||
article_dict = parse_pdf(fp, grobid_url)
|
article_dict = parse_pdf(fp, grobid_url)
|
||||||
print(article_dict)
|
if article_dict is None: raise RuntimeError("解析PDF失败,请检查PDF是否损坏。")
|
||||||
prompt = "以下是一篇学术论文的基本信息:\n"
|
prompt = "以下是一篇学术论文的基本信息:\n"
|
||||||
# title
|
# title
|
||||||
title = article_dict.get('title', '无法获取 title'); prompt += f'title:{title}\n\n'
|
title = article_dict.get('title', '无法获取 title'); prompt += f'title:{title}\n\n'
|
||||||
|
@ -24,12 +24,12 @@ explain_msg = """
|
|||||||
## 虚空终端插件说明:
|
## 虚空终端插件说明:
|
||||||
|
|
||||||
1. 请用**自然语言**描述您需要做什么。例如:
|
1. 请用**自然语言**描述您需要做什么。例如:
|
||||||
- 「请调用插件,为我翻译PDF论文,论文我刚刚放到上传区了。」
|
- 「请调用插件,为我翻译PDF论文,论文我刚刚放到上传区了」
|
||||||
- 「请调用插件翻译PDF论文,地址为https://www.nature.com/articles/s41586-019-1724-z.pdf」
|
- 「请调用插件翻译PDF论文,地址为https://aaa/bbb/ccc.pdf」
|
||||||
- 「生成一张图片,图中鲜花怒放,绿草如茵,用插件实现。」
|
- 「把Arxiv论文翻译成中文PDF,arxiv论文的ID是1812.10695,记得用插件!」
|
||||||
|
- 「生成一张图片,图中鲜花怒放,绿草如茵,用插件实现」
|
||||||
- 「用插件翻译README,Github网址是https://github.com/facebookresearch/co-tracker」
|
- 「用插件翻译README,Github网址是https://github.com/facebookresearch/co-tracker」
|
||||||
- 「给爷翻译Arxiv论文,arxiv论文的ID是1812.10695,记得用插件,不要自己瞎搞!」
|
- 「我不喜欢当前的界面颜色,修改配置,把主题THEME更换为THEME="High-Contrast"」
|
||||||
- 「我不喜欢当前的界面颜色,修改配置,把主题THEME更换为THEME="High-Contrast"。」
|
|
||||||
- 「请问Transformer网络的结构是怎样的?」
|
- 「请问Transformer网络的结构是怎样的?」
|
||||||
|
|
||||||
2. 您可以打开插件下拉菜单以了解本项目的各种能力。
|
2. 您可以打开插件下拉菜单以了解本项目的各种能力。
|
||||||
|
@ -20,4 +20,4 @@ arxiv
|
|||||||
rich
|
rich
|
||||||
pypdf2==2.12.1
|
pypdf2==2.12.1
|
||||||
websocket-client
|
websocket-client
|
||||||
scipdf_parser==0.3
|
scipdf_parser>=0.3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user