Skip to content
3 changes: 2 additions & 1 deletion api/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def value_of(cls, value: str) -> "AppMode":
class IconType(StrEnum):
IMAGE = auto()
EMOJI = auto()
LINK = auto()


class App(Base):
Expand All @@ -81,7 +82,7 @@ class App(Base):
name: Mapped[str] = mapped_column(String(255))
description: Mapped[str] = mapped_column(LongText, default=sa.text("''"))
mode: Mapped[str] = mapped_column(String(255))
icon_type: Mapped[str | None] = mapped_column(String(255)) # image, emoji
icon_type: Mapped[str | None] = mapped_column(String(255)) # image, emoji, link
icon = mapped_column(String(255))
icon_background: Mapped[str | None] = mapped_column(String(255))
app_model_config_id = mapped_column(StringUUID, nullable=True)
Expand Down
6 changes: 3 additions & 3 deletions api/services/app_dsl_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from factories import variable_factory
from libs.datetime_utils import naive_utc_now
from models import Account, App, AppMode
from models.model import AppModelConfig
from models.model import AppModelConfig, IconType
from models.workflow import Workflow
from services.plugin.dependencies_analysis import DependenciesAnalysisService
from services.workflow_draft_variable_service import WorkflowDraftVariableService
Expand Down Expand Up @@ -428,10 +428,10 @@ def _create_or_update_app(

# Set icon type
icon_type_value = icon_type or app_data.get("icon_type")
if icon_type_value in ["emoji", "link", "image"]:
if icon_type_value in [IconType.EMOJI.value, IconType.IMAGE.value, IconType.LINK.value]:
icon_type = icon_type_value
else:
icon_type = "emoji"
icon_type = IconType.EMOJI.value
icon = icon or str(app_data.get("icon", ""))

if app:
Expand Down
2 changes: 1 addition & 1 deletion api/tests/unit_tests/models/test_app_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_app_mode_value_of(self):
def test_icon_type_validation(self):
"""Test icon type enum values."""
# Assert
assert {t.value for t in IconType} == {"image", "emoji"}
assert {t.value for t in IconType} == {"image", "emoji", "link"}

def test_app_desc_or_prompt_with_description(self):
"""Test desc_or_prompt property when description exists."""
Expand Down
2 changes: 1 addition & 1 deletion web/types/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ export type SiteConfig = {
use_icon_as_answer_icon: boolean
}

export type AppIconType = 'image' | 'emoji'
export type AppIconType = 'image' | 'emoji' | 'link'

/**
* App
Expand Down
Loading