feat(home): add pi coding agent configuration
- Add pi module for terminal configuration - Include pi-coding-agent package in home.packages - Configure pi with llama-swap provider via models.json - Enable pi for mac-va-mbp-work profile
This commit is contained in:
60
modules/home/programs/terminal/pi/lib.nix
Normal file
60
modules/home/programs/terminal/pi/lib.nix
Normal file
@@ -0,0 +1,60 @@
|
||||
{ lib }:
|
||||
let
|
||||
inherit (lib)
|
||||
mapAttrs
|
||||
filterAttrs
|
||||
any
|
||||
flatten
|
||||
listToAttrs
|
||||
nameValuePair
|
||||
;
|
||||
in
|
||||
{
|
||||
toPiModels =
|
||||
llamaSwapConfig:
|
||||
let
|
||||
textGenModels = filterAttrs
|
||||
(
|
||||
name: model: any (t: t == "text-generation") (model.metadata.type or [ ])
|
||||
)
|
||||
(llamaSwapConfig.models or { });
|
||||
|
||||
localModels = mapAttrs
|
||||
(
|
||||
name: model:
|
||||
{
|
||||
id = name;
|
||||
inherit (model) name;
|
||||
}
|
||||
// (
|
||||
if model.macros.ctx or null != null then
|
||||
{
|
||||
contextWindow = lib.toInt model.macros.ctx;
|
||||
}
|
||||
else
|
||||
{ }
|
||||
)
|
||||
)
|
||||
textGenModels;
|
||||
|
||||
peerModels = listToAttrs (
|
||||
flatten (
|
||||
map
|
||||
(
|
||||
peer:
|
||||
map
|
||||
(
|
||||
modelName:
|
||||
nameValuePair modelName {
|
||||
id = modelName;
|
||||
name = modelName;
|
||||
}
|
||||
)
|
||||
peer.models
|
||||
)
|
||||
(builtins.attrValues (llamaSwapConfig.peers or { }))
|
||||
)
|
||||
);
|
||||
in
|
||||
builtins.attrValues (localModels // peerModels);
|
||||
}
|
||||
Reference in New Issue
Block a user