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

1 line
16 KiB
JSON

{"repo": "aliserag/deadgrid", "files": {"lib/ai/DeepSeekClient.ts": {"13b1a8f0f216772f076622c69273323556888790": {"t": 1785746035.630433, "n": 7430, "h": "064cb8a4887c0a5c", "c": "interface DeepSeekRequest {\n model: string;\n messages: Array<{\n role: 'system' | 'user' | 'assistant';\n content: string;\n }>;\n temperature?: number;\n max_tokens?: number;\n response_format?: { type: 'json_object' };\n}\n\ninterface DeepSeekResponse {\n choices: Array<{\n message: {\n content: string;\n };\n }>;\n}\n\nexport class DeepSeekClient {\n private apiKey: string;\n private baseUrl: string = 'https://api.deepseek.com/v1';\n \n constructor(apiKey: string) {\n this.apiKey = apiKey;\n }\n \n async generateContent<T>(\n systemPrompt: string,\n userPrompt: string,\n responseFormat: 'json' | 'text' = 'json'\n ): Promise<T> {\n const request: DeepSeekRequest = {\n model: 'deepseek-chat',\n messages: [\n { role: 'system', content: systemPrompt },\n { role: 'user', content: userPrompt }\n ],\n temperature: 0.8,\n max_tokens: 2000\n };\n \n if (responseFormat === 'json') {\n request.response_format = { type: 'json_object' };\n }\n \n try {\n const response = await fetch(`${this.baseUrl}/chat/completions`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${this.apiKey}`\n },\n body: JSON.stringify(request)\n });\n \n if (!response.ok) {\n throw new Error(`DeepSeek API error: ${response.status}`);\n }\n \n const data: DeepSeekResponse = await response.json();\n const content = data.choices[0]?.message?.content;\n \n if (!content) {\n throw new Error('No content in DeepSeek response');\n }\n \n if (responseFormat === 'json') {\n return JSON.parse(content) as T;\n }\n \n return content as T;\n } catch (error) {\n console.error('DeepSeek API error:', error);\n throw error;\n }\n }\n \n async generateEvent() {\n const systemPrompt = `You are a creative AI generating dynamic events for a post-apocalyptic zombie survival game.\n Generate unique, immersive events that fit the dark, desperate atmosphere.\n Include meaningful choices with consequences.\n Return a JSON object with the following structure:\n {\n \"title\": \"Event Title\",\n \"description\": \"Detailed event description\",\n \"choices\": [\n {\n \"text\": \"Choice text\",\n \"requirements\": { \"items\": [], \"skills\": [] },\n \"outcomes\": {\n \"success\": { \"description\": \"What happens on success\", \"effects\": {} },\n \"failure\": { \"description\": \"What happens on failure\", \"effects\": {} }\n }\n }\n ],\n \"rarity\": \"common|uncommon|rare\",\n \"tags\": [\"exploration\", \"combat\", \"social\", etc]\n }`;\n \n const userPrompt = `Generate a unique random event for a zombie survival game. \n Make it atmospheric and challenging. The event should present meaningful choices to the player.`;\n \n return this.generateContent(systemPrompt, userPrompt, 'json');\n }\n \n async generateNPC() {\n const systemPrompt = `You are creating NPCs for a post-apocalyptic zombie survival game.\n Generate unique survivors with personalities, backstories, and motivations.\n Return a JSON object with:\n {\n \"name\": \"NPC Name\",\n \"description\": \"Physical description and demeanor\",\n \"backstory\": \"Brief backstory\",\n \"faction\": \"SURVIVORS|RAIDERS|TRADERS|MILITARY|CANNIBALS|INDEPENDENT\",\n \"personality\": {\n \"traits\": [\"trait1\", \"trait2\"],\n \"alignment\": \"friendly|neutral|hostile\",\n \"trust\": 0\n },\n \"dialogue\": {\n \"greeting\": \"Initial greeting\",\n \"trade\": \"Trade dialogue\",\n \"hostile\": \"Hostile dialogue\"\n },\n \"inventory\": [],\n \"skills\": []\n }`;\n \n const userPrompt = `Generate a unique NPC survivor with interesting personality and backstory.`;\n \n return this.generateContent(systemPrompt, userPrompt, 'json');\n }\n \n async generateQuest() {\n const systemPrompt = `You are creating quests for a post-apocalyptic zombie survival game.\n Generate engaging quests with clear objectives and meaningful rewards.\n Return a JSON object with:\n {\n \"title\": \"Quest Title\",\n \"description\": \"Quest description\",\n \"giver\": \"Quest giver name or null\",\n \"objectives\": [\n {\n \"description\": \"Objective description\",\n \"type\": \"kill|collect|deliver|explore|survive\",\n \"target\": \"target description\",\n \"quantity\": 1\n }\n ],\n \"rewards\": {\n \"items\": [],\n \"experience\": 0,\n \"reputation\": {}\n },\n \"dialogue\": {\n \"start\": \"Quest start dialogue\",\n \"progress\": \"In-progress dialogue\",\n \"complete\": \"Completion dialogue\"\n }\n }`;\n \n const userPrompt = `Generate an interesting quest that fits the zombie apocalypse setting.`;\n \n return this.generateContent(systemPrompt, userPrompt, 'json');\n }\n \n async generateStoryArc() {\n const systemPrompt = `You are creating story arcs for a post-apocalyptic zombie survival game.\n Generate compelling multi-part storylines that evolve over time.\n Return a JSON object with:\n {\n \"title\": \"Story Arc Title\",\n \"description\": \"Overall arc description\",\n \"chapters\": [\n {\n \"title\": \"Chapter Title\",\n \"description\": \"Chapter description\",\n \"events\": [],\n \"conditions\": {\n \"day\": 0,\n \"requirements\": []\n }\n }\n ],\n \"themes\": [\"survival\", \"betrayal\", \"hope\", etc],\n \"duration\": \"short|medium|long\"\n }`;\n \n const userPrompt = `Generate a compelling story arc about survival in the zombie apocalypse.`;\n \n return this.generateContent(systemPrompt, userPrompt, 'json');\n }\n \n async generateLocation() {\n const systemPrompt = `You are creating locations for a post-apocalyptic zombie survival game.\n Generate atmospheric locations with loot possibilities and dangers.\n Return a JSON object with:\n {\n \"name\": \"Location Name\",\n \"type\": \"building|camp|landmark|settlement\",\n \"description\": \"Atmospheric description\",\n \"danger_level\": \"safe|low|medium|high|extreme\",\n \"loot_tier\": \"poor|common|uncommon|rare\",\n \"features\": [\"feature1\", \"feature2\"],\n \"encounters\": {\n \"zombies\": { \"chance\": 0.5, \"types\": [\"single\", \"group\"] },\n \"npcs\": { \"chance\": 0.3, \"factions\": [] },\n \"events\": { \"chance\": 0.2 }\n }\n }`;\n \n const userPrompt = `Generate an interesting location for exploration in the zombie apocalypse.`;\n \n return this.generateContent(systemPrompt, userPrompt, 'json');\n }\n \n async generateWeatherEvent() {\n const systemPrompt = `You are creating weather events for a post-apocalyptic game.\n Generate atmospheric weather that affects gameplay.\n Return a JSON object with:\n {\n \"type\": \"clear|rain|fog|storm|snow|ash_fall|acid_rain\",\n \"description\": \"Atmospheric description\",\n \"duration\": 1-24 (hours),\n \"effects\": {\n \"visibility\": 0.1-1.0,\n \"movement_speed\": 0.1-1.0,\n \"zombie_spawn_rate\": 0.5-2.0,\n \"health_drain\": 0-5 per hour\n },\n \"special_events\": []\n }`;\n \n const userPrompt = `Generate a weather event that creates interesting gameplay challenges.`;\n \n return this.generateContent(systemPrompt, userPrompt, 'json');\n }\n}"}, "e9fa50554cffd05f544ff0879840c8dd820ab8cc": {"t": 1785759075.3590064, "n": 7430, "h": "064cb8a4887c0a5c", "c": "interface DeepSeekRequest {\n model: string;\n messages: Array<{\n role: 'system' | 'user' | 'assistant';\n content: string;\n }>;\n temperature?: number;\n max_tokens?: number;\n response_format?: { type: 'json_object' };\n}\n\ninterface DeepSeekResponse {\n choices: Array<{\n message: {\n content: string;\n };\n }>;\n}\n\nexport class DeepSeekClient {\n private apiKey: string;\n private baseUrl: string = 'https://api.deepseek.com/v1';\n \n constructor(apiKey: string) {\n this.apiKey = apiKey;\n }\n \n async generateContent<T>(\n systemPrompt: string,\n userPrompt: string,\n responseFormat: 'json' | 'text' = 'json'\n ): Promise<T> {\n const request: DeepSeekRequest = {\n model: 'deepseek-chat',\n messages: [\n { role: 'system', content: systemPrompt },\n { role: 'user', content: userPrompt }\n ],\n temperature: 0.8,\n max_tokens: 2000\n };\n \n if (responseFormat === 'json') {\n request.response_format = { type: 'json_object' };\n }\n \n try {\n const response = await fetch(`${this.baseUrl}/chat/completions`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${this.apiKey}`\n },\n body: JSON.stringify(request)\n });\n \n if (!response.ok) {\n throw new Error(`DeepSeek API error: ${response.status}`);\n }\n \n const data: DeepSeekResponse = await response.json();\n const content = data.choices[0]?.message?.content;\n \n if (!content) {\n throw new Error('No content in DeepSeek response');\n }\n \n if (responseFormat === 'json') {\n return JSON.parse(content) as T;\n }\n \n return content as T;\n } catch (error) {\n console.error('DeepSeek API error:', error);\n throw error;\n }\n }\n \n async generateEvent() {\n const systemPrompt = `You are a creative AI generating dynamic events for a post-apocalyptic zombie survival game.\n Generate unique, immersive events that fit the dark, desperate atmosphere.\n Include meaningful choices with consequences.\n Return a JSON object with the following structure:\n {\n \"title\": \"Event Title\",\n \"description\": \"Detailed event description\",\n \"choices\": [\n {\n \"text\": \"Choice text\",\n \"requirements\": { \"items\": [], \"skills\": [] },\n \"outcomes\": {\n \"success\": { \"description\": \"What happens on success\", \"effects\": {} },\n \"failure\": { \"description\": \"What happens on failure\", \"effects\": {} }\n }\n }\n ],\n \"rarity\": \"common|uncommon|rare\",\n \"tags\": [\"exploration\", \"combat\", \"social\", etc]\n }`;\n \n const userPrompt = `Generate a unique random event for a zombie survival game. \n Make it atmospheric and challenging. The event should present meaningful choices to the player.`;\n \n return this.generateContent(systemPrompt, userPrompt, 'json');\n }\n \n async generateNPC() {\n const systemPrompt = `You are creating NPCs for a post-apocalyptic zombie survival game.\n Generate unique survivors with personalities, backstories, and motivations.\n Return a JSON object with:\n {\n \"name\": \"NPC Name\",\n \"description\": \"Physical description and demeanor\",\n \"backstory\": \"Brief backstory\",\n \"faction\": \"SURVIVORS|RAIDERS|TRADERS|MILITARY|CANNIBALS|INDEPENDENT\",\n \"personality\": {\n \"traits\": [\"trait1\", \"trait2\"],\n \"alignment\": \"friendly|neutral|hostile\",\n \"trust\": 0\n },\n \"dialogue\": {\n \"greeting\": \"Initial greeting\",\n \"trade\": \"Trade dialogue\",\n \"hostile\": \"Hostile dialogue\"\n },\n \"inventory\": [],\n \"skills\": []\n }`;\n \n const userPrompt = `Generate a unique NPC survivor with interesting personality and backstory.`;\n \n return this.generateContent(systemPrompt, userPrompt, 'json');\n }\n \n async generateQuest() {\n const systemPrompt = `You are creating quests for a post-apocalyptic zombie survival game.\n Generate engaging quests with clear objectives and meaningful rewards.\n Return a JSON object with:\n {\n \"title\": \"Quest Title\",\n \"description\": \"Quest description\",\n \"giver\": \"Quest giver name or null\",\n \"objectives\": [\n {\n \"description\": \"Objective description\",\n \"type\": \"kill|collect|deliver|explore|survive\",\n \"target\": \"target description\",\n \"quantity\": 1\n }\n ],\n \"rewards\": {\n \"items\": [],\n \"experience\": 0,\n \"reputation\": {}\n },\n \"dialogue\": {\n \"start\": \"Quest start dialogue\",\n \"progress\": \"In-progress dialogue\",\n \"complete\": \"Completion dialogue\"\n }\n }`;\n \n const userPrompt = `Generate an interesting quest that fits the zombie apocalypse setting.`;\n \n return this.generateContent(systemPrompt, userPrompt, 'json');\n }\n \n async generateStoryArc() {\n const systemPrompt = `You are creating story arcs for a post-apocalyptic zombie survival game.\n Generate compelling multi-part storylines that evolve over time.\n Return a JSON object with:\n {\n \"title\": \"Story Arc Title\",\n \"description\": \"Overall arc description\",\n \"chapters\": [\n {\n \"title\": \"Chapter Title\",\n \"description\": \"Chapter description\",\n \"events\": [],\n \"conditions\": {\n \"day\": 0,\n \"requirements\": []\n }\n }\n ],\n \"themes\": [\"survival\", \"betrayal\", \"hope\", etc],\n \"duration\": \"short|medium|long\"\n }`;\n \n const userPrompt = `Generate a compelling story arc about survival in the zombie apocalypse.`;\n \n return this.generateContent(systemPrompt, userPrompt, 'json');\n }\n \n async generateLocation() {\n const systemPrompt = `You are creating locations for a post-apocalyptic zombie survival game.\n Generate atmospheric locations with loot possibilities and dangers.\n Return a JSON object with:\n {\n \"name\": \"Location Name\",\n \"type\": \"building|camp|landmark|settlement\",\n \"description\": \"Atmospheric description\",\n \"danger_level\": \"safe|low|medium|high|extreme\",\n \"loot_tier\": \"poor|common|uncommon|rare\",\n \"features\": [\"feature1\", \"feature2\"],\n \"encounters\": {\n \"zombies\": { \"chance\": 0.5, \"types\": [\"single\", \"group\"] },\n \"npcs\": { \"chance\": 0.3, \"factions\": [] },\n \"events\": { \"chance\": 0.2 }\n }\n }`;\n \n const userPrompt = `Generate an interesting location for exploration in the zombie apocalypse.`;\n \n return this.generateContent(systemPrompt, userPrompt, 'json');\n }\n \n async generateWeatherEvent() {\n const systemPrompt = `You are creating weather events for a post-apocalyptic game.\n Generate atmospheric weather that affects gameplay.\n Return a JSON object with:\n {\n \"type\": \"clear|rain|fog|storm|snow|ash_fall|acid_rain\",\n \"description\": \"Atmospheric description\",\n \"duration\": 1-24 (hours),\n \"effects\": {\n \"visibility\": 0.1-1.0,\n \"movement_speed\": 0.1-1.0,\n \"zombie_spawn_rate\": 0.5-2.0,\n \"health_drain\": 0-5 per hour\n },\n \"special_events\": []\n }`;\n \n const userPrompt = `Generate a weather event that creates interesting gameplay challenges.`;\n \n return this.generateContent(systemPrompt, userPrompt, 'json');\n }\n}"}}}}