Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Replace trigger in prompt #22

Open
vityav opened this issue Feb 14, 2023 · 1 comment
Open

[Feature Request] Replace trigger in prompt #22

vityav opened this issue Feb 14, 2023 · 1 comment

Comments

@vityav
Copy link

vityav commented Feb 14, 2023

Hello,
This extension is fantastic for working with a large amount of trained models, but I was wondering if it would be possible to have a mode that replaces some trigger word with the pre-set keyword for a model. For example:
A photo of $trigger on a scenic mountaintop
or
A charcoal drawing of an army of ducks following $trigger with a pan flute
would replace $trigger with whatever keyword was associated with the model. This way the keyword could come anywhere in the prompt rather than always being pre/appended.

I naively think this could be as simple as replacing:

            if keyword_placement.startswith('keyword'):
                arr.append(prompt)
            else:
                arr.insert(0, prompt)

with something like

            trigger = 'xyz'
            if keyword_placement.startswith('keyword'):
                arr.append(prompt)
            elif 'replace' in keyword_placement:
                arr = prompt.replace(trigger, ''.join(arr))
            else:
                arr.insert(0, prompt)

and the relevant menu options, but I may be missing something.

Thanks!

@mix1009
Copy link
Owner

mix1009 commented Feb 15, 2023

Thank you. that's a very good idea.
I'll think about the implementation.
Any suggestion for the trigger word? It should not interfere with other extensions.
I also want to use "keyword" rather than "trigger" because of the extension name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants