Wolf-Chat-for-Lastwar/config_template.py
z060142 4d8308e9f6 Major system update: ChromaDB integration, detection upgrades, LLM refinements, and Windows process fixes
- Migrated to ChromaDB v1.0.6+ with PersistentClient for memory backend.
- Added chroma_client.py for collection access and memory/query utilities.
- Integrated configurable memory preload system with Setup.py support.
- Refactored keyword detection with dual-template (grayscale + CLAHE + invert) and absolute coordinate correction.
- Added island-based color detection for chat bubbles using HSV masks and connected components.
- Reordered LLM structured JSON output to prioritize 'commands', improving tool use parsing and consistency.
- Enhanced canned reply handling for empty LLM outputs and personalized user name input in debug mode.
- Updated Wolf to consistently speak in British English.
- Improved reply-type detection and removed redundant logic.
- Augmented Setup.py with persistent window behavior and script control buttons (run/stop).
- Introduced Game Monitor to track game window visibility and trigger restarts.
- Injected ESC fallback logic to close unresponsive homepage ads.
- Switched MCP server to stdio_client context with AsyncExitStack for safe shutdown on Windows.
- Retained CTRL event handler to support graceful exits via console close or interruptions.
2025-05-02 11:20:13 +08:00

77 lines
3.3 KiB
Python

# ====================================================================
# Wolf Chat Configuration Template
# This file is used by setup.py to generate the final config.py
# ====================================================================
import os
import json
from dotenv import load_dotenv
# --- Load environment variables from .env file ---
load_dotenv()
print("Loaded environment variables from .env file.")
# =============================================================================
# OpenAI API Configuration / OpenAI-Compatible Provider Settings
# =============================================================================
# Leave OPENAI_API_BASE_URL as None or "" to use official OpenAI
OPENAI_API_BASE_URL = "${OPENAI_API_BASE_URL}"
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
LLM_MODEL = "${LLM_MODEL}"
# =============================================================================
# External API Keys
# =============================================================================
EXA_API_KEY = os.getenv("EXA_API_KEY")
# --- Exa Configuration ---
exa_config_dict = {"exaApiKey": EXA_API_KEY if EXA_API_KEY else "YOUR_EXA_KEY_MISSING"}
exa_config_arg_string = json.dumps(exa_config_dict)
# =============================================================================
# MCP Server Configuration
# =============================================================================
MCP_SERVERS = ${MCP_SERVERS}
# =============================================================================
# MCP Client Configuration
# =============================================================================
MCP_CONFIRM_TOOL_EXECUTION = False # True: Confirm before execution, False: Execute automatically
# =============================================================================
# Chat Logging Configuration
# =============================================================================
ENABLE_CHAT_LOGGING = ${ENABLE_CHAT_LOGGING}
LOG_DIR = "${LOG_DIR}"
# =============================================================================
# Persona Configuration
# =============================================================================
PERSONA_NAME = "Wolfhart"
# =============================================================================
# Game Window Configuration
# =============================================================================
WINDOW_TITLE = "${WINDOW_TITLE}"
ENABLE_SCHEDULED_RESTART = ${ENABLE_SCHEDULED_RESTART}
RESTART_INTERVAL_MINUTES = ${RESTART_INTERVAL_MINUTES}
GAME_EXECUTABLE_PATH = r"${GAME_EXECUTABLE_PATH}"
GAME_WINDOW_X = ${GAME_WINDOW_X}
GAME_WINDOW_Y = ${GAME_WINDOW_Y}
GAME_WINDOW_WIDTH = ${GAME_WINDOW_WIDTH}
GAME_WINDOW_HEIGHT = ${GAME_WINDOW_HEIGHT}
MONITOR_INTERVAL_SECONDS = ${MONITOR_INTERVAL_SECONDS}
# =============================================================================
# ChromaDB Memory Configuration
# =============================================================================
ENABLE_PRELOAD_PROFILES = ${ENABLE_PRELOAD_PROFILES}
PRELOAD_RELATED_MEMORIES = ${PRELOAD_RELATED_MEMORIES}
# Collection Names (used for both local access and MCP tool calls)
PROFILES_COLLECTION = "${PROFILES_COLLECTION}"
CONVERSATIONS_COLLECTION = "${CONVERSATIONS_COLLECTION}"
BOT_MEMORY_COLLECTION = "${BOT_MEMORY_COLLECTION}"
# Ensure Chroma path is consistent for both direct access and MCP
CHROMA_DATA_DIR = os.path.abspath("chroma_data")