mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-02-09 00:25:46 +08:00
update configs.__init__, webui.py and api.py
This commit is contained in:
parent
4278d1e000
commit
52837429d2
@ -1,2 +1,4 @@
|
|||||||
from .model_config import *
|
from .model_config import *
|
||||||
from .server_config import *
|
from .server_config import *
|
||||||
|
|
||||||
|
VERSION = "v0.2.1-preview"
|
||||||
|
|||||||
@ -6,6 +6,7 @@ sys.path.append(os.path.dirname(os.path.dirname(__file__)))
|
|||||||
|
|
||||||
from configs.model_config import NLTK_DATA_PATH
|
from configs.model_config import NLTK_DATA_PATH
|
||||||
from configs.server_config import OPEN_CROSS_DOMAIN
|
from configs.server_config import OPEN_CROSS_DOMAIN
|
||||||
|
from configs import VERSION
|
||||||
import argparse
|
import argparse
|
||||||
import uvicorn
|
import uvicorn
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
@ -19,7 +20,6 @@ from server.knowledge_base.kb_doc_api import (list_docs, upload_doc, delete_doc,
|
|||||||
from server.utils import BaseResponse, ListResponse, FastAPI, MakeFastAPIOffline
|
from server.utils import BaseResponse, ListResponse, FastAPI, MakeFastAPIOffline
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
|
||||||
nltk.data.path = [NLTK_DATA_PATH] + nltk.data.path
|
nltk.data.path = [NLTK_DATA_PATH] + nltk.data.path
|
||||||
|
|
||||||
|
|
||||||
@ -28,7 +28,10 @@ async def document():
|
|||||||
|
|
||||||
|
|
||||||
def create_app():
|
def create_app():
|
||||||
app = FastAPI(title="Langchain-Chatchat API Server")
|
app = FastAPI(
|
||||||
|
title="Langchain-Chatchat API Server",
|
||||||
|
version=VERSION
|
||||||
|
)
|
||||||
MakeFastAPIOffline(app)
|
MakeFastAPIOffline(app)
|
||||||
# Add CORS middleware to allow all origins
|
# Add CORS middleware to allow all origins
|
||||||
# 在config.py中设置OPEN_DOMAIN=True,允许跨域
|
# 在config.py中设置OPEN_DOMAIN=True,允许跨域
|
||||||
|
|||||||
10
webui.py
10
webui.py
@ -9,6 +9,7 @@ from webui_pages.utils import *
|
|||||||
from streamlit_option_menu import option_menu
|
from streamlit_option_menu import option_menu
|
||||||
from webui_pages import *
|
from webui_pages import *
|
||||||
import os
|
import os
|
||||||
|
from configs import VERSION
|
||||||
|
|
||||||
api = ApiRequest(base_url="http://127.0.0.1:7861", no_remote_api=False)
|
api = ApiRequest(base_url="http://127.0.0.1:7861", no_remote_api=False)
|
||||||
|
|
||||||
@ -17,6 +18,11 @@ if __name__ == "__main__":
|
|||||||
"Langchain-Chatchat WebUI",
|
"Langchain-Chatchat WebUI",
|
||||||
os.path.join("img", "chatchat_icon_blue_square_v2.png"),
|
os.path.join("img", "chatchat_icon_blue_square_v2.png"),
|
||||||
initial_sidebar_state="expanded",
|
initial_sidebar_state="expanded",
|
||||||
|
menu_items={
|
||||||
|
'Get Help': 'https://github.com/chatchat-space/Langchain-Chatchat',
|
||||||
|
'Report a bug': "https://github.com/chatchat-space/Langchain-Chatchat/issues",
|
||||||
|
'About': f"""欢迎使用 Langchain-Chatchat WebUI {VERSION}!"""
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
if not chat_box.chat_inited:
|
if not chat_box.chat_inited:
|
||||||
@ -44,6 +50,10 @@ if __name__ == "__main__":
|
|||||||
),
|
),
|
||||||
use_column_width=True
|
use_column_width=True
|
||||||
)
|
)
|
||||||
|
st.caption(
|
||||||
|
f"""<p align="right">当前版本:{VERSION}</p>""",
|
||||||
|
unsafe_allow_html=True,
|
||||||
|
)
|
||||||
options = list(pages)
|
options = list(pages)
|
||||||
icons = [x["icon"] for x in pages.values()]
|
icons = [x["icon"] for x in pages.values()]
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user