Skip to content

feat(web): add customizable input placeholder for Agent/Chatflow/Chatbot web app#37790

Draft
CyberPU2099 wants to merge 3 commits into
mainfrom
feat/webapp-input-placeholder
Draft

feat(web): add customizable input placeholder for Agent/Chatflow/Chatbot web app#37790
CyberPU2099 wants to merge 3 commits into
mainfrom
feat/webapp-input-placeholder

Conversation

@CyberPU2099

Copy link
Copy Markdown

Summary

Adds an Input placeholder field to Web App Settings that lets owners customize the chat input box placeholder text. Available only for chat-style apps (Chatbot / Agent / Chatflow) and gated behind the same paid-plan entitlement (webappCopyrightEnabled) as Copyright.

  • Free plan: Upgrade pill + read-only mini-chat-input preview + hover tooltip
  • Paid plan: editable up to 64 chars with live N / 64 counter; the field renders as a mini chat input box (text + disabled send button) and on blur swaps the entered value to placeholder-gray so owners see the actual rendered effect
  • Runtime: takes effect in both standalone Web App and embedded chatbot; empty / whitespace-only falls back to the existing Talk to {{botName}} i18n string
  • i18n: en-US, zh-Hans, ja-JP (other locales intentionally deferred to translation flow per repo convention)

Scope

Frontend only (web/). No new dependencies. 8 files, +106/-2.

File Change
web/types/app.ts SiteConfig.input_placeholder: string
web/models/share.ts SiteInfo.input_placeholder?: string
web/i18n/{en-US,zh-Hans,ja-JP}/app-overview.json 4 keys × 3 locales
web/app/components/app/overview/settings/index.tsx New settings row, gated by mode + plan
web/app/components/base/chat/chat/index.tsx Pass customPlaceholder to ChatInputArea
web/app/components/base/chat/chat/chat-input-area/index.tsx Accept customPlaceholder prop and prefer it over the default i18n string when not readonly

⚠️ Backend dependency (BLOCKING)

This PR ships the frontend only. End-to-end functionality requires a backend counterpart:

  1. DB migration — add input_placeholder VARCHAR(64) NOT NULL DEFAULT '' to the sites table.
  2. Site GET (console + share/web API) — include input_placeholder in the serialized site payload so the frontend can read what was saved.
  3. Site PATCH — accept the field in the request body, enforce len <= 64, persist.
  4. Entitlement — confirm whether to reuse webapp_copyright_enabled (current frontend gate) or add a dedicated webapp_input_placeholder_enabled flag. If the backend splits the gate, swap a single constant in settings/index.tsx.

Without these, the field renders correctly in Settings but the value is silently dropped on save (backend ignores the unknown field, GET returns no value, runtime falls back to default).

Test plan

  • Chatbot app → Settings → "Show more settings" shows the Input placeholder row above Copyright
  • Agent app → shows the row
  • Chatflow app → shows the row
  • Workflow app → row is hidden
  • Text Generator app → row is hidden
  • Free-plan workspace (Cloud edition, sandbox): Upgrade pill visible, input disabled, hover wrapper → tooltip "Upgrade to customize the placeholder" (zh: 升级后可自定义提示语 / ja: アップグレードするとプレースホルダーをカスタマイズできます), no character counter
  • Paid-plan workspace: input editable, N / 64 counter, maxLength enforced; focus → text in primary color, blur with value → text switches to placeholder-gray (live preview)
  • Language switch (Settings → Language → en/zh/ja) — label, tip, tooltip, placeholder all match canonical translations
  • After backend lands: chat input box in standalone Web App picks up the configured placeholder; empty falls back to Talk to {botName}
  • After backend lands: embedded chatbot iframe shows the configured placeholder
  • readonly chat (e.g. shared preview without permission) still uses chat.inputDisabledPlaceholder rather than the custom string
  • Empty / whitespace-only string saves as empty and falls back to default at runtime

Related

  • PRD:
  • Prototype reference: local HTML mockup matched to this implementation

🤖 Generated with Claude Code

Add an "Input placeholder" field to Web App Settings that lets owners
customize the chat input box placeholder text. Available only for chat-style
apps (Chatbot / Agent / Chatflow) and gated behind the same paid-plan
entitlement (`webappCopyrightEnabled`) as Copyright.

Free plan shows an Upgrade pill + read-only field; paid plan can edit up to
64 chars with a live counter. At runtime the value flows into both the
standalone Web App and the embedded chatbot; empty / whitespace-only falls
back to the existing `Talk to {{botName}}` i18n string.

i18n: en-US, zh-Hans, ja-JP.

Requires backend support to persist the new `input_placeholder` column on
the `sites` table and surface it on the site GET/PATCH endpoints — see PR
description for details. Without the backend counterpart the UI renders
correctly but the value is silently dropped on save.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions github-actions Bot added the web This relates to changes on the web. label Jun 23, 2026
@CyberPU2099 CyberPU2099 changed the title feat(web): add customizable input placeholder for chat web app feat(web): add customizable input placeholder for Agent/Chatflow/Chatbot web app Jun 23, 2026
@hjlarry hjlarry self-assigned this Jun 23, 2026
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.66667% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.79%. Comparing base (a3309cd) to head (cce3410).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
web/app/components/app/overview/settings/index.tsx 85.71% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #37790      +/-   ##
==========================================
- Coverage   85.79%   85.79%   -0.01%     
==========================================
  Files        5001     5001              
  Lines      255153   255181      +28     
  Branches    48288    48307      +19     
==========================================
+ Hits       218911   218932      +21     
- Misses      32048    32055       +7     
  Partials     4194     4194              
Flag Coverage Δ
dify-ui 94.94% <ø> (ø)
web 85.44% <86.66%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants