Preface

DSH (DeepSeek Harness) adopts a plugin-based architecture, allowing functionality to be extended in the Web GUI. The dsh-better-input plugin adds an “AI Optimize Input” button to the left of the model selector. When clicked, the plugin optimizes the content in the input box based on customizable prompts and writes the result back into the input box. The plugin supports undo, streaming backfill, and separated management of system prompts and appended prompts.

Core Features

  • AI Optimize Input Button: Displayed to the left of the model selector; the button is disabled when the input is empty.
  • Custom Prompt Optimization: Supports configuring model parameters and prompts in the settings page, taking effect immediately.
  • Undo and State Validation: Supports an undo stack and CAS validation, allowing the optimization process to be rolled back.
  • Streaming Backfill: Supports SSE streaming backfill, replacing the draft while it is being generated.
  • Prompt Layering: Separates system prompts from appended prompts, and supports managing appended prompts independently.
  • Multi-Select Optimization Styles: Supports selecting multiple optimization styles and incorporating them into the appended prompt list.

Installation and Enablement

Prerequisites: dsh 0.2.0-rc.2+, profile web.

  1. Install the Plugin: Add the plugin to the profile so that the package name can be resolved.
dsh plugin --profile web add link:F:\dsh\dsh_BetterInput
  1. Create Dependency Symlinks: Run in the repository root to resolve Node module path issues.
npm run link-deps
  1. Restart the Service: After changing the host-side code or installation method, you must restart dsh web.

Usage

  • UI Operation: After refreshing the page, a ✨ button appears to the left of the model selector.
  • API Call: You can directly call the host interface to optimize text.
curl.exe -s -X POST http://127.0.0.1:3080/api/dsh-input-optimizer/optimize `
  -H 'content-type: application/json' `
  -d '{"text":"帮我把那个脚本弄一下,快点"}'
  • Configuration Management: Configure the model parameters and prompts in the settings page and save them. The settings page automatically opens the configuration file cordis.patch.yml.

Applicable Scenarios and Notes

  • Applicable Scenarios: Developers who need to quickly adjust prompts or perform style-based input optimization.
  • Notes:
    • On Windows, do not use absolute paths as plugin names in the patch.
    • When installing with link:, you must run npm run link-deps; otherwise, the host side may fail to start due to module resolution failures.
    • The plugin runs with the permissions of the current dsh process. Review the source code and license before installation.

Conclusion

The plugin has achieved a complete closed loop from the UI button to the backend API, with improved undo, streaming backfill, and configuration management capabilities. Developers can flexibly configure the model and prompts in the settings page to meet different input optimization needs.