Compare commits

...

46 Commits

Author SHA1 Message Date
binary-husky
7894e2f02d renew pip url 2024-02-25 22:15:24 +08:00
binary-husky
9e9bd7aa27 Merge branch 'master' into huggingfacelocal 2024-02-25 22:14:50 +08:00
binary-husky
c534814363 Merge branch 'master' into huggingfacelocal 2024-01-23 15:52:51 +08:00
binary-husky
8a525a4560 ADD_WAIFU 2023-12-27 00:04:53 +08:00
binary-husky
22f58d0953 Toggle dark mode in config.py 2023-12-26 23:58:53 +08:00
binary-husky
59b4345945 Merge branch 'master' into huggingfacelocal 2023-12-26 23:57:23 +08:00
binary-husky
72ba7e9738 Merge branch 'master' into huggingfacelocal 2023-11-29 00:35:20 +08:00
binary-husky
d7f4b07fe4 Merge branch 'master' into huggingfacelocal 2023-11-20 01:17:04 +08:00
binary-husky
df27843e51 Merge branch 'master' into huggingfacelocal 2023-10-06 11:59:18 +08:00
binary-husky
e2fefec2e3 减小Latex容器体积 2023-10-06 11:47:27 +08:00
binary-husky
2bf71bd1a8 Chuanhu-Small-and-Beautiful 2023-09-15 17:30:31 +08:00
binary-husky
6a56fb7477 Merge branch 'master' into huggingfacelocal 2023-09-15 17:19:59 +08:00
binary-husky
a2e7ea748c up 2023-09-09 19:02:51 +08:00
binary-husky
8153c1b49d Merge branch 'master' into huggingfacelocal 2023-09-09 18:54:53 +08:00
binary-husky
2552126744 up 2023-08-28 01:43:45 +08:00
binary-husky
2475163337 Merge branch 'master' into huggingfacelocal 2023-08-28 01:39:20 +08:00
binary-husky
a3bdb69e30 sync 2023-08-16 13:28:44 +08:00
binary-husky
81874b380f qw 2023-08-16 13:01:41 +08:00
binary-husky
96c1852abc Merge branch 'master' into huggingface 2023-06-30 12:09:25 +08:00
binary-husky
cd145c0794 1 2023-06-29 15:04:03 +08:00
binary-husky
7a4d4ad956 Merge branch 'huggingface' of github.com:binary-husky/chatgpt_academic into huggingface 2023-06-29 12:54:24 +08:00
binary-husky
9f9848c6e9 again 2023-06-29 12:54:19 +08:00
binary-husky
94425c49fd again 2023-05-28 21:34:50 +08:00
binary-husky
e874a16050 try again 2023-05-28 21:33:28 +08:00
binary-husky
c28388c5fe load version 2023-05-28 21:32:10 +08:00
binary-husky
b4a56d391b Merge branch 'huggingface' of github.com:binary-husky/chatgpt_academic into huggingface 2023-05-28 21:30:34 +08:00
binary-husky
7075092f86 fix app 2023-05-28 21:30:29 +08:00
binary-husky
1086ff8092 Merge branch 'huggingface' of github.com:binary-husky/chatgpt_academic into huggingface 2023-05-28 21:27:31 +08:00
binary-husky
3a22446b47 try4 2023-05-28 21:27:25 +08:00
binary-husky
7842cf03cc Merge branch 'master' into huggingface 2023-05-28 21:27:20 +08:00
binary-husky
54f55c32f2 213 2023-05-28 21:25:45 +08:00
binary-husky
94318ff0a2 try3 2023-05-28 21:24:46 +08:00
binary-husky
5be6b83762 try2 2023-05-28 21:24:02 +08:00
binary-husky
6f18d1716e Merge branch 'master' into huggingface 2023-05-28 21:21:12 +08:00
binary-husky
90944bd744 up 2023-05-25 15:04:53 +08:00
binary-husky
752937cb70 Merge branch 'master' into huggingface 2023-05-25 15:01:30 +08:00
binary-husky
c584cbac5b fix ver 2023-05-19 14:08:47 +08:00
binary-husky
309d12b404 Merge branch 'master' into huggingface 2023-05-19 14:05:23 +08:00
binary-husky
52ea0acd61 Merge branch 'master' into huggingface 2023-05-06 23:06:53 +08:00
binary-husky
9f5e3e0fd5 Merge branch 'master' into huggingface 2023-05-05 18:24:36 +08:00
binary-husky
315e78e5d9 Merge branch 'master' into huggingface 2023-04-29 03:53:32 +08:00
binary-husky
b6b4ba684a Merge branch 'master' into huggingface 2023-04-24 18:32:56 +08:00
binary-husky
2281a5ca7f 修改提示 2023-04-24 12:55:53 +08:00
binary-husky
49558686f2 Merge branch 'master' into huggingface 2023-04-24 12:30:59 +08:00
Your Name
b050ccedb5 Merge branch 'master' into huggingface 2023-04-21 18:48:00 +08:00
Your Name
ae56cab6f4 huggingface 2023-04-19 18:07:32 +08:00
5 changed files with 64 additions and 19 deletions

View File

@@ -1,8 +1,20 @@
> [!IMPORTANT] ---
> 2024.1.18: 更新3.70版本支持Mermaid绘图库让大模型绘制脑图 title: GPT-Academic
> 2024.1.17: 恭迎GLM4全力支持Qwen、GLM、DeepseekCoder等国内中文大语言基座模型 emoji: 😻
> 2024.1.17: 某些依赖包尚不兼容python 3.12推荐python 3.11。 colorFrom: blue
> 2024.1.17: 安装依赖时,请选择`requirements.txt`中**指定的版本**。 安装命令:`pip install -r requirements.txt`。本项目完全开源免费,您可通过订阅[在线服务](https://github.com/binary-husky/gpt_academic/wiki/online)的方式鼓励本项目的发展。 colorTo: blue
sdk: gradio
sdk_version: 3.32.0
app_file: app.py
pinned: false
---
# ChatGPT 学术优化
> **Note**
>
> 2023.11.12: 某些依赖包尚不兼容python 3.12推荐python 3.11。
>
> 2023.12.26: 安装依赖时,请选择`requirements.txt`中**指定的版本**。 安装命令:`pip install -r requirements.txt`。本项目完全开源免费,您可通过订阅[在线服务](https://github.com/binary-husky/gpt_academic/wiki/online)的方式鼓励本项目的发展。
<br> <br>

View File

@@ -14,6 +14,8 @@ help_menu_description = \
</br></br>如何临时更换API_KEY: 在输入区输入临时API_KEY后提交网页刷新后失效""" </br></br>如何临时更换API_KEY: 在输入区输入临时API_KEY后提交网页刷新后失效"""
def main(): def main():
import subprocess, sys
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'https://public.agent-matrix.com/publish/gradio-3.32.8-py3-none-any.whl'])
import gradio as gr import gradio as gr
if gr.__version__ not in ['3.32.8']: if gr.__version__ not in ['3.32.8']:
raise ModuleNotFoundError("使用项目内置Gradio获取最优体验! 请运行 `pip install -r requirements.txt` 指令安装内置Gradio及其他依赖, 详情信息见requirements.txt.") raise ModuleNotFoundError("使用项目内置Gradio获取最优体验! 请运行 `pip install -r requirements.txt` 指令安装内置Gradio及其他依赖, 详情信息见requirements.txt.")
@@ -76,6 +78,7 @@ def main():
predefined_btns = {} predefined_btns = {}
with gr.Blocks(title="GPT 学术优化", theme=set_theme, analytics_enabled=False, css=advanced_css) as demo: with gr.Blocks(title="GPT 学术优化", theme=set_theme, analytics_enabled=False, css=advanced_css) as demo:
gr.HTML(title_html) gr.HTML(title_html)
gr.HTML('''<center><a href="https://huggingface.co/spaces/qingxu98/gpt-academic?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>请您打开此页面后务必点击上方的“复制空间”Duplicate Space按钮<font color="#FF00FF">使用时先在输入框填入API-KEY然后回车。</font><br/>切忌在“复制空间”Duplicate Space之前填入API_KEY或进行提问否则您的API_KEY将极可能被空间所有者攫取<br/>支持任意数量的OpenAI的密钥和API2D的密钥共存例如输入"OpenAI密钥1,API2D密钥2",然后提交,即可同时使用两种模型接口。</center>''')
secret_css, dark_mode, py_pickle_cookie = gr.Textbox(visible=False), gr.Textbox(DARK_MODE, visible=False), gr.Textbox(visible=False) secret_css, dark_mode, py_pickle_cookie = gr.Textbox(visible=False), gr.Textbox(DARK_MODE, visible=False), gr.Textbox(visible=False)
cookies = gr.State(load_chat_cookies()) cookies = gr.State(load_chat_cookies())
with gr_L1(): with gr_L1():
@@ -86,7 +89,7 @@ def main():
with gr_L2(scale=1, elem_id="gpt-panel"): with gr_L2(scale=1, elem_id="gpt-panel"):
with gr.Accordion("输入区", open=True, elem_id="input-panel") as area_input_primary: with gr.Accordion("输入区", open=True, elem_id="input-panel") as area_input_primary:
with gr.Row(): with gr.Row():
txt = gr.Textbox(show_label=False, placeholder="Input question here.", elem_id='user_input_main').style(container=False) txt = gr.Textbox(show_label=False, lines=2, placeholder="输入问题或API密钥输入多个密钥时用英文逗号间隔。支持多个OpenAI密钥共存。").style(container=False)
with gr.Row(): with gr.Row():
submitBtn = gr.Button("提交", elem_id="elem_submit", variant="primary") submitBtn = gr.Button("提交", elem_id="elem_submit", variant="primary")
with gr.Row(): with gr.Row():
@@ -393,16 +396,8 @@ def main():
threading.Thread(target=warm_up_mods, name="warm-up", daemon=True).start() # 预热tiktoken模块 threading.Thread(target=warm_up_mods, name="warm-up", daemon=True).start() # 预热tiktoken模块
run_delayed_tasks() run_delayed_tasks()
demo.queue(concurrency_count=CONCURRENT_COUNT).launch( demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", share=False, favicon_path="docs/logo.png", blocked_paths=["config.py","config_private.py","docker-compose.yml","Dockerfile"])
quiet=True,
server_name="0.0.0.0",
ssl_keyfile=None if SSL_KEYFILE == "" else SSL_KEYFILE,
ssl_certfile=None if SSL_CERTFILE == "" else SSL_CERTFILE,
ssl_verify=False,
server_port=PORT,
favicon_path=os.path.join(os.path.dirname(__file__), "docs/logo.png"),
auth=AUTHENTICATION if len(AUTHENTICATION) != 0 else None,
blocked_paths=["config.py","config_private.py","docker-compose.yml","Dockerfile",f"{PATH_LOGGING}/admin"])
# 如果需要在二级路径下运行 # 如果需要在二级路径下运行
# CUSTOM_PATH = get_conf('CUSTOM_PATH') # CUSTOM_PATH = get_conf('CUSTOM_PATH')

View File

@@ -11,6 +11,10 @@
API_KEY = "此处填API密钥" # 可同时填写多个API-KEY用英文逗号分割例如API_KEY = "sk-openaikey1,sk-openaikey2,fkxxxx-api2dkey3,azure-apikey4" API_KEY = "此处填API密钥" # 可同时填写多个API-KEY用英文逗号分割例如API_KEY = "sk-openaikey1,sk-openaikey2,fkxxxx-api2dkey3,azure-apikey4"
# [step 1]>> API_KEY = "sk-123456789xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx123456789"。极少数情况下还需要填写组织格式如org-123456789abcdefghijklmno的请向下翻找 API_ORG 设置项
API_KEY = "此处填API密钥" # 可同时填写多个API-KEY用英文逗号分割例如API_KEY = "sk-openaikey1,sk-openaikey2,fkxxxx-api2dkey3,azure-apikey4"
# [step 2]>> 改为True应用代理如果直接在海外服务器部署此处不修改如果使用本地或无地域限制的大模型时此处也不需要修改 # [step 2]>> 改为True应用代理如果直接在海外服务器部署此处不修改如果使用本地或无地域限制的大模型时此处也不需要修改
USE_PROXY = False USE_PROXY = False
if USE_PROXY: if USE_PROXY:
@@ -45,7 +49,7 @@ DEFAULT_WORKER_NUM = 3
# 色彩主题, 可选 ["Default", "Chuanhu-Small-and-Beautiful", "High-Contrast"] # 色彩主题, 可选 ["Default", "Chuanhu-Small-and-Beautiful", "High-Contrast"]
# 更多主题, 请查阅Gradio主题商店: https://huggingface.co/spaces/gradio/theme-gallery 可选 ["Gstaff/Xkcd", "NoCrypt/Miku", ...] # 更多主题, 请查阅Gradio主题商店: https://huggingface.co/spaces/gradio/theme-gallery 可选 ["Gstaff/Xkcd", "NoCrypt/Miku", ...]
THEME = "Default" THEME = "Chuanhu-Small-and-Beautiful"
AVAIL_THEMES = ["Default", "Chuanhu-Small-and-Beautiful", "High-Contrast", "Gstaff/Xkcd", "NoCrypt/Miku"] AVAIL_THEMES = ["Default", "Chuanhu-Small-and-Beautiful", "High-Contrast", "Gstaff/Xkcd", "NoCrypt/Miku"]
@@ -66,7 +70,7 @@ LAYOUT = "LEFT-RIGHT" # "LEFT-RIGHT"(左右布局) # "TOP-DOWN"(上下
# 暗色模式 / 亮色模式 # 暗色模式 / 亮色模式
DARK_MODE = True DARK_MODE = False
# 发送请求到OpenAI后等待多久判定为超时 # 发送请求到OpenAI后等待多久判定为超时
@@ -80,6 +84,9 @@ WEB_PORT = -1
# 如果OpenAI不响应网络卡顿、代理失败、KEY失效重试的次数限制 # 如果OpenAI不响应网络卡顿、代理失败、KEY失效重试的次数限制
MAX_RETRY = 2 MAX_RETRY = 2
# OpenAI模型选择是gpt4现在只对申请成功的人开放
LLM_MODEL = "gpt-3.5-turbo" # 可选 "chatglm"
AVAIL_LLM_MODELS = ["gpt-3.5-turbo", "gpt-4", "api2d-gpt-4", "api2d-gpt-3.5-turbo", "spark", "azure-gpt-3.5"]
# 插件分类默认选项 # 插件分类默认选项
DEFAULT_FN_GROUPS = ['对话', '编程', '学术', '智能体'] DEFAULT_FN_GROUPS = ['对话', '编程', '学术', '智能体']
@@ -136,7 +143,7 @@ AUTO_CLEAR_TXT = False
# 加一个live2d装饰 # 加一个live2d装饰
ADD_WAIFU = False ADD_WAIFU = True
# 设置用户名和密码不需要修改相关功能不稳定与gradio版本和网络都相关如果本地使用不建议加这个 # 设置用户名和密码不需要修改相关功能不稳定与gradio版本和网络都相关如果本地使用不建议加这个

View File

@@ -0,0 +1,28 @@
# encoding: utf-8
# @Time : 2023/4/19
# @Author : Spike
# @Descr :
from toolbox import update_ui
from toolbox import CatchException, report_execption, write_results_to_file
from crazy_functions.crazy_utils import request_gpt_model_in_new_thread_with_ui_alive
@CatchException
def 猜你想问(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, web_port):
if txt:
show_say = txt
prompt = txt+'\n回答完问题后,再列出用户可能提出的三个问题。'
else:
prompt = history[-1]+"\n分析上述回答,再列出用户可能提出的三个问题。"
show_say = '分析上述回答,再列出用户可能提出的三个问题。'
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(
inputs=prompt,
inputs_show_user=show_say,
llm_kwargs=llm_kwargs,
chatbot=chatbot,
history=history,
sys_prompt=system_prompt
)
chatbot[-1] = (show_say, gpt_say)
history.extend([show_say, gpt_say])
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面

View File

@@ -10,6 +10,9 @@ ENV PATH "$PATH:/usr/local/texlive/2024/bin/x86_64-linux"
ENV PATH "$PATH:/usr/local/texlive/2025/bin/x86_64-linux" ENV PATH "$PATH:/usr/local/texlive/2025/bin/x86_64-linux"
ENV PATH "$PATH:/usr/local/texlive/2026/bin/x86_64-linux" ENV PATH "$PATH:/usr/local/texlive/2026/bin/x86_64-linux"
# 删除文档文件以节约空间
RUN rm -rf /usr/local/texlive/2023/texmf-dist/doc
# 指定路径 # 指定路径
WORKDIR /gpt WORKDIR /gpt