Skip to content

Commit d1d0dd4

Browse files
committed
[features-service][add atomic crud]
1 parent 6a8fa07 commit d1d0dd4

File tree

16 files changed

+1474
-283
lines changed

16 files changed

+1474
-283
lines changed

docker-compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ services:
127127
TZ: "${TZ}"
128128
ports:
129129
- 11434:11434
130-
volumes:
130+
# volumes:
131131
# - //d/models/ollama:/root/.ollama # windows path
132-
# - /Users/wangyunpeng/Downloads/models:/root/.ollama # linux/mac path
132+
# - /Users/xxxx/Desktop/ollama:/root/.ollama # linux/mac path
133133
networks:
134134
- ekg-net
135135
restart: on-failure

examples/muagent_examples/codechat_example.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@
3131
embeddings = None
3232
logger.error(f"{e}")
3333

34-
# # test local code
35-
# src_dir = os.path.join(
36-
# os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
37-
# )
38-
# sys.path.append(src_dir)
34+
# test local code
35+
src_dir = os.path.join(
36+
os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
37+
)
38+
sys.path.append(src_dir)
3939
from muagent.base_configs.env_config import CB_ROOT_PATH
4040
from muagent.llm_models.llm_config import EmbedConfig, LLMConfig
4141
from muagent.connector.phase import BasePhase
@@ -58,7 +58,7 @@
5858

5959
# delete codebase
6060
codebase_name = 'client_local'
61-
code_path = "D://chromeDownloads/devopschat-bot/client_v2/client"
61+
code_path = "{add_your_code_path}"
6262
# initialize codebase
6363
use_nh = True
6464
do_interpret = True

muagent/base_configs/prompts/intention_template_prompt.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,17 @@ def get_intention_prompt(
9797

9898

9999
INTENTIONS_CONSULT_WHICH = [
100-
('整体计划查询', '用户询问关于某个解决方案的完整流程或步骤,包含但不限于“整个流程”、“步骤”、“流程图”等词汇或概念。'),
101-
('下一步任务查询', '用户询问在某个解决方案的特定步骤中应如何操作或处理,通常会提及“下一步”、“具体操作”、“如何做”等,且明确指向解决方案中的某个特定环节。'),
100+
('整体计划查询', '用户想要获取某个问题的答案,或某个解决方案的完整流程(步骤)。'),
101+
('下一步任务查询', '用户询问某个问题或方案的特定步骤,通常会提及“下一步”、“具体操作”'),
102102
('闲聊', '用户询问的内容与当前的技术问题或解决方案无关,更多是出于兴趣或社交性质的交流。')
103103
]
104104
CONSULT_WHICH_PROMPT = get_intention_prompt(
105105
'作为运维领域的客服,您的职责是根据用户询问的内容,精准判断其背后的意图,以便提供最恰当的服务和支持。',
106106
INTENTIONS_CONSULT_WHICH,
107107
{
108+
'如何组织一次活动?': '整体计划查询',
108109
'系统升级的整个流程是怎样的?': '整体计划查询',
110+
'为什么我没有收到红包?请告诉我方案': '整体计划查询',
109111
'听说你们采用了新工具,能讲讲它的特点吗?': '闲聊'
110112
}
111113
)
@@ -119,7 +121,7 @@ def get_intention_prompt(
119121
INTENTIONS_WHETHER_EXEC,
120122
{
121123
'为什么我的优惠券使用失败?': '执行',
122-
'我想知道如何才能更好地优化我的服务器性能,你们有什么建议吗?': '询问'
124+
'为什么我的优惠券使用失败?请告诉我方案': '询问'
123125
}
124126
)
125127

muagent/connector/agents/base_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import List, Union
1+
from typing import List, Union,Generator
22
import importlib
33
import re, os
44
import copy

muagent/connector/agents/executor_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import List, Union
1+
from typing import List, Union, Generator
22
import copy
33
import uuid
44
from loguru import logger

muagent/connector/memory_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from abc import abstractmethod, ABC
22
from typing import List, Dict
3-
import os, sys, copy, json, uuid
3+
import os, sys, copy, json, uuid, random
44
from jieba.analyse import extract_tags
55
from collections import Counter
66
from loguru import logger
@@ -238,7 +238,7 @@ def __init__(
238238
# self.unique_name = unique_name
239239
# self.memory_type = memory_type
240240
self.db_config = db_config
241-
self.vb_config = vb_config
241+
self.vb_config = vb_config or VBConfig(vb_type="LocalFaissHandler")
242242
self.gb_config = gb_config
243243
self.tb_config = tb_config
244244
self.do_init = do_init

muagent/connector/phase/base_phase.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ def __init__(
9292
)
9393
else:
9494
self.memory_manager: BaseMemoryManager = LocalMemoryManager(
95-
unique_name=phase_name, do_init=True, kb_root_path = kb_root_path, embed_config=embed_config, llm_config=llm_config
95+
# unique_name=phase_name,
96+
do_init=True, kb_root_path = kb_root_path, embed_config=embed_config, llm_config=llm_config
9697
)
9798
self.conv_summary_agent = BaseAgent(
9899
role=role_configs["conv_summary"].role,

muagent/db_handler/graph_db_handler/geabase_handler.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,24 @@ def __init__(
2525
self.project = gb_config.extra_kwargs.get("project")
2626
self.city = gb_config.extra_kwargs.get("city")
2727
self.lib_path = gb_config.extra_kwargs.get("lib_path")
28-
29-
GeaBaseEnv.init(self.lib_path)
30-
self.geabase_client = GeaBaseClient(
31-
self.metaserver_address, self.project,self.city
32-
)
28+
self.graph_name = gb_config.extra_kwargs.get("graph_name")
29+
30+
try:
31+
GeaBaseEnv.init(self.lib_path)
32+
except Exception as e:
33+
logger.error(f"{e}")
34+
35+
if self.graph_name:
36+
self.geabase_client = GeaBaseClient(
37+
self.metaserver_address, self.project,self.city,
38+
graph_name=self.graph_name
39+
)
40+
self.hop_max = 6
41+
else:
42+
self.geabase_client = GeaBaseClient(
43+
self.metaserver_address, self.project,self.city,
44+
)
45+
self.hop_max = 8
3346

3447
# option 指定
3548
self.option = GeaBaseEnv.QueryRequestOption.newBuilder().gqlType(GeaBaseEnv.QueryProtocol.GQLType.GQL_ISO).build()
@@ -227,7 +240,7 @@ def get_hop_infos(self, attributes: dict, node_type: str = None, hop: int = 2, b
227240
'''
228241
hop >= 2, 表面需要至少两跳
229242
'''
230-
hop_max = 8
243+
hop_max = self.hop_max
231244
#
232245
where_str = ' and '.join([f"n0.{k}='{v}'" for k, v in attributes.items()])
233246
if reverse:

muagent/db_handler/graph_db_handler/nebula_handler.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ def execute_cypher(self, cypher: str, space_name: str = '', format_res: str = 'a
7171
resp = resp.dict_for_vis()
7272
return resp
7373

74+
def add_hosts(self, hostname, port):
75+
with self.connection_pool.session_context(self.username, self.password) as session:
76+
cypher = f'ADD HOSTS "{hostname}":{port}'
77+
resp = session.execute(cypher)
78+
return resp
79+
7480
def close_connection(self):
7581
self.connection_pool.close()
7682

muagent/schemas/ekg/ekg_graph.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ class EKGNodeTbaseSchema(BaseModel):
165165
# node_str = 'graph_id={graph_id}'/teamids, use for searching by graph_id/teamids
166166
node_str: str
167167
name_keyword: str
168-
desc_keyword: str
168+
description_keyword: str
169169
name_vector: List
170-
desc_vector: List
170+
description_vector: List
171171

172172

173173
class EKGEdgeTbaseSchema(BaseModel):
@@ -204,6 +204,24 @@ class EKGSlsData(BaseModel):
204204
}
205205

206206

207+
###############################
208+
##### tbase & gbase status #####
209+
###############################
210+
211+
class TbaseExecStatus(BaseModel):
212+
errorMessage: Optional[str] = None
213+
statusCode: Optional[int] = None
214+
#
215+
total: Optional[int] = None
216+
docs: Optional[List[dict]] = None
217+
218+
class GbaseExecStatus(BaseModel):
219+
errorMessage: Optional[str] = None
220+
statusCode: Optional[int] = None
221+
222+
223+
224+
207225
#####################
208226
##### yuque dsl #####
209227
#####################

0 commit comments

Comments
 (0)