-
Notifications
You must be signed in to change notification settings - Fork 83
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: Support patterns from external resources #235
Comments
This allows to set a role message to either a http/https URL or a filepath (prefixed with `file://`). Solves #235 Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
would #245 do it? you can do things like: roles:
"create_summary":
- https://raw.githubusercontent.com/danielmiessler/fabric/main/patterns/create_summary/system.md wdyt? |
Pulled down the branch and tried it out, this is a powerful new feature for getting better responses. Like the flexibility of a URL or file as the source. |
After living with this for a few days it became tedious configuring individual roles in the settings file and mapping them to a growing library of markdown files. Made this addition locally - now when I want to define a new role, I simply create a new markdown file and a role is dynamically defined based on the filename.
# mods.yml settings file
...
# Directory containing roles defined in markdown.
roles-directory: /path/to/roles
... // config.go
type Config struct {
...
RolesDirectory string `yaml:"roles-directory" env:"ROLES_DIRECTORY"`
...
} // mods.go
// Appends roles from roles-directory to cfg.Roles
func (m *Mods) startCompletionCmd(content string) tea.Cmd {
...
if cfg.RolesDirectory != "" {
roles := make(map[string][]string)
err := filepath.Walk(cfg.RolesDirectory, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if !info.IsDir() && strings.HasSuffix(info.Name(), ".md") && info.Name() != "README.md" {
name := strings.TrimSuffix(info.Name(), ".md")
roles[name] = append(roles[name], "file://"+path)
}
return nil
})
if err != nil {
return modsError{
err: err,
reason: "Could not read roles from roles directory",
}
}
for k, v := range roles {
cfg.Roles[k] = v
}
}
...
} |
This allows to set a role message to either a http/https URL or a filepath (prefixed with `file://`). Solves #235 Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
yeah, that might be a good idea as well... another one would be to generate yaml, something like: find . -name 'system.md' | while read -r line; do
echo " - $(basename $(dirname $line)):"
echo " - $(readlink -f $line)"
done |
Agree, YAML generation outside of mods similar to your suggestion is likely sufficient and avoids feature bloat in mods, as this need may be more of an edge case. Thanks @caarlos0. |
okay, gonna close this then! thanks everyone! |
It looks like #245 is merged! Thank you! |
As example step number one and inspiration, imagine:
that would fetch (or use cached) pattern from https://github.com/danielmiessler/fabric/tree/main/patterns and use it.
Of course this could be extended in future to other providers.
(Maybe it's actually worth to be project by itself and be modular, sth like "pattern provider" from which tools like this one could get patterns/prompts etc...)
cross-linking: TheR1D/shell_gpt#518
The text was updated successfully, but these errors were encountered: