Skip to content

Commit

Permalink
fix: Fix load some dbgpts error
Browse files Browse the repository at this point in the history
  • Loading branch information
fangyinc committed Feb 22, 2024
1 parent 8ba3128 commit 0960acb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
12 changes: 9 additions & 3 deletions dbgpt/core/awel/flow/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,9 @@ def get_runnable_parameters(
for parameter in self.parameters
if not parameter.optional
}
current_parameters = {
parameter.name: parameter for parameter in self.parameters
}
if len(view_required_parameters) < len(current_required_parameters):
# TODO, skip the optional parameters.
raise FlowParameterMetadataException(
Expand All @@ -651,10 +654,13 @@ def get_runnable_parameters(
f"Required parameters: {current_required_parameters.keys()}, "
f"but got {view_required_parameters.keys()}."
)
for i, parameter in enumerate(self.parameters):
view_param = view_parameters[i]
for view_param_key, view_param in view_required_parameters.items():
if view_param_key not in current_parameters:
raise FlowParameterMetadataException(
f"Parameter {view_param_key} not found in the metadata."
)
runnable_parameters.update(
parameter.to_runnable_parameter(
current_parameters[view_param_key].to_runnable_parameter(
view_param.get_typed_value(), resources, key_to_resource_instance
)
)
Expand Down
6 changes: 3 additions & 3 deletions dbgpt/core/interface/operators/prompt_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ class CommonChatPromptTemplate(ChatPromptTemplate):
def pre_fill(cls, values: Dict[str, Any]) -> Dict[str, Any]:
"""Pre fill the messages."""
if "system_message" not in values:
raise ValueError("No system message")
values["system_message"] = "You are a helpful AI Assistant."
if "human_message" not in values:
raise ValueError("No human message")
values["human_message"] = "{user_input}"
if "message_placeholder" not in values:
raise ValueError("No message placeholder")
values["message_placeholder"] = "chat_history"
system_message = values.pop("system_message")
human_message = values.pop("human_message")
message_placeholder = values.pop("message_placeholder")
Expand Down
2 changes: 1 addition & 1 deletion dbgpt/util/dbgpts/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def update_repo(repo: str):
logger.info(f"Repo '{repo}' is not a git repository.")
return
logger.info(f"Updating repo '{repo}'...")
subprocess.run(["git", "pull"], check=True)
subprocess.run(["git", "pull"], check=False)


def install(
Expand Down

0 comments on commit 0960acb

Please sign in to comment.