Skip to content

同步1220 #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ zdatafront*
*log
examples/mysql/db



# frontend
frontend/node_modules
frontend/.env.local
Expand All @@ -37,4 +39,21 @@ frontend/.mfsu
frontend/.swc
frontend/pnpm-lock.yaml

*.jar
*.jar




.spyproject/
model_config.py
model_config_example.py
config.py
**/service_onlyant
**/ekg_test
**/generalization_reasoning
ekg.yaml
*.ipynb
**/web_operation
examples/mysql/db
tests/service/test_*
tests/service/replacements.py
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ services:


mysql:
image: mysql:8.0.23
image: mysql:8.4.3
container_name: mysql
environment:
MYSQL_ROOT_PASSWORD: 'root'
Expand Down
68 changes: 41 additions & 27 deletions examples/ekg_examples/who_is_spy_game.py

Large diffs are not rendered by default.

28 changes: 23 additions & 5 deletions muagent/connector/memory_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from collections import Counter
from loguru import logger
import numpy as np
import logging

from langchain_community.docstore.document import Document

Expand Down Expand Up @@ -877,7 +878,7 @@ def get_msg_by_role_name(self, chat_index: str, role_name: str) -> Optional[Mess
return msg
return None

def get_msg_content_by_role_name(self, chat_index: str, role_name: str) -> Optional[str]:
def get_msg_content_by_rule_name(self, chat_index: str, role_name: str) -> Optional[str]:
message = self.get_msg_by_role_name(chat_index, role_name)
if message == None:
return None
Expand All @@ -889,16 +890,33 @@ def update_msg_content_by_rule(self, chat_index: str, role_name: str, new_conten

if message == None:
return False

prompt = f"{new_content}\n{role_name}:{message.role_content}\n{update_rule}"

if update_rule == '':
prompt = '任务:请根据游戏内容,更新变量,变量名为:' + role_name + ',变量更新前的内容为:' + message.role_content + '。本节点游戏记录:' + new_content + '。请根据游戏内容,输出更新后的变量内容,不要包含其他信息,不要重复变量名,只输出变量更新后的内容即可。。'
else:
prompt = '任务:请根据游戏内容,更新变量,变量名为:' + role_name + ',变量更新前的内容为:' + message.role_content + '。本节点游戏记录:' + new_content + '。变量更新规则为:' + update_rule + '。请根据游戏内容和变量更新规则,输出更新后的变量内容,不要包含其他信息,不要重复变量名,只输出变量更新后的内容即可。'
logging.info(f'变量更新的prompt:{prompt}')
model = getChatModelFromConfig(self.llm_config)

new_role_content = model.predict(prompt)

logging.info(f'变量更新的输出结果:{new_role_content}')
if new_role_content is not None:
message.role_content = new_role_content
self.append(message)
logging.info(f'输出结果:{self.get_msg_content_by_rule_name(chat_index, role_name)}')

return True
else:
return False

def update_global_msg_content(self, chat_index: str, role_name: str, new_content: str) -> bool:
message = self.get_msg_by_role_name(chat_index, role_name)
print(f' message if {message}')
if message == None:
return False

if new_content is not None:
message.role_content = new_content
self.append(message)
return True
else:
return False
13 changes: 3 additions & 10 deletions muagent/db_handler/graph_db_handler/nebula_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ def __init__(self,gb_config : GBConfig = None):
self.nb_pw = '' or 'nebula'
self.space_name = "client"
else:

logger.info('NebulaGraph容器启动中,请等待')

if self.nebula_started(gb_config):
self.connection_pool.init([(gb_config.extra_kwargs.get("host"), gb_config.extra_kwargs.get("port"))], config)


self.username = gb_config.extra_kwargs.get("username")
self.nb_pw = gb_config.extra_kwargs.get("password")
self.space_name = gb_config.extra_kwargs.get("space")
Expand Down Expand Up @@ -317,16 +319,7 @@ def add_node(self, node: GNode) -> GbaseExecStatus:
if prop_name in {'extra', 'description', 'envdescription','updaterule'}:
# 转义换行符和双引号
value = value.replace("\n", "\\n").replace("\"", "\\\"")
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}",'
cypher += f'"{value}",'
else:
cypher += f'{value},'
cypher = cypher.rstrip(',')
Expand Down
Loading