[PR #9980] Feat/support form in conversation #26640

Closed
opened 2026-02-21 20:39:58 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/9980

State: closed
Merged: Yes


Checklist:

Important

Please review the checklist below before submitting your pull request.

  • Please open an issue before creating a PR or link to an existing issue
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

Description

// This defines the response structure of the submit action
enum DATA_FORMAT {
  TEXT = 'text',
  JSON = 'json',
}

// This defines supported tags in a form item for now :)
enum SUPPORTED_TAGS {
  LABEL = 'label',
  INPUT = 'input',
  TEXTAREA = 'textarea',
  BUTTON = 'button',
}

// This defines supported types of a input element
enum SUPPORTED_TYPES {
  TEXT = 'text',
  PASSWORD = 'password',
  EMAIL = 'email',
  NUMBER = 'number',
}
<form data-format="json"> // Default to text
  <label for="username">Username:</label>
  <input type="text" name="username" />
  <label for="password">Password:</label>
  <input type="password" name="password" />
  <div>This tag is not supported</div>
  <input type="random" name="password" /> // This is not supported as well
  <label for="content">Content:</label>
  <textarea name="content"></textarea>
  <button data-size="small" data-variant="primary">Login</button>
</form>
Response type: Text Response type: Json

Example DSL: Form in conversation.yml.zip

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update, included: Dify Document
  • Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement
  • Dependency upgrade

Testing Instructions

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B
**Original Pull Request:** https://github.com/langgenius/dify/pull/9980 **State:** closed **Merged:** Yes --- # Checklist: > [!IMPORTANT] > Please review the checklist below before submitting your pull request. - [ ] Please open an issue before creating a PR or link to an existing issue - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods # Description ``` // This defines the response structure of the submit action enum DATA_FORMAT { TEXT = 'text', JSON = 'json', } // This defines supported tags in a form item for now :) enum SUPPORTED_TAGS { LABEL = 'label', INPUT = 'input', TEXTAREA = 'textarea', BUTTON = 'button', } // This defines supported types of a input element enum SUPPORTED_TYPES { TEXT = 'text', PASSWORD = 'password', EMAIL = 'email', NUMBER = 'number', } ``` ``` <form data-format="json"> // Default to text <label for="username">Username:</label> <input type="text" name="username" /> <label for="password">Password:</label> <input type="password" name="password" /> <div>This tag is not supported</div> <input type="random" name="password" /> // This is not supported as well <label for="content">Content:</label> <textarea name="content"></textarea> <button data-size="small" data-variant="primary">Login</button> </form> ``` <table> <tr> <td>Response type: Text</td> <td>Response type: Json</td> </tr> <tr> <td><img src="https://github.com/user-attachments/assets/1c1e7b27-38bd-4671-a6fb-94922d898663"/></td> <td><img src="https://github.com/user-attachments/assets/f5455ef0-08f3-47ea-b2c0-31a1e3981c84"/></td> </tr> </table> Example DSL: [Form in conversation.yml.zip](https://github.com/user-attachments/files/17551924/Form.in.conversation.yml.zip) ## Type of Change - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [ ] Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement - [ ] Dependency upgrade # Testing Instructions Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration - [ ] Test A - [ ] Test B
yindo added the pull-request label 2026-02-21 20:39:58 -05:00
yindo closed this issue 2026-02-21 20:39:59 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#26640