From 2e0dca148eaa3d8c1354c0f4a27fa9401bd31474 Mon Sep 17 00:00:00 2001 From: streetycat <305190374@qq.com> Date: Mon, 9 Oct 2023 03:36:10 +0000 Subject: [PATCH 1/7] Several spelling errors --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8f158be..23f5140 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Click the image below for a demo: There are two ways to install the Internal Test Version of OpenDAN: 1. Installation through docker, this is also the installation method we recommend now -2. Installing through the source code, this method may encounter some traditional Pyhont dependence problems and requires you to have a certain ability to solve.But if you want to do secondary development of OpenDAN, this method is necessary. +2. Installing through the source code, this method may encounter some traditional Python dependence problems and requires you to have a certain ability to solve.But if you want to do secondary development of OpenDAN, this method is necessary. ### Preparation before installation @@ -75,7 +75,7 @@ If you don't know how to install docker, you can refer to [here](https://docs.do 2. OpenAI API Token If there is no api token, you can apply for [here](https://beta.openai.com/) -Applying for the API Token may have some thresholds for new players. You can find friends around you, and you can give you a temporary, or join our internal test experience group. We will also release some free experience API token from time to time.These token is limited to the maximum consumption and effective time +Applying for the API Token may have some thresholds for new players. You can find friends around you, and he can give you a temporary, or join our internal test experience group. We will also release some free experience API token from time to time.These token is limited to the maximum consumption and effective time ### Install From 2e07637e463dde1d340d3fb42a181fe361db6786 Mon Sep 17 00:00:00 2001 From: streetycat <305190374@qq.com> Date: Thu, 12 Oct 2023 04:17:02 +0000 Subject: [PATCH 2/7] fix a variable name --- src/aios_kernel/workflow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aios_kernel/workflow.py b/src/aios_kernel/workflow.py index a25e202..f1e0064 100644 --- a/src/aios_kernel/workflow.py +++ b/src/aios_kernel/workflow.py @@ -442,7 +442,7 @@ class Workflow: prompt = AgentPrompt() - prompt.append(the_role.agent.prompt) + prompt.append(the_role.agent.agent_prompt) prompt.append(self.get_workflow_rule_prompt()) prompt.append(the_role.get_prompt()) # prompt.append(self._get_function_prompt(the_role.get_name())) From b117b36e5bea44891bd23071de3c544a5bdbb798 Mon Sep 17 00:00:00 2001 From: streetycat <305190374@qq.com> Date: Mon, 16 Oct 2023 10:00:53 +0000 Subject: [PATCH 3/7] fix bugs --- rootfs/agents/math_teacher/agent.toml | 2 +- src/aios_kernel/compute_kernel.py | 2 +- src/aios_kernel/workflow.py | 3 ++- src/service/aios_shell/aios_shell.py | 5 +++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/rootfs/agents/math_teacher/agent.toml b/rootfs/agents/math_teacher/agent.toml index 871b29a..3f84b7a 100644 --- a/rootfs/agents/math_teacher/agent.toml +++ b/rootfs/agents/math_teacher/agent.toml @@ -1,6 +1,6 @@ instance_id = "math_teacher" fullname = "the one" -llm_model_name = "gpt-4-0613" +llm_model_name = "70B" [[prompt]] role = "system" content = "You are a teacher who is proficient in mathematics" diff --git a/src/aios_kernel/compute_kernel.py b/src/aios_kernel/compute_kernel.py index 3f97708..3cc5cf2 100644 --- a/src/aios_kernel/compute_kernel.py +++ b/src/aios_kernel/compute_kernel.py @@ -123,7 +123,7 @@ class ComputeKernel: if task_req.state == ComputeTaskState.ERROR: break - if check_times >= 120: + if check_times >= 12000: task_req.state = ComputeTaskState.ERROR break diff --git a/src/aios_kernel/workflow.py b/src/aios_kernel/workflow.py index f1e0064..5cf0bbf 100644 --- a/src/aios_kernel/workflow.py +++ b/src/aios_kernel/workflow.py @@ -544,8 +544,9 @@ class Workflow: async def _get_prompt_from_session(self,the_role:AIRole,chatsession:AIChatSession) -> AgentPrompt: messages = chatsession.read_history(the_role.history_len) # read last 10 message result_prompt = AgentPrompt() + for msg in reversed(messages): - if msg.sender == chatsession.owner_id: + if msg.sender == the_role.role_id: result_prompt.messages.append({"role":"assistant","content":msg.body}) else: result_prompt.messages.append({"role":"user","content":f"{msg.body}"}) diff --git a/src/service/aios_shell/aios_shell.py b/src/service/aios_shell/aios_shell.py index b10ac84..d42096e 100644 --- a/src/service/aios_shell/aios_shell.py +++ b/src/service/aios_shell/aios_shell.py @@ -414,8 +414,8 @@ class AIOS_Shell: if len(args) < 4: return show_text - model_name = args[3] - url = args[4] + model_name = args[2] + url = args[3] ComputeNodeConfig.get_instance().remove_node("llama", url, model_name) ComputeNodeConfig.get_instance().save() else: @@ -747,6 +747,7 @@ async def main(): '/disable $feature', '/node add llama $model_name $url', '/node rm llama $model_name $url', + '/node list', '/show', '/exit', '/help'], ignore_case=True) From d945796f7e539d547777cac8d769decab80aaccb Mon Sep 17 00:00:00 2001 From: streetycat <305190374@qq.com> Date: Mon, 16 Oct 2023 10:02:59 +0000 Subject: [PATCH 4/7] remove test --- rootfs/agents/math_teacher/agent.toml | 2 +- src/aios_kernel/compute_kernel.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rootfs/agents/math_teacher/agent.toml b/rootfs/agents/math_teacher/agent.toml index 3f84b7a..871b29a 100644 --- a/rootfs/agents/math_teacher/agent.toml +++ b/rootfs/agents/math_teacher/agent.toml @@ -1,6 +1,6 @@ instance_id = "math_teacher" fullname = "the one" -llm_model_name = "70B" +llm_model_name = "gpt-4-0613" [[prompt]] role = "system" content = "You are a teacher who is proficient in mathematics" diff --git a/src/aios_kernel/compute_kernel.py b/src/aios_kernel/compute_kernel.py index 3cc5cf2..3f97708 100644 --- a/src/aios_kernel/compute_kernel.py +++ b/src/aios_kernel/compute_kernel.py @@ -123,7 +123,7 @@ class ComputeKernel: if task_req.state == ComputeTaskState.ERROR: break - if check_times >= 12000: + if check_times >= 120: task_req.state = ComputeTaskState.ERROR break From 71726d680bde0e9974ea49556f0d2fb0cb7ffc67 Mon Sep 17 00:00:00 2001 From: alexsunxl Date: Wed, 18 Oct 2023 17:20:06 +0800 Subject: [PATCH 5/7] Fixed a crash with knowledge base arguments --- src/service/aios_shell/aios_shell.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/service/aios_shell/aios_shell.py b/src/service/aios_shell/aios_shell.py index d42096e..f015776 100644 --- a/src/service/aios_shell/aios_shell.py +++ b/src/service/aios_shell/aios_shell.py @@ -367,9 +367,12 @@ class AIOS_Shell: else: return show_text if sub_cmd == "journal": - topn = 10 if len(args) == 1 else int(args[1]) - journals = [str(journal) for journal in KnowledgePipline.get_instance().get_latest_journals(topn)] - print_formatted_text("\r\n".join(journals)) + try: + topn = 10 if len(args) == 1 else int(args[1]) + journals = [str(journal) for journal in KnowledgePipline.get_instance().get_latest_journals(topn)] + print_formatted_text("\r\n".join(journals)) + except ValueError: + return FormattedText([("class:title", f"/knowledge journal failed: {args[1]} is not a valid integer.\n")]) if sub_cmd == "query": if len(args) < 2: return show_text From c342e5678b73bf0a1a2ca1cdd2f4acfc7bee1563 Mon Sep 17 00:00:00 2001 From: streetycat <305190374@qq.com> Date: Tue, 24 Oct 2023 09:27:06 +0000 Subject: [PATCH 6/7] fix bugs for proxy and dynamics node --- src/aios_kernel/compute_node_config.py | 6 ++++-- src/service/aios_shell/proxy.py | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/aios_kernel/compute_node_config.py b/src/aios_kernel/compute_node_config.py index 8e25f50..c3b2c96 100644 --- a/src/aios_kernel/compute_node_config.py +++ b/src/aios_kernel/compute_node_config.py @@ -70,10 +70,12 @@ class ComputeNodeConfig: def remove_node(self, model_type: str, url: str, model_name: str): if model_type == "llama": llama_nodes_cfg = self.config.get("llama") or [] - for i in range(0, len(llama_nodes_cfg)): - cfg = llama_nodes_cfg[i] + i = 0 + for cfg in llama_nodes_cfg: if url == cfg["url"] and model_name == cfg["model_name"]: llama_nodes_cfg.pop(i) + else: + i += 1 def list(self) -> str: return toml.dumps(self.config) diff --git a/src/service/aios_shell/proxy.py b/src/service/aios_shell/proxy.py index f8b124c..2ed8a82 100644 --- a/src/service/aios_shell/proxy.py +++ b/src/service/aios_shell/proxy.py @@ -35,10 +35,15 @@ def apply_storage(): socks.set_default_proxy(socks.SOCKS5, host, int(port), username = username, password = password) socket.socket = socks.socksocket logger.info(f"proxy {host_url} will be used.") + case "http": + (host, port) = host.split(":") + socks.set_default_proxy(socks.HTTP, host, int(port), username = username, password = password) + socket.socket = socks.socksocket + logger.info(f"proxy {host_url} will be used.") case _: logger.error(f"the proxy type ({proxy_type}) has not support. proxy will not be used.") def declare_user_config(): user_config = AIStorage.get_instance().get_user_config() - user_config.add_user_config("proxy", "set your proxy service as 'proxy_type@host:port@username@password', 'proxy_type' = 'socks5'", True, None) + user_config.add_user_config("proxy", "set your proxy service as 'proxy_type@host:port@username@password', 'proxy_type' = 'socks5|http'", True, None) From 1083cddfd73df7397c8db590c1acd29d6509c84c Mon Sep 17 00:00:00 2001 From: Xin Xiang Date: Fri, 3 Nov 2023 12:16:02 -0700 Subject: [PATCH 7/7] Update README.md --- README.md | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 23f5140..00c066a 100644 --- a/README.md +++ b/README.md @@ -136,21 +136,27 @@ Say Hello to your private AI assistant Jarvis ! ### Build OpenDAN from source code 1. Install the latest version of python (>= 3.11) and pip -2. Clone the source code -``` -git clone https://github.com/fiatrete/OpenDAN-Personal-AI-OS.git -cd OpenDAN-Personal-AI-OS -``` -3. Install the dependent python library -``` -pip install -r ./src/requirements.txt -``` -Waiting for installation. - -4. Start OpenDAN through aios_shell -``` -python ./src/srvice/aios_shell/aios_shell.py -``` +1. Clone the source code + ``` + git clone https://github.com/fiatrete/OpenDAN-Personal-AI-OS.git + cd OpenDAN-Personal-AI-OS + ``` +1. Enable virtual env + ``` + virtualenv venv + source ./venv/bin/activate + ``` +1. Install the dependent python library + ``` + pip install -r ./src/requirements.txt + ``` + Waiting for installation. +1. Start OpenDAN through aios_shell + ``` + python ./src/srvice/aios_shell/aios_shell.py + ``` + 1. If seeing error saying `No ffmpeg exe could be found`, you need to install it manually from https://www.ffmpeg.org/ + Now OpenDAN runs in the development mode, and the directory is: - AIOS_ROOT: ./rootfs (/opt/aios in docker) - AIOS_MYAI: ~/myai (/root/myai in docer)