hellooooooo000 commited on
Commit
651dd72
·
verified ·
1 Parent(s): c6cbacb

au pire fais en sorte que c'est deepseek qui genere l'app

Browse files
Files changed (2) hide show
  1. index.html +10 -1
  2. script.js +30 -20
index.html CHANGED
@@ -136,6 +136,15 @@
136
  spacing: 15
137
  });
138
  </script>
139
- <script src="https://deepsite.hf.co/deepsite-badge.js"></script>
 
 
 
 
 
 
 
 
 
140
  </body>
141
  </html>
 
136
  spacing: 15
137
  });
138
  </script>
139
+ <script>
140
+ // Initialize DeepSeek chat badge
141
+ if (typeof DeepSeekChat !== 'undefined') {
142
+ new DeepSeekChat({
143
+ position: 'right',
144
+ style: 'rounded',
145
+ prompt: "Hi! I'm your DeepSeek AI assistant. How can I help you with your app today?"
146
+ });
147
+ }
148
+ </script>
149
  </body>
150
  </html>
script.js CHANGED
@@ -22,26 +22,31 @@ const generateBtn = document.getElementById('generate-btn');
22
  feather.replace();
23
 
24
  try {
25
- const prompt = `Crée une application qui ${appDescription.value}. Génère le code complet avec HTML, CSS et JavaScript.`;
26
- // Call Gemini API
27
- const response = await fetch('https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=AIzaSyB0HOw6eHYRrqMJ_ZwcEdynMk2NdDfPnP4', {
28
- method: 'POST',
29
  headers: {
30
  'Content-Type': 'application/json',
 
31
  },
32
  body: JSON.stringify({
33
- contents: [{
34
- parts: [{
35
- text: prompt
36
- }]
37
- }]
 
 
 
 
38
  })
39
- });
40
  const data = await response.json();
41
- if (!response.ok || !data.candidates?.[0]?.content?.parts?.[0]?.text) {
42
  throw new Error(data.error?.message || 'Failed to generate code. Please check your API key and try again.');
43
  }
44
- let generatedCode = data.candidates[0].content.parts[0].text;
45
  // Display the code with typewriter effect
46
  typeWriterEffect(codeOutput, generatedCode, 10, () => {
47
  generateBtn.disabled = false;
@@ -103,24 +108,29 @@ chatInput.addEventListener('keypress', (e) => {
103
 
104
  // Call Gemini API for response
105
  try {
106
- const response = await fetch('https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=AIzaSyB0HOw6eHYRrqMJ_ZwcEdynMk2NdDfPnP4', {
107
  method: 'POST',
108
  headers: {
109
  'Content-Type': 'application/json',
 
110
  },
111
  body: JSON.stringify({
112
- contents: [{
113
- parts: [{
114
- text: `You are an AI coding assistant. The user asked: "${message}". Please provide a helpful response about modifying their code.`
115
- }]
116
- }]
 
 
 
 
117
  })
118
  });
119
  const data = await response.json();
120
- if (!response.ok || !data.candidates?.[0]?.content?.parts?.[0]?.text) {
121
  throw new Error(data.error?.message || 'Failed to get AI response.');
122
  }
123
- const aiResponse = data.candidates[0].content.parts[0].text;
124
  addMessage(aiResponse, 'ai');
125
  chatMessages.scrollTop = chatMessages.scrollHeight;
126
  } catch (error) {
 
22
  feather.replace();
23
 
24
  try {
25
+ const prompt = `Crée une application web complète (HTML, CSS, JavaScript) qui ${appDescription.value}. Fournis le code complet et fonctionnel.`;
26
+ // Call DeepSeek API
27
+ const response = await fetch('https://api.deepseek.com/v1/chat/completions', {
28
+ method: 'POST',
29
  headers: {
30
  'Content-Type': 'application/json',
31
+ 'Authorization': 'Bearer YOUR_DEEPSEEK_API_KEY'
32
  },
33
  body: JSON.stringify({
34
+ model: "deepseek-chat",
35
+ messages: [
36
+ {
37
+ role: "user",
38
+ content: prompt
39
+ }
40
+ ],
41
+ temperature: 0.7,
42
+ max_tokens: 2048
43
  })
44
+ });
45
  const data = await response.json();
46
+ if (!response.ok || !data.choices?.[0]?.message?.content) {
47
  throw new Error(data.error?.message || 'Failed to generate code. Please check your API key and try again.');
48
  }
49
+ let generatedCode = data.choices[0].message.content;
50
  // Display the code with typewriter effect
51
  typeWriterEffect(codeOutput, generatedCode, 10, () => {
52
  generateBtn.disabled = false;
 
108
 
109
  // Call Gemini API for response
110
  try {
111
+ const response = await fetch('https://api.deepseek.com/v1/chat/completions', {
112
  method: 'POST',
113
  headers: {
114
  'Content-Type': 'application/json',
115
+ 'Authorization': 'Bearer YOUR_DEEPSEEK_API_KEY'
116
  },
117
  body: JSON.stringify({
118
+ model: "deepseek-chat",
119
+ messages: [
120
+ {
121
+ role: "user",
122
+ content: `You are an AI coding assistant. The user asked: "${message}". Please provide a helpful response about modifying their code.`
123
+ }
124
+ ],
125
+ temperature: 0.7,
126
+ max_tokens: 1024
127
  })
128
  });
129
  const data = await response.json();
130
+ if (!response.ok || !data.choices?.[0]?.message?.content) {
131
  throw new Error(data.error?.message || 'Failed to get AI response.');
132
  }
133
+ const aiResponse = data.choices[0].message.content;
134
  addMessage(aiResponse, 'ai');
135
  chatMessages.scrollTop = chatMessages.scrollHeight;
136
  } catch (error) {