| |
| import os |
| import json |
| import logging |
| from pathlib import Path |
|
|
| |
| logging.basicConfig(level=logging.INFO, |
| format='%(asctime)s [%(levelname)s] %(message)s', |
| datefmt='%Y-%m-%d %H:%M:%S') |
|
|
| logger = logging.getLogger('temp-property') |
|
|
| |
| TMP_DIR = Path("/tmp/ten-agent") |
| TMP_DIR.mkdir(exist_ok=True, parents=True) |
|
|
| |
| TEMP_PROPERTY_JSON = TMP_DIR / "property.json" |
|
|
| |
| property_data = { |
| "_ten": {}, |
| "name": "TEN Agent Example", |
| "version": "0.0.1", |
| "extensions": ["openai_chatgpt"], |
| "description": "A basic voice agent with OpenAI", |
| "predefined_graphs": [ |
| { |
| "name": "Voice Agent", |
| "description": "Basic voice agent with OpenAI", |
| "file": "voice_agent.json" |
| }, |
| { |
| "name": "Chat Agent", |
| "description": "Simple chat agent", |
| "file": "chat_agent.json" |
| } |
| ], |
| "graphs": [ |
| { |
| "name": "Voice Agent", |
| "description": "Basic voice agent with OpenAI", |
| "file": "voice_agent.json" |
| }, |
| { |
| "name": "Chat Agent", |
| "description": "Simple chat agent", |
| "file": "chat_agent.json" |
| } |
| ] |
| } |
|
|
| |
| with open(TEMP_PROPERTY_JSON, 'w') as f: |
| json.dump(property_data, f, indent=2) |
|
|
| logger.info(f"Создан временный property.json: {TEMP_PROPERTY_JSON}") |
|
|
| |
| |
| with open("/tmp/ten-agent/property_path.txt", 'w') as f: |
| f.write(str(TEMP_PROPERTY_JSON)) |
|
|
| logger.info("Путь к property.json сохранен в /tmp/ten-agent/property_path.txt") |