try aichat for local
This commit is contained in:
parent
5f068937f8
commit
927355791c
8 changed files with 222 additions and 37 deletions
73
flake.lock
73
flake.lock
|
|
@ -130,11 +130,11 @@
|
|||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1760948891,
|
||||
"narHash": "sha256-TmWcdiUUaWk8J4lpjzu4gCGxWY6/Ok7mOK4fIFfBuU4=",
|
||||
"lastModified": 1762040540,
|
||||
"narHash": "sha256-z5PlZ47j50VNF3R+IMS9LmzI5fYRGY/Z5O5tol1c9I4=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "864599284fc7c0ba6357ed89ed5e2cd5040f0c04",
|
||||
"rev": "0010412d62a25d959151790968765a70c436598b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -271,6 +271,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gp-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1754903071,
|
||||
"narHash": "sha256-+K536d3WF5eHRTSgkhn1NLFHms67iw4A0Ql8OZ9TgTw=",
|
||||
"owner": "Robitx",
|
||||
"repo": "gp.nvim",
|
||||
"rev": "c37f154b97690c4925fef4e35ffdbf2c844b5f4e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Robitx",
|
||||
"repo": "gp.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hlargs-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
|
@ -294,11 +310,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1762025346,
|
||||
"narHash": "sha256-6KR4dsNfA3Pqm6uT8j7aKjWydP/KXFqZUhOfMlfP+1E=",
|
||||
"lastModified": 1762286824,
|
||||
"narHash": "sha256-xwfiYyn210aNIE/JKc6qmU7qd0619JaYMOGuFKNm9oc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "87044c57222fb485974062e2dd557e7b8abd8fff",
|
||||
"rev": "1c75dd70229171f47ff10f4ed184101af7c7a392",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -336,11 +352,11 @@
|
|||
"kulala-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1761409896,
|
||||
"narHash": "sha256-fChsMhTgne97vHvJzKAxBbM3OO1AZLE4b2TCrY2xL+4=",
|
||||
"lastModified": 1762151137,
|
||||
"narHash": "sha256-NQZGW4RblskDrARb8TwzufJgSClNnuIdv7twTIlYfYs=",
|
||||
"owner": "mistweaverco",
|
||||
"repo": "kulala.nvim",
|
||||
"rev": "9a9308b664f71159f1c150e8cfb18541b143a9e9",
|
||||
"rev": "c328aeb219c4b77106917dd2698c90ea9657281b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -413,6 +429,7 @@
|
|||
],
|
||||
"gen-luarc": "gen-luarc",
|
||||
"gentags-lua": "gentags-lua",
|
||||
"gp-nvim": "gp-nvim",
|
||||
"hlargs-nvim": "hlargs-nvim",
|
||||
"kulala-fmt": "kulala-fmt",
|
||||
"kulala-nvim": "kulala-nvim",
|
||||
|
|
@ -432,11 +449,11 @@
|
|||
"yaml-nvim": "yaml-nvim"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1762026035,
|
||||
"narHash": "sha256-sNrEhcRZveN24S0wofavwdzlgwwhbxdkOz+t5D9f33A=",
|
||||
"lastModified": 1762290734,
|
||||
"narHash": "sha256-8dtU28cXa9QRgOkc45Ci7xGtd2ZRkMkqQbF7pj3E+pY=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "09cb23c371f44130cb5eae0e31b9f95bfea182d6",
|
||||
"revCount": 44,
|
||||
"rev": "8d0081c12916e37334edf8162a38a76d6b66eb85",
|
||||
"revCount": 45,
|
||||
"type": "git",
|
||||
"url": "https://git.jmarkin.ru/jmarkin/nvim-nix"
|
||||
},
|
||||
|
|
@ -472,11 +489,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1761955453,
|
||||
"narHash": "sha256-hQomzSbBiFsDXDMCjHmWXrAMgFlQlCiy7T37Eq7RvT4=",
|
||||
"lastModified": 1762214689,
|
||||
"narHash": "sha256-rRIECim04sRqCeBCvuARPLyDezGa7CU4XKAkCx4mmqA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "neovim-nightly-overlay",
|
||||
"rev": "c58076a0d9b24bf77fef4fa2e7c43950914edf71",
|
||||
"rev": "928ecc3c71ef85227c25cf0ff3bfba1efd9b1930",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -488,11 +505,11 @@
|
|||
"neovim-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1761949631,
|
||||
"narHash": "sha256-YgMQaFD4L9+PEYSkUlBkqaKt+ALPHiVgzgRbjOSW4tE=",
|
||||
"lastModified": 1762151025,
|
||||
"narHash": "sha256-5XdkjVsB8LbqTUMmOmK3YscnCVm7yHenKoaKrgFESac=",
|
||||
"owner": "neovim",
|
||||
"repo": "neovim",
|
||||
"rev": "1fddd74da7428e38b79ccb817dbd6952ff1d8ac6",
|
||||
"rev": "b80d390765b0c987f86ecd257fa8c38cc1225797",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -503,11 +520,11 @@
|
|||
},
|
||||
"nixos": {
|
||||
"locked": {
|
||||
"lastModified": 1761597516,
|
||||
"narHash": "sha256-wxX7u6D2rpkJLWkZ2E932SIvDJW8+ON/0Yy8+a5vsDU=",
|
||||
"lastModified": 1761999846,
|
||||
"narHash": "sha256-IYlYnp4O4dzEpL77BD/lj5NnJy2J8qbHkNSFiPBCbqo=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "daf6dc47aa4b44791372d6139ab7b25269184d55",
|
||||
"rev": "3de8f8d73e35724bf9abef41f1bdbedda1e14a31",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -535,11 +552,11 @@
|
|||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1754788789,
|
||||
"narHash": "sha256-x2rJ+Ovzq0sCMpgfgGaaqgBSwY+LST+WbZ6TytnT9Rk=",
|
||||
"lastModified": 1761765539,
|
||||
"narHash": "sha256-b0yj6kfvO8ApcSE+QmA6mUfu8IYG6/uU28OFn4PaC8M=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "a73b9c743612e4244d865a2fdee11865283c04e6",
|
||||
"rev": "719359f4562934ae99f5443f20aa06c2ffff91fc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -596,11 +613,11 @@
|
|||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1761880412,
|
||||
"narHash": "sha256-QoJjGd4NstnyOG4mm4KXF+weBzA2AH/7gn1Pmpfcb0A=",
|
||||
"lastModified": 1762156382,
|
||||
"narHash": "sha256-Yg7Ag7ov5+36jEFC1DaZh/12SEXo6OO3/8rqADRxiqs=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a7fc11be66bdfb5cdde611ee5ce381c183da8386",
|
||||
"rev": "7241bcbb4f099a66aafca120d37c65e8dda32717",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
inputs = {
|
||||
systems.url = "github:nix-systems/default";
|
||||
|
||||
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
|
||||
# flake-utils.url = "github:numtide/flake-utils";
|
||||
|
|
@ -18,8 +18,6 @@
|
|||
# limainit.inputs.flake-utils.follows = "flake-utils";
|
||||
# limainit.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
|
||||
# neovim-nightly-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
home-manager.url = "github:nix-community/home-manager/master";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
|
@ -48,11 +46,10 @@
|
|||
neovim-nightly-overlay.inputs.flake-parts.follows = "flake-parts";
|
||||
|
||||
mynvim.url = "git+https://git.jmarkin.ru/jmarkin/nvim-nix";
|
||||
# mynvim.url = "path:/home/kron/nvim-nix";
|
||||
# mynvim.url = "path:/projects/jmarkin/nvim-nix";
|
||||
mynvim.inputs.nixpkgs.follows = "nixpkgs";
|
||||
mynvim.inputs.flake-parts.follows = "flake-parts";
|
||||
mynvim.inputs.neovim-nightly-overlay.follows = "neovim-nightly-overlay";
|
||||
# mynvim.url = "path:/projects/jmarkin/nvim-nix";
|
||||
|
||||
secrets.url = "git+ssh://git@git.jmarkin.ru:222/jmarkin/secrets.git";
|
||||
# secrets.url = "path:/projects/jmarkin/secrets";
|
||||
|
|
@ -66,7 +63,7 @@
|
|||
, nixos
|
||||
, home-manager
|
||||
, mac-app-util
|
||||
# , limainit
|
||||
# , limainit
|
||||
, secrets
|
||||
, ...
|
||||
} @ inputs:
|
||||
|
|
|
|||
109
home/programs/ai/aichat.nix
Normal file
109
home/programs/ai/aichat.nix
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
yek = pkgs.rustPlatform.buildRustPackage rec {
|
||||
pname = "yek";
|
||||
version = "0.25.0";
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "bodo-run";
|
||||
repo = "yek";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-6yHQyl4UnRQlmWkBbAvUEBZnrHW3GsrrFZyOU+p3mjE=";
|
||||
};
|
||||
nativeBuildInputs = with pkgs; [
|
||||
perl
|
||||
];
|
||||
cargoHash = "sha256-WheN8rk/LwKTVg0mDorbXGBvojISSu1KtknFkWmpLMk=";
|
||||
doCheck = false;
|
||||
meta = {
|
||||
description = "yek";
|
||||
homepage = "https://github.com/bodo-run/yek";
|
||||
changelog = "";
|
||||
mainProgram = "yek";
|
||||
};
|
||||
};
|
||||
in
|
||||
rec {
|
||||
home.packages = with pkgs; [
|
||||
aichat
|
||||
poppler-utils
|
||||
pandoc
|
||||
yek
|
||||
];
|
||||
home.sessionVariables = {
|
||||
OLLAMA_URL = "http://192.168.88.15:11434";
|
||||
};
|
||||
|
||||
home.file.".config/aichat/config.yaml".text = /*yaml*/''
|
||||
model: ollama:orieg/gemma3-tools:4b # Specify the LLM to use
|
||||
stream: true # Controls whether to use the stream-style API.
|
||||
save: true # Indicates whether to persist the message
|
||||
keybindings: vi # Choose keybinding style (emacs, vi)
|
||||
editor: nvim # Specifies the command used to edit input buffer or session. (e.g. vim, emacs, nano).
|
||||
wrap: no # Controls text wrapping (no, auto, <max-width>)
|
||||
wrap_code: false # Enables or disables wrapping of code blocks
|
||||
function_calling: true # Enables or disables function calling (Globally).
|
||||
|
||||
rag_embedding_model: ollama:nomic-embed-text:latest # Specifies the embedding model used for context retrieval
|
||||
|
||||
document_loaders:
|
||||
# You can add custom loaders using the following syntax:
|
||||
# <file-extension>: <command-to-load-the-file>
|
||||
# Note: Use `$1` for input file and `$2` for output file. If `$2` is omitted, use stdout as output.
|
||||
pdf: 'pdftotext $1 -' # Load .pdf file, see https://poppler.freedesktop.org to set up pdftotext
|
||||
docx: 'pandoc --to plain $1' # Load .docx file, see https://pandoc.org to set up pandoc
|
||||
git: >
|
||||
sh -c "yek $1 --json | jq '[.[] | { path: .filename, contents: .content }]'"
|
||||
|
||||
# ---- clients ----
|
||||
clients:
|
||||
# All clients have the following configuration:
|
||||
# - type: xxxx
|
||||
# name: xxxx # Only use it to distinguish clients with the same client type. Optional
|
||||
# models:
|
||||
# - name: xxxx # Chat model
|
||||
# max_input_tokens: 100000
|
||||
# supports_vision: true
|
||||
# supports_function_calling: true
|
||||
# - name: xxxx # Embedding model
|
||||
# type: embedding
|
||||
# default_chunk_size: 1500
|
||||
# max_batch_size: 100
|
||||
# - name: xxxx # Reranker model
|
||||
# type: reranker
|
||||
# patch: # Patch api
|
||||
# chat_completions: # Api type, possible values: chat_completions, embeddings, and rerank
|
||||
# <regex>: # The regex to match model names, e.g. '.*' 'gpt-4o' 'gpt-4o|gpt-4-.*'
|
||||
# url: "" # Patch request url
|
||||
# body: # Patch request body
|
||||
# <json>
|
||||
# headers: # Patch request headers
|
||||
# <key>: <value>
|
||||
# extra:
|
||||
# proxy: socks5://127.0.0.1:1080 # Set proxy
|
||||
# connect_timeout: 10 # Set timeout in seconds for connect to api
|
||||
|
||||
# See https://platform.openai.com/docs/quickstart
|
||||
- type: openai-compatible
|
||||
name: ollama
|
||||
api_base: ${home.sessionVariables.OLLAMA_URL}/v1
|
||||
models:
|
||||
- name: orieg/gemma3-tools:4b
|
||||
max_input_tokens: 128000
|
||||
supports_function_calling: true
|
||||
supports_vision: true
|
||||
- name: gpt-oss-safeguard:20b
|
||||
max_input_tokens: 8128
|
||||
supports_function_calling: true
|
||||
supports_vision: true
|
||||
- name: danielsheep/Qwen3-Coder-30B-A3B-Instruct-1M-Unsloth:UD-IQ3_XXS
|
||||
max_input_tokens: 8128
|
||||
supports_function_calling: true
|
||||
supports_vision: true
|
||||
- name: nomic-embed-text:latest
|
||||
type: embedding
|
||||
default_chunk_size: 1000
|
||||
max_batch_size: 50
|
||||
'';
|
||||
}
|
||||
|
||||
50
home/programs/ai/crush.nix
Normal file
50
home/programs/ai/crush.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
home.sessionVariables = {
|
||||
CRUSH_DISABLE_METRICS = 1;
|
||||
CRUSH_DISABLE_PROVIDER_AUTO_UPDATE = 1;
|
||||
};
|
||||
|
||||
# programs.crush = {
|
||||
# enable = true;
|
||||
# settings = {
|
||||
# providers = {
|
||||
# ollama = {
|
||||
# name = "Ollama";
|
||||
# base_url = "${home.sessionVariables.OLLAMA_URL}/v1/";
|
||||
# type = "openai-compat";
|
||||
# models = [
|
||||
# {
|
||||
# name = "Gemma3";
|
||||
# id = "orieg/gemma3-tools:4b";
|
||||
# default_max_tokens = "20000";
|
||||
# }
|
||||
# {
|
||||
# name = "Qwen3-Coder";
|
||||
# id = "danielsheep/Qwen3-Coder-30B-A3B-Instruct-1M-Unsloth:UD-IQ3_XXS";
|
||||
# default_max_tokens = "20000";
|
||||
# }
|
||||
# {
|
||||
# name = "GPT-OSS";
|
||||
# id = "gpt-oss-safeguard:20b";
|
||||
# default_max_tokens = "20000";
|
||||
# }
|
||||
# ];
|
||||
# };
|
||||
# };
|
||||
# lsp = {
|
||||
# go = { command = "gopls"; enabled = true; };
|
||||
# nix = { command = "nixd"; enabled = true; };
|
||||
# zuban = { command = "zuban"; enabled = true; };
|
||||
# };
|
||||
# options = {
|
||||
# attribution = {
|
||||
# co_authored_by = false;
|
||||
# generated_with = false;
|
||||
# };
|
||||
# tui = { compact_mode = true; };
|
||||
# debug = false;
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
}
|
||||
11
home/programs/ai/default.nix
Normal file
11
home/programs/ai/default.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
home.sessionVariables = {
|
||||
OLLAMA_HOST = "192.168.88.15";
|
||||
OLLAMA_URL = "http://192.168.88.15:11434";
|
||||
};
|
||||
|
||||
imports = [
|
||||
./aichat.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -70,6 +70,7 @@
|
|||
];
|
||||
|
||||
home.sessionVariables = {
|
||||
DO_NOT_TRACK = 1;
|
||||
LS_COLORS = (builtins.readFile ../legacyconfig/ls_colors);
|
||||
CLICOLOR = 1;
|
||||
PYTHONPYCACHEPREFIX = "/tmp/cpython";
|
||||
|
|
|
|||
|
|
@ -10,8 +10,10 @@
|
|||
|
||||
imports = [
|
||||
./kron.nix
|
||||
../programs/ai
|
||||
];
|
||||
|
||||
|
||||
home.sessionVariables.OLLAMA_HOST = "192.168.88.15";
|
||||
home.sessionVariables.OLLAMA_URL = "http://192.168.88.15:11434";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
{ inputs }:
|
||||
[
|
||||
|
||||
inputs.mynvim.overlays.default
|
||||
# inputs.neovim-nightly-overlay.overlays.default
|
||||
# (self: super: {
|
||||
# mcp-hub = inputs.mcp-hub.packages."${super.system}".default;
|
||||
# mcphub-nvim = inputs.mcphub-nvim.packages."${super.system}".default;
|
||||
|
|
@ -11,7 +9,7 @@
|
|||
(import ./createnv.nix)
|
||||
(import ./vpn_slice.nix)
|
||||
# before release 3.5
|
||||
(import ./tmux.nix)
|
||||
# (import ./tmux.nix)
|
||||
|
||||
# disable build always time
|
||||
(self: super: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue