diff --git a/.github/workflows/docker-image-pull.yml b/.github/workflows/docker-image-pull.yml index d867a29..ca64365 100644 --- a/.github/workflows/docker-image-pull.yml +++ b/.github/workflows/docker-image-pull.yml @@ -12,7 +12,7 @@ jobs: os: [linux] service: - name: runtime:0.1.0 - - name: ekgservice:0.1.0 + - name: muagent:0.1.0 - name: ekgfrontend:0.1.0 steps: diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 7049c57..04e0c50 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -22,8 +22,8 @@ jobs: - name: ekgservice context: . dockerfile: ./Dockerfile_gh - tag: ghcr.io/codefuse-ai/ekgservice:0.1.0 - tag_latest: ghcr.io/codefuse-ai/ekgservice:latest + tag: ghcr.io/codefuse-ai/muagent:0.1.0 + tag_latest: ghcr.io/codefuse-ai/muagent:latest steps: - name: Checkout code diff --git a/README.md b/README.md index b9dd126..dcdc7c4 100644 --- a/README.md +++ b/README.md @@ -71,9 +71,8 @@ docker compose up -d -Now is beta version. Once the v1.0+ version is enhanced, we will release v1.0+ image for download. +We provide corresponding muagent-related images (beta) at [codefuse-ai/packages](https://github.com/orgs/codefuse-ai/packages). If needed, you can download them using `bash docker_pull_images.sh`. -To Be Continued! ### SDK diff --git a/README_zh.md b/README_zh.md index d8f3f13..a882b43 100644 --- a/README_zh.md +++ b/README_zh.md @@ -71,9 +71,8 @@ https://github.com/user-attachments/assets/7d5251a0-2864-438c-8897-b0445f0b1c30 https://github.com/user-attachments/assets/34e5efea-f237-4b04-aeca-1f443ed7eb88 -现在仍为 beta 版本,待 v1.0 版本完善后,会放出 v1.0+ 的镜像以供下载。 +我们在[codefuse-ai/packages](https://github.com/orgs/codefuse-ai/packages)中提供了对应muagent相关的镜像(beta版本),有需要可以通过`bash docker_pull_images.sh`进行下载。如果存在网络问题,可通过[个人阿里云镜像方案](docs/gh_image_to_aliyun_image.md)完成镜像同步。 -敬请期待! ### SKD 版本 diff --git a/docker_pull_images.sh b/docker_pull_images.sh new file mode 100644 index 0000000..82998c1 --- /dev/null +++ b/docker_pull_images.sh @@ -0,0 +1,27 @@ +#!/bin/bash + + +# while network is error, `docker-compose up -d` might error +# so we add a script for pulling dependent images befort `docker-compose up -d` + +# 国内镜像源,根据需要自行配置,不一定完全生效 +# 搜索引擎搜 ”DockerHub国内镜像源列表“ 即可 +# "registry-mirrors": [] + + +# pull images from dockerhub docker.io +docker pull vesoft/nebula-metad:v3.8.0 +docker pull vesoft/nebula-storaged:v3.8.0 +docker pull vesoft/nebula-graphd:v3.8.0 +docker pull redis/redis-stack:7.4.0-v0 +docker pull ollama/ollama:0.3.6 + +# pull images from github ghcr.io by nju +docker pull ghcr.nju.edu.cn/runtime:0.1.0 +docker pull ghcr.nju.edu.cn/muagent:0.1.0 +docker pull ghcr.nju.edu.cn/ekgfrontend:0.1.0 + +# # pull images from github ghcr.io +# docker pull ghcr.io/runtime:0.1.0 +# docker pull ghcr.io/muagent:0.1.0 +# docker pull ghcr.io/ekgfrontend:0.1.0 diff --git a/docs/gh_image_to_aliyun_image.md b/docs/gh_image_to_aliyun_image.md index e72bfa2..711e9fa 100644 --- a/docs/gh_image_to_aliyun_image.md +++ b/docs/gh_image_to_aliyun_image.md @@ -3,7 +3,7 @@ ## 1、使用google/baidu 搜索 阿里云镜像服务 ## 2、登录后点击管理控制台 -![](resources/aliyun_01.webp) +![](resources/aliyun_01.png) ## 3、点击个人实例,如果没有就生成一个(免费的) ![](resources/aliyun_02.webp) @@ -28,7 +28,7 @@ ALIYUN_PASSWWORD={配置访问凭证} ```bash # 本地执行拉取镜像 -# 示例,仅支持ekgfrontend、runtime、ekgservice;其他镜像根据需求对docker-image-pull进行修改 +# 示例,仅支持ekgfrontend、runtime、muagent;其他镜像根据需求对docker-image-pull进行修改 # 登录阿里云镜像库 docker login --username=xxx registry.cn-hangzhou.aliyuncs.com diff --git a/docs/resources/aliyun_01.png b/docs/resources/aliyun_01.png new file mode 100644 index 0000000..7cc737c Binary files /dev/null and b/docs/resources/aliyun_01.png differ diff --git a/docs/resources/aliyun_01.webp b/docs/resources/aliyun_01.webp deleted file mode 100644 index 39c0874..0000000 Binary files a/docs/resources/aliyun_01.webp and /dev/null differ diff --git a/muagent/db_handler/graph_db_handler/nebula_handler.py b/muagent/db_handler/graph_db_handler/nebula_handler.py index 6c3e73f..79fcb24 100644 --- a/muagent/db_handler/graph_db_handler/nebula_handler.py +++ b/muagent/db_handler/graph_db_handler/nebula_handler.py @@ -289,7 +289,16 @@ def add_node(self, node: GNode) -> GbaseExecStatus: if prop_name in {'extra', 'description', 'envdescription','updaterule'}: # 转义换行符和双引号 value = value.replace("\n", "\\n").replace("\"", "\\\"") - cypher += f'"{value}",' + cypher += f'"{value}",' + elif prop_name == 'description': + value = value.replace("\n", "\\n").replace("\"", "\\\"") + cypher += f'"{value}",' + elif prop_name == 'envdescription': + value = value.replace("\n", "\\n").replace("\"", "\\\"") + cypher += f'"{value}",' + else: + cypher += f'"{value}",' + #cypher += f'"{value}",' else: cypher += f'{value},' cypher = cypher.rstrip(',') diff --git a/muagent/db_handler/vector_db_handler/tbase_handler.py b/muagent/db_handler/vector_db_handler/tbase_handler.py index de30551..70e5776 100644 --- a/muagent/db_handler/vector_db_handler/tbase_handler.py +++ b/muagent/db_handler/vector_db_handler/tbase_handler.py @@ -117,20 +117,24 @@ def vector_search(self, base_query: str, index_name: str = None, query_params: d r = self.search(query, index_name, query_params, limit=limit) return r - def delete(self, content): + def delete(self, content: str): ''' delete :param id: :return: ''' - id = f"{self.definition_value}:{content}" + id = content if content.startswith(f"{self.definition_value}:") \ + else f"{self.definition_value}:{content}" res = self.client.delete(id) return res - def get(self, content): - id = f"{self.definition_value}:{content}" - logger.debug(f"{id}") - res = self.client.hgetall(id) + def get(self, content, id=None, key=None): + id = id or f"{self.definition_value}:{content}" + + if key: + res = self.client.hget(id, key) + else: + res = self.client.hgetall(id) return res def fuzzy_delete(self, collection_name, delete_str, index_name="test"): diff --git a/muagent/service/ekg_construct/ekg_construct_base.py b/muagent/service/ekg_construct/ekg_construct_base.py index 150c152..5a1b816 100644 --- a/muagent/service/ekg_construct/ekg_construct_base.py +++ b/muagent/service/ekg_construct/ekg_construct_base.py @@ -481,15 +481,21 @@ def add_nodes(self, nodes: List[GNode], teamid: str, ekg_type: str="ekgnode") -> tbase_nodes = [] for node in nodes: # get the node's teamids - r = self.tb.search( - f"@node_id: *{node.id}*", index_name=self.node_indexname - ) - + r = self.tb.get(node.id, key="node_str") teamids = [ i.strip() - for i in r.docs[0]["node_str"].replace("graph_id=", "").split(",") - if i.strip() - ] if r.docs else [] + for i in r.decode().replace("graph_id=", "").split(",") + ] if r else [] + + # r = self.tb.search( + # f"@node_id: *{node.id}*", index_name=self.node_indexname + # ) + + # teamids = [ + # i.strip() + # for i in r.docs[0]["node_str"].replace("graph_id=", "").split(",") + # if i.strip() + # ] if r.docs else [] teamids = list(set(teamids+[teamid])) tbase_nodes.append({ @@ -667,11 +673,17 @@ def update_nodes(self, nodes: List[GNode], teamid: str): logger.error(f"there must something wrong! " f"ID not match, such as {tbase_missing_nodeids}") for nodeid in tbase_missing_nodeids: - r = self.tb.search( - f"@node_id: {nodeid.replace('-', '_')}", - index_name=self.node_indexname) - teamids_by_nodeid.update( - {data['node_id']: data["node_str"] for data in r.docs}) + r = self.tb.get(nodeid.replace('-', '_'), key="node_str") + if r: + teamids_by_nodeid.update( + {nodeid.replace('-', '_'): r.decode()} + ) + + # r = self.tb.search( + # f"@node_id: {nodeid.replace('-', '_')}", + # index_name=self.node_indexname) + # teamids_by_nodeid.update( + # {data['node_id']: data["node_str"] for data in r.docs}) tbase_datas = [] for node in nodes: @@ -811,12 +823,18 @@ def get_node_by_id( else: node = GNode(id=nodeid, type="", attributes={}) # tbase search - r = self.tb.search(f"@node_id: *{nodeid}*", index_name=self.node_indexname) + r = self.tb.get(nodeid.replace('-', '_'), key="node_str") teamids = [ - i.strip() - for i in r.docs[0]["node_str"].replace("graph_id=", "").split(",") - if i.strip() - ] if r.docs else [] + i.strip() + for i in r.decode().replace("graph_id=", "").split(",") + ] if r else [] + + # r = self.tb.search(f"@node_id: *{nodeid}*", index_name=self.node_indexname) + # teamids = [ + # i.strip() + # for i in r.docs[0]["node_str"].replace("graph_id=", "").split(",") + # if i.strip() + # ] if r.docs else [] node.attributes["teamids"] = ', '.join(teamids) return node