Skip to content

Commit

Permalink
Fix the history issue: draft
Browse files Browse the repository at this point in the history
  • Loading branch information
yorevs committed Oct 9, 2024
1 parent 972b096 commit 4b5e04a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/main/askai/core/model/acc_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
Copyright (c) 2024, HomeSetup
"""
from askai.core.enums.acc_color import AccColor, AccuracyColors
from askai.core.support.llm_parser import parse_field
from dataclasses import dataclass
from pathlib import Path

from hspylib.core.tools.text_tools import ensure_endswith
from os.path import expandvars

import os
from askai.core.enums.acc_color import AccColor, AccuracyColors
from askai.core.support.llm_parser import parse_field


@dataclass(frozen=True)
Expand All @@ -38,6 +38,7 @@ def parse_response(cls, response: str) -> "AccResponse":
:param response: The LLM response.
:return: An instance of AccResponse created from the parsed response.
"""
Path(Path.home() / 'acc-resp.txt').write_text(response)

acc_color: AccColor = AccColor.of_color(parse_field("@color", response))
accuracy: float = float(parse_field("@accuracy", response).strip("%"))
Expand Down
7 changes: 6 additions & 1 deletion src/main/askai/core/model/action_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Copyright (c) 2024, HomeSetup
"""
from dataclasses import dataclass, field
from pathlib import Path
from types import SimpleNamespace
from typing import Any

Expand Down Expand Up @@ -60,6 +61,7 @@ def _parse_response(question: str, response: str) -> "ActionPlan":
:param response: The router's response.
:return: An instance of ActionPlan created from the parsed response.
"""
Path(Path.home() / 'splitter-resp.txt').write_text(response)

speak: str = parse_field("@speak", response)
primary_goal: str = parse_field("@primary_goal", response)
Expand Down Expand Up @@ -88,7 +90,10 @@ def _direct_answer(question: str, answer: str, goal: str, model: ModelResult) ->
:param model: The result model.
:return: An instance of ActionPlan created from the direct response.
"""
speak: str = answer.split(',')[0].strip("'\"")
if answer:
speak: str = answer.split(',')[0].strip("'\"")
else:
speak: str = answer

return ActionPlan(question, speak, goal, True, [], [], model)

Expand Down

0 comments on commit 4b5e04a

Please sign in to comment.