Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

feat: integrate Hugging Face provider into web app and engine management

Victor Muštar178d1546fe6e
diff --git a/extensions/engine-management-extension/engines.mjs b/extensions/engine-management-extension/engines.mjs
index eafe8a09c..b63bc6b52 100644
--- a/extensions/engine-management-extension/engines.mjs
+++ b/extensions/engine-management-extension/engines.mjs
@@ -3,6 +3,7 @@ import cohere from './resources/cohere.json' with { type: 'json' }
import openai from './resources/openai.json' with { type: 'json' }
import openrouter from './resources/openrouter.json' with { type: 'json' }
import groq from './resources/groq.json' with { type: 'json' }
+import huggingface from './resources/huggingface.json' with { type: 'json' }
import martian from './resources/martian.json' with { type: 'json' }
import mistral from './resources/mistral.json' with { type: 'json' }
import nvidia from './resources/nvidia.json' with { type: 'json' }
@@ -14,6 +15,7 @@ import cohereModels from './models/cohere.json' with { type: 'json' }
import openaiModels from './models/openai.json' with { type: 'json' }
import openrouterModels from './models/openrouter.json' with { type: 'json' }
import groqModels from './models/groq.json' with { type: 'json' }
+import huggingfaceModels from './models/huggingface.json' with { type: 'json' }
import martianModels from './models/martian.json' with { type: 'json' }
import mistralModels from './models/mistral.json' with { type: 'json' }
import nvidiaModels from './models/nvidia.json' with { type: 'json' }
@@ -26,6 +28,7 @@ const engines = [
cohere,
openrouter,
groq,
+ huggingface,
mistral,
martian,
nvidia,
@@ -38,6 +41,7 @@ const models = [
...cohereModels,
...openrouterModels,
...groqModels,
+ ...huggingfaceModels,
...mistralModels,
...martianModels,
...nvidiaModels,
diff --git a/web-app/src/lib/utils.ts b/web-app/src/lib/utils.ts
index b193257f2..168798f45 100644
--- a/web-app/src/lib/utils.ts
+++ b/web-app/src/lib/utils.ts
@@ -11,6 +11,8 @@ export function getProviderLogo(provider: string) {
return '/images/model-provider/llamacpp.svg'
case 'anthropic':
return '/images/model-provider/anthropic.svg'
+ case 'huggingface':
+ return '/images/model-provider/huggingface.svg'
case 'mistral':
return '/images/model-provider/mistral.svg'
case 'martian':
@@ -46,6 +48,8 @@ export const getProviderTitle = (provider: string) => {
return 'OpenRouter'
case 'gemini':
return 'Gemini'
+ case 'huggingface':
+ return 'Hugging Face'
default:
return provider.charAt(0).toUpperCase() + provider.slice(1)
}
diff --git a/web-app/src/mock/data.ts b/web-app/src/mock/data.ts
index 3610eab97..7e1d586fb 100644
--- a/web-app/src/mock/data.ts
+++ b/web-app/src/mock/data.ts
@@ -281,4 +281,64 @@ export const predefinedProviders = [
],
models: [],
},
+ {
+ active: true,
+ api_key: '',
+ base_url: 'https://router.huggingface.co/v1',
+ explore_models_url:
+ 'https://huggingface.co/models?pipeline_tag=text-generation&inference_provider=all',
+ provider: 'huggingface',
+ settings: [
+ {
+ key: 'api-key',
+ title: 'API Key',
+ description:
+ "The Hugging Face API uses tokens for authentication. Visit your [Access Tokens](https://huggingface.co/settings/tokens) page to retrieve the token you'll use in your requests.",
+ controller_type: 'input',
+ controller_props: {
+ placeholder: 'Insert API Token',
+ value: '',
+ type: 'password',
+ input_actions: ['unobscure', 'copy'],
+ },
+ },
+ {
+ key: 'base-url',
+ title: 'Base URL',
+ description:
+ 'The base endpoint to use. See the [Hugging Face Inference Providers documentation](https://huggingface.co/docs/inference-providers) for more information.',
+ controller_type: 'input',
+ controller_props: {
+ placeholder: 'https://router.huggingface.co/v1',
+ value: 'https://router.huggingface.co/v1',
+ },
+ },
+ ],
+ models: [
+ {
+ id: 'moonshotai/Kimi-K2-Instruct:groq',
+ name: 'Kimi-K2-Instruct',
+ version: '1.0',
+ description:
+ "Moonshot's Kimi K2 model with 131k context and tool calling support",
+ capabilities: ['completion', 'tools'],
+ },
+ {
+ id: 'deepseek-ai/DeepSeek-R1-0528',
+ name: 'DeepSeek-R1-0528',
+ version: '1.0',
+ description:
+ "DeepSeek's reasoning model with 163k context, tool calling support, and open weights",
+ capabilities: ['completion', 'tools'],
+ },
+ {
+ id: 'deepseek-ai/DeepSeek-V3-0324',
+ name: 'DeepSeek-V3-0324',
+ version: '1.0',
+ description:
+ 'DeepSeek V3 with 16k context, tool calling support, and open weights',
+ capabilities: ['completion', 'tools'],
+ },
+ ],
+ },
]