mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-07-30 23:28:35 +00:00
fix: resolve KeyError: 'question' in chat_dashboard prompt template (#2695)
Co-authored-by: Fangyin Cheng <staneyffer@gmail.com>
This commit is contained in:
parent
d300a4d412
commit
d2429eeff4
@ -95,6 +95,19 @@ class ChatDashboard(BaseChat):
|
|||||||
"supported_chat_type": self.dashboard_template["supported_chart_type"],
|
"supported_chat_type": self.dashboard_template["supported_chart_type"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Mapping variable names: compatible with custom prompt template variable names
|
||||||
|
# Get the input_variables of the current prompt
|
||||||
|
input_variables = []
|
||||||
|
if hasattr(self.prompt_template, "prompt") and hasattr(
|
||||||
|
self.prompt_template.prompt, "input_variables"
|
||||||
|
):
|
||||||
|
input_variables = self.prompt_template.prompt.input_variables
|
||||||
|
# Compatible with question and user_input
|
||||||
|
if "question" in input_variables:
|
||||||
|
input_values["question"] = self.current_user_input
|
||||||
|
if "user_input" in input_variables:
|
||||||
|
input_values["user_input"] = self.current_user_input
|
||||||
|
|
||||||
return input_values
|
return input_values
|
||||||
|
|
||||||
def do_action(self, prompt_response):
|
def do_action(self, prompt_response):
|
||||||
|
Loading…
Reference in New Issue
Block a user