mirror of
https://github.com/langgenius/dify-plugin-sdks.git
synced 2026-08-26 18:56:41 -04:00
038edf957e
- Added CLI for generating documentation with `generate-docs` command. - Introduced `SchemaDocumentationGenerator` to create structured documentation from schemas. - Implemented `SchemaDoc` class for schema metadata and documentation management. - Updated `PluginConfiguration` to include descriptions for plugin components. - Added support for outside reference fields in the SchemaDocumentationGenerator to improve documentation clarity. - Updated SchemaDoc to include outside_reference_fields parameter. - Modified various entity classes to utilize outside_reference_fields for better schema representation. - Introduced new container type checks and helper methods for handling dynamic fields in documentation generation.
29 lines
640 B
Python
29 lines
640 B
Python
from typing import Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from dify_plugin.core.documentation.schema_doc import docs
|
|
|
|
|
|
@docs(
|
|
description="Common i18n object",
|
|
)
|
|
class I18nObject(BaseModel):
|
|
"""
|
|
Model class for i18n object.
|
|
"""
|
|
|
|
zh_Hans: Optional[str] = None
|
|
pt_BR: Optional[str] = None
|
|
en_US: str
|
|
|
|
def __init__(self, **data):
|
|
super().__init__(**data)
|
|
if not self.zh_Hans:
|
|
self.zh_Hans = self.en_US
|
|
if not self.pt_BR:
|
|
self.pt_BR = self.en_US
|
|
|
|
def to_dict(self) -> dict:
|
|
return {"zh_Hans": self.zh_Hans, "en_US": self.en_US, "pt_BR": self.pt_BR}
|