Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/biolbe1230_ai-spire.json
T

1 line
23 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"repo": "biolbe1230/ai-spire", "files": {"Scripts/Config/AIConfig.cs": {"b0a409973bfbc9205bd78a7b63b7c61aa449874b": {"t": 1785746201.7152715, "n": 4389, "h": "57397966c68badc6", "c": "using System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Godot;\nusing MegaCrit.Sts2.Core.Logging;\n\nnamespace AISpire.Config;\n\npublic static class AIConfig\n{\n // ── 运行时从 config.json 加载的字段 ──\n public static string ApiKey { get; private set; } = \"\";\n public static string ApiEndpoint { get; private set; } = \"https://api.deepseek.com/v1/chat/completions\";\n public static string Model { get; private set; } = \"deepseek-chat\";\n public static int ApiTimeoutMs { get; private set; } = 15000;\n public static int MaxRetries { get; private set; } = 1;\n public static bool Enabled { get; set; } = true;\n public static int ActionDelayMs { get; private set; } = 500;\n public static bool VerboseLogging { get; private set; } = true;\n public static int MaxHistoryMessages { get; private set; } = 40;\n\n // 语言: \"zhs\"(中文) 或 \"en\"(英文),auto 表示跟随游戏\n public static string Language { get; private set; } = \"auto\";\n\n private static string _modDir = \"\";\n\n // spire-codex 数据目录(根据语言选择 data/en/ 或 data/zhs/)\n public static string DataPath\n {\n get\n {\n var lang = Language == \"en\" ? \"en\" : \"zhs\";\n var langPath = Path.Combine(_modDir, \"data\", lang);\n if (Directory.Exists(langPath)) return langPath;\n // fallback: 无子目录时尝试旧的 data/ 目录\n return Path.Combine(_modDir, \"data\");\n }\n }\n\n /// <summary>\n /// 从 config.json 加载配置,找不到则使用默认值\n /// </summary>\n public static void Load()\n {\n _modDir = Path.GetDirectoryName(typeof(AIConfig).Assembly.Location) ?? \".\";\n var configPath = Path.Combine(_modDir, \"config.json\");\n\n if (!File.Exists(configPath))\n {\n Log.Info($\"[AISpire] config.json not found at {configPath}, using defaults\");\n return;\n }\n\n try\n {\n var json = File.ReadAllText(configPath);\n var cfg = JsonSerializer.Deserialize<ConfigJson>(json);\n if (cfg == null) return;\n\n if (!string.IsNullOrEmpty(cfg.ApiKey)) ApiKey = cfg.ApiKey;\n if (!string.IsNullOrEmpty(cfg.ApiEndpoint)) ApiEndpoint = cfg.ApiEndpoint;\n if (!string.IsNullOrEmpty(cfg.Model)) Model = cfg.Model;\n if (cfg.ApiTimeoutMs.HasValue) ApiTimeoutMs = cfg.ApiTimeoutMs.Value;\n if (cfg.MaxRetries.HasValue) MaxRetries = cfg.MaxRetries.Value;\n if (cfg.Enabled.HasValue) Enabled = cfg.Enabled.Value;\n if (cfg.ActionDelayMs.HasValue) ActionDelayMs = cfg.ActionDelayMs.Value;\n if (cfg.VerboseLogging.HasValue) VerboseLogging = cfg.VerboseLogging.Value;\n if (cfg.MaxHistoryMessages.HasValue) MaxHistoryMessages = cfg.MaxHistoryMessages.Value;\n if (!string.IsNullOrEmpty(cfg.Language)) Language = cfg.Language;\n\n // auto-detect: 从 Godot TranslationServer 获取当前游戏语言\n if (Language == \"auto\")\n {\n try\n {\n var locale = TranslationServer.GetLocale(); // e.g. \"zh_CN\", \"en\"\n Language = locale.StartsWith(\"zh\", StringComparison.OrdinalIgnoreCase) ? \"zhs\" : \"en\";\n }\n catch\n {\n Language = \"zhs\"; // 获取失败默认中文\n }\n }\n\n Log.Info($\"[AISpire] Config loaded: model={Model}, endpoint={ApiEndpoint}, language={Language}\");\n }\n catch (Exception e)\n {\n Log.Info($\"[AISpire] Error loading config.json: {e.Message}\");\n }\n }\n\n private class ConfigJson\n {\n [JsonPropertyName(\"api_key\")] public string? ApiKey { get; set; }\n [JsonPropertyName(\"api_endpoint\")] public string? ApiEndpoint { get; set; }\n [JsonPropertyName(\"model\")] public string? Model { get; set; }\n [JsonPropertyName(\"api_timeout_ms\")] public int? ApiTimeoutMs { get; set; }\n [JsonPropertyName(\"max_retries\")] public int? MaxRetries { get; set; }\n [JsonPropertyName(\"enabled\")] public bool? Enabled { get; set; }\n [JsonPropertyName(\"action_delay_ms\")] public int? ActionDelayMs { get; set; }\n [JsonPropertyName(\"verbose_logging\")] public bool? VerboseLogging { get; set; }\n [JsonPropertyName(\"max_history_messages\")] public int? MaxHistoryMessages { get; set; }\n [JsonPropertyName(\"language\")] public string? Language { get; set; }\n }\n}\n"}, "1170da1fd02e4d779ff1f3efbc6fc91cdd057f6a": {"t": 1785760560.6108172, "n": 4389, "h": "57397966c68badc6", "c": "using System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Godot;\nusing MegaCrit.Sts2.Core.Logging;\n\nnamespace AISpire.Config;\n\npublic static class AIConfig\n{\n // ── 运行时从 config.json 加载的字段 ──\n public static string ApiKey { get; private set; } = \"\";\n public static string ApiEndpoint { get; private set; } = \"https://api.deepseek.com/v1/chat/completions\";\n public static string Model { get; private set; } = \"deepseek-chat\";\n public static int ApiTimeoutMs { get; private set; } = 15000;\n public static int MaxRetries { get; private set; } = 1;\n public static bool Enabled { get; set; } = true;\n public static int ActionDelayMs { get; private set; } = 500;\n public static bool VerboseLogging { get; private set; } = true;\n public static int MaxHistoryMessages { get; private set; } = 40;\n\n // 语言: \"zhs\"(中文) 或 \"en\"(英文),auto 表示跟随游戏\n public static string Language { get; private set; } = \"auto\";\n\n private static string _modDir = \"\";\n\n // spire-codex 数据目录(根据语言选择 data/en/ 或 data/zhs/)\n public static string DataPath\n {\n get\n {\n var lang = Language == \"en\" ? \"en\" : \"zhs\";\n var langPath = Path.Combine(_modDir, \"data\", lang);\n if (Directory.Exists(langPath)) return langPath;\n // fallback: 无子目录时尝试旧的 data/ 目录\n return Path.Combine(_modDir, \"data\");\n }\n }\n\n /// <summary>\n /// 从 config.json 加载配置,找不到则使用默认值\n /// </summary>\n public static void Load()\n {\n _modDir = Path.GetDirectoryName(typeof(AIConfig).Assembly.Location) ?? \".\";\n var configPath = Path.Combine(_modDir, \"config.json\");\n\n if (!File.Exists(configPath))\n {\n Log.Info($\"[AISpire] config.json not found at {configPath}, using defaults\");\n return;\n }\n\n try\n {\n var json = File.ReadAllText(configPath);\n var cfg = JsonSerializer.Deserialize<ConfigJson>(json);\n if (cfg == null) return;\n\n if (!string.IsNullOrEmpty(cfg.ApiKey)) ApiKey = cfg.ApiKey;\n if (!string.IsNullOrEmpty(cfg.ApiEndpoint)) ApiEndpoint = cfg.ApiEndpoint;\n if (!string.IsNullOrEmpty(cfg.Model)) Model = cfg.Model;\n if (cfg.ApiTimeoutMs.HasValue) ApiTimeoutMs = cfg.ApiTimeoutMs.Value;\n if (cfg.MaxRetries.HasValue) MaxRetries = cfg.MaxRetries.Value;\n if (cfg.Enabled.HasValue) Enabled = cfg.Enabled.Value;\n if (cfg.ActionDelayMs.HasValue) ActionDelayMs = cfg.ActionDelayMs.Value;\n if (cfg.VerboseLogging.HasValue) VerboseLogging = cfg.VerboseLogging.Value;\n if (cfg.MaxHistoryMessages.HasValue) MaxHistoryMessages = cfg.MaxHistoryMessages.Value;\n if (!string.IsNullOrEmpty(cfg.Language)) Language = cfg.Language;\n\n // auto-detect: 从 Godot TranslationServer 获取当前游戏语言\n if (Language == \"auto\")\n {\n try\n {\n var locale = TranslationServer.GetLocale(); // e.g. \"zh_CN\", \"en\"\n Language = locale.StartsWith(\"zh\", StringComparison.OrdinalIgnoreCase) ? \"zhs\" : \"en\";\n }\n catch\n {\n Language = \"zhs\"; // 获取失败默认中文\n }\n }\n\n Log.Info($\"[AISpire] Config loaded: model={Model}, endpoint={ApiEndpoint}, language={Language}\");\n }\n catch (Exception e)\n {\n Log.Info($\"[AISpire] Error loading config.json: {e.Message}\");\n }\n }\n\n private class ConfigJson\n {\n [JsonPropertyName(\"api_key\")] public string? ApiKey { get; set; }\n [JsonPropertyName(\"api_endpoint\")] public string? ApiEndpoint { get; set; }\n [JsonPropertyName(\"model\")] public string? Model { get; set; }\n [JsonPropertyName(\"api_timeout_ms\")] public int? ApiTimeoutMs { get; set; }\n [JsonPropertyName(\"max_retries\")] public int? MaxRetries { get; set; }\n [JsonPropertyName(\"enabled\")] public bool? Enabled { get; set; }\n [JsonPropertyName(\"action_delay_ms\")] public int? ActionDelayMs { get; set; }\n [JsonPropertyName(\"verbose_logging\")] public bool? VerboseLogging { get; set; }\n [JsonPropertyName(\"max_history_messages\")] public int? MaxHistoryMessages { get; set; }\n [JsonPropertyName(\"language\")] public string? Language { get; set; }\n }\n}\n"}, "aa6999c420d5f59b2c302881b30aca326a57618a": {"t": 1785760561.9184248, "n": 4392, "h": "f20d74bc9a28cc58", "c": "using System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Godot;\nusing MegaCrit.Sts2.Core.Logging;\n\nnamespace AISpire.Config;\n\npublic static class AIConfig\n{\n // ── 运行时从 config.json 加载的字段 ──\n public static string ApiKey { get; private set; } = \"\";\n public static string ApiEndpoint { get; private set; } = \"https://api.deepseek.com/v1/chat/completions\";\n public static string Model { get; private set; } = \"deepseek-chat\";\n public static int ApiTimeoutMs { get; private set; } = 15000;\n public static int MaxRetries { get; private set; } = 1;\n public static bool Enabled { get; set; } = true;\n public static int ActionDelayMs { get; private set; } = 500;\n public static bool VerboseLogging { get; private set; } = true;\n public static int MaxHistoryMessages { get; private set; } = 40;\n\n // 语言: \"zhs\"(中文) 或 \"en\"(英文),auto 表示跟随游戏\n public static string Language { get; private set; } = \"auto\";\n\n private static string _modDir = \"\";\n\n // spire-codex 数据目录(根据语言选择 data/en/ 或 data/zhs/)\n public static string DataPath\n {\n get\n {\n var lang = Language == \"en\" ? \"en\" : \"zhs\";\n var langPath = Path.Combine(_modDir, \"data\", lang);\n if (Directory.Exists(langPath)) return langPath;\n // fallback: 无子目录时尝试旧的 data/ 目录\n return Path.Combine(_modDir, \"data\");\n }\n }\n\n /// <summary>\n /// 从 config.json 加载配置,找不到则使用默认值\n /// </summary>\n public static void Load()\n {\n _modDir = Path.GetDirectoryName(typeof(AIConfig).Assembly.Location) ?? \".\";\n var configPath = Path.Combine(_modDir, \"config.json\");\n\n if (!File.Exists(configPath))\n {\n Log.Debug($\"[AISpire] config.json not found at {configPath}, using defaults\");\n return;\n }\n\n try\n {\n var json = File.ReadAllText(configPath);\n var cfg = JsonSerializer.Deserialize<ConfigJson>(json);\n if (cfg == null) return;\n\n if (!string.IsNullOrEmpty(cfg.ApiKey)) ApiKey = cfg.ApiKey;\n if (!string.IsNullOrEmpty(cfg.ApiEndpoint)) ApiEndpoint = cfg.ApiEndpoint;\n if (!string.IsNullOrEmpty(cfg.Model)) Model = cfg.Model;\n if (cfg.ApiTimeoutMs.HasValue) ApiTimeoutMs = cfg.ApiTimeoutMs.Value;\n if (cfg.MaxRetries.HasValue) MaxRetries = cfg.MaxRetries.Value;\n if (cfg.Enabled.HasValue) Enabled = cfg.Enabled.Value;\n if (cfg.ActionDelayMs.HasValue) ActionDelayMs = cfg.ActionDelayMs.Value;\n if (cfg.VerboseLogging.HasValue) VerboseLogging = cfg.VerboseLogging.Value;\n if (cfg.MaxHistoryMessages.HasValue) MaxHistoryMessages = cfg.MaxHistoryMessages.Value;\n if (!string.IsNullOrEmpty(cfg.Language)) Language = cfg.Language;\n\n // auto-detect: 从 Godot TranslationServer 获取当前游戏语言\n if (Language == \"auto\")\n {\n try\n {\n var locale = TranslationServer.GetLocale(); // e.g. \"zh_CN\", \"en\"\n Language = locale.StartsWith(\"zh\", StringComparison.OrdinalIgnoreCase) ? \"zhs\" : \"en\";\n }\n catch\n {\n Language = \"zhs\"; // 获取失败默认中文\n }\n }\n\n Log.Debug($\"[AISpire] Config loaded: model={Model}, endpoint={ApiEndpoint}, language={Language}\");\n }\n catch (Exception e)\n {\n Log.Debug($\"[AISpire] Error loading config.json: {e.Message}\");\n }\n }\n\n private class ConfigJson\n {\n [JsonPropertyName(\"api_key\")] public string? ApiKey { get; set; }\n [JsonPropertyName(\"api_endpoint\")] public string? ApiEndpoint { get; set; }\n [JsonPropertyName(\"model\")] public string? Model { get; set; }\n [JsonPropertyName(\"api_timeout_ms\")] public int? ApiTimeoutMs { get; set; }\n [JsonPropertyName(\"max_retries\")] public int? MaxRetries { get; set; }\n [JsonPropertyName(\"enabled\")] public bool? Enabled { get; set; }\n [JsonPropertyName(\"action_delay_ms\")] public int? ActionDelayMs { get; set; }\n [JsonPropertyName(\"verbose_logging\")] public bool? VerboseLogging { get; set; }\n [JsonPropertyName(\"max_history_messages\")] public int? MaxHistoryMessages { get; set; }\n [JsonPropertyName(\"language\")] public string? Language { get; set; }\n }\n}\n"}, "e3d93cd8a4ec80c6b352849e0524410be970a352": {"t": 1785760563.4763303, "n": 3561, "h": "d4eea2c45764543c", "c": "using System.Text.Json;\nusing System.Text.Json.Serialization;\nusing MegaCrit.Sts2.Core.Logging;\n\nnamespace AISpire.Config;\n\npublic static class AIConfig\n{\n // ── 运行时从 config.json 加载的字段 ──\n public static string ApiKey { get; private set; } = \"\";\n public static string ApiEndpoint { get; private set; } = \"https://api.deepseek.com/v1/chat/completions\";\n public static string Model { get; private set; } = \"deepseek-chat\";\n public static int ApiTimeoutMs { get; private set; } = 15000;\n public static int MaxRetries { get; private set; } = 1;\n public static bool Enabled { get; set; } = true;\n public static int ActionDelayMs { get; private set; } = 500;\n public static bool VerboseLogging { get; private set; } = true;\n public static int MaxHistoryMessages { get; private set; } = 40;\n\n // spire-codex 数据目录(运行时自动定位到 mods/AISpire/data/)\n public static string DataPath =>\n Path.Combine(Path.GetDirectoryName(typeof(AIConfig).Assembly.Location) ?? \".\", \"data\");\n\n // 语言设置\n public static string Language { get; private set; } = \"zh\";\n\n /// <summary>\n /// 从 config.json 加载配置,找不到则使用默认值\n /// </summary>\n public static void Load()\n {\n var configPath = Path.Combine(\n Path.GetDirectoryName(typeof(AIConfig).Assembly.Location) ?? \".\", \"config.json\");\n\n if (!File.Exists(configPath))\n {\n Log.Info($\"[AISpire] config.json not found at {configPath}, using defaults\");\n return;\n }\n\n try\n {\n var json = File.ReadAllText(configPath);\n var cfg = JsonSerializer.Deserialize<ConfigJson>(json);\n if (cfg == null) return;\n\n if (!string.IsNullOrEmpty(cfg.ApiKey)) ApiKey = cfg.ApiKey;\n if (!string.IsNullOrEmpty(cfg.ApiEndpoint)) ApiEndpoint = cfg.ApiEndpoint;\n if (!string.IsNullOrEmpty(cfg.Model)) Model = cfg.Model;\n if (cfg.ApiTimeoutMs.HasValue) ApiTimeoutMs = cfg.ApiTimeoutMs.Value;\n if (cfg.MaxRetries.HasValue) MaxRetries = cfg.MaxRetries.Value;\n if (cfg.Enabled.HasValue) Enabled = cfg.Enabled.Value;\n if (cfg.ActionDelayMs.HasValue) ActionDelayMs = cfg.ActionDelayMs.Value;\n if (cfg.VerboseLogging.HasValue) VerboseLogging = cfg.VerboseLogging.Value;\n if (cfg.MaxHistoryMessages.HasValue) MaxHistoryMessages = cfg.MaxHistoryMessages.Value;\n if (!string.IsNullOrEmpty(cfg.Language)) Language = cfg.Language;\n\n Log.Info($\"[AISpire] Config loaded: model={Model}, endpoint={ApiEndpoint}\");\n }\n catch (Exception e)\n {\n Log.Info($\"[AISpire] Error loading config.json: {e.Message}\");\n }\n }\n\n private class ConfigJson\n {\n [JsonPropertyName(\"api_key\")] public string? ApiKey { get; set; }\n [JsonPropertyName(\"api_endpoint\")] public string? ApiEndpoint { get; set; }\n [JsonPropertyName(\"model\")] public string? Model { get; set; }\n [JsonPropertyName(\"api_timeout_ms\")] public int? ApiTimeoutMs { get; set; }\n [JsonPropertyName(\"max_retries\")] public int? MaxRetries { get; set; }\n [JsonPropertyName(\"enabled\")] public bool? Enabled { get; set; }\n [JsonPropertyName(\"action_delay_ms\")] public int? ActionDelayMs { get; set; }\n [JsonPropertyName(\"verbose_logging\")] public bool? VerboseLogging { get; set; }\n [JsonPropertyName(\"max_history_messages\")] public int? MaxHistoryMessages { get; set; }\n [JsonPropertyName(\"language\")] public string? Language { get; set; }\n }\n}\n"}, "e2a015df35d8b5897e6874b593fdbe2aa6954c22": {"t": 1785760564.8728209, "n": 3332, "h": "9c9c44144fb74adc", "c": "using System.Text.Json;\nusing System.Text.Json.Serialization;\nusing MegaCrit.Sts2.Core.Logging;\n\nnamespace AISpire.Config;\n\npublic static class AIConfig\n{\n // ── 运行时从 config.json 加载的字段 ──\n public static string ApiKey { get; private set; } = \"\";\n public static string ApiEndpoint { get; private set; } = \"https://api.deepseek.com/v1/chat/completions\";\n public static string Model { get; private set; } = \"deepseek-chat\";\n public static int ApiTimeoutMs { get; private set; } = 15000;\n public static int MaxRetries { get; private set; } = 1;\n public static bool Enabled { get; set; } = true;\n public static int ActionDelayMs { get; private set; } = 500;\n public static bool VerboseLogging { get; private set; } = true;\n public static int MaxHistoryMessages { get; private set; } = 40;\n\n // spire-codex 数据目录(运行时自动定位到 mods/AISpire/data/)\n public static string DataPath =>\n Path.Combine(Path.GetDirectoryName(typeof(AIConfig).Assembly.Location) ?? \".\", \"data\");\n\n /// <summary>\n /// 从 config.json 加载配置,找不到则使用默认值\n /// </summary>\n public static void Load()\n {\n var configPath = Path.Combine(\n Path.GetDirectoryName(typeof(AIConfig).Assembly.Location) ?? \".\", \"config.json\");\n\n if (!File.Exists(configPath))\n {\n Log.Debug($\"[AISpire] config.json not found at {configPath}, using defaults\");\n return;\n }\n\n try\n {\n var json = File.ReadAllText(configPath);\n var cfg = JsonSerializer.Deserialize<ConfigJson>(json);\n if (cfg == null) return;\n\n if (!string.IsNullOrEmpty(cfg.ApiKey)) ApiKey = cfg.ApiKey;\n if (!string.IsNullOrEmpty(cfg.ApiEndpoint)) ApiEndpoint = cfg.ApiEndpoint;\n if (!string.IsNullOrEmpty(cfg.Model)) Model = cfg.Model;\n if (cfg.ApiTimeoutMs.HasValue) ApiTimeoutMs = cfg.ApiTimeoutMs.Value;\n if (cfg.MaxRetries.HasValue) MaxRetries = cfg.MaxRetries.Value;\n if (cfg.Enabled.HasValue) Enabled = cfg.Enabled.Value;\n if (cfg.ActionDelayMs.HasValue) ActionDelayMs = cfg.ActionDelayMs.Value;\n if (cfg.VerboseLogging.HasValue) VerboseLogging = cfg.VerboseLogging.Value;\n if (cfg.MaxHistoryMessages.HasValue) MaxHistoryMessages = cfg.MaxHistoryMessages.Value;\n\n Log.Debug($\"[AISpire] Config loaded: model={Model}, endpoint={ApiEndpoint}\");\n }\n catch (Exception e)\n {\n Log.Debug($\"[AISpire] Error loading config.json: {e.Message}\");\n }\n }\n\n private class ConfigJson\n {\n [JsonPropertyName(\"api_key\")] public string? ApiKey { get; set; }\n [JsonPropertyName(\"api_endpoint\")] public string? ApiEndpoint { get; set; }\n [JsonPropertyName(\"model\")] public string? Model { get; set; }\n [JsonPropertyName(\"api_timeout_ms\")] public int? ApiTimeoutMs { get; set; }\n [JsonPropertyName(\"max_retries\")] public int? MaxRetries { get; set; }\n [JsonPropertyName(\"enabled\")] public bool? Enabled { get; set; }\n [JsonPropertyName(\"action_delay_ms\")] public int? ActionDelayMs { get; set; }\n [JsonPropertyName(\"verbose_logging\")] public bool? VerboseLogging { get; set; }\n [JsonPropertyName(\"max_history_messages\")] public int? MaxHistoryMessages { get; set; }\n }\n}\n"}, "c3f3c3877561f443e721416bb350caa09b56a286": {"t": 1785760566.543567, "n": 835, "h": "060fbbd03c168018", "c": "namespace AISpire.Config;\n\npublic static class AIConfig\n{\n // DeepSeek API\n public const string ApiKey = \"sk-876589a840af4e288ca6b116be0dcd9a\";\n public const string ApiEndpoint = \"https://api.deepseek.com/v1/chat/completions\";\n public const string Model = \"deepseek-chat\";\n\n // 超时与重试\n public const int ApiTimeoutMs = 15000;\n public const int MaxRetries = 1;\n\n // AI 开关\n public static bool Enabled { get; set; } = true;\n\n // 决策间隔(毫秒),防止过快操作\n public const int ActionDelayMs = 500;\n\n // 日志\n public const bool VerboseLogging = true;\n\n // spire-codex 数据目录(运行时自动定位到 mods/AISpire/data/)\n public static string DataPath =>\n Path.Combine(Path.GetDirectoryName(typeof(AIConfig).Assembly.Location) ?? \".\", \"data\");\n\n // 多轮对话最大历史消息数(system 不计入)\n public const int MaxHistoryMessages = 40;\n}\n"}}}}