Skip to content

Commit

Permalink
Fix the ctrl+s issue
Browse files Browse the repository at this point in the history
  • Loading branch information
yorevs committed Nov 21, 2024
1 parent d0ea134 commit 439205b
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/demo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def init_context(
console_enable: bool = False,
context_size: int = 1000,
engine_name: Literal["openai"] = "openai",
model_name: Literal["gpt-3.5-turbo", "gpt-4", "gpt-4o"] = "gpt-3.5-turbo",
model_name: Literal["gpt-3.5-turbo", "gpt-4", "gpt-4o", "gpt-4o-mini"] = "gpt-4o-mini",
) -> None:
"""Initialize AskAI context and startup components."""
if log_name:
Expand Down
3 changes: 1 addition & 2 deletions src/main/askai/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from clitt.core.tui.tui_application import TUIApplication
from hspylib.core.enums.charset import Charset
from hspylib.core.tools.commons import syserr, to_bool
from hspylib.core.tools.dict_tools import get_or_default
from hspylib.modules.application.argparse.parser_action import ParserAction
from hspylib.modules.application.exit_status import ExitStatus
from hspylib.modules.application.version import Version
Expand Down Expand Up @@ -113,7 +112,7 @@ def _setup_arguments(self) -> None:
.option(
"engine", "e", "engine",
"Set which AI engine to use (if not provided, the default engine wil be used).",
choices=["openai", "gemini"],
choices=["openai", "gemini", "llama"],
nargs="?")\
.option(
"model", "m", "model",
Expand Down
4 changes: 2 additions & 2 deletions src/main/askai/core/askai.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from askai.core.processors.ai_processor import AIProcessor
from askai.core.support.chat_context import ChatContext
from askai.core.support.shared_instances import shared
from askai.core.support.utilities import display_text, read_stdin
from askai.core.support.utilities import read_stdin
from askai.exception.exceptions import *
from askai.tui.app_icons import AppIcons

Expand Down Expand Up @@ -129,7 +129,7 @@ def abort(self, signals: Any | None = None, frame: Any | None = None) -> None:
log.warning(f"User interrupted: signals: {signals} frame: {frame}")
self._abort_count += 1
if self._abort_count > 1:
display_text(f"%RED%\n{msg.terminate_requested('User aborted [ctrl+c]')}%NC%", markdown=False)
events.reply.emit(reply=AIReply.error(f"\n{msg.terminate_requested('User aborted [ctrl+c]')}"))
log.warning(f"User aborted. Exiting…")
self._abort()
events.abort.emit(message="User interrupted [ctrl+c]")
Expand Down
2 changes: 1 addition & 1 deletion src/main/askai/core/askai_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def interruption_requested(self, reason: str) -> str:
return f" Interrupting execution => {reason}…"

def terminate_requested(self, reason: str) -> str:
return f" Terminating execution => {reason}…"
return f" Terminating execution => {reason}. Exiting…"


assert (msg := AskAiMessages().INSTANCE) is not None
6 changes: 3 additions & 3 deletions src/main/askai/core/askai_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AskAiSettings(metaclass=Singleton):
INSTANCE: "AskAiSettings"

# Current settings version. Updating this value will trigger a database recreation using the defaults.
__ACTUAL_VERSION: str = "0.4.2"
__ACTUAL_VERSION: str = "0.4.3"

__RESOURCE_DIR = str(classpath.resource_path)

Expand Down Expand Up @@ -100,13 +100,13 @@ def defaults(self) -> None:
self._settings.put("askai.speak.enabled", "askai", False)
self._settings.put("askai.cache.enabled", "askai", False)
self._settings.put("askai.cache.ttl.minutes", "askai", 25)
self._settings.put("askai.context.keep.conversation", "askai", True)
self._settings.put("askai.context.keep.conversation", "askai", False)
self._settings.put("askai.preferred.language", "askai", "")
self._settings.put("askai.router.mode.default", "askai", "splitter")
self._settings.put("askai.router.pass.threshold", "askai", "moderate")
self._settings.put("askai.router.assistive.enabled", "askai", False)
self._settings.put("askai.default.engine", "askai", "openai")
self._settings.put("askai.default.engine.model", "askai", "gpt-3.5-turbo")
self._settings.put("askai.default.engine.model", "askai", "gpt-4o-mini")
self._settings.put("askai.verbosity.level", "askai", 3)
self._settings.put("askai.text.to.speech.tempo", "askai", 1)
self._settings.put("askai.text.splitter.chunk.size", "askai", 1000)
Expand Down
2 changes: 1 addition & 1 deletion src/main/askai/core/commander/commander.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def _format_help(command: Command) -> str:
return COMMANDER_HELP_CMD_TPL.substitute(command=command.name.title(), docstr=docstr, usage=usage_str)


def _init_context(context_size: int = 1000, engine_name: str = "openai", model_name: str = "gpt-3.5-turbo") -> None:
def _init_context(context_size: int = 1000, engine_name: str = "openai", model_name: str = "gpt-4o-mini") -> None:
"""Initialize the AskAI context and startup components.
:param context_size: The maximum size of the context window (default is 1000).
:param engine_name: The name of the engine to initialize (default is "openai").
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,6 @@ def run(self) -> None:
)
self.display(f"Failures:\n{all_failures}")

if final_state != States.COMPLETE:
if final_state != States.COMPLETE and not self._interrupted:
retries: int = self.pipeline.failures[self.pipeline.state.value]
self.display(f" Failed to generate a response after {retries} retries", True)
25 changes: 12 additions & 13 deletions src/main/askai/resources/prompts/taius/taius-non-interactive.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,30 @@ If the context is provided, utilize it to address the question; otherwise, proce

**Guidelines (in-order):**

- Use the following pieces of retrieved context to answer the question.
1. Use the retrieved context to answer the question; if the context is not useful, rely on your latest information.

- If the context in not useful, respond using your latest information.
2. Keep responses concise, focusing on key details. Include useful examples where applicable.

- Keep the answer concise.
3. Avoid expressing personal opinions.

Give some examples.
4. Utilize your strengths as a large language model by employing simple and effective strategies, avoiding legal complications.

- Don't express your opinion.
5. Provide comprehensive answers/guidelines that address all steps or aspects of the query.

- Play to your strengths as an LLM and pursue simple strategies with no legal complications.
6. Include any helpful links to resources (e.g., websites, GitHub projects, YouTube videos) when relevant.

- Provide the complete answer/guidelines, not just one step.
7. Use plain text for responses, avoiding markdown or complex formatting.

- Provide any useful links to web sites, github projects, youtube videos, etc...
8. Highlight important details, especially those related to files, folders, and line numbers, for clarity.

- Do not use markdown to format the response message. Use plain text.
9. Do not seek user assistance in providing answers.

- Ensure important details are included, specially when mentioning files, folders, line numbers, etc.
10. For terminal commands, provide them directly without explanation unless explicitly requested.

- Don't seek user assistance.
11. When applicable, indicate where in the documentation more information can be found.

- If applicable, mention where in the docs to find out more information.
12. If an answer is not known, state clearly: "I don't know." Do not fabricate responses.

- If you don't know the answer, just say that you don't know.


Chat History and Context:
Expand Down

0 comments on commit 439205b

Please sign in to comment.