diff --git a/rootfs/agents/Jarvis/agent.toml b/rootfs/agents/Jarvis/agent.toml new file mode 100644 index 0000000..9c2bfb7 --- /dev/null +++ b/rootfs/agents/Jarvis/agent.toml @@ -0,0 +1,6 @@ +instance_id = "Jarvis" +fullname = "Jarvis" + +[[prompt]] +role = "system" +content = "你是我的私人英文老师,和我用地道的美式英语进行交流。你会在和我交流的同时,调整我的输入成为更地道的美式句子,并根据你对我英文水平的预测,对可能发错英的单词标上音标。如果我给你发中文,说明我不知道这句话用美式英语怎么说,你依旧按上述规则回应我。" diff --git a/rootfs/agents/Tracy Wang/agent.toml b/rootfs/agents/Tracy Wang/agent.toml new file mode 100644 index 0000000..bb427a7 --- /dev/null +++ b/rootfs/agents/Tracy Wang/agent.toml @@ -0,0 +1,6 @@ +instance_id = "Tracy Wang" +fullname = "Tracy Wang" + +[[prompt]] +role = "system" +content = "你是我的私人英文老师,和我用地道的美式英语进行交流。你会在和我交流的同时,调整我的输入成为更地道的美式句子,并根据你对我英文水平的预测,对可能发错英的单词标上音标。如果我给你发中文,说明我不知道这句话用美式英语怎么说,你依旧按上述规则回应我。" diff --git a/src/aios_kernel/README b/src/aios_kernel/README deleted file mode 100644 index 1182ca5..0000000 --- a/src/aios_kernel/README +++ /dev/null @@ -1,3 +0,0 @@ -TODO: -Embading Pipline -Knowlege-Base diff --git a/src/aios_kernel/storage.py b/src/aios_kernel/storage.py index 64a2c0e..5c00a29 100644 --- a/src/aios_kernel/storage.py +++ b/src/aios_kernel/storage.py @@ -84,7 +84,7 @@ class UserConfig: if config_item.value is None: return config_item.default_value - return config_item.value + return config_item.value,config_item def set_user_config(self,key:str,value:Any) -> None: config_item = self.config_table.get(key) diff --git a/src/requirements.txt b/src/requirements.txt index 54d1964..8ade250 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -21,3 +21,4 @@ Requests==2.31.0 stability_sdk toml==0.10.2 +google-cloud-texttospeech diff --git a/src/service/aios_shell/aios_shell.py b/src/service/aios_shell/aios_shell.py index 3a20679..0e82363 100644 --- a/src/service/aios_shell/aios_shell.py +++ b/src/service/aios_shell/aios_shell.py @@ -5,6 +5,7 @@ import os import logging import re import toml +import shlex from typing import Any, Optional, TypeVar, Tuple, Sequence import argparse @@ -141,6 +142,20 @@ class AIOS_Shell: show_text = FormattedText([("class:title", f"{self.current_topic}@{self.current_target} >>> "), ("class:content", resp)]) return show_text + case 'set_config': + show_text = FormattedText([("class:title", f"set config failed!")]) + if len(args) == 1: + key = args[0] + old_value,config_item = AIStorage.get_instance().get_user_config().get_user_config(key) + if config_item is not None: + value = await session.prompt_async(f"{key} : {config_item.desc} \nCurrent : {old_value}\nPlease input new value:",style=shell_style) + AIStorage.get_instance().get_user_config().set_user_config(key,value) + await AIStorage.get_instance().get_user_config().save_value_to_user_config() + show_text = FormattedText([("class:title", f"set {key} to {value} success!")]) + + return show_text + + case 'open': if len(args) >= 1: target_id = args[0] @@ -190,18 +205,15 @@ history = FileHistory('aios_shell_history.txt') session = PromptSession(history=history) def parse_function_call(func_string): - match = re.search(r'\s*(\w+)\s*\(\s*(.*)\s*\)\s*', func_string) - if not match: + if len(func_string) > 2: + if func_string[0] == '/' and func_string[1] != '/': + str_list = shlex.split(func_string[1:]) + func_name = str_list[0] + params = str_list[1:] + return func_name, params + else: return None - - func_name = match.group(1) - params_string = match.group(2).strip() - params = re.split(r'\s*,\s*(?=(?:[^"]*"[^"]*")*[^"]*$)', params_string) - params = [param.strip('"') for param in params] - if len(params[0]) == 0: - params = None - - return func_name, params + async def get_user_config_from_input(check_result:dict) -> bool: for key,item in check_result.items(): @@ -233,6 +245,7 @@ def print_welcome_screen(): print("\033[0m") print("\033[1;32m \t\tWelcome to OpenDAN - Your Personal AI OS\033[0m\n") + introduce = """ \tThe core goal of version 0.5.1 is to turn the concept of AIOS into code and get it up and running as quickly as possible. \tAfter three weeks of development, our plans have undergone some changes based on the actual progress of the system. @@ -241,7 +254,7 @@ def print_welcome_screen(): \twe intend to strengthen some components. This document will explain these changes and provide an update \ton the current development progress of MVP(0.5.1,0.5.2) -""" +""" print(introduce) print(f"\033[1;34m \t\tVersion: {AIOS_Version}\n\033") @@ -253,7 +266,7 @@ def print_welcome_screen(): async def main(): print_welcome_screen() - print("OpenDAN is booting...") + print("Booting...") logging.basicConfig(filename="aios_shell.log",filemode="w",encoding='utf-8',force=True, level=logging.INFO, format='[%(asctime)s]%(name)s[%(levelname)s]: %(message)s') @@ -294,14 +307,16 @@ async def main(): return await main_daemon_loop(shell) #TODO: read last input config - completer = WordCompleter(['send($target,$msg,$topic)', - 'open($target,$topic)', - 'history($num,$offset)', - 'login($username)', - 'connect($target)', - 'show()', - 'exit()', - 'help()'], ignore_case=True) + completer = WordCompleter(['/send $target $msg $topic', + '/open $target $topic', + '/history $num $offset', + '/login $username', + '/connect $target', + '/set_config $key', + '/list_config', + '/show', + '/exit', + '/help'], ignore_case=True) while True: user_input = await session.prompt_async(f"{shell.username}<->{shell.current_topic}@{shell.current_target}$",completer=completer,style=shell_style)