akemi/tailwind #1
|
@ -6,5 +6,8 @@
|
|||
"action": {
|
||||
"default_popup": "src/main.html",
|
||||
"default_icon": "assets/logo.png"
|
||||
}
|
||||
},
|
||||
"host_permissions": [
|
||||
"http://localhost/*"
|
||||
]
|
||||
}
|
||||
|
|
38
src/main.js
38
src/main.js
|
@ -1 +1,37 @@
|
|||
console.log("Popup")
|
||||
const ollama_get_models = async () => {
|
||||
const res = await fetch('http://localhost:11434/api/tags')
|
||||
|
||||
if (res.status !== 200) {
|
||||
console.error("Failed to make request to Ollama")
|
||||
return
|
||||
}
|
||||
|
||||
const js = await res.json()
|
||||
return js
|
||||
}
|
||||
|
||||
const ollama_chat_complete = async (model, messages) => {
|
||||
const body = {
|
||||
model: "gemmachad:latest",
|
||||
messages: { role: "user", content: "why is the sky blue?" },
|
||||
stream: false
|
||||
}
|
||||
|
||||
console.log(body)
|
||||
|
||||
const res = await fetch('http://localhost:11434/api/chat', {
|
||||
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(body)
|
||||
})
|
||||
|
||||
if (res.status !== 200) {
|
||||
console.error("Failed to make request to Ollama")
|
||||
return
|
||||
}
|
||||
|
||||
const js = await res.json()
|
||||
return js
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue
Currently I'm getting a 403 for this one... but not for
ollama_get_models
? Not sure what's up