fix(user/malte): roles.yaml for aichat

This commit is contained in:
Malte Tammena 2024-06-03 10:26:39 +02:00
parent 7914950387
commit 0ca56f3c10
2 changed files with 23 additions and 3 deletions

View file

@ -179,7 +179,7 @@ in {
keybindings = "vi";
};
roles = {
emoji = ''
emoji.prompt = ''
I want you to translate the sentences I write into emojis.
I will write the sentence, and you will express it with emojis.
I don't want you to reply with anything but emoji.

View file

@ -15,6 +15,8 @@
${lib.getExe pkgs.aichat} "$@"
'';
};
rolesTransformed = lib.mapAttrsToList (name: config: {inherit name;} // config) cfg.roles;
in {
options.programs.aichat = {
enable = lib.mkEnableOption "aichat, the terminal ai interface";
@ -31,7 +33,25 @@ in {
'';
};
roles = lib.mkOption {
type = lib.types.attrsOf lib.types.lines;
type = with lib.types;
attrsOf (submodule {
options = {
prompt = lib.mkOption {
type = lines;
description = "Instructions and context provided to the LLM.";
};
temperature = lib.mkOption {
type = nullOr number;
description = "(Optional) Controls the creativity and randomness of the LLM's response.";
default = null;
};
top_p = lib.mkOption {
type = nullOr number;
description = "(Optional) Alternative way to control LLM's output diversity, affecting the probability distribution of tokens.";
default = null;
};
};
});
default = {};
description = ''
aichat role configuration.
@ -49,6 +69,6 @@ in {
};
xdg.configFile."aichat/config.yaml".source = yamlFormat.generate "config.yaml" cfg.settings;
xdg.configFile."aichat/roles.yaml".source = yamlFormat.generate "roles.yaml" cfg.roles;
xdg.configFile."aichat/roles.yaml".source = yamlFormat.generate "roles.yaml" rolesTransformed;
};
}