初步建立agent术语表配置

This commit is contained in:
xunbu
2025-08-27 21:05:30 +08:00
parent b1d68c2fc0
commit 78a4525108
6 changed files with 81 additions and 14 deletions

View File

@@ -0,0 +1,15 @@
class Glossary:
def __init__(self,glossary_dict:dict[str:str]|None=None):
self.glossary_dict=glossary_dict
def update(self,update_dict:dict[str:str]):
for src,dst in update_dict.items():
if src not in self.glossary_dict:
self.glossary_dict[src]=dst
def append_system_prompt(self,text:str):
prompt="\n以下为参考术语表:\n"
for src,dst in self.glossary_dict:
if src in text:
prompt+=f"{src}=>{dst}\n"
prompt+="术语表结束\n"