Skip to content

Commit c8b43db

Browse files
committed
feat: add OpenAI protocol support and enhance AI provider configuration
1 parent 64fe02c commit c8b43db

8 files changed

Lines changed: 583 additions & 14 deletions

File tree

domain/ai/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222
AIModelUpdate,
2323
AIProviderCreate,
2424
AIProviderUpdate,
25+
OPENAI_PROTOCOL_CHAT_COMPLETIONS,
26+
OPENAI_PROTOCOL_RESPONSES,
2527
VectorDBConfigPayload,
2628
normalize_capabilities,
29+
normalize_openai_protocol,
2730
)
2831
from .vector_providers import (
2932
BaseVectorProvider,
@@ -58,6 +61,9 @@
5861
"get_provider_class",
5962
"ABILITIES",
6063
"normalize_capabilities",
64+
"normalize_openai_protocol",
65+
"OPENAI_PROTOCOL_CHAT_COMPLETIONS",
66+
"OPENAI_PROTOCOL_RESPONSES",
6167
"AIDefaultsUpdate",
6268
"AIModelCreate",
6369
"AIModelUpdate",

domain/ai/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async def list_providers_endpoint(
3434
@audit(
3535
action=AuditAction.CREATE,
3636
description="创建 AI 提供商",
37-
body_fields=["name", "identifier", "provider_type", "api_format", "base_url", "logo_url"],
37+
body_fields=["name", "identifier", "provider_type", "api_format", "base_url", "logo_url", "extra_config"],
3838
redact_fields=["api_key"],
3939
)
4040
@router_ai.post("/providers")
@@ -61,7 +61,7 @@ async def get_provider(
6161
@audit(
6262
action=AuditAction.UPDATE,
6363
description="更新 AI 提供商",
64-
body_fields=["name", "provider_type", "api_format", "base_url", "logo_url", "api_key"],
64+
body_fields=["name", "provider_type", "api_format", "base_url", "logo_url", "api_key", "extra_config"],
6565
redact_fields=["api_key"],
6666
)
6767
@router_ai.put("/providers/{provider_id}")

0 commit comments

Comments
 (0)