feat: add OllamaLocalExecutor and update provider handling
- Introduced OllamaLocalExecutor to handle requests for the "ollama-local" provider. - Removed the direct URL construction for "ollama-local" from BaseExecutor. - Updated index.js to include the new OllamaLocalExecutor in the executors mapping. - Enhanced the ProvidersPage component to support dynamic addition of OpenAI/Anthropic compatible providers.
This commit is contained in:
parent
050e56f20b
commit
0d61a1d546
8 changed files with 127 additions and 94 deletions
|
|
@ -2,7 +2,14 @@
|
|||
|
||||
import { useState, useEffect, useMemo, useCallback } from "react";
|
||||
import { useSearchParams, useRouter } from "next/navigation";
|
||||
import { FREE_PROVIDERS } from "@/shared/constants/providers";
|
||||
import { FREE_PROVIDERS, AI_PROVIDERS } from "@/shared/constants/providers";
|
||||
|
||||
// Keep providers without serviceKinds (default LLM) or with "llm" in serviceKinds
|
||||
function isLLMProvider(id) {
|
||||
const p = AI_PROVIDERS[id];
|
||||
if (!p?.serviceKinds) return true;
|
||||
return p.serviceKinds.includes("llm");
|
||||
}
|
||||
import Badge from "./Badge";
|
||||
import Card from "./Card";
|
||||
import OverviewCards from "@/app/(dashboard)/dashboard/usage/components/OverviewCards";
|
||||
|
|
@ -206,12 +213,14 @@ export default function UsageStats({ period: periodProp, setPeriod: setPeriodPro
|
|||
.then((d) => {
|
||||
const seen = new Set();
|
||||
const unique = (d?.connections || []).filter((c) => {
|
||||
if (c.isActive === false) return false;
|
||||
if (!isLLMProvider(c.provider)) return false;
|
||||
if (seen.has(c.provider)) return false;
|
||||
seen.add(c.provider);
|
||||
return true;
|
||||
});
|
||||
const noAuthProviders = Object.values(FREE_PROVIDERS)
|
||||
.filter((p) => p.noAuth && !seen.has(p.id))
|
||||
.filter((p) => p.noAuth && !seen.has(p.id) && isLLMProvider(p.id))
|
||||
.map((p) => ({ provider: p.id, name: p.name }));
|
||||
setProviders([...unique, ...noAuthProviders]);
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue