feat(provider): 添加厂商预设与模型发现接口
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from app.contracts import ModelCapability, ProviderConfig, ProviderType
|
||||
from app.contracts import ModelCapability, ProviderConfig, ProviderPreset, ProviderType
|
||||
from app.providers.base import ModelProvider
|
||||
from app.providers.credentials import CredentialResolver
|
||||
from app.providers.ollama import OllamaProvider
|
||||
@@ -27,6 +27,30 @@ class ProviderFactory:
|
||||
return OllamaProvider(config.base_url or "http://127.0.0.1:11434")
|
||||
raise UnsupportedProviderError(config.provider_type.value)
|
||||
|
||||
@staticmethod
|
||||
def presets() -> list[ProviderPreset]:
|
||||
return [
|
||||
ProviderPreset(
|
||||
preset_id="openai",
|
||||
name="OpenAI",
|
||||
provider_type=ProviderType.openai_chat,
|
||||
base_url="https://api.openai.com/v1",
|
||||
),
|
||||
ProviderPreset(
|
||||
preset_id="deepseek",
|
||||
name="DeepSeek",
|
||||
provider_type=ProviderType.openai_compatible,
|
||||
base_url="https://api.deepseek.com",
|
||||
),
|
||||
ProviderPreset(
|
||||
preset_id="ollama",
|
||||
name="Ollama",
|
||||
provider_type=ProviderType.ollama,
|
||||
base_url="http://127.0.0.1:11434",
|
||||
requires_credential=False,
|
||||
),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def capabilities(provider_type: ProviderType) -> list[ModelCapability]:
|
||||
if provider_type in {
|
||||
|
||||
Reference in New Issue
Block a user