diff --git a/agentmain.py b/agentmain.py index 6250f84..bb42be5 100644 --- a/agentmain.py +++ b/agentmain.py @@ -14,14 +14,18 @@ with open(os.path.join(script_dir, 'assets/tools_schema.json'), 'r', encoding='u TS = f.read() TOOLS_SCHEMA = json.loads(TS if os.name == 'nt' else TS.replace('powershell', 'bash')) -if not os.path.exists('memory'): os.makedirs('memory') -if not os.path.exists('memory/global_mem.txt'): - with open('memory/global_mem.txt', 'w', encoding='utf-8') as f: f.write('') -if not os.path.exists('memory/global_mem_insight.txt'): - t = 'assets/global_mem_insight_template.txt' - open('memory/global_mem_insight.txt', 'w', encoding='utf-8').write(open(t, encoding='utf-8').read() if os.path.exists(t) else '') -if not os.path.exists('assets/tmwd_cdp_bridge/config.js'): - with open('assets/tmwd_cdp_bridge/config.js', 'w', encoding='utf-8') as f: +mem_dir = os.path.join(script_dir, 'memory') +if not os.path.exists(mem_dir): os.makedirs(mem_dir) +mem_txt = os.path.join(mem_dir, 'global_mem.txt') +if not os.path.exists(mem_txt): + with open(mem_txt, 'w', encoding='utf-8') as f: f.write('') +mem_insight = os.path.join(mem_dir, 'global_mem_insight.txt') +if not os.path.exists(mem_insight): + t = os.path.join(script_dir, 'assets/global_mem_insight_template.txt') + open(mem_insight, 'w', encoding='utf-8').write(open(t, encoding='utf-8').read() if os.path.exists(t) else '') +cdp_cfg = os.path.join(script_dir, 'assets/tmwd_cdp_bridge/config.js') +if not os.path.exists(cdp_cfg): + with open(cdp_cfg, 'w', encoding='utf-8') as f: f.write(f"const TID = '__ljq_{hex(random.randint(0, 99999999))[2:8]}';") def get_system_prompt():