mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-01 16:18:27 +00:00
WEB API independent
This commit is contained in:
parent
4475c0eabe
commit
6c90740fbe
@ -27,8 +27,11 @@ class DbChatOutputParser(BaseOutputParser):
|
||||
clean_str = super().parse_prompt_response(model_out_text)
|
||||
print("clean prompt response:", clean_str)
|
||||
response = json.loads(clean_str)
|
||||
|
||||
sql, thoughts = response["sql"], response["thoughts"]
|
||||
for key in sorted(response):
|
||||
if key.strip() == 'sql':
|
||||
sql =response[key]
|
||||
if key.strip() == 'thoughts':
|
||||
thoughts =response[key]
|
||||
return SqlAction(sql, thoughts)
|
||||
|
||||
def parse_view_response(self, speak, data) -> str:
|
||||
|
@ -28,11 +28,13 @@ class PluginChatOutputParser(BaseOutputParser):
|
||||
except Exception as e:
|
||||
raise ValueError("model server out not fllow the prompt!")
|
||||
|
||||
command, thoughts, speak = (
|
||||
response["command"],
|
||||
response["thoughts"],
|
||||
response["speak"],
|
||||
)
|
||||
for key in sorted(response):
|
||||
if key.strip() == 'command':
|
||||
command =response[key]
|
||||
if key.strip() == 'thoughts':
|
||||
thoughts =response[key]
|
||||
if key.strip() == 'speak':
|
||||
speak =response[key]
|
||||
return PluginAction(command, speak, thoughts)
|
||||
|
||||
def parse_view_response(self, speak, data) -> str:
|
||||
|
Loading…
Reference in New Issue
Block a user