diff --git a/pilot/model/llm_out/vicuna_base_llm.py b/pilot/model/llm_out/vicuna_base_llm.py index 30033860b..d4fcaa33d 100644 --- a/pilot/model/llm_out/vicuna_base_llm.py +++ b/pilot/model/llm_out/vicuna_base_llm.py @@ -11,6 +11,7 @@ def generate_stream( """Fork from fastchat: https://github.com/lm-sys/FastChat/blob/main/fastchat/serve/inference.py""" prompt = params["prompt"] l_prompt = len(prompt) + prompt= prompt.replace("ai:", "assistant:").replace("human:", "user:") temperature = float(params.get("temperature", 1.0)) max_new_tokens = int(params.get("max_new_tokens", 2048)) stop_str = params.get("stop", None) diff --git a/pilot/scene/base_chat.py b/pilot/scene/base_chat.py index 6eecbbc71..449df3fe4 100644 --- a/pilot/scene/base_chat.py +++ b/pilot/scene/base_chat.py @@ -115,7 +115,7 @@ class BaseChat(ABC): payload = { "model": self.llm_model, - "prompt": self.generate_llm_text().replace("ai:", "assistant:"), + "prompt": self.generate_llm_text(), "temperature": float(self.prompt_template.temperature), "max_new_tokens": int(self.prompt_template.max_new_tokens), "stop": self.prompt_template.sep, diff --git a/pilot/scene/chat_db/auto_execute/out_parser.py b/pilot/scene/chat_db/auto_execute/out_parser.py index c7237671b..64432520e 100644 --- a/pilot/scene/chat_db/auto_execute/out_parser.py +++ b/pilot/scene/chat_db/auto_execute/out_parser.py @@ -42,8 +42,9 @@ class DbChatOutputParser(BaseOutputParser): html_table = df.to_html(index=False, escape=False) html = f"
{table_style}{html_table}" else: - html = df.to_html(index=False, escape=False, sparsify=False) - html = "".join(html.split()) + html_table = df.to_html(index=False, escape=False, sparsify=False) + table_str = "".join(html_table.split()) + html = f"""