Merge remote-tracking branch 'origin/main' into MVP
# Conflicts: # src/service/aios_shell/aios_shell.py
This commit is contained in:
@@ -58,7 +58,7 @@ Click the image below for a demo:
|
|||||||
There are two ways to install the Internal Test Version of OpenDAN:
|
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
|
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
|
### 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
|
2. OpenAI API Token
|
||||||
If there is no api token, you can apply for [here](https://beta.openai.com/)
|
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
|
### Install
|
||||||
|
|
||||||
@@ -136,21 +136,27 @@ Say Hello to your private AI assistant Jarvis !
|
|||||||
|
|
||||||
### Build OpenDAN from source code
|
### Build OpenDAN from source code
|
||||||
1. Install the latest version of python (>= 3.11) and pip
|
1. Install the latest version of python (>= 3.11) and pip
|
||||||
2. Clone the source code
|
1. Clone the source code
|
||||||
```
|
```
|
||||||
git clone https://github.com/fiatrete/OpenDAN-Personal-AI-OS.git
|
git clone https://github.com/fiatrete/OpenDAN-Personal-AI-OS.git
|
||||||
cd OpenDAN-Personal-AI-OS
|
cd OpenDAN-Personal-AI-OS
|
||||||
```
|
```
|
||||||
3. Install the dependent python library
|
1. Enable virtual env
|
||||||
```
|
```
|
||||||
pip install -r ./src/requirements.txt
|
virtualenv venv
|
||||||
```
|
source ./venv/bin/activate
|
||||||
Waiting for installation.
|
```
|
||||||
|
1. Install the dependent python library
|
||||||
4. Start OpenDAN through aios_shell
|
```
|
||||||
```
|
pip install -r ./src/requirements.txt
|
||||||
python ./src/srvice/aios_shell/aios_shell.py
|
```
|
||||||
```
|
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:
|
Now OpenDAN runs in the development mode, and the directory is:
|
||||||
- AIOS_ROOT: ./rootfs (/opt/aios in docker)
|
- AIOS_ROOT: ./rootfs (/opt/aios in docker)
|
||||||
- AIOS_MYAI: ~/myai (/root/myai in docer)
|
- AIOS_MYAI: ~/myai (/root/myai in docer)
|
||||||
|
|||||||
@@ -70,10 +70,12 @@ class ComputeNodeConfig:
|
|||||||
def remove_node(self, model_type: str, url: str, model_name: str):
|
def remove_node(self, model_type: str, url: str, model_name: str):
|
||||||
if model_type == "llama":
|
if model_type == "llama":
|
||||||
llama_nodes_cfg = self.config.get("llama") or []
|
llama_nodes_cfg = self.config.get("llama") or []
|
||||||
for i in range(0, len(llama_nodes_cfg)):
|
i = 0
|
||||||
cfg = llama_nodes_cfg[i]
|
for cfg in llama_nodes_cfg:
|
||||||
if url == cfg["url"] and model_name == cfg["model_name"]:
|
if url == cfg["url"] and model_name == cfg["model_name"]:
|
||||||
llama_nodes_cfg.pop(i)
|
llama_nodes_cfg.pop(i)
|
||||||
|
else:
|
||||||
|
i += 1
|
||||||
|
|
||||||
def list(self) -> str:
|
def list(self) -> str:
|
||||||
return toml.dumps(self.config)
|
return toml.dumps(self.config)
|
||||||
|
|||||||
@@ -471,8 +471,9 @@ class Workflow:
|
|||||||
async def _get_prompt_from_session(self,the_role:AIRole,chatsession:AIChatSession) -> AgentPrompt:
|
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
|
messages = chatsession.read_history(the_role.history_len) # read last 10 message
|
||||||
result_prompt = AgentPrompt()
|
result_prompt = AgentPrompt()
|
||||||
|
|
||||||
for msg in reversed(messages):
|
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})
|
result_prompt.messages.append({"role":"assistant","content":msg.body})
|
||||||
else:
|
else:
|
||||||
result_prompt.messages.append({"role":"user","content":f"{msg.body}"})
|
result_prompt.messages.append({"role":"user","content":f"{msg.body}"})
|
||||||
|
|||||||
@@ -356,10 +356,13 @@ class AIOS_Shell:
|
|||||||
pipelines = KnowledgePipelineManager.get_instance().get_pipelines()
|
pipelines = KnowledgePipelineManager.get_instance().get_pipelines()
|
||||||
print_formatted_text("\r\n".join(pipeline.get_name() for pipeline in pipelines))
|
print_formatted_text("\r\n".join(pipeline.get_name() for pipeline in pipelines))
|
||||||
if sub_cmd == "journal":
|
if sub_cmd == "journal":
|
||||||
name = args[1]
|
try:
|
||||||
topn = 10 if len(args) == 2 else int(args[2])
|
name = args[1]
|
||||||
journals = [str(journal) for journal in KnowledgePipelineManager.get_instance().get_pipeline(name).get_journal().latest_journals(topn)]
|
topn = 10 if len(args) == 2 else int(args[2])
|
||||||
print_formatted_text("\r\n".join(str(journal) for journal in journals))
|
journals = [str(journal) for journal in KnowledgePipelineManager.get_instance().get_pipeline(name).get_journal().latest_journals(topn)]
|
||||||
|
print_formatted_text("\r\n".join(str(journal) for journal in journals))
|
||||||
|
except ValueError:
|
||||||
|
return FormattedText([("class:title", f"/knowledge journal failed: {args[1]} is not a valid integer.\n")])
|
||||||
if sub_cmd == "query":
|
if sub_cmd == "query":
|
||||||
if len(args) < 2:
|
if len(args) < 2:
|
||||||
return show_text
|
return show_text
|
||||||
@@ -404,8 +407,8 @@ class AIOS_Shell:
|
|||||||
if len(args) < 4:
|
if len(args) < 4:
|
||||||
return show_text
|
return show_text
|
||||||
|
|
||||||
model_name = args[3]
|
model_name = args[2]
|
||||||
url = args[4]
|
url = args[3]
|
||||||
ComputeNodeConfig.get_instance().remove_node("llama", url, model_name)
|
ComputeNodeConfig.get_instance().remove_node("llama", url, model_name)
|
||||||
ComputeNodeConfig.get_instance().save()
|
ComputeNodeConfig.get_instance().save()
|
||||||
else:
|
else:
|
||||||
@@ -760,6 +763,7 @@ async def main():
|
|||||||
'/disable $feature',
|
'/disable $feature',
|
||||||
'/node add llama $model_name $url',
|
'/node add llama $model_name $url',
|
||||||
'/node rm llama $model_name $url',
|
'/node rm llama $model_name $url',
|
||||||
|
'/node list',
|
||||||
'/show',
|
'/show',
|
||||||
'/exit',
|
'/exit',
|
||||||
'/help'], ignore_case=True)
|
'/help'], ignore_case=True)
|
||||||
|
|||||||
@@ -35,10 +35,15 @@ def apply_storage():
|
|||||||
socks.set_default_proxy(socks.SOCKS5, host, int(port), username = username, password = password)
|
socks.set_default_proxy(socks.SOCKS5, host, int(port), username = username, password = password)
|
||||||
socket.socket = socks.socksocket
|
socket.socket = socks.socksocket
|
||||||
logger.info(f"proxy {host_url} will be used.")
|
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 _:
|
case _:
|
||||||
logger.error(f"the proxy type ({proxy_type}) has not support. proxy will not be used.")
|
logger.error(f"the proxy type ({proxy_type}) has not support. proxy will not be used.")
|
||||||
|
|
||||||
|
|
||||||
def declare_user_config():
|
def declare_user_config():
|
||||||
user_config = AIStorage.get_instance().get_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)
|
||||||
|
|||||||
Reference in New Issue
Block a user