Ahh fix bloating size upload was to large

This commit is contained in:
Ace
2026-06-24 09:54:28 +02:00
parent 2b4749e5e1
commit b2a2f7e40f
5 changed files with 63 additions and 43 deletions
+9 -10
View File
@@ -28,7 +28,7 @@ export function AIChat() {
const messagesEndRef = useRef<HTMLDivElement>(null)
useEffect(() => {
fetch("/api/ai/jobs")
fetch(`${AI_API}/ai/jobs`)
.then((r) => r.json())
.then((data) => {
if (data.jobs?.length) {
@@ -64,14 +64,13 @@ export function AIChat() {
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" })
}, [messages])
const AI_API = process.env.NEXT_PUBLIC_AI_URL || "http://127.0.0.1:3001"
const checkOllama = async () => {
try {
const res = await fetch("/api/ai/chat", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ message: "__ping__" }),
})
setOllamaStatus(res.status !== 503)
const res = await fetch(`${AI_API}/health`)
const data = await res.json()
setOllamaStatus(data.status === "ok")
} catch {
setOllamaStatus(false)
}
@@ -89,15 +88,15 @@ export function AIChat() {
setLoading(true)
try {
const res = await fetch("/api/ai/chat", {
const res = await fetch(`${AI_API}/ai/chat`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ message: msg }),
})
if (!res.ok) {
const data = await res.json()
throw new Error(data.error || "Failed to get response")
const data = await res.json().catch(() => ({}))
throw new Error(data.error || `Error ${res.status}`)
}
const data = await res.json()