diff --git a/app.py b/app.py index 3a459b2..be657de 100644 --- a/app.py +++ b/app.py @@ -19,7 +19,7 @@ # 修改成自己的配置!!! app_config = ApplicationConfig() app_config.docs_path = "./docs/" -app_config.llm_model_path = "/data/users/searchgpt/pretrained_models/chatglm3-6b/" +app_config.llm_model_path = "/data/users/searchgpt/pretrained_models/glm-4-9b-chat" retriever_config = DenseRetrieverConfig( model_name_or_path="/data/users/searchgpt/pretrained_models/bge-large-zh-v1.5", @@ -174,7 +174,7 @@ def predict(input, # ) with gr.Column(scale=4): with gr.Row(): - chatbot = gr.Chatbot(label='Gomate Application').style(height=400) + chatbot = gr.Chatbot(label='Gomate Application').style(height=650) with gr.Row(): message = gr.Textbox(label='请输入问题') with gr.Row(): diff --git a/gomate/applications/rag.py b/gomate/applications/rag.py index 99dd5e5..4d093ed 100644 --- a/gomate/applications/rag.py +++ b/gomate/applications/rag.py @@ -13,7 +13,7 @@ from gomate.modules.generator.llm import GLMChat from gomate.modules.reranker.bge_reranker import BgeReranker from gomate.modules.retrieval.dense_retriever import DenseRetriever - +from gomate.modules.citation.match_citation import MatchCitation class ApplicationConfig(): def __init__(self): @@ -28,7 +28,7 @@ def __init__(self, config): self.retriever = DenseRetriever(self.config.retriever_config) self.reranker = BgeReranker(self.config.rerank_config) self.llm = GLMChat(self.config.llm_model_path) - + self.mc=MatchCitation() def init_vector_store(self): """ @@ -57,4 +57,10 @@ def chat(self, question: str = '', top_k: int = 5): content = '\n'.join([content['text'] for content in contents]) print(contents) response, history = self.llm.chat(question, [], content) - return response, history, contents + result = self.mc.ground_response( + response=response, + evidences=[content['text'] for content in contents], + selected_idx=[idx for idx in range(len(contents))], + markdown=True + ) + return result, history, contents diff --git a/resources/demo.png b/resources/demo.png index 79a295b..a316f63 100644 Binary files a/resources/demo.png and b/resources/demo.png differ