mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-12 13:42:23 +00:00
fix: support bard in chatdb
support bard proxy llm in chatdb
This commit is contained in:
parent
c4638bfde3
commit
ca50e87b8f
@ -31,7 +31,11 @@ def bard_generate_stream(model, tokenizer, params, device, context_len=2048):
|
|||||||
history.remove(last_user_input)
|
history.remove(last_user_input)
|
||||||
history.append(last_user_input)
|
history.append(last_user_input)
|
||||||
|
|
||||||
response = bardapi.core.Bard(token).get_answer(last_user_input["content"])
|
msgs = []
|
||||||
|
for msg in history:
|
||||||
|
if msg.get("content"):
|
||||||
|
msgs.append(msg["content"])
|
||||||
|
response = bardapi.core.Bard(token).get_answer("\n".join(msgs))
|
||||||
if response is not None and response.get("content") is not None:
|
if response is not None and response.get("content") is not None:
|
||||||
yield str(response["content"])
|
yield str(response["content"])
|
||||||
else:
|
else:
|
||||||
|
@ -38,7 +38,7 @@ class ChatDashboard(BaseChat):
|
|||||||
current_user_input=user_input,
|
current_user_input=user_input,
|
||||||
)
|
)
|
||||||
if not db_name:
|
if not db_name:
|
||||||
raise ValueError(f"{ChatScene.ChatDashboard.value} mode should chose db!")
|
raise ValueError(f"{ChatScene.ChatDashboard.value} mode should choose db!")
|
||||||
self.db_name = db_name
|
self.db_name = db_name
|
||||||
self.report_name = report_name
|
self.report_name = report_name
|
||||||
self.database = CFG.local_db
|
self.database = CFG.local_db
|
||||||
|
Loading…
Reference in New Issue
Block a user