blue-assistant 4.21.1__tar.gz → 4.32.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {blue_assistant-4.21.1/blue_assistant.egg-info → blue_assistant-4.32.1}/PKG-INFO +5 -5
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/README.md +4 -4
- blue_assistant-4.21.1/blue_assistant/.abcli/chat.sh → blue_assistant-4.32.1/blue_assistant/.abcli/script/run.sh +6 -10
- blue_assistant-4.32.1/blue_assistant/.abcli/script.sh +15 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/.abcli/tests/help.sh +2 -1
- blue_assistant-4.32.1/blue_assistant/.abcli/tests/script_run.sh +11 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/__init__.py +1 -1
- blue_assistant-4.32.1/blue_assistant/config.env +1 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/env.py +2 -2
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/help/functions.py +2 -2
- blue_assistant-4.21.1/blue_assistant/help/chat.py → blue_assistant-4.32.1/blue_assistant/help/script.py +9 -8
- {blue_assistant-4.21.1/blue_assistant/chat → blue_assistant-4.32.1/blue_assistant/script}/__main__.py +7 -11
- blue_assistant-4.32.1/blue_assistant/script/blue_amo.py +18 -0
- blue_assistant-4.32.1/blue_assistant/script/functions.py +40 -0
- blue_assistant-4.32.1/blue_assistant/script/generic.py +41 -0
- blue_assistant-4.32.1/blue_assistant/script/kinds.py +6 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1/blue_assistant.egg-info}/PKG-INFO +5 -5
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant.egg-info/SOURCES.txt +11 -8
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/setup.py +1 -4
- blue_assistant-4.21.1/blue_assistant/.abcli/tests/chat.sh +0 -12
- blue_assistant-4.21.1/blue_assistant/chat/context.py +0 -109
- blue_assistant-4.21.1/blue_assistant/chat/functions.py +0 -36
- blue_assistant-4.21.1/blue_assistant/config.env +0 -1
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/LICENSE +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/MANIFEST.in +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/.abcli/abcli.sh +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/.abcli/actions.sh +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/.abcli/alias.sh +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/.abcli/blue_assistant.sh +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/.abcli/browse.sh +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/.abcli/tests/README.sh +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/.abcli/tests/version.sh +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/README.py +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/__main__.py +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/functions.py +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/help/__init__.py +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/help/__main__.py +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/host.py +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/logger.py +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/sample.env +0 -0
- {blue_assistant-4.21.1/blue_assistant/chat → blue_assistant-4.32.1/blue_assistant/script}/__init__.py +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant/urls.py +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant.egg-info/dependency_links.txt +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant.egg-info/requires.txt +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant.egg-info/top_level.txt +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/pyproject.toml +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/requirements.txt +0 -0
- {blue_assistant-4.21.1 → blue_assistant-4.32.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: blue_assistant
|
3
|
-
Version: 4.
|
3
|
+
Version: 4.32.1
|
4
4
|
Summary: 🌀 An AI Assistant.
|
5
5
|
Home-page: https://github.com/kamangir/blue-assistant
|
6
6
|
Author: Arash Abadpour (Kamangir)
|
@@ -48,12 +48,12 @@ pip install blue-assistant
|
|
48
48
|
|
49
49
|
```mermaid
|
50
50
|
graph LR
|
51
|
-
|
51
|
+
assistant_script_run["@assistant<br>script<br>run -<br><object-name>"]
|
52
52
|
|
53
53
|
object["📂 object"]:::folder
|
54
54
|
|
55
|
-
object -->
|
56
|
-
|
55
|
+
object --> assistant_script_run
|
56
|
+
assistant_script_run --> object
|
57
57
|
|
58
58
|
classDef folder fill:#999,stroke:#333,stroke-width:2px;
|
59
59
|
```
|
@@ -63,4 +63,4 @@ graph LR
|
|
63
63
|
|
64
64
|
[](https://github.com/kamangir/blue-assistant/actions/workflows/pylint.yml) [](https://github.com/kamangir/blue-assistant/actions/workflows/pytest.yml) [](https://github.com/kamangir/blue-assistant/actions/workflows/bashtest.yml) [](https://pypi.org/project/blue-assistant/) [](https://pypistats.org/packages/blue-assistant)
|
65
65
|
|
66
|
-
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_assistant-4.
|
66
|
+
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_assistant-4.32.1`](https://github.com/kamangir/blue-assistant).
|
@@ -8,12 +8,12 @@ pip install blue-assistant
|
|
8
8
|
|
9
9
|
```mermaid
|
10
10
|
graph LR
|
11
|
-
|
11
|
+
assistant_script_run["@assistant<br>script<br>run -<br><object-name>"]
|
12
12
|
|
13
13
|
object["📂 object"]:::folder
|
14
14
|
|
15
|
-
object -->
|
16
|
-
|
15
|
+
object --> assistant_script_run
|
16
|
+
assistant_script_run --> object
|
17
17
|
|
18
18
|
classDef folder fill:#999,stroke:#333,stroke-width:2px;
|
19
19
|
```
|
@@ -23,4 +23,4 @@ graph LR
|
|
23
23
|
|
24
24
|
[](https://github.com/kamangir/blue-assistant/actions/workflows/pylint.yml) [](https://github.com/kamangir/blue-assistant/actions/workflows/pytest.yml) [](https://github.com/kamangir/blue-assistant/actions/workflows/bashtest.yml) [](https://pypi.org/project/blue-assistant/) [](https://pypistats.org/packages/blue-assistant)
|
25
25
|
|
26
|
-
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_assistant-4.
|
26
|
+
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_assistant-4.32.1`](https://github.com/kamangir/blue-assistant).
|
@@ -1,24 +1,20 @@
|
|
1
1
|
#! /usr/bin/env bash
|
2
2
|
|
3
|
-
function
|
3
|
+
function blue_assistant_script_run() {
|
4
4
|
local options=$1
|
5
5
|
local do_dryrun=$(abcli_option_int "$options" dryrun 0)
|
6
|
-
local do_download=$(abcli_option_int "$options" download
|
6
|
+
local do_download=$(abcli_option_int "$options" download $(abcli_not $do_dryrun))
|
7
7
|
local do_upload=$(abcli_option_int "$options" upload $(abcli_not $do_dryrun))
|
8
8
|
|
9
|
-
local
|
10
|
-
local interactive=$(abcli_option_int "$chat_options" interact 1)
|
11
|
-
|
12
|
-
local object_name=$(abcli_clarify_object $3 chat-$(abcli_string_timestamp))
|
9
|
+
local object_name=$(abcli_clarify_object $2 .)
|
13
10
|
[[ "$do_download" == 1 ]] &&
|
14
11
|
abcli_download - $object_name
|
15
12
|
|
16
13
|
abcli_eval dryrun=$do_dryrun \
|
17
|
-
python3 -m blue_assistant.
|
18
|
-
|
14
|
+
python3 -m blue_assistant.script \
|
15
|
+
run \
|
19
16
|
--object_name $object_name \
|
20
|
-
|
21
|
-
"${@:4}"
|
17
|
+
"${@:3}"
|
22
18
|
[[ $? -ne 0 ]] && return 1
|
23
19
|
|
24
20
|
[[ "$do_upload" == 1 ]] &&
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#! /usr/bin/env bash
|
2
|
+
|
3
|
+
function blue_assistant_script() {
|
4
|
+
local task=$(abcli_unpack_keyword $1 help)
|
5
|
+
|
6
|
+
local function_name=blue_assistant_script_$task
|
7
|
+
if [[ $(type -t $function_name) == "function" ]]; then
|
8
|
+
$function_name "${@:2}"
|
9
|
+
return
|
10
|
+
fi
|
11
|
+
|
12
|
+
python3 -m blue_assistant.script "$@"
|
13
|
+
}
|
14
|
+
|
15
|
+
abcli_source_caller_suffix_path /script
|
@@ -0,0 +1 @@
|
|
1
|
+
BLUE_ASSISTANT_TEST_OBJECT=blue-amo
|
@@ -4,7 +4,7 @@ from blue_options.terminal import show_usage, xtra
|
|
4
4
|
from abcli.help.generic import help_functions as generic_help_functions
|
5
5
|
|
6
6
|
from blue_assistant import ALIAS
|
7
|
-
from blue_assistant.help.
|
7
|
+
from blue_assistant.help.script import help_functions as help_script
|
8
8
|
|
9
9
|
|
10
10
|
def help_browse(
|
@@ -29,6 +29,6 @@ help_functions = generic_help_functions(plugin_name=ALIAS)
|
|
29
29
|
help_functions.update(
|
30
30
|
{
|
31
31
|
"browse": help_browse,
|
32
|
-
"
|
32
|
+
"script": help_script,
|
33
33
|
}
|
34
34
|
)
|
@@ -3,25 +3,26 @@ from typing import List
|
|
3
3
|
from blue_options.terminal import show_usage, xtra
|
4
4
|
|
5
5
|
|
6
|
-
def
|
6
|
+
def help_run(
|
7
7
|
tokens: List[str],
|
8
8
|
mono: bool,
|
9
9
|
) -> str:
|
10
|
-
options = xtra("download,dryrun,~upload", mono=mono)
|
11
|
-
|
12
|
-
chat_options = xtra("~interact", mono=mono)
|
10
|
+
options = xtra("~download,dryrun,~upload", mono=mono)
|
13
11
|
|
14
12
|
args = ["--verbose 1"]
|
15
13
|
|
16
14
|
return show_usage(
|
17
15
|
[
|
18
16
|
"@assistant",
|
19
|
-
"
|
17
|
+
"script",
|
18
|
+
"run",
|
20
19
|
f"[{options}]",
|
21
|
-
|
22
|
-
"[-|<object-name>]",
|
20
|
+
"[.|<object-name>]",
|
23
21
|
]
|
24
22
|
+ args,
|
25
|
-
"
|
23
|
+
"run <object-name>.",
|
26
24
|
mono=mono,
|
27
25
|
)
|
26
|
+
|
27
|
+
|
28
|
+
help_functions = {"run": help_run}
|
@@ -4,7 +4,7 @@ from blueness import module
|
|
4
4
|
from blueness.argparse.generic import sys_exit
|
5
5
|
|
6
6
|
from blue_assistant import NAME
|
7
|
-
from blue_assistant.
|
7
|
+
from blue_assistant.script.functions import load_script
|
8
8
|
from blue_assistant.logger import logger
|
9
9
|
|
10
10
|
NAME = module.name(__file__, NAME)
|
@@ -13,18 +13,12 @@ parser = argparse.ArgumentParser(NAME)
|
|
13
13
|
parser.add_argument(
|
14
14
|
"task",
|
15
15
|
type=str,
|
16
|
-
help="
|
16
|
+
help="run",
|
17
17
|
)
|
18
18
|
parser.add_argument(
|
19
19
|
"--object_name",
|
20
20
|
type=str,
|
21
21
|
)
|
22
|
-
parser.add_argument(
|
23
|
-
"--interactive",
|
24
|
-
type=int,
|
25
|
-
default=0,
|
26
|
-
help="0 | 1",
|
27
|
-
)
|
28
22
|
parser.add_argument(
|
29
23
|
"--verbose",
|
30
24
|
type=int,
|
@@ -34,12 +28,14 @@ parser.add_argument(
|
|
34
28
|
args = parser.parse_args()
|
35
29
|
|
36
30
|
success = False
|
37
|
-
if args.task == "
|
38
|
-
success =
|
31
|
+
if args.task == "run":
|
32
|
+
success, script = load_script(
|
39
33
|
object_name=args.object_name,
|
40
|
-
interactive=args.interactive == 1,
|
41
34
|
verbose=args.verbose == 1,
|
42
35
|
)
|
36
|
+
|
37
|
+
if success:
|
38
|
+
success = script.run()
|
43
39
|
else:
|
44
40
|
success = None
|
45
41
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
from blue_assistant.script.generic import GenericScript
|
2
|
+
from blue_assistant.script.kinds import ScriptKind
|
3
|
+
|
4
|
+
|
5
|
+
class BlueAmoScript(GenericScript):
|
6
|
+
def __init__(
|
7
|
+
self,
|
8
|
+
object_name: str,
|
9
|
+
verbose: bool = False,
|
10
|
+
download: bool = False,
|
11
|
+
):
|
12
|
+
super().__init__(
|
13
|
+
object_name=object_name,
|
14
|
+
verbose=verbose,
|
15
|
+
download=download,
|
16
|
+
)
|
17
|
+
|
18
|
+
self.kind = ScriptKind.BLUE_AMO
|
@@ -0,0 +1,40 @@
|
|
1
|
+
from typing import Tuple, Union, Type
|
2
|
+
|
3
|
+
from blueness import module
|
4
|
+
from blue_objects.metadata import get_from_object
|
5
|
+
|
6
|
+
from blue_assistant import NAME
|
7
|
+
from blue_assistant.script.generic import GenericScript
|
8
|
+
from blue_assistant.script.blue_amo import BlueAmoScript
|
9
|
+
from blue_assistant.logger import logger
|
10
|
+
|
11
|
+
|
12
|
+
NAME = module.name(__file__, NAME)
|
13
|
+
|
14
|
+
|
15
|
+
def load_script(
|
16
|
+
object_name: str,
|
17
|
+
verbose: bool = False,
|
18
|
+
download: bool = False,
|
19
|
+
) -> Tuple[bool, Union[GenericScript, None]]:
|
20
|
+
script_kind = get_from_object(
|
21
|
+
object_name=object_name,
|
22
|
+
key="script.kind",
|
23
|
+
default="generic",
|
24
|
+
)
|
25
|
+
|
26
|
+
script_class: Type[GenericScript] = GenericScript
|
27
|
+
if script_kind == "blue_amo":
|
28
|
+
script_class = BlueAmoScript
|
29
|
+
if verbose:
|
30
|
+
logger.info(f"script class: {script_class.__name__}")
|
31
|
+
|
32
|
+
script = script_class(
|
33
|
+
object_name=object_name,
|
34
|
+
verbose=verbose,
|
35
|
+
download=download,
|
36
|
+
)
|
37
|
+
if verbose:
|
38
|
+
logger.info(f"script kind: {script.kind}")
|
39
|
+
|
40
|
+
return True, script
|
@@ -0,0 +1,41 @@
|
|
1
|
+
from blueness import module
|
2
|
+
from blue_objects.metadata import get_from_object
|
3
|
+
|
4
|
+
from blue_assistant import NAME
|
5
|
+
from blue_assistant.script.kinds import ScriptKind
|
6
|
+
from blue_assistant.logger import logger
|
7
|
+
|
8
|
+
|
9
|
+
NAME = module.name(__file__, NAME)
|
10
|
+
|
11
|
+
|
12
|
+
class GenericScript:
|
13
|
+
def __init__(
|
14
|
+
self,
|
15
|
+
object_name: str,
|
16
|
+
verbose: bool = False,
|
17
|
+
download: bool = False,
|
18
|
+
):
|
19
|
+
self.verbose = verbose
|
20
|
+
|
21
|
+
self.object_name = object_name
|
22
|
+
|
23
|
+
self.kind = ScriptKind.GENERIC
|
24
|
+
|
25
|
+
self.script = get_from_object(
|
26
|
+
object_name=object_name,
|
27
|
+
key="script",
|
28
|
+
default={},
|
29
|
+
download=download,
|
30
|
+
)
|
31
|
+
|
32
|
+
def run(self) -> bool:
|
33
|
+
logger.info(
|
34
|
+
"{}.run({} @ {})".format(
|
35
|
+
NAME,
|
36
|
+
self.__class__.__name__,
|
37
|
+
self.object_name,
|
38
|
+
)
|
39
|
+
)
|
40
|
+
|
41
|
+
return True
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: blue_assistant
|
3
|
-
Version: 4.
|
3
|
+
Version: 4.32.1
|
4
4
|
Summary: 🌀 An AI Assistant.
|
5
5
|
Home-page: https://github.com/kamangir/blue-assistant
|
6
6
|
Author: Arash Abadpour (Kamangir)
|
@@ -48,12 +48,12 @@ pip install blue-assistant
|
|
48
48
|
|
49
49
|
```mermaid
|
50
50
|
graph LR
|
51
|
-
|
51
|
+
assistant_script_run["@assistant<br>script<br>run -<br><object-name>"]
|
52
52
|
|
53
53
|
object["📂 object"]:::folder
|
54
54
|
|
55
|
-
object -->
|
56
|
-
|
55
|
+
object --> assistant_script_run
|
56
|
+
assistant_script_run --> object
|
57
57
|
|
58
58
|
classDef folder fill:#999,stroke:#333,stroke-width:2px;
|
59
59
|
```
|
@@ -63,4 +63,4 @@ graph LR
|
|
63
63
|
|
64
64
|
[](https://github.com/kamangir/blue-assistant/actions/workflows/pylint.yml) [](https://github.com/kamangir/blue-assistant/actions/workflows/pytest.yml) [](https://github.com/kamangir/blue-assistant/actions/workflows/bashtest.yml) [](https://pypi.org/project/blue-assistant/) [](https://pypistats.org/packages/blue-assistant)
|
65
65
|
|
66
|
-
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_assistant-4.
|
66
|
+
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_assistant-4.32.1`](https://github.com/kamangir/blue-assistant).
|
@@ -24,16 +24,19 @@ blue_assistant/.abcli/actions.sh
|
|
24
24
|
blue_assistant/.abcli/alias.sh
|
25
25
|
blue_assistant/.abcli/blue_assistant.sh
|
26
26
|
blue_assistant/.abcli/browse.sh
|
27
|
-
blue_assistant/.abcli/
|
27
|
+
blue_assistant/.abcli/script.sh
|
28
|
+
blue_assistant/.abcli/script/run.sh
|
28
29
|
blue_assistant/.abcli/tests/README.sh
|
29
|
-
blue_assistant/.abcli/tests/chat.sh
|
30
30
|
blue_assistant/.abcli/tests/help.sh
|
31
|
+
blue_assistant/.abcli/tests/script_run.sh
|
31
32
|
blue_assistant/.abcli/tests/version.sh
|
32
|
-
blue_assistant/chat/__init__.py
|
33
|
-
blue_assistant/chat/__main__.py
|
34
|
-
blue_assistant/chat/context.py
|
35
|
-
blue_assistant/chat/functions.py
|
36
33
|
blue_assistant/help/__init__.py
|
37
34
|
blue_assistant/help/__main__.py
|
38
|
-
blue_assistant/help/
|
39
|
-
blue_assistant/help/
|
35
|
+
blue_assistant/help/functions.py
|
36
|
+
blue_assistant/help/script.py
|
37
|
+
blue_assistant/script/__init__.py
|
38
|
+
blue_assistant/script/__main__.py
|
39
|
+
blue_assistant/script/blue_amo.py
|
40
|
+
blue_assistant/script/functions.py
|
41
|
+
blue_assistant/script/generic.py
|
42
|
+
blue_assistant/script/kinds.py
|
@@ -1,109 +0,0 @@
|
|
1
|
-
from blue_objects import file, objects
|
2
|
-
from blue_options import string
|
3
|
-
from blue_objects.metadata import post_to_object, get_from_object
|
4
|
-
from blue_options.terminal.functions import hr
|
5
|
-
from openai_commands.prompt_completion.api import complete_prompt
|
6
|
-
|
7
|
-
from blue_assistant import ICON
|
8
|
-
from blue_assistant.logger import logger
|
9
|
-
|
10
|
-
|
11
|
-
class ChatContext:
|
12
|
-
def __init__(
|
13
|
-
self,
|
14
|
-
object_name: str,
|
15
|
-
load_history: bool = True,
|
16
|
-
verbose: bool = False,
|
17
|
-
):
|
18
|
-
self.verbose = verbose
|
19
|
-
|
20
|
-
self.ended: bool = False
|
21
|
-
|
22
|
-
self.object_name = object_name
|
23
|
-
|
24
|
-
self.history = (
|
25
|
-
get_from_object(
|
26
|
-
self.object_name,
|
27
|
-
"history",
|
28
|
-
[],
|
29
|
-
)
|
30
|
-
if load_history
|
31
|
-
else []
|
32
|
-
)
|
33
|
-
|
34
|
-
def chat(
|
35
|
-
self,
|
36
|
-
interactive: bool = True,
|
37
|
-
) -> bool:
|
38
|
-
logger.info('Type in "help" for help.')
|
39
|
-
|
40
|
-
while True:
|
41
|
-
prompt = input(f"{ICON} > ") if interactive else ""
|
42
|
-
|
43
|
-
if not self.process_prompt(prompt):
|
44
|
-
return False
|
45
|
-
|
46
|
-
if self.ended or not interactive:
|
47
|
-
break
|
48
|
-
|
49
|
-
print(hr(width=21))
|
50
|
-
|
51
|
-
return True
|
52
|
-
|
53
|
-
def process_prompt(
|
54
|
-
self,
|
55
|
-
prompt: str,
|
56
|
-
max_tokens: int = 2000,
|
57
|
-
) -> bool:
|
58
|
-
if prompt in ["help", "?", ""]:
|
59
|
-
return self.show_help()
|
60
|
-
|
61
|
-
if prompt in ["quit", "exit", "q"]:
|
62
|
-
self.ended = True
|
63
|
-
return True
|
64
|
-
|
65
|
-
success, response, metadata = complete_prompt(
|
66
|
-
prompt=prompt,
|
67
|
-
max_tokens=max_tokens,
|
68
|
-
verbose=self.verbose,
|
69
|
-
)
|
70
|
-
if not success:
|
71
|
-
return success
|
72
|
-
logger.info(response)
|
73
|
-
|
74
|
-
logger.info(f"🪄 {prompt}")
|
75
|
-
|
76
|
-
id_ = string.pretty_date(
|
77
|
-
as_filename=True,
|
78
|
-
unique=True,
|
79
|
-
)
|
80
|
-
self.history.append(
|
81
|
-
{
|
82
|
-
"id": id_,
|
83
|
-
"prompt": prompt,
|
84
|
-
"response": response,
|
85
|
-
}
|
86
|
-
)
|
87
|
-
|
88
|
-
return file.save_yaml(
|
89
|
-
objects.path_of(
|
90
|
-
object_name=self.object_name,
|
91
|
-
filename=f"{id_}.yaml",
|
92
|
-
),
|
93
|
-
metadata,
|
94
|
-
)
|
95
|
-
|
96
|
-
def save(self) -> bool:
|
97
|
-
return post_to_object(
|
98
|
-
self.object_name,
|
99
|
-
"history",
|
100
|
-
self.history,
|
101
|
-
)
|
102
|
-
|
103
|
-
def show_help(self) -> bool:
|
104
|
-
for command, description in {
|
105
|
-
"help": "show this help.",
|
106
|
-
"quit": "quit the chat.",
|
107
|
-
}.items():
|
108
|
-
logger.info(f"{command}: {description}")
|
109
|
-
return True
|
@@ -1,36 +0,0 @@
|
|
1
|
-
from blueness import module
|
2
|
-
|
3
|
-
from blue_assistant import NAME
|
4
|
-
from blue_assistant.chat.context import ChatContext
|
5
|
-
from blue_assistant.logger import logger
|
6
|
-
|
7
|
-
|
8
|
-
NAME = module.name(__file__, NAME)
|
9
|
-
|
10
|
-
|
11
|
-
def chat(
|
12
|
-
object_name: str,
|
13
|
-
interactive: bool = True,
|
14
|
-
verbose: bool = False,
|
15
|
-
load_history: bool = True,
|
16
|
-
) -> bool:
|
17
|
-
logger.info(
|
18
|
-
"{}.chat -{}> {}".format(
|
19
|
-
NAME,
|
20
|
-
"interactive-" if interactive else "",
|
21
|
-
object_name,
|
22
|
-
)
|
23
|
-
)
|
24
|
-
|
25
|
-
context = ChatContext(
|
26
|
-
object_name,
|
27
|
-
load_history=load_history,
|
28
|
-
verbose=verbose,
|
29
|
-
)
|
30
|
-
|
31
|
-
if not context.chat(
|
32
|
-
interactive=interactive,
|
33
|
-
):
|
34
|
-
return False
|
35
|
-
|
36
|
-
return context.save()
|
@@ -1 +0,0 @@
|
|
1
|
-
BLUE_PLUGIN_CONFIG=value
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{blue_assistant-4.21.1 → blue_assistant-4.32.1}/blue_assistant.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|