Compare commits
No commits in common. "51e416b7e0a001e95a8a010b11a4e5ff9cad5209" and "bcb892e5a61f7b27041e24fb1779bfd47d43a5f6" have entirely different histories.
51e416b7e0
...
bcb892e5a6
1 changed files with 54 additions and 142 deletions
|
@ -3,6 +3,7 @@
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
# TODO: Add `eza`, `gitui`, `opencode`
|
# TODO: Add `eza`, `gitui`, `opencode`
|
||||||
|
# TODO: Increase context window for `aichat_reasoning_remote`
|
||||||
|
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
|
@ -14,30 +15,12 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
# localFastModel = "qwen2.5-coder-num_ctx";
|
||||||
|
# localReasoningModel = "deepseek-r1-num_ctx";
|
||||||
llm = {
|
llm = {
|
||||||
free = {
|
remote = {
|
||||||
key = "openrouter";
|
coding = "moonshotai/kimi-k2:free";
|
||||||
name = "OpenRouter";
|
reasoning = "deepseek/deepseek-r1-0528:free";
|
||||||
url = "https://openrouter.ai/api/v1";
|
|
||||||
env = "OPENROUTER_API_KEY";
|
|
||||||
models = {
|
|
||||||
coding = {
|
|
||||||
key = "moonshotai/kimi-k2:free";
|
|
||||||
name = "Kimi K2 (free)";
|
|
||||||
provider = [ "chutes/fp8" ];
|
|
||||||
tools = false;
|
|
||||||
reasoning = false;
|
|
||||||
vision = true;
|
|
||||||
};
|
|
||||||
reasoning = {
|
|
||||||
key = "deepseek/deepseek-r1-0528:free";
|
|
||||||
name = "Deepseek R1 (free)";
|
|
||||||
provider = [ "chutes" ];
|
|
||||||
tools = false;
|
|
||||||
reasoning = true;
|
|
||||||
vision = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
@ -168,9 +151,7 @@ in
|
||||||
nushell = {
|
nushell = {
|
||||||
enable = true;
|
enable = true;
|
||||||
environmentVariables = {
|
environmentVariables = {
|
||||||
${llm.free.env} = lib.hm.nushell.mkNushellInline "cat ${
|
OPENROUTER_API_KEY = lib.hm.nushell.mkNushellInline "cat ${config.sops.secrets.openrouter_api_key.path}";
|
||||||
config.sops.secrets."${llm.free.key}_api_key".path
|
|
||||||
}";
|
|
||||||
};
|
};
|
||||||
settings = {
|
settings = {
|
||||||
completions = {
|
completions = {
|
||||||
|
@ -183,9 +164,9 @@ in
|
||||||
};
|
};
|
||||||
# set -x ZATHURA_PLUGINS_PATH $GUIX_HOME/lib/zathura
|
# set -x ZATHURA_PLUGINS_PATH $GUIX_HOME/lib/zathura
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
aichat_reasoning_free = "${pkgs.aichat}/bin/aichat --model openrouter:${llm.free.models.reasoning.key}";
|
aichat_reasoning_remote = "${pkgs.aichat}/bin/aichat --model openrouter:${llm.remote.reasoning}";
|
||||||
aichat_coding_free = "${pkgs.aichat}/bin/aichat --model ${llm.free.key}:${llm.free.models.coding.key}";
|
aichat_coding_remote = "${pkgs.aichat}/bin/aichat --model openrouter:${llm.remote.coding}";
|
||||||
codex_free = "${pkgs.codex}/bin/codex --provider ${llm.free.key} --model ${llm.free.models.coding.key}";
|
codex_remote = "${pkgs.codex}/bin/codex --provider openrouter --model ${llm.remote.coding}";
|
||||||
hotspot = "sudo sysctl net.ipv4.ip_default_ttl=65";
|
hotspot = "sudo sysctl net.ipv4.ip_default_ttl=65";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -403,44 +384,44 @@ in
|
||||||
};
|
};
|
||||||
codex = {
|
codex = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# custom-instructions = ''
|
custom-instructions = ''
|
||||||
# ## 10. Applying Patch Files with patch
|
## 10. Applying Patch Files with patch
|
||||||
|
|
||||||
# When the built-in `apply_patch` tool or `git apply` fails to apply a diff/patch file (especially if the file being patched contains special characters that might confuse simpler patch tools), the standard `patch` utility can be a more robust alternative.
|
When the built-in `apply_patch` tool or `git apply` fails to apply a diff/patch file (especially if the file being patched contains special characters that might confuse simpler patch tools), the standard `patch` utility can be a more robust alternative.
|
||||||
|
|
||||||
# - **Patch File Format**: Ensure your patch file is in a standard unified diff format. Typically, these patches are generated with `git diff > my_feature.patch` or manually crafted. If the patch refers to files with `a/` and `b/` prefixes (e.g., `--- a/file.txt`, `+++ b/file.txt`), you'll use the `-p1` option.
|
- **Patch File Format**: Ensure your patch file is in a standard unified diff format. Typically, these patches are generated with `git diff > my_feature.patch` or manually crafted. If the patch refers to files with `a/` and `b/` prefixes (e.g., `--- a/file.txt`, `+++ b/file.txt`), you'll use the `-p1` option.
|
||||||
|
|
||||||
# - **Creating the Patch File**: You can create a patch file using shell redirection, for example:
|
- **Creating the Patch File**: You can create a patch file using shell redirection, for example:
|
||||||
|
|
||||||
# ```bash`
|
```bash`
|
||||||
# cat <<'EOF' > fix_descriptive_name.patch
|
cat <<'EOF' > fix_descriptive_name.patch
|
||||||
# --- a/path/to/your/file.ext
|
--- a/path/to/your/file.ext
|
||||||
# +++ b/path/to/your/file.ext
|
+++ b/path/to/your/file.ext
|
||||||
# @@ -line_num,num_lines +line_num,num_lines @@ context_or_change
|
@@ -line_num,num_lines +line_num,num_lines @@ context_or_change
|
||||||
# -old_line_content
|
-old_line_content
|
||||||
# +new_line_content
|
+new_line_content
|
||||||
# EOF
|
EOF
|
||||||
# ```
|
```
|
||||||
|
|
||||||
# *Important*: Ensure the `EOF` marker is on its own line with no trailing spaces.
|
*Important*: Ensure the `EOF` marker is on its own line with no trailing spaces.
|
||||||
|
|
||||||
# - **Applying the Patch**: Use the `patch` command via the `shell` tool. The `-p1` option strips the leading component from file paths in the patch file (`a/`, `b/`).
|
- **Applying the Patch**: Use the `patch` command via the `shell` tool. The `-p1` option strips the leading component from file paths in the patch file (`a/`, `b/`).
|
||||||
|
|
||||||
# ```
|
```
|
||||||
# # Example: Apply a patch file
|
# Example: Apply a patch file
|
||||||
# default_api.shell(command=["sh", "-c", "patch -p1 < fix_descriptive_name.patch"])
|
default_api.shell(command=["sh", "-c", "patch -p1 < fix_descriptive_name.patch"])
|
||||||
# ```
|
```
|
||||||
|
|
||||||
# - **Verification**: After applying, always verify that the target file has been changed as expected (e.g., using `cat` or `git diff`).
|
- **Verification**: After applying, always verify that the target file has been changed as expected (e.g., using `cat` or `git diff`).
|
||||||
|
|
||||||
# - **Cleanup**: Remove the patch file if it's no longer needed:
|
- **Cleanup**: Remove the patch file if it's no longer needed:
|
||||||
|
|
||||||
# ```
|
```
|
||||||
# default_api.shell(command=["rm", "fix_descriptive_name.patch"])
|
default_api.shell(command=["rm", "fix_descriptive_name.patch"])
|
||||||
# ```
|
```
|
||||||
# '';
|
'';
|
||||||
settings = {
|
settings = {
|
||||||
model = llm.free.models.coding.key;
|
model = "${llm.remote.coding}";
|
||||||
provider = "ollama";
|
provider = "ollama";
|
||||||
providers = {
|
providers = {
|
||||||
ollama = {
|
ollama = {
|
||||||
|
@ -448,77 +429,18 @@ in
|
||||||
baseURL = "http://localhost:11434/v1";
|
baseURL = "http://localhost:11434/v1";
|
||||||
envKey = "OLLAMA_API_KEY";
|
envKey = "OLLAMA_API_KEY";
|
||||||
};
|
};
|
||||||
${llm.free.key} = {
|
openrouter = {
|
||||||
name = llm.free.name;
|
name = "OpenRouter";
|
||||||
baseURL = llm.free.url;
|
baseURL = "https://openrouter.ai/api/v1";
|
||||||
envKey = llm.free.env;
|
envKey = "OPENROUTER_API_KEY";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
opencode = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
"$schema" = "https://opencode.ai/config.json";
|
|
||||||
provider = {
|
|
||||||
${llm.free.key} = {
|
|
||||||
npm = "@ai-sdk/openai-compatible";
|
|
||||||
name = llm.free.name;
|
|
||||||
options = {
|
|
||||||
baseURL = llm.free.url;
|
|
||||||
apiKey = "{env:${llm.free.env}}";
|
|
||||||
};
|
|
||||||
models = {
|
|
||||||
${llm.free.models.coding.key} = (
|
|
||||||
let
|
|
||||||
model = llm.free.models.coding;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
id = model.key;
|
|
||||||
name = model.name;
|
|
||||||
options = {
|
|
||||||
tools = model.tools;
|
|
||||||
${llm.free.name} = {
|
|
||||||
provider = {
|
|
||||||
order = model.provider;
|
|
||||||
allow_fallbacks = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
tool_call = model.tools;
|
|
||||||
reasoning = model.reasoning;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
${llm.free.models.reasoning.key} = (
|
|
||||||
let
|
|
||||||
model = llm.free.models.reasoning;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
id = model.key;
|
|
||||||
name = model.name;
|
|
||||||
options = {
|
|
||||||
tools = model.tools;
|
|
||||||
${llm.free.name} = {
|
|
||||||
provider = {
|
|
||||||
order = model.provider;
|
|
||||||
allow_fallbacks = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
tool_call = model.tools;
|
|
||||||
reasoning = model.reasoning;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
model = "${llm.free.key}:${llm.free.models.coding.key}";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
aichat = {
|
aichat = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
model = "${llm.free.key}:${llm.free.models.coding.key}";
|
model = "openrouter:${llm.remote.coding}";
|
||||||
clients = [
|
clients = [
|
||||||
# {
|
# {
|
||||||
# type = "openai-compatible";
|
# type = "openai-compatible";
|
||||||
|
@ -539,29 +461,19 @@ in
|
||||||
# }
|
# }
|
||||||
{
|
{
|
||||||
type = "openai-compatible";
|
type = "openai-compatible";
|
||||||
name = llm.free.key;
|
name = "openrouter";
|
||||||
api_base = llm.free.url;
|
api_base = "https://openrouter.ai/api/v1";
|
||||||
models = [
|
models = [
|
||||||
(
|
{
|
||||||
let
|
name = "${llm.remote.coding}";
|
||||||
model = llm.free.models.coding;
|
supports_function_calling = true;
|
||||||
in
|
supports_vision = true;
|
||||||
{
|
}
|
||||||
name = model.key;
|
{
|
||||||
supports_function_calling = model.tools;
|
name = "${llm.remote.reasoning}";
|
||||||
supports_vision = model.vision;
|
supports_function_calling = true;
|
||||||
}
|
supports_vision = true;
|
||||||
)
|
}
|
||||||
(
|
|
||||||
let
|
|
||||||
model = llm.free.models.reasoning;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
name = model.key;
|
|
||||||
supports_function_calling = model.tools;
|
|
||||||
supports_vision = model.vision;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
Loading…
Add table
Reference in a new issue