Replies: 2 comments
-
Thanks for sharing @wss29 🙌 API is coming ⏲️ |
Beta Was this translation helpful? Give feedback.
0 replies
-
Alright — It's now possible to submit prompts in a clean way, programmatically. Feature available from 2.7.6 Docs here: https://docs.nlkit.com/nlux/reference/api/send-message |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have try to use a trick method submit char programmatically before useAiChatApi be added
const elements = document.getElementsByClassName('nlux-comp-composer nlux-composer--typing');
if (elements.length > 0) {
const composerComp = elements[0];
const promptText = composerComp.querySelector('textarea');
const submitButton = composerComp.querySelector('button');
if (promptText && submitButton) {
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, 'value')?.set;
if (nativeInputValueSetter) {
nativeInputValueSetter.call(promptText, String(args));
}
const event = new Event('change', { bubbles: true });
promptText.dispatchEvent(event);
setTimeout(() => {
submitButton?.click();
}, 1000);
}
}
Beta Was this translation helpful? Give feedback.
All reactions