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

1 line
5.5 KiB
JSON

{"repo": "celiabustea/pawfinder", "files": {"api.js": {"55dfb17325d85fd61700470883916382085fdeb1": {"t": 1785746525.678337, "n": 2561, "h": "c55ac026a212a316", "c": "import axios from \"axios\";\n\nconst api = axios.create({\n baseURL: \"https://api.deepseek.com/v1\",\n headers: {\n Authorization: `Bearer sk-7066fb6aafbf4263a0385d5f7771ba0c`,\n \"Content-Type\": \"application/json\",\n },\n timeout: 30000,\n});\n\nexport const interpretUserInput = async (input) => {\n try {\n console.log(\"📡 Sending request to DeepSeek API...\");\n\n const response = await api.post(\"/chat/completions\", {\n model: \"deepseek-chat\",\n messages: [\n {\n role: \"system\",\n content: \"You are a friendly and helpful assistant that helps users find their lost pets or report found pets. Ask for details like type, breed, color, and location in a conversational way. Respond in JSON format with extracted details. Ensure that the response is ONLY valid JSON and does not include any additional text. Also, include a field 'intent' with the value 'lost' if the user lost a pet or 'found' if the user found a pet.\",\n },\n {\n role: \"user\",\n content: input,\n },\n ],\n });\n\n console.log(\"📝 Raw API Response:\", response.data);\n\n if (!response.data?.choices?.[0]?.message?.content) {\n throw new Error(\"Invalid API response format: Missing content.\");\n }\n\n // Extract and clean the content\n const content = response.data.choices[0].message.content;\n console.log(\"📄 Parsed Content:\", content);\n\n let details;\n try {\n // Remove surrounding ```json ... ``` if present\n const cleanedContent = content.replace(/^```json\\s*|\\s*```$/g, \"\").trim();\n\n // Parse the cleaned content as JSON\n details = JSON.parse(cleanedContent);\n } catch (err) {\n throw new Error(\"API response is not valid JSON. Raw content: \" + content);\n }\n\n console.log(\"🔍 Extracted Details:\", details);\n\n // Ensure required fields are present\n if (!details.type || !details.intent) {\n console.warn(\"⚠️ Incomplete details received:\", details);\n details.type = details.type || \"necunoscut\";\n details.intent = details.intent || \"lost\"; // Default to \"lost\" if intent is missing\n }\n\n return details;\n } catch (error) {\n console.error(\"🚨 API Error:\", error);\n throw new Error(error.response?.data?.message || \"DeepSeek API request failed. Please check your input and try again.\");\n }\n};"}, "3b53c46555b24aeb7f31d91b7971aac7500e954f": {"t": 1785765307.5811298, "n": 2561, "h": "c55ac026a212a316", "c": "import axios from \"axios\";\n\nconst api = axios.create({\n baseURL: \"https://api.deepseek.com/v1\",\n headers: {\n Authorization: `Bearer sk-7066fb6aafbf4263a0385d5f7771ba0c`,\n \"Content-Type\": \"application/json\",\n },\n timeout: 30000,\n});\n\nexport const interpretUserInput = async (input) => {\n try {\n console.log(\"📡 Sending request to DeepSeek API...\");\n\n const response = await api.post(\"/chat/completions\", {\n model: \"deepseek-chat\",\n messages: [\n {\n role: \"system\",\n content: \"You are a friendly and helpful assistant that helps users find their lost pets or report found pets. Ask for details like type, breed, color, and location in a conversational way. Respond in JSON format with extracted details. Ensure that the response is ONLY valid JSON and does not include any additional text. Also, include a field 'intent' with the value 'lost' if the user lost a pet or 'found' if the user found a pet.\",\n },\n {\n role: \"user\",\n content: input,\n },\n ],\n });\n\n console.log(\"📝 Raw API Response:\", response.data);\n\n if (!response.data?.choices?.[0]?.message?.content) {\n throw new Error(\"Invalid API response format: Missing content.\");\n }\n\n // Extract and clean the content\n const content = response.data.choices[0].message.content;\n console.log(\"📄 Parsed Content:\", content);\n\n let details;\n try {\n // Remove surrounding ```json ... ``` if present\n const cleanedContent = content.replace(/^```json\\s*|\\s*```$/g, \"\").trim();\n\n // Parse the cleaned content as JSON\n details = JSON.parse(cleanedContent);\n } catch (err) {\n throw new Error(\"API response is not valid JSON. Raw content: \" + content);\n }\n\n console.log(\"🔍 Extracted Details:\", details);\n\n // Ensure required fields are present\n if (!details.type || !details.intent) {\n console.warn(\"⚠️ Incomplete details received:\", details);\n details.type = details.type || \"necunoscut\";\n details.intent = details.intent || \"lost\"; // Default to \"lost\" if intent is missing\n }\n\n return details;\n } catch (error) {\n console.error(\"🚨 API Error:\", error);\n throw new Error(error.response?.data?.message || \"DeepSeek API request failed. Please check your input and try again.\");\n }\n};"}}}}