From e11a0db660c37c2f3a348e7300f5a5a868267169 Mon Sep 17 00:00:00 2001 From: Kyattsukuro Date: Tue, 5 May 2026 01:12:57 +0200 Subject: [PATCH] added AI to ZED and global AI via localai --- .gitignore | 3 + eggs/localai/compose.yml | 39 +++++++++ .../configuration/runtime_settings.json | 52 ++++++++++++ eggs/utility/util-scripts/global_ai_toggle.sh | 74 +++++++++++++++++ eggs/waybar/bar/config.jsonc | 21 +++++ eggs/waybar/bar/style.css | 7 ++ eggs/zed/settings.json | 82 +++++++++++++++++++ 7 files changed, 278 insertions(+) create mode 100644 eggs/localai/compose.yml create mode 100755 eggs/localai/config/configuration/runtime_settings.json create mode 100644 eggs/utility/util-scripts/global_ai_toggle.sh diff --git a/.gitignore b/.gitignore index 9e6ffffb..c7de4619 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,9 @@ eggs/i2p_librewolf/profile/* !eggs/i2p_librewolf/profile/addons.json !eggs/i2p_librewolf/profile/prefs.js +eggs/localai/config/* +!eggs/localai/config/configuration + eggs/libreoffice/4/user/backup eggs/libreoffice/4/user/store diff --git a/eggs/localai/compose.yml b/eggs/localai/compose.yml new file mode 100644 index 00000000..3cd6a935 --- /dev/null +++ b/eggs/localai/compose.yml @@ -0,0 +1,39 @@ +services: + local-ai: + image: localai/localai:latest-gpu-hipblas + ports: + - "8080:8080" + volumes: + - ./config/models:/models + - ./config/images:/tmp/generated/images/ + - ./config/data:/data + - ./config/backends:/backends + - ./config/configuration:/configuration + devices: + - /dev/kfd:/dev/kfd + - /dev/dri:/dev/dri + group_add: + - video + environment: + - LOCALAI_AGENT_POOL_VECTOR_ENGINE=postgres + - LOCALAI_AGENT_POOL_DATABASE_URL=postgresql://localrecall:localrecall@postgres:5432/localrecall?sslmode=disable + - LOCALAI_DISABLE_AGENTS=false + - LOCALAI_AGENT_POOL_ENABLE_SKILLS=true + - LOCALAI_AGENT_POOL_ENABLE_LOGS=true + - LOCALAI_AGENT_HUB_URL=https://agenthub.localai.io + - HSA_VISIBLE_DEVICES=0 # 0 is Dedicated, 1 is IGPU + - HIP_VISIBLE_DEVICES=0 + + postgres: + image: quay.io/mudler/localrecall:v0.5.2-postgresql + environment: + - POSTGRES_DB=localrecall + - POSTGRES_USER=localrecall + - POSTGRES_PASSWORD=localrecall + volumes: + - ./config/postgress_data:/var/lib/postgresql + healthcheck: + test: ["CMD-SHELL", "pg_isready -U localrecall"] + interval: 10s + timeout: 5s + retries: 5 diff --git a/eggs/localai/config/configuration/runtime_settings.json b/eggs/localai/config/configuration/runtime_settings.json new file mode 100755 index 00000000..cef30cb4 --- /dev/null +++ b/eggs/localai/config/configuration/runtime_settings.json @@ -0,0 +1,52 @@ +{ + "watchdog_enabled": true, + "watchdog_idle_enabled": true, + "watchdog_busy_enabled": true, + "watchdog_idle_timeout": "15m0s", + "watchdog_busy_timeout": "5m0s", + "watchdog_interval": "500ms", + "single_backend": false, + "max_active_backends": 0, + "memory_reclaimer_enabled": true, + "memory_reclaimer_threshold": 0.95, + "force_eviction_when_busy": false, + "lru_eviction_max_retries": 30, + "lru_eviction_retry_interval": "1s", + "threads": 0, + "context_size": 0, + "f16": true, + "debug": false, + "enable_tracing": false, + "tracing_max_items": 1024, + "enable_backend_logging": false, + "cors": false, + "csrf": false, + "cors_allow_origins": "", + "p2p_token": "", + "p2p_network_id": "", + "federated": false, + "galleries": [ + { + "url": "github:mudler/LocalAI/gallery/index.yaml@master", + "name": "localai" + } + ], + "backend_galleries": [ + { + "url": "github:mudler/LocalAI/backend/index.yaml@master", + "name": "localai" + } + ], + "autoload_galleries": true, + "autoload_backend_galleries": true, + "api_keys": null, + "agent_job_retention_days": 30, + "open_responses_store_ttl": "0", + "agent_pool_enabled": true, + "agent_pool_default_model": "mistralai_ministral-3-14b-reasoning-2512-multimodal", + "agent_pool_embedding_model": "granite-embedding-107m-multilingual", + "agent_pool_max_chunking_size": 400, + "agent_pool_chunk_overlap": 0, + "agent_pool_enable_logs": true, + "agent_pool_collection_db_path": "" +} \ No newline at end of file diff --git a/eggs/utility/util-scripts/global_ai_toggle.sh b/eggs/utility/util-scripts/global_ai_toggle.sh new file mode 100644 index 00000000..52eb093b --- /dev/null +++ b/eggs/utility/util-scripts/global_ai_toggle.sh @@ -0,0 +1,74 @@ +#!/usr/share/env bin + +DOCKER_LOCATION="$HOME/.config/yolk/eggs/localai" + +function _docker_run() { + # 1: up/down/.. + cd $DOCKER_LOCATION + extra_flags=() + if [ $1 = "up" ]; then + extra_flags+=("-d") + fi + docker compose $1 $extra_flags + cd - > /dev/zero +} + +function _zed_replace() { + # 1: true/false/.. + sed --follow-symlinks -i "s/\"disable_ai\":.*/\"disable_ai\": ${1},/" $HOME/.config/yolk/eggs/zed/settings.json +} + +function show_usage() { + echo "Usage: $0 [--help] [command]" + echo "[command]" + echo " on: Turn AI features on" + echo " off: Turn AI features off" + echo " toggle: Toggle AI" + echo " status: Get curent status based on docker" +} + + +function turn_on() { + _docker_run up + _zed_replace false +} + +function turn_off() { + _docker_run down + _zed_replace true +} + +function toggle() { + if [ "$(get_status)" = "on" ];then + turn_off + else + turn_on + fi + get_status +} + +function get_status() { + cd $DOCKER_LOCATION + if [ "$(docker compose ps -q)" != "" ]; then + echo "on" + else + echo "off" + fi + cd - > /dev/zero +} + +if [ $# -eq 0 ]; then + echo "Argument needet!"; show_usage; exit 1 +fi + +for arg in "$@"; do + case $arg in + --help|-h) show_usage; exit 0 ;; + on) turn_on; ;; + off) turn_off; ;; + status) get_status; ;; + toggle) toggle; ;; + *) + echo "Unsuported: $arg"; show_usage; exit 1 ;; + esac +done diff --git a/eggs/waybar/bar/config.jsonc b/eggs/waybar/bar/config.jsonc index b599fda8..94a73715 100755 --- a/eggs/waybar/bar/config.jsonc +++ b/eggs/waybar/bar/config.jsonc @@ -255,7 +255,28 @@ "unit": "GB", }, + "custom/aiToggle": { + "format": "{}", + "actions": { + // fixes; what: in Json::Value::find(begin, end): requires objectValue or nullValue + "on-click-right": "", + "on-scroll-up": "", + "on-scroll-down": "", + }, + // "exec-on-event": true, + "tooltip": false, + "signal": 13, + "exec": "if [ \"$(bash $HOME/.config/yolk/eggs/utility/util-scripts/global_ai_toggle.sh status)\" = \"off\" ]; then echo '󰹏'; else echo '󰛨'; fi", + "on-click-right": "if [ \"$(bash $HOME/.config/yolk/eggs/utility/util-scripts/global_ai_toggle.sh status)\" = \"on\" ]; then xdg-open http://localhost:8080; else dunstify -a System -r 1000 -t 5000 -i \"$HOME/.config/assets/arch-maron.png\" \"AI Controll\" \"AI is not running, start it fist!\"; fi", + "on-click": "bash $HOME/.config/yolk/eggs/utility/util-scripts/global_ai_toggle.sh toggle; pkill -SIGRTMIN+13 waybar", + }, + "custom/idleWatch": { + "actions": { + "on-click-right": "", + "on-scroll-up": "", + "on-scroll-down": "", + }, "format": "{}", "exec-on-event": true, "tooltip": false, diff --git a/eggs/waybar/bar/style.css b/eggs/waybar/bar/style.css index db6f72cc..4946c680 100755 --- a/eggs/waybar/bar/style.css +++ b/eggs/waybar/bar/style.css @@ -197,6 +197,12 @@ window#waybar.empty #window { color: @base; } +#custom-aiToggle { + background-color: @yellow; + font-size: 20px; + color: @base; +} + #mpris.status { background-color: @mauve; font-size: 20px; @@ -284,6 +290,7 @@ window#waybar.empty #window { #custom-logout, #custom-hibernate, #window, +#custom-aiToggle, #custom-notification, #privacy, #network.addr, diff --git a/eggs/zed/settings.json b/eggs/zed/settings.json index a06b577f..2a856b4e 100644 --- a/eggs/zed/settings.json +++ b/eggs/zed/settings.json @@ -7,6 +7,82 @@ // custom settings, run `zed: open default settings` from the // command palette (cmd-shift-p / ctrl-shift-p) { + "cli_default_open_behavior": "existing_window", + "proxy": "", + "agent_servers": { + "opencode": { + "type": "registry", + }, + }, + "language_models": { + "openai_compatible": { + "Localai Gema": { + "api_url": "http://localhost:8080/v1", + "available_models": [ + { + "name": "gemma-3-12b-it", + "max_tokens": 200000, + "max_output_tokens": 32000, + "max_completion_tokens": 200000, + "capabilities": { + "tools": true, + "images": false, + "parallel_tool_calls": false, + "prompt_cache_key": false, + "chat_completions": true, + "interleaved_reasoning": false, + }, + }, + ], + }, + "LocalAi Qwen": { + "api_url": "http://localhost:8080/v1", + "available_models": [ + { + "name": "qwen3-vl-8b-instruct", + "max_tokens": 200000, + "max_output_tokens": 32000, + "max_completion_tokens": 200000, + "capabilities": { + "tools": true, + "images": false, + "parallel_tool_calls": false, + "prompt_cache_key": false, + "chat_completions": true, + "interleaved_reasoning": false, + }, + }, + ], + }, + "LocalAi": { + "api_url": "http://localhost:8080/v1", + "available_models": [ + { + "name": "mistralai_ministral-3-14b-reasoning-2512-multimodal", + "max_tokens": 200000, + "max_output_tokens": 32000, + "max_completion_tokens": 200000, + "capabilities": { + "tools": true, + "images": false, + "parallel_tool_calls": false, + "prompt_cache_key": false, + "chat_completions": true, + "interleaved_reasoning": false, + }, + }, + ], + }, + }, + }, + "edit_predictions": { + "provider": "open_ai_compatible_api", + "open_ai_compatible_api": { + "prompt_format": "infer", + "model": "mistralai_ministral-3-14b-reasoning-2512-multimodal", + "api_url": "http://localhost:8080/v1", + }, + }, "project_panel": { "dock": "left", }, @@ -14,9 +90,15 @@ "dock": "left", }, "collaboration_panel": { + "button": false, "dock": "left", }, "agent": { + "default_model": { + "provider": "LocalAi", + "model": "mistralai_ministral-3-14b-reasoning-2512-multimodal", + "enable_thinking": false, + }, "dock": "right", "favorite_models": [], "model_parameters": [],