mirror of
https://github.com/BoardWare-Genius/jarvis-models.git
synced 2025-12-14 17:13:25 +00:00
new branch
This commit is contained in:
@ -5,13 +5,17 @@ from fastapi.responses import JSONResponse
|
||||
from .blackbox import Blackbox
|
||||
|
||||
from ..utils import chroma_setting
|
||||
from .fastchat import Fastchat
|
||||
from .chroma_query import ChromaQuery
|
||||
|
||||
DEFAULT_COLLECTION_ID = "123"
|
||||
|
||||
from injector import singleton
|
||||
from injector import singleton,inject
|
||||
@singleton
|
||||
class ChromaChat(Blackbox):
|
||||
|
||||
def __init__(self, fastchat, chroma_query):
|
||||
@inject
|
||||
def __init__(self, fastchat: Fastchat, chroma_query: ChromaQuery):
|
||||
self.fastchat = fastchat
|
||||
self.chroma_query = chroma_query
|
||||
|
||||
@ -29,11 +33,13 @@ class ChromaChat(Blackbox):
|
||||
collection_id = DEFAULT_COLLECTION_ID
|
||||
else:
|
||||
collection_id = setting.ChromaSetting.collection_ids[0]
|
||||
print("collection_id: ",collection_id)
|
||||
# query it
|
||||
chroma_result = self.chroma_query(question, collection_id)
|
||||
print("chroma_result: ",type(chroma_result),chroma_result)
|
||||
|
||||
fast_question = "问题: "+ question + "。根据问题,总结以下内容:" + chroma_result
|
||||
response = self.fastchat(fast_question)
|
||||
fast_question = "问题: "+ question + "。根据问题,总结以下内容和来源:" + chroma_result
|
||||
response = self.fastchat(model_name="Qwen1.5-14B-Chat", prompt=fast_question, template='回答限制50字', context=None)
|
||||
|
||||
return response
|
||||
|
||||
|
||||
Reference in New Issue
Block a user