// import axios from 'axios'; // const DEEPSEEK_API_URL = 'http://localhost:11434'; // 实际的 DeepSeek API 地址 // const DEEPSEEK_API_KEY = 'sk-eff330c7a8664ddaaba523ba9bf0226a'; // 替换为你的 DeepSeek API Key // // 创建 axios 实例 // const deepseekClient = axios.create({ // baseURL: DEEPSEEK_API_URL, // timeout: 60000, // 超时时间延长至60秒‌ // headers: { // 'Authorization': `Bearer ${DEEPSEEK_API_KEY}`, // 'Content-Type': 'application/json', // }, // }); // // 示例:发送聊天请求‌:ml-citation{ref="4" data="citationList"} // export const getDeepseekResponse = async (prompt) => { // try { // const response = await deepseekClient.post('/chat/completions', { // model: "deepseek-r1:1.5b", // messages: [{ role: "user", content: prompt }] // }); // return response.data.choices.message.content; // } catch (error) { // console.error('API Error:', error); // return null; // } // }; import axios from 'axios'; const ollamaClient = axios.create({ baseURL: '/ollama', timeout: 60000 // 超时时间延长至60秒‌:ml-citation{ref="3,7" data="citationList"} }); export const getDeepseekResponse = (params) => { return ollamaClient.post('/api/generate', { model: 'deepseek-r1:1.5b', // 需与本地部署模型名称一致‌:ml-citation{ref="5,6" data="citationList"} prompt: params.prompt, stream: params.stream || false }); };