RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
feat: Add n1n provider (#12680)
n1n.aif3d347f55f55
diff --git a/conf/llm_factories.json b/conf/llm_factories.jsonindex b128f4e67f..5439f368b6 100644--- a/conf/llm_factories.json+++ b/conf/llm_factories.json@@ -5539,6 +5539,43 @@"status": "1","rank": "910","llm": []+ },+ {+ "name": "n1n",+ "logo": "",+ "tags": "LLM",+ "status": "1",+ "rank": "900",+ "llm": [+ {+ "llm_name": "gpt-4o-mini",+ "tags": "LLM,CHAT,128K,IMAGE2TEXT",+ "max_tokens": 128000,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "gpt-4o",+ "tags": "LLM,CHAT,128K,IMAGE2TEXT",+ "max_tokens": 128000,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "gpt-3.5-turbo",+ "tags": "LLM,CHAT,4K",+ "max_tokens": 4096,+ "model_type": "chat",+ "is_tools": false+ },+ {+ "llm_name": "deepseek-chat",+ "tags": "LLM,CHAT,128K",+ "max_tokens": 128000,+ "model_type": "chat",+ "is_tools": true+ }+ ]}]-}+}\ No newline at end of filediff --git a/rag/llm/__init__.py b/rag/llm/__init__.pyindex 4b36d8a051..ce5b5ef234 100644--- a/rag/llm/__init__.py+++ b/rag/llm/__init__.py@@ -56,6 +56,7 @@ class SupportedLiteLLMProvider(StrEnum):GPUStack = "GPUStack"OpenAI = "OpenAI"Azure_OpenAI = "Azure-OpenAI"+ n1n = "n1n"FACTORY_DEFAULT_BASE_URL = {@@ -81,6 +82,7 @@ FACTORY_DEFAULT_BASE_URL = {SupportedLiteLLMProvider.MiniMax: "https://api.minimaxi.com/v1",SupportedLiteLLMProvider.DeerAPI: "https://api.deerapi.com/v1",SupportedLiteLLMProvider.OpenAI: "https://api.openai.com/v1",+ SupportedLiteLLMProvider.n1n: "https://api.n1n.ai/v1",}@@ -118,6 +120,7 @@ LITELLM_PROVIDER_PREFIX = {SupportedLiteLLMProvider.GPUStack: "openai/",SupportedLiteLLMProvider.OpenAI: "openai/",SupportedLiteLLMProvider.Azure_OpenAI: "azure/",+ SupportedLiteLLMProvider.n1n: "openai/",}ChatModel = globals().get("ChatModel", {})diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.pyindex eb1a0f8261..edb74b214e 100644--- a/rag/llm/chat_model.py+++ b/rag/llm/chat_model.py@@ -1165,6 +1165,15 @@ class TokenPonyChat(Base):super().__init__(key, model_name, base_url, **kwargs)+class N1nChat(Base):+ _FACTORY_NAME = "n1n"++ def __init__(self, key, model_name, base_url="https://api.n1n.ai/v1", **kwargs):+ if not base_url:+ base_url = "https://api.n1n.ai/v1"+ super().__init__(key, model_name, base_url, **kwargs)++class LiteLLMBase(ABC):_FACTORY_NAME = ["Tongyi-Qianwen",diff --git a/web/src/assets/svg/llm/n1n.svg b/web/src/assets/svg/llm/n1n.svgnew file mode 100644index 0000000000..58296008bc--- /dev/null+++ b/web/src/assets/svg/llm/n1n.svg@@ -0,0 +1,4 @@+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <rect x="2" y="2" width="20" height="20" rx="5" ry="5" fill="#000000" stroke="none" />+ <text x="50%" y="54%" dominant-baseline="middle" text-anchor="middle" font-family="Arial, sans-serif" font-size="8" fill="#ffffff" font-weight="bold">n1n</text>+</svg>diff --git a/web/src/components/svg-icon.tsx b/web/src/components/svg-icon.tsxindex 3f97bf0d07..2b3ae9be54 100644--- a/web/src/components/svg-icon.tsx+++ b/web/src/components/svg-icon.tsx@@ -83,6 +83,7 @@ const svgIcons = [LLMFactory.StepFun,LLMFactory.MinerU,LLMFactory.PaddleOCR,+ LLMFactory.N1n,// LLMFactory.DeerAPI,];diff --git a/web/src/constants/llm.ts b/web/src/constants/llm.tsindex 5551ad3cee..f8ae332669 100644--- a/web/src/constants/llm.ts+++ b/web/src/constants/llm.ts@@ -62,6 +62,7 @@ export enum LLMFactory {Builtin = 'Builtin',MinerU = 'MinerU',PaddleOCR = 'PaddleOCR',+ N1n = 'n1n',}// Please lowercase the file name@@ -129,6 +130,7 @@ export const IconMap = {[LLMFactory.Builtin]: 'builtin',[LLMFactory.MinerU]: 'mineru',[LLMFactory.PaddleOCR]: 'paddleocr',+ [LLMFactory.N1n]: 'n1n',};export const APIMapUrl = {@@ -181,4 +183,5 @@ export const APIMapUrl = {[LLMFactory.TokenPony]: 'https://www.tokenpony.cn/#/user/keys',[LLMFactory.DeepInfra]: 'https://deepinfra.com/dash/api_keys',[LLMFactory.PaddleOCR]: 'https://www.paddleocr.ai/latest/',+ [LLMFactory.N1n]: 'https://docs.n1n.ai',};