mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 01:18:05 +08:00
feat: move model request to plugin daemon
This commit is contained in:
@ -1,8 +1,11 @@
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import Generic, Optional, TypeVar
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from core.model_runtime.entities.model_entities import AIModelEntity
|
||||
from core.model_runtime.entities.provider_entities import ProviderEntity
|
||||
from core.tools.entities.tool_entities import ToolProviderEntityWithPlugin
|
||||
|
||||
T = TypeVar("T", bound=(BaseModel | dict | list | bool))
|
||||
@ -22,6 +25,7 @@ class InstallPluginMessage(BaseModel):
|
||||
"""
|
||||
Message for installing a plugin.
|
||||
"""
|
||||
|
||||
class Event(Enum):
|
||||
Info = "info"
|
||||
Done = "done"
|
||||
@ -42,4 +46,44 @@ class PluginBasicBooleanResponse(BaseModel):
|
||||
"""
|
||||
Basic boolean response from plugin daemon.
|
||||
"""
|
||||
result: bool
|
||||
|
||||
result: bool
|
||||
|
||||
|
||||
class PluginModelSchemaEntity(BaseModel):
|
||||
model_schema: AIModelEntity = Field(description="The model schema.")
|
||||
|
||||
# pydantic configs
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class PluginModelProviderEntity(BaseModel):
|
||||
id: str = Field(alias="ID", description="ID")
|
||||
created_at: datetime = Field(alias="CreatedAt", description="The created at time of the model provider.")
|
||||
updated_at: datetime = Field(alias="UpdatedAt", description="The updated at time of the model provider.")
|
||||
provider: str = Field(description="The provider of the model.")
|
||||
tenant_id: str = Field(description="The tenant ID.")
|
||||
plugin_unique_identifier: str = Field(description="The plugin unique identifier.")
|
||||
plugin_id: str = Field(description="The plugin ID.")
|
||||
declaration: ProviderEntity = Field(description="The declaration of the model provider.")
|
||||
|
||||
|
||||
class PluginNumTokensResponse(BaseModel):
|
||||
"""
|
||||
Response for number of tokens.
|
||||
"""
|
||||
|
||||
num_tokens: int = Field(description="The number of tokens.")
|
||||
|
||||
|
||||
class PluginStringResultResponse(BaseModel):
|
||||
result: str = Field(description="The result of the string.")
|
||||
|
||||
|
||||
class PluginVoiceEntity(BaseModel):
|
||||
name: str = Field(description="The name of the voice.")
|
||||
value: str = Field(description="The value of the voice.")
|
||||
|
||||
|
||||
class PluginVoicesResponse(BaseModel):
|
||||
voices: list[PluginVoiceEntity] = Field(description="The result of the voices.")
|
||||
|
||||
Reference in New Issue
Block a user