mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-21 18:55:16 +02:00
Merge pull request #361 from TensorNull/feat/cometapi
feat: Added CometAPI to LLM providers list
This commit is contained in:
commit
eafa837320
5 changed files with 56 additions and 0 deletions
|
|
@ -0,0 +1,47 @@
|
||||||
|
"""Add COMETAPI to LiteLLMProvider enum
|
||||||
|
|
||||||
|
Revision ID: 22
|
||||||
|
Revises: 21
|
||||||
|
"""
|
||||||
|
|
||||||
|
from collections.abc import Sequence
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision: str = "22"
|
||||||
|
down_revision: str | None = "21"
|
||||||
|
branch_labels: str | Sequence[str] | None = None
|
||||||
|
depends_on: str | Sequence[str] | None = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
"""Add COMETAPI to LiteLLMProvider enum."""
|
||||||
|
|
||||||
|
# Add COMETAPI to the enum if it doesn't already exist
|
||||||
|
op.execute(
|
||||||
|
"""
|
||||||
|
DO $$
|
||||||
|
BEGIN
|
||||||
|
IF NOT EXISTS (
|
||||||
|
SELECT 1 FROM pg_enum
|
||||||
|
WHERE enumtypid = 'litellmprovider'::regtype
|
||||||
|
AND enumlabel = 'COMETAPI'
|
||||||
|
) THEN
|
||||||
|
ALTER TYPE litellmprovider ADD VALUE 'COMETAPI';
|
||||||
|
END IF;
|
||||||
|
END$$;
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
"""Remove COMETAPI from LiteLLMProvider enum.
|
||||||
|
|
||||||
|
Note: PostgreSQL doesn't support removing enum values directly.
|
||||||
|
This would require recreating the enum type and updating all dependent objects.
|
||||||
|
For safety, this downgrade is a no-op.
|
||||||
|
"""
|
||||||
|
# PostgreSQL doesn't support removing enum values directly
|
||||||
|
# This would require a complex migration recreating the enum
|
||||||
|
pass
|
||||||
|
|
@ -100,6 +100,7 @@ class LiteLLMProvider(str, Enum):
|
||||||
NLPCLOUD = "NLPCLOUD"
|
NLPCLOUD = "NLPCLOUD"
|
||||||
ALEPH_ALPHA = "ALEPH_ALPHA"
|
ALEPH_ALPHA = "ALEPH_ALPHA"
|
||||||
PETALS = "PETALS"
|
PETALS = "PETALS"
|
||||||
|
COMETAPI = "COMETAPI"
|
||||||
CUSTOM = "CUSTOM"
|
CUSTOM = "CUSTOM"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ async def get_user_llm_instance(
|
||||||
"MISTRAL": "mistral",
|
"MISTRAL": "mistral",
|
||||||
"AZURE_OPENAI": "azure",
|
"AZURE_OPENAI": "azure",
|
||||||
"OPENROUTER": "openrouter",
|
"OPENROUTER": "openrouter",
|
||||||
|
"COMETAPI": "openai",
|
||||||
# Add more mappings as needed
|
# Add more mappings as needed
|
||||||
}
|
}
|
||||||
provider_prefix = provider_map.get(
|
provider_prefix = provider_map.get(
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ const LLM_PROVIDERS = [
|
||||||
{ value: "TOGETHER_AI", label: "Together AI", example: "togethercomputer/llama-2-70b-chat" },
|
{ value: "TOGETHER_AI", label: "Together AI", example: "togethercomputer/llama-2-70b-chat" },
|
||||||
{ value: "REPLICATE", label: "Replicate", example: "meta/llama-2-70b-chat" },
|
{ value: "REPLICATE", label: "Replicate", example: "meta/llama-2-70b-chat" },
|
||||||
{ value: "OPENROUTER", label: "OpenRouter", example: "anthropic/claude-opus-4.1, openai/gpt-5" },
|
{ value: "OPENROUTER", label: "OpenRouter", example: "anthropic/claude-opus-4.1, openai/gpt-5" },
|
||||||
|
{ value: "COMETAPI", label: "CometAPI", example: "gpt-4o, claude-3-5-sonnet-20241022" },
|
||||||
{ value: "CUSTOM", label: "Custom Provider", example: "your-custom-model" },
|
{ value: "CUSTOM", label: "Custom Provider", example: "your-custom-model" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,12 @@ const LLM_PROVIDERS = [
|
||||||
example: "anthropic/claude-opus-4.1, openai/gpt-5",
|
example: "anthropic/claude-opus-4.1, openai/gpt-5",
|
||||||
description: "API gateway and LLM marketplace that provides unified access ",
|
description: "API gateway and LLM marketplace that provides unified access ",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
value: "COMETAPI",
|
||||||
|
label: "CometAPI",
|
||||||
|
example: "gpt-5-mini, claude-sonnet-4-5",
|
||||||
|
description: "500+ AI models through one unified API",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
value: "CUSTOM",
|
value: "CUSTOM",
|
||||||
label: "Custom Provider",
|
label: "Custom Provider",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue