Skip to content

Commit

Permalink
Adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
yorevs committed Oct 1, 2024
1 parent 42d4394 commit 32e182d
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/main/askai/core/askai_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _reply(self, reply: AIReply) -> None:
if configs.is_speak and reply.is_speakable:
self.engine.text_to_speech(text, f"{shared.nickname}")
elif not configs.is_interactive:
display_text(text_formatter.strip_format(text), f"{shared.nickname}", markdown=False)
display_text(text_formatter.strip_format(text), f"%%{shared.nickname}", markdown=False)
else:
display_text(text, f"{shared.nickname}")

Expand Down
17 changes: 11 additions & 6 deletions src/main/askai/core/askai_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,17 @@ def press_esc_enter(self) -> str:
def device_switch(self, device_info: str) -> str:
return f"\nSwitching to Audio Input device: `{device_info}`\n"

# Status updates

def model_select(self, model: str) -> str:
return f"Using routing model: `{model}`…"

def refine_answer(self) -> str:
return f"Refining answer…"

def wrap_answer(self) -> str:
return "Wrapping answer…"

# Debug messages

def photo_captured(self, photo: str) -> str:
Expand Down Expand Up @@ -173,18 +184,12 @@ def x_reference(self, pathname: str) -> str:
def describe_image(self, image_path: str) -> str:
return f"~~[DEBUG]~~ Describing image: `{image_path}`…"

def model_select(self, model: str) -> str:
return f"~~[DEBUG]~~ Using routing model: `{model}`"

def task(self, task: str) -> str:
return f"~~[DEBUG]~~ > `Task:` {task}"

def final_query(self, query: str) -> str:
return f"~~[DEBUG]~~ > Final query: `{query}`"

def refine_answer(self, answer: str) -> str:
return f"~~[DEBUG]~~ > Refining answer: `{answer}`"

def no_caption(self) -> str:
return "No caption available"

Expand Down
7 changes: 4 additions & 3 deletions src/main/askai/core/model/acc_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""
import os
from dataclasses import dataclass
from os.path import expandvars

from askai.core.enums.acc_color import AccColor, AccuracyColors
from askai.core.support.llm_parser import parse_field
Expand All @@ -36,9 +37,9 @@ def parse_response(cls, response: str) -> "AccResponse":
"""TODO"""

# FIXME: Remove log the response
with open("/Users/hjunior/Desktop/acc-response-resp.txt", "w") as f_bosta:
f_bosta.write(response + os.linesep)
f_bosta.flush()
with open(os.path.expandvars("${HOME}/Desktop/acc-response-resp.txt"), "w") as f_resp:
f_resp.write(response + os.linesep)
f_resp.flush()

# Parse fields
acc_color: AccColor = AccColor.of_color(parse_field("@color", response))
Expand Down
7 changes: 4 additions & 3 deletions src/main/askai/core/model/action_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import os
import re
from dataclasses import dataclass, field
from os.path import expandvars
from types import SimpleNamespace

from askai.core.model.model_result import ModelResult
Expand Down Expand Up @@ -60,9 +61,9 @@ def _parse_response(question: str, response: str) -> "ActionPlan":
:return: An instance of ActionPlan created from the parsed response.
"""
# FIXME: Remove log the response
with open("/Users/hjunior/Desktop/task-splitter-resp.txt", "w") as f_bosta:
f_bosta.write(response + os.linesep)
f_bosta.flush()
with open(os.path.expandvars("${HOME}/Desktop/task-splitter-resp.txt"), "w") as f_resp:
f_resp.write(response + os.linesep)
f_resp.flush()

speak: str = parse_field("@speak", response)
primary_goal: str = parse_field("@primary_goal", response)
Expand Down
7 changes: 4 additions & 3 deletions src/main/askai/core/model/search_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""
import json
import os
from os.path import expandvars
from dataclasses import dataclass
from typing import Literal

Expand Down Expand Up @@ -42,9 +43,9 @@ def parse_response(cls, question: str, query_response: str) -> "SearchResult":
"""TODO"""

# FIXME: Remove log the response
with open("/Users/hjunior/Desktop/search-result-resp.txt", "w") as f_bosta:
f_bosta.write(query_response + os.linesep)
f_bosta.flush()
with open(os.path.expandvars("${HOME}/Desktop/search-result-resp.txt"), "w") as f_resp:
f_resp.write(query_response + os.linesep)
f_resp.flush()

# Parse fields
engine: Literal["Google", "Bing"] = parse_field("@engine", query_response)
Expand Down
4 changes: 2 additions & 2 deletions src/main/askai/core/support/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from typing import AnyStr, Optional

from askai.core.support.text_formatter import text_formatter
from clitt.core.term.cursor import Cursor
from clitt.core.term.cursor import Cursor, cursor
from hspylib.core.config.path_object import PathObject
from hspylib.core.enums.charset import Charset
from hspylib.core.metaclass.classpath import AnyPath
Expand All @@ -51,7 +51,7 @@ def display_text(text: AnyStr, prefix: AnyStr = "", markdown: bool = True, erase
:param erase_last: Whether to erase the last displayed line before displaying the new text (default is False).
"""
if erase_last:
Cursor.INSTANCE.erase_line()
cursor.erase_line()
if markdown:
text_formatter.display_markdown(f"{str(prefix)}{text}")
else:
Expand Down

0 comments on commit 32e182d

Please sign in to comment.