Skip to content

Commit

Permalink
fix: Code standards (#1393)
Browse files Browse the repository at this point in the history
  • Loading branch information
yyhhyyyyyy authored Apr 9, 2024
1 parent 4fe10c0 commit 0f2b46d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions dbgpt/core/interface/output_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ def parse_model_nostream_resp(self, response: ResponseTye, sep: str):
ai_response = ai_response.replace("assistant:", "")
ai_response = ai_response.replace("Assistant:", "")
ai_response = ai_response.replace("ASSISTANT:", "")
ai_response = ai_response.replace("\_", "_")
ai_response = ai_response.replace("\*", "*")
ai_response = ai_response.replace("\\_", "_")
ai_response = ai_response.replace("\\*", "*")
ai_response = ai_response.replace("\t", "")

# ai_response = ai_response.strip().replace("\\n", " ").replace("\n", " ")
Expand Down Expand Up @@ -234,7 +234,7 @@ def parse_prompt_response(self, model_out_text) -> Any:
.replace("\\n", " ")
.replace("\n", " ")
.replace("\\", " ")
.replace("\_", "_")
.replace("\\_", "_")
)
cleaned_output = self._illegal_json_ends(cleaned_output)
return cleaned_output
Expand Down
2 changes: 1 addition & 1 deletion dbgpt/model/adapter/old_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def _parse_model_path(model_path: str) -> Tuple[bool, str]:
logger.warn(
f"Model path {model_path} is not single file, use first *gglm*.gguf model file: {model_path}"
)
if not re.fullmatch(".*ggml.*\.gguf", model_path):
if not re.fullmatch(r".*ggml.*\.gguf", model_path):
return False, None
return True, model_path

Expand Down
6 changes: 5 additions & 1 deletion dbgpt/serve/agent/team/plan/planner_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from dbgpt._private.config import Config
from dbgpt.agent.agents.base_agent_new import ConversableAgent
from dbgpt.agent.resource.resource_api import AgentResource

from .plan_action import PlanAction

CFG = Config()
Expand Down Expand Up @@ -80,7 +81,10 @@ def bind_agents(self, agents: List[ConversableAgent]) -> ConversableAgent:
for agent in self.agents:
if agent.resources and len(agent.resources) > 0:
for resource in agent.resources:
if self.get_unique_resources_codes(resource) not in unique_resources:
if (
self.get_unique_resources_codes(resource)
not in unique_resources
):
unique_resources.add(self.get_unique_resources_codes(resource))
self.resources.append(resource)
return self
Expand Down
2 changes: 1 addition & 1 deletion dbgpt/util/system_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def get_cpu_info():
match = re.search(r".*Model name:\s*(.+)", output)
if match:
cpu_info = match.group(1).strip()
match = re.search(f".*型号名称:\s*(.+)", output)
match = re.search(r".*型号名称:\s*(.+)", output)
if match:
cpu_info = match.group(1).strip()
except:
Expand Down

0 comments on commit 0f2b46d

Please sign in to comment.