(prompt)
| 482 | cache_dir = os.path.join(script_directory, 'text_embed_cache') |
| 483 | os.makedirs(cache_dir, exist_ok=True) |
| 484 | def get_cache_path(prompt): |
| 485 | cache_key = prompt.strip() |
| 486 | cache_hash = hashlib.sha256(cache_key.encode('utf-8')).hexdigest() |
| 487 | return os.path.join(cache_dir, f"{cache_hash}.pt") |
| 488 | cache_path = get_cache_path(prompt) |
| 489 | if os.path.exists(cache_path): |
| 490 | try: |