File size: 909 Bytes
910002b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
async function generateExpertCode(userProblem) {
    const response = await fetch(
        "https://api-inference.huggingface.co/models/deepseek-ai/deepseek-coder-1.3b-instruct", // موديل كود خفيف وقوي
        {
            headers: { 
                "Authorization": "Bearer YOUR_HUGGINGFACE_API_TOKEN",
                "Content-Type": "application/json"
            },
            method: "POST",
            body: JSON.stringify({
                inputs: `System: You are an elite Senior Software Engineer. Follow the 5-step analysis/code protocol.\nUser: ${userProblem}\nAssistant:`,
                parameters: {
                    max_new_tokens: 1024,
                    temperature: 0.2 // درجة حرارة منخفضة لضمان الدقة وعدم التأليف
                }
            }),
        }
    );
    const result = await response.json();
    return result;
}