Je vous demande d'insérer la clé que je vous ai envoyée, la clé API de OLAMA, dans l'espace codage, s'il vous plaît, dans mon entreprise. Merci.
Browse files- ai-adapter.js +8 -4
- app.js +6 -2
- config.js +2 -1
ai-adapter.js
CHANGED
|
@@ -25,8 +25,11 @@ async function callAI(prompt) {
|
|
| 25 |
try {
|
| 26 |
const response = await fetch(`${APP_CONFIG.ollama.baseUrl}/api/generate`, {
|
| 27 |
method: "POST",
|
| 28 |
-
headers: {
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
| 30 |
model: APP_CONFIG.ollama.defaultModel,
|
| 31 |
prompt: prompt,
|
| 32 |
stream: false
|
|
@@ -60,9 +63,10 @@ async function generateImage(prompt) {
|
|
| 60 |
const response = await fetch(`${APP_CONFIG.ollama.baseUrl}/api/generate`, {
|
| 61 |
method: 'POST',
|
| 62 |
headers: {
|
| 63 |
-
'Content-Type': 'application/json'
|
|
|
|
| 64 |
},
|
| 65 |
-
|
| 66 |
model: 'stable-diffusion',
|
| 67 |
prompt: prompt,
|
| 68 |
stream: false
|
|
|
|
| 25 |
try {
|
| 26 |
const response = await fetch(`${APP_CONFIG.ollama.baseUrl}/api/generate`, {
|
| 27 |
method: "POST",
|
| 28 |
+
headers: {
|
| 29 |
+
"Content-Type": "application/json",
|
| 30 |
+
"Authorization": `Bearer ${APP_CONFIG.ollama.apiKey}`
|
| 31 |
+
},
|
| 32 |
+
body: JSON.stringify({
|
| 33 |
model: APP_CONFIG.ollama.defaultModel,
|
| 34 |
prompt: prompt,
|
| 35 |
stream: false
|
|
|
|
| 63 |
const response = await fetch(`${APP_CONFIG.ollama.baseUrl}/api/generate`, {
|
| 64 |
method: 'POST',
|
| 65 |
headers: {
|
| 66 |
+
'Content-Type': 'application/json',
|
| 67 |
+
'Authorization': `Bearer ${APP_CONFIG.ollama.apiKey}`
|
| 68 |
},
|
| 69 |
+
body: JSON.stringify({
|
| 70 |
model: 'stable-diffusion',
|
| 71 |
prompt: prompt,
|
| 72 |
stream: false
|
app.js
CHANGED
|
@@ -73,8 +73,12 @@ function hideSettings() {
|
|
| 73 |
async function testOllamaConnection() {
|
| 74 |
const url = document.getElementById('ollamaUrl').value;
|
| 75 |
try {
|
| 76 |
-
const response = await fetch(`${url}/api/tags`
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
alert('Connexion réussie à Ollama!');
|
| 79 |
} catch (error) {
|
| 80 |
alert(`Erreur de connexion: ${error.message}`);
|
|
|
|
| 73 |
async function testOllamaConnection() {
|
| 74 |
const url = document.getElementById('ollamaUrl').value;
|
| 75 |
try {
|
| 76 |
+
const response = await fetch(`${url}/api/tags`, {
|
| 77 |
+
headers: {
|
| 78 |
+
"Authorization": `Bearer ${APP_CONFIG.ollama.apiKey}`
|
| 79 |
+
}
|
| 80 |
+
});
|
| 81 |
+
if (!response.ok) throw new Error('Connection failed');
|
| 82 |
alert('Connexion réussie à Ollama!');
|
| 83 |
} catch (error) {
|
| 84 |
alert(`Erreur de connexion: ${error.message}`);
|
config.js
CHANGED
|
@@ -16,6 +16,7 @@ window.APP_CONFIG = {
|
|
| 16 |
ollama: {
|
| 17 |
baseUrl: "http://localhost:11434",
|
| 18 |
defaultModel: "llama2",
|
| 19 |
-
availableModels: ["llama2", "mistral", "codellama"]
|
|
|
|
| 20 |
}
|
| 21 |
};
|
|
|
|
| 16 |
ollama: {
|
| 17 |
baseUrl: "http://localhost:11434",
|
| 18 |
defaultModel: "llama2",
|
| 19 |
+
availableModels: ["llama2", "mistral", "codellama"],
|
| 20 |
+
apiKey: "YOUR_OLAMA_API_KEY" // Remplacez par votre clé API réelle
|
| 21 |
}
|
| 22 |
};
|