mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-12 20:49:53 +08:00
Compare commits
45
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98e91d33dc | ||
|
|
38b72e89b6 | ||
|
|
6e77b08eb3 | ||
|
|
3855ff2b02 | ||
|
|
668f79c0ab | ||
|
|
75be7cb3ea | ||
|
|
29736bb528 | ||
|
|
73aa6a45f6 | ||
|
|
3c9bcfb978 | ||
|
|
ba2a789d20 | ||
|
|
1a63498d5d | ||
|
|
dee0c80b3e | ||
|
|
4612f7c38d | ||
|
|
f3a4c98f26 | ||
|
|
6857633105 | ||
|
|
57729cf174 | ||
|
|
9c46e760af | ||
|
|
21ab839be7 | ||
|
|
23b76c098b | ||
|
|
a87ada3776 | ||
|
|
4c8d8427bc | ||
|
|
d47c5ebb4e | ||
|
|
52b1f24447 | ||
|
|
7fccf68edf | ||
|
|
113608ec02 | ||
|
|
58b73ef761 | ||
|
|
ea16ea1ece | ||
|
|
e355a50890 | ||
|
|
42ab388118 | ||
|
|
dfedd1b881 | ||
|
|
29acbc33b8 | ||
|
|
d6bdb25f58 | ||
|
|
eb2fa69f58 | ||
|
|
c1e4b1c9bf | ||
|
|
d08b28821e | ||
|
|
8986217a73 | ||
|
|
73788abff9 | ||
|
|
de0ba6b718 | ||
|
|
a8ff1ea2bc | ||
|
|
b723406a48 | ||
|
|
783cb4a6f1 | ||
|
|
801974a18b | ||
|
|
5f71b2783f | ||
|
|
691c7e34bf | ||
|
|
0d50a179aa |
@@ -77,6 +77,7 @@ export default function ExamplePanel({
|
|||||||
minimal?: boolean
|
minimal?: boolean
|
||||||
}) {
|
}) {
|
||||||
const dict = useDictionary()
|
const dict = useDictionary()
|
||||||
|
const isSelfHosted = process.env.NEXT_PUBLIC_SELFHOSTED === "true"
|
||||||
|
|
||||||
const handleReplicateFlowchart = async () => {
|
const handleReplicateFlowchart = async () => {
|
||||||
setInput("Replicate this flowchart.")
|
setInput("Replicate this flowchart.")
|
||||||
@@ -125,29 +126,31 @@ export default function ExamplePanel({
|
|||||||
<div className={minimal ? "" : "py-6 px-2 animate-fade-in"}>
|
<div className={minimal ? "" : "py-6 px-2 animate-fade-in"}>
|
||||||
{!minimal && (
|
{!minimal && (
|
||||||
<>
|
<>
|
||||||
{/* MCP Server Notice */}
|
{/* MCP Server Notice, hidden on self-hosted deployments */}
|
||||||
<a
|
{!isSelfHosted && (
|
||||||
href="https://github.com/DayuanJiang/next-ai-draw-io/tree/main/packages/mcp-server"
|
<a
|
||||||
target="_blank"
|
href="https://github.com/DayuanJiang/next-ai-draw-io/tree/main/packages/mcp-server"
|
||||||
rel="noopener noreferrer"
|
target="_blank"
|
||||||
className="block mb-4 p-3 rounded-xl bg-gradient-to-r from-purple-500/10 to-blue-500/10 border border-purple-500/20 hover:border-purple-500/40 transition-colors group"
|
rel="noopener noreferrer"
|
||||||
>
|
className="block mb-4 p-3 rounded-xl bg-gradient-to-r from-purple-500/10 to-blue-500/10 border border-purple-500/20 hover:border-purple-500/40 transition-colors group"
|
||||||
<div className="flex items-center gap-3">
|
>
|
||||||
<div className="w-8 h-8 rounded-lg bg-purple-500/20 flex items-center justify-center shrink-0">
|
<div className="flex items-center gap-3">
|
||||||
<Terminal className="w-4 h-4 text-purple-500" />
|
<div className="w-8 h-8 rounded-lg bg-purple-500/20 flex items-center justify-center shrink-0">
|
||||||
</div>
|
<Terminal className="w-4 h-4 text-purple-500" />
|
||||||
<div className="min-w-0">
|
</div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="min-w-0">
|
||||||
<span className="text-sm font-medium text-foreground group-hover:text-purple-500 transition-colors">
|
<div className="flex items-center gap-2">
|
||||||
{dict.examples.mcpServer}
|
<span className="text-sm font-medium text-foreground group-hover:text-purple-500 transition-colors">
|
||||||
</span>
|
{dict.examples.mcpServer}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<p className="text-xs text-muted-foreground">
|
||||||
|
{dict.examples.mcpDescription}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-xs text-muted-foreground">
|
|
||||||
{dict.examples.mcpDescription}
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</a>
|
||||||
</a>
|
)}
|
||||||
|
|
||||||
{/* Welcome section */}
|
{/* Welcome section */}
|
||||||
<div className="text-center mb-6">
|
<div className="text-center mb-6">
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ MODELSCOPE_BASE_URL=https://your-custom-endpoint
|
|||||||
可选的自定义 URL:
|
可选的自定义 URL:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
OLLAMA_BASE_URL=http://localhost:11434
|
OLLAMA_BASE_URL=http://localhost:11434/api
|
||||||
```
|
```
|
||||||
|
|
||||||
### Vercel AI Gateway
|
### Vercel AI Gateway
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ AI_MODEL=llama3.2
|
|||||||
Optional custom URL:
|
Optional custom URL:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
OLLAMA_BASE_URL=http://localhost:11434
|
OLLAMA_BASE_URL=http://localhost:11434/api
|
||||||
```
|
```
|
||||||
|
|
||||||
### ModelScope
|
### ModelScope
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ AI_MODEL=llama3.2
|
|||||||
任意のカスタム URL:
|
任意のカスタム URL:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
OLLAMA_BASE_URL=http://localhost:11434
|
OLLAMA_BASE_URL=http://localhost:11434/api
|
||||||
```
|
```
|
||||||
|
|
||||||
### ModelScope
|
### ModelScope
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,6 @@
|
|||||||
# AI Provider Configuration
|
# AI Provider Configuration
|
||||||
# AI_PROVIDER: Which provider to use
|
# AI_PROVIDER: Which provider to use
|
||||||
# Options: bedrock, openai, anthropic, google, vertexai, azure, ollama, openrouter, aihubmix, deepseek, siliconflow, gateway, novita
|
# Options: bedrock, openai, anthropic, google, vertexai, azure, ollama, openrouter, aihubmix, deepseek, siliconflow, sglang, gateway, edgeone, doubao, modelscope, glm, qwen, qiniu, kimi, minimax, novita, mimo, atlascloud
|
||||||
# Default: bedrock
|
# Default: bedrock
|
||||||
AI_PROVIDER=bedrock
|
AI_PROVIDER=bedrock
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ AI_MODEL=global.anthropic.claude-sonnet-4-5-20250929-v1:0
|
|||||||
# AZURE_REASONING_SUMMARY=detailed
|
# AZURE_REASONING_SUMMARY=detailed
|
||||||
|
|
||||||
# Ollama Configuration (Local or Cloud)
|
# Ollama Configuration (Local or Cloud)
|
||||||
# OLLAMA_BASE_URL=https://ollama.com/api # Optional: Ollama Cloud; defaults to local Ollama (http://127.0.0.1:11434)
|
# OLLAMA_BASE_URL=https://ollama.com/api # Optional: Ollama Cloud; defaults to local Ollama (http://127.0.0.1:11434/api)
|
||||||
# OLLAMA_API_KEY=your-ollama-cloud-api-key # Optional: For Ollama Cloud or authenticated remote instances
|
# OLLAMA_API_KEY=your-ollama-cloud-api-key # Optional: For Ollama Cloud or authenticated remote instances
|
||||||
# OLLAMA_ENABLE_THINKING=true # Optional: Enable thinking for models that support it (e.g., qwen3)
|
# OLLAMA_ENABLE_THINKING=true # Optional: Enable thinking for models that support it (e.g., qwen3)
|
||||||
|
|
||||||
@@ -168,6 +168,7 @@ AI_MODEL=global.anthropic.claude-sonnet-4-5-20250929-v1:0
|
|||||||
# which triggers the client UI to display messages suggesting self-hosting or sponsorship.
|
# which triggers the client UI to display messages suggesting self-hosting or sponsorship.
|
||||||
# This switch allows self-hosted users to provide custom messages in response to a 429 code,
|
# This switch allows self-hosted users to provide custom messages in response to a 429 code,
|
||||||
# in messageTokenSelfHosted, messageApiSelfHosted, and tipSelfHosted translation strings.
|
# in messageTokenSelfHosted, messageApiSelfHosted, and tipSelfHosted translation strings.
|
||||||
|
# It also turns off the MCP server advertisement in the chat examples.
|
||||||
# NEXT_PUBLIC_SELFHOSTED=true
|
# NEXT_PUBLIC_SELFHOSTED=true
|
||||||
|
|
||||||
# Minimax Configuration (Optional)
|
# Minimax Configuration (Optional)
|
||||||
|
|||||||
@@ -125,7 +125,12 @@ let writableCache: boolean | null = null
|
|||||||
export function isSettingsWritable(): boolean {
|
export function isSettingsWritable(): boolean {
|
||||||
if (writableCache !== null) return writableCache
|
if (writableCache !== null) return writableCache
|
||||||
try {
|
try {
|
||||||
const dir = path.dirname(getSettingsPath())
|
const filePath = getSettingsPath()
|
||||||
|
if (fs.existsSync(filePath) && !fs.statSync(filePath).isFile()) {
|
||||||
|
writableCache = false
|
||||||
|
return writableCache
|
||||||
|
}
|
||||||
|
const dir = path.dirname(filePath)
|
||||||
fs.mkdirSync(dir, { recursive: true })
|
fs.mkdirSync(dir, { recursive: true })
|
||||||
fs.accessSync(dir, fs.constants.W_OK)
|
fs.accessSync(dir, fs.constants.W_OK)
|
||||||
writableCache = true
|
writableCache = true
|
||||||
|
|||||||
+2
-1
@@ -25,6 +25,7 @@ import { getEnvFallback } from "@/lib/admin/settings"
|
|||||||
import { isPrivateUrl, redirectGuardedFetch } from "@/lib/ssrf-protection"
|
import { isPrivateUrl, redirectGuardedFetch } from "@/lib/ssrf-protection"
|
||||||
import {
|
import {
|
||||||
normalizeBaseUrl,
|
normalizeBaseUrl,
|
||||||
|
ollamaApiUrl,
|
||||||
PROVIDER_INFO,
|
PROVIDER_INFO,
|
||||||
type ProviderName,
|
type ProviderName,
|
||||||
} from "@/lib/types/model-config"
|
} from "@/lib/types/model-config"
|
||||||
@@ -1025,7 +1026,7 @@ export function getAIModel(clientOverrides?: ClientOverrides): ModelConfig {
|
|||||||
? PROVIDER_INFO.ollama.defaultBaseUrl
|
? PROVIDER_INFO.ollama.defaultBaseUrl
|
||||||
: resolveBaseUrlEnv(overrides, "OLLAMA_BASE_URL"))
|
: resolveBaseUrlEnv(overrides, "OLLAMA_BASE_URL"))
|
||||||
model = createOllama({
|
model = createOllama({
|
||||||
...(baseURL && { baseURL }),
|
...(baseURL && { baseURL: ollamaApiUrl(baseURL) }),
|
||||||
...(apiKey && {
|
...(apiKey && {
|
||||||
headers: { Authorization: `Bearer ${apiKey}` },
|
headers: { Authorization: `Bearer ${apiKey}` },
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { getModelInfo } from "@/lib/model-catalog"
|
|||||||
import { readLimitedBody } from "@/lib/read-limited-body"
|
import { readLimitedBody } from "@/lib/read-limited-body"
|
||||||
import {
|
import {
|
||||||
normalizeBaseUrl,
|
normalizeBaseUrl,
|
||||||
|
ollamaApiUrl,
|
||||||
PROVIDER_INFO,
|
PROVIDER_INFO,
|
||||||
type ProviderName,
|
type ProviderName,
|
||||||
} from "@/lib/types/model-config"
|
} from "@/lib/types/model-config"
|
||||||
@@ -200,8 +201,11 @@ export async function listProviderModels(
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
case "ollama": {
|
case "ollama": {
|
||||||
const api = base.endsWith("/api") ? base : `${base}/api`
|
const data = await getJson(
|
||||||
const data = await getJson(`${api}/tags`, bearer, fetchFn)
|
`${ollamaApiUrl(base)}/tags`,
|
||||||
|
bearer,
|
||||||
|
fetchFn,
|
||||||
|
)
|
||||||
models = (data.models ?? []).map((m: { name: string }) => ({
|
models = (data.models ?? []).map((m: { name: string }) => ({
|
||||||
id: m.name,
|
id: m.name,
|
||||||
}))
|
}))
|
||||||
|
|||||||
@@ -622,6 +622,15 @@ export function normalizeBaseUrl(url: string): string {
|
|||||||
.replace(/\/(?:chat\/completions|completions|messages|responses)$/, "")
|
.replace(/\/(?:chat\/completions|completions|messages|responses)$/, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ollama's native API root, which the SDK appends /chat to and the model
|
||||||
|
* list /tags. Users often enter the server address ("http://localhost:11434")
|
||||||
|
* or its OpenAI-compatible one (".../v1"); both get /api.
|
||||||
|
*/
|
||||||
|
export function ollamaApiUrl(baseUrl: string): string {
|
||||||
|
return `${normalizeBaseUrl(baseUrl).replace(/\/(?:api|v1)$/, "")}/api`
|
||||||
|
}
|
||||||
|
|
||||||
/** Where a chat request goes for a base URL, or null when the SDK decides */
|
/** Where a chat request goes for a base URL, or null when the SDK decides */
|
||||||
export function chatRequestUrl(
|
export function chatRequestUrl(
|
||||||
provider: ProviderName,
|
provider: ProviderName,
|
||||||
@@ -630,6 +639,7 @@ export function chatRequestUrl(
|
|||||||
const url = normalizeBaseUrl(baseUrl)
|
const url = normalizeBaseUrl(baseUrl)
|
||||||
if (!url) return null
|
if (!url) return null
|
||||||
if (provider === "anthropic") return `${url}/messages`
|
if (provider === "anthropic") return `${url}/messages`
|
||||||
|
if (provider === "ollama") return `${ollamaApiUrl(url)}/chat`
|
||||||
// These SDKs build their own paths (or, for MiniMax, pick the protocol
|
// These SDKs build their own paths (or, for MiniMax, pick the protocol
|
||||||
// from the URL)
|
// from the URL)
|
||||||
const ownPaths: ProviderName[] = [
|
const ownPaths: ProviderName[] = [
|
||||||
@@ -637,7 +647,6 @@ export function chatRequestUrl(
|
|||||||
"vertexai",
|
"vertexai",
|
||||||
"azure",
|
"azure",
|
||||||
"bedrock",
|
"bedrock",
|
||||||
"ollama",
|
|
||||||
"gateway",
|
"gateway",
|
||||||
"minimax",
|
"minimax",
|
||||||
"edgeone",
|
"edgeone",
|
||||||
|
|||||||
Generated
+466
-1308
File diff suppressed because it is too large
Load Diff
@@ -67,7 +67,6 @@
|
|||||||
"@radix-ui/react-use-controllable-state": "^1.2.2",
|
"@radix-ui/react-use-controllable-state": "^1.2.2",
|
||||||
"@xmldom/xmldom": "^0.9.8",
|
"@xmldom/xmldom": "^0.9.8",
|
||||||
"ai": "^6.0.300",
|
"ai": "^6.0.300",
|
||||||
"base-64": "^1.0.0",
|
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"cmdk": "^1.1.1",
|
"cmdk": "^1.1.1",
|
||||||
|
|||||||
@@ -11,9 +11,11 @@ const REQUIRED = [
|
|||||||
"dist/preview/preview.js",
|
"dist/preview/preview.js",
|
||||||
]
|
]
|
||||||
|
|
||||||
const [pack] = JSON.parse(
|
const output = JSON.parse(
|
||||||
execSync("npm pack --dry-run --json", { encoding: "utf8" }),
|
execSync("npm pack --dry-run --json", { encoding: "utf8" }),
|
||||||
)
|
)
|
||||||
|
// npm 11 prints a list, npm 12 an object keyed by package name
|
||||||
|
const pack = Array.isArray(output) ? output[0] : Object.values(output)[0]
|
||||||
const files = new Set(pack.files.map((f) => f.path))
|
const files = new Set(pack.files.map((f) => f.path))
|
||||||
const missing = REQUIRED.filter((f) => !files.has(f))
|
const missing = REQUIRED.filter((f) => !files.has(f))
|
||||||
if (missing.length > 0) {
|
if (missing.length > 0) {
|
||||||
|
|||||||
@@ -154,9 +154,9 @@ describe("isSettingsWritable", () => {
|
|||||||
expect(isSettingsWritable()).toBe(true)
|
expect(isSettingsWritable()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns false for an unwritable path", () => {
|
it("returns false when the settings path is a directory", () => {
|
||||||
_resetForTests()
|
_resetForTests()
|
||||||
process.env.SETTINGS_FILE = "/nonexistent-root-dir/settings.json"
|
process.env.SETTINGS_FILE = tmpDir
|
||||||
expect(isSettingsWritable()).toBe(false)
|
expect(isSettingsWritable()).toBe(false)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -170,7 +170,9 @@ describe("settings file on disk", () => {
|
|||||||
version: 1,
|
version: 1,
|
||||||
values: { TEST_ADMIN_VAR: "secret" },
|
values: { TEST_ADMIN_VAR: "secret" },
|
||||||
})
|
})
|
||||||
const mode = fs.statSync(filePath).mode & 0o777
|
if (process.platform !== "win32") {
|
||||||
expect(mode).toBe(0o600)
|
const mode = fs.statSync(filePath).mode & 0o777
|
||||||
|
expect(mode).toBe(0o600)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -434,7 +434,7 @@ describe("Ollama API key security", () => {
|
|||||||
|
|
||||||
expect(createOllamaMock).toHaveBeenCalledWith(
|
expect(createOllamaMock).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
baseURL: "https://my-ollama.com",
|
baseURL: "https://my-ollama.com/api",
|
||||||
headers: { Authorization: "Bearer client-key" },
|
headers: { Authorization: "Bearer client-key" },
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
@@ -448,7 +448,7 @@ describe("Ollama API key security", () => {
|
|||||||
|
|
||||||
expect(createOllamaMock).toHaveBeenCalledWith(
|
expect(createOllamaMock).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
baseURL: "https://cloud.ollama.com",
|
baseURL: "https://cloud.ollama.com/api",
|
||||||
headers: { Authorization: "Bearer server-key" },
|
headers: { Authorization: "Bearer server-key" },
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
@@ -483,7 +483,24 @@ describe("Ollama API key security", () => {
|
|||||||
|
|
||||||
expect(createOllamaMock).toHaveBeenCalledTimes(1)
|
expect(createOllamaMock).toHaveBeenCalledTimes(1)
|
||||||
const callArgs = createOllamaMock.mock.calls[0][0]
|
const callArgs = createOllamaMock.mock.calls[0][0]
|
||||||
expect(callArgs.baseURL).toBe("https://my-ollama.com")
|
expect(callArgs.baseURL).toBe("https://my-ollama.com/api")
|
||||||
expect(callArgs).not.toHaveProperty("headers")
|
expect(callArgs).not.toHaveProperty("headers")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("sends chat to Ollama's /api for a server address or a /v1 URL", () => {
|
||||||
|
delete process.env.OLLAMA_API_KEY
|
||||||
|
|
||||||
|
for (const baseUrl of [
|
||||||
|
"http://localhost:11434",
|
||||||
|
"http://localhost:11434/",
|
||||||
|
"http://localhost:11434/v1",
|
||||||
|
"http://localhost:11434/api",
|
||||||
|
]) {
|
||||||
|
createOllamaMock.mockClear()
|
||||||
|
getAIModel({ provider: "ollama", baseUrl, modelId: "llama3.2" })
|
||||||
|
expect(createOllamaMock.mock.calls[0][0].baseURL).toBe(
|
||||||
|
"http://localhost:11434/api",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
import { describe, expect, it } from "vitest"
|
import { describe, expect, it } from "vitest"
|
||||||
import { chatRequestUrl, normalizeBaseUrl } from "@/lib/types/model-config"
|
import {
|
||||||
|
chatRequestUrl,
|
||||||
|
normalizeBaseUrl,
|
||||||
|
ollamaApiUrl,
|
||||||
|
} from "@/lib/types/model-config"
|
||||||
|
|
||||||
describe("normalizeBaseUrl", () => {
|
describe("normalizeBaseUrl", () => {
|
||||||
it("drops spaces, trailing slashes and a pasted endpoint path", () => {
|
it("drops spaces, trailing slashes and a pasted endpoint path", () => {
|
||||||
@@ -32,6 +36,9 @@ describe("chatRequestUrl", () => {
|
|||||||
expect(
|
expect(
|
||||||
chatRequestUrl("anthropic", "https://proxy.example.com/v1"),
|
chatRequestUrl("anthropic", "https://proxy.example.com/v1"),
|
||||||
).toBe("https://proxy.example.com/v1/messages")
|
).toBe("https://proxy.example.com/v1/messages")
|
||||||
|
expect(chatRequestUrl("ollama", "http://localhost:11434")).toBe(
|
||||||
|
"http://localhost:11434/api/chat",
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("stays out of the way for SDKs that build their own paths", () => {
|
it("stays out of the way for SDKs that build their own paths", () => {
|
||||||
@@ -40,3 +47,21 @@ describe("chatRequestUrl", () => {
|
|||||||
expect(chatRequestUrl("glm", " ")).toBeNull()
|
expect(chatRequestUrl("glm", " ")).toBeNull()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe("ollamaApiUrl", () => {
|
||||||
|
it("points at Ollama's /api whatever form the address takes", () => {
|
||||||
|
for (const url of [
|
||||||
|
"http://localhost:11434",
|
||||||
|
"http://localhost:11434/",
|
||||||
|
"http://localhost:11434/api",
|
||||||
|
"http://localhost:11434/api/",
|
||||||
|
"http://localhost:11434/v1",
|
||||||
|
"http://localhost:11434/v1/chat/completions",
|
||||||
|
]) {
|
||||||
|
expect(ollamaApiUrl(url)).toBe("http://localhost:11434/api")
|
||||||
|
}
|
||||||
|
expect(ollamaApiUrl("https://ollama.com/api")).toBe(
|
||||||
|
"https://ollama.com/api",
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user