mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-09-01 17:10:24 +08:00
Add Ollama Cloud support with Base URL and API Key configuration (#692)
* Add Ollama Cloud support with Base URL and API Key configuration * implemented feedback * fix: use OLLAMA_BASE_URL env fallback in validate-model endpoint * Remove dedicated Ollama configuration block * security(ollama): prevent API key leak to client-controlled URLs * added test * fix: security hardening and Ollama Cloud default URL - Add server OLLAMA_API_KEY fallback to validate-model endpoint with SSRF guard mirroring ai-providers.ts - Tighten top-level SSRF exemption: only exempt Ollama when no server OLLAMA_API_KEY is configured - Update Electron config to support OLLAMA_API_KEY env var - Change default Ollama URL from localhost:11434 to ollama.com/api (Ollama Cloud) for web UI users - Add tests for server env combo, API-key-only, and SSRF guard scenarios --------- Co-authored-by: dayuan.jiang <jdy.toh@gmail.com>
This commit is contained in:
committed by
GitHub
parent
e171fbcdd8
commit
a5d1554c3f
@@ -282,6 +282,7 @@ export function ModelConfigDialog({
|
||||
// Check credentials based on provider type
|
||||
const isBedrock = selectedProvider.provider === "bedrock"
|
||||
const isEdgeOne = selectedProvider.provider === "edgeone"
|
||||
const isOllama = selectedProvider.provider === "ollama"
|
||||
const isVertexAI = selectedProvider.provider === "vertexai"
|
||||
if (isBedrock) {
|
||||
if (
|
||||
@@ -296,7 +297,7 @@ export function ModelConfigDialog({
|
||||
if (!selectedProvider.vertexApiKey) {
|
||||
return
|
||||
}
|
||||
} else if (!isEdgeOne && !selectedProvider.apiKey) {
|
||||
} else if (!isEdgeOne && !isOllama && !selectedProvider.apiKey) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1030,9 +1031,7 @@ export function ModelConfigDialog({
|
||||
</div>
|
||||
</>
|
||||
) : selectedProvider.provider ===
|
||||
"ollama" ||
|
||||
selectedProvider.provider ===
|
||||
"edgeone" ? (
|
||||
"edgeone" ? (
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<Button
|
||||
@@ -1100,6 +1099,9 @@ export function ModelConfigDialog({
|
||||
dict.modelConfig
|
||||
.apiKey
|
||||
}
|
||||
{selectedProvider.provider ===
|
||||
"ollama" &&
|
||||
` ${dict.modelConfig.optional}`}
|
||||
</Label>
|
||||
<div className="flex gap-2">
|
||||
<div className="relative flex-1">
|
||||
@@ -1163,7 +1165,9 @@ export function ModelConfigDialog({
|
||||
handleValidate
|
||||
}
|
||||
disabled={
|
||||
!selectedProvider.apiKey ||
|
||||
(selectedProvider.provider !==
|
||||
"ollama" &&
|
||||
!selectedProvider.apiKey) ||
|
||||
validationStatus ===
|
||||
"validating"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user