fix: missing detailed paths of endpoints

This commit is contained in:
Yeuoly
2024-10-10 00:12:46 +08:00
parent 2622159763
commit a470e0e60e
3 changed files with 23 additions and 25 deletions

View File

@ -1,4 +1,5 @@
from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field, model_validator
@ -12,7 +13,17 @@ class EndpointDeclaration(BaseModel):
declaration of an endpoint
"""
path: str
method: str
class EndpointProviderDeclaration(BaseModel):
"""
declaration of an endpoint group
"""
settings: list[ProviderConfig] = Field(default_factory=list)
endpoints: Optional[list[EndpointDeclaration]] = Field(default_factory=list)
class EndpointEntity(BasePluginEntity):
@ -21,14 +32,17 @@ class EndpointEntity(BasePluginEntity):
"""
settings: dict
tenant_id: str
plugin_id: str
expired_at: datetime
declaration: EndpointProviderDeclaration = Field(default_factory=EndpointProviderDeclaration)
class EndpointEntityWithInstance(EndpointEntity):
name: str
enabled: bool
url: str
hook_id: str
tenant_id: str
plugin_id: str
expired_at: datetime
declaration: EndpointDeclaration = Field(default_factory=EndpointDeclaration)
@model_validator(mode="before")
@classmethod

View File

@ -5,7 +5,7 @@ from pydantic import BaseModel, Field
from core.model_runtime.entities.provider_entities import ProviderEntity
from core.plugin.entities.base import BasePluginEntity
from core.plugin.entities.endpoint import EndpointEntity
from core.plugin.entities.endpoint import EndpointProviderDeclaration
from core.tools.entities.common_entities import I18nObject
from core.tools.entities.tool_entities import ToolProviderEntity
@ -61,7 +61,7 @@ class PluginDeclaration(BaseModel):
plugins: Plugins
tool: Optional[ToolProviderEntity] = None
model: Optional[ProviderEntity] = None
endpoint: Optional[EndpointEntity] = None
endpoint: Optional[EndpointProviderDeclaration] = None
class PluginEntity(BasePluginEntity):