This commit is contained in:
xunbu
2025-08-27 21:23:25 +08:00
parent 1ffed8f280
commit 172f4ba9fd
2 changed files with 4 additions and 3 deletions

View File

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

View File

@@ -1,5 +1,5 @@
from abc import abstractmethod from abc import abstractmethod
from dataclasses import dataclass from dataclasses import dataclass, field
from typing import TypeVar from typing import TypeVar
from docutranslate.agents.agent import ThinkingMode from docutranslate.agents.agent import ThinkingMode