input "/" in the text box to directly select variables not work
Self Checks
- [X] I have searched for existing issues search for existing issues, including closed ones.
- [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [X] Pleas do not modify this template :) and fill in all the required fields.
Dify version
v0.6.0-preview-workflow.2
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
https://github.com/langgenius/dify/assets/5676888/594d4ca2-43e4-4878-92d9-89a2a2895d2f
✔️ Expected Behavior
simply input "/" in the text box to directly select variables
❌ Actual Behavior
No response
Hey @doucheng! 🌟 Long time no type! 😄 How's the coding universe treating you?
Based on the details you've provided, it seems like the functionality to trigger variable selection upon typing "/" is not correctly implemented within the PromptEditor component. The PromptEditor component's onChange and onBlur handlers do not contain any logic related to detecting the "/" input and displaying a variable selection interface:
<PromptEditor
...
onChange={(value) => {
handleChange?.(value, [])
}}
onBlur={() => {
handleChange(promptTemplate, getVars(promptTemplate))
}}
/>
To address this issue, you would typically implement or integrate a feature within the PromptEditor component that listens for the "/" character input and subsequently displays a selection interface with available variables. This could involve modifying the onChange handler to detect the "/" input and trigger the display of a variable selection UI, or ensuring that any plugin or extension responsible for this functionality is correctly integrated and enabled in the PromptEditor.
Since the provided code snippet does not include the implementation details of the PromptEditor component or any related plugins/extensions, I cannot provide a specific code solution. You would need to review the PromptEditor component's implementation or any associated documentation to integrate this feature correctly. You can find the PromptEditor component's code here.
As for the changes between version v0.5.11-fix1 and v0.6.0-preview-workflow.2 that could potentially affect the functionality of the "/" input for variable selection, I'm unable to provide a specific answer as I couldn't find the relevant information in the repository. It's possible that the changes are documented elsewhere or I may have missed them.
I hope this information helps you in resolving the issue. If you need further assistance, please provide more details about the PromptEditor component's implementation or any related plugins/extensions.
Sources
- web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx
- web/app/components/base/prompt-editor/index.tsx
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
which broswer?
chrome