Исправления в ветке main

This commit is contained in:
2026-10-22 12:42:32 +06:00
parent 933e5ccb58
commit 9b05edc263
31 changed files with 2433 additions and 114 deletions

View File

@@ -92,7 +92,7 @@ lcg co -f
- **api_key_file** - файл с API ключом
- **result_folder** - папка для сохранения результатов
- **prompt_folder** - папка с системными промптами
- **provider_type** - тип провайдера (ollama/proxy)
- **provider_type** - тип провайдера (ollama/proxy/apimira)
- **jwt_token** - статус JWT токена (***set***/***from file***/***not set***)
- **prompt_id** - ID промпта по умолчанию
- **timeout** - таймаут запросов в секундах

View File

@@ -35,6 +35,21 @@ Explanations:
Clipboard support requires `xclip` or `xsel`.
Write the generated script to a file instead of stdout:
```bash
lcg --mode file "I want to extract linux-command-gpt.tar.gz file"
# 💾 Файл создан: lcg-out-script.sh
lcg --mode file --output-file ~/bin/unpack.sh "I want to extract linux-command-gpt.tar.gz file"
```
The file is rewritten on each request: only the code produced for the current query remains, earlier content is removed.
Before rewriting an existing file backup copies are created: `<file>.bak` is the latest one, `<file>.bak.1`, `<file>.bak.2`, … are older; the number of kept copies is set by `LCG_BACKUP_COUNT` (default `3`) or `--backup-count`, `0` disables backups.
If the file already exists and is not empty, its content is passed to the model as data (see `LCG_CONTEXT_MAX_BYTES`): inline when it fits the user message limit, otherwise as a separate message before the query.
The model is asked to return code in markdown fences (```` ```bash ````, ```` ```python ````, …): only fenced blocks are written to the file as code, the rest of the answer becomes comments in the syntax of the target file (`#`, `//`, `--`, `<!-- -->`, … by extension). Shebang and `set -euo pipefail` are added only for shell scripts; a shebang already present in the model's code is reused, and `set -euo pipefail` is not duplicated.
## What's new in 2.0.14
- Authentication: JWT-based authentication with HTTP-only cookies
@@ -49,19 +64,26 @@ Clipboard support requires `xclip` or `xsel`.
## Environment
- `LCG_PROVIDER` (default `ollama`) — provider type: `ollama` or `proxy`
- `LCG_HOST` (default `http://192.168.87.108:11434/`) — base API URL
- `LCG_MODEL` (default `hf.co/yandex/YandexGPT-5-Lite-8B-instruct-GGUF:Q4_K_M`)
- `LCG_PROVIDER` (default `ollama`) — provider type: `ollama`, `proxy` or `apimira`
- `LCG_HOST` (default `http://192.168.87.108:11434/`, for `apimira`: `https://apimira.com`) — base API URL
- `LCG_MODEL` (default `hf.co/yandex/YandexGPT-5-Lite-8B-instruct-GGUF:Q4_K_M`; for `apimira` required in `vendor/model` form, e.g. `anthropic/claude-opus-4.7`)
- `LCG_PROMPT` — default system prompt content
- `LCG_PROXY_URL` (default `/api/v1/protected/sberchat/chat`) — proxy chat endpoint
- `LCG_COMPLETIONS_PATH` (default `api/chat`) — Ollama chat endpoint (relative)
- `LCG_COMPLETIONS_PATH` (default `api/chat`, for `apimira`: `/v1/chat/completions`) — chat endpoint (relative)
- `LCG_TIMEOUT` (default `300`) — request timeout in seconds
- `LCG_RETRIES` (default `3`) — retry attempts on transient errors (network, `429`, `5xx`) with delays 5s/10s/20s; `0` disables retries; CLI flag `--retries` overrides it
- `LCG_MODE` (default `stdout`) — output mode: `stdout` or `file`; CLI flag `--mode` overrides it
- `LCG_OUTPUT_FILE` (default `./lcg-out-script.sh`) — output file for `--mode file`; CLI flag `--output-file` overrides it
- `LCG_CONTEXT_MAX_BYTES` (default `16000`) — limit of output file bytes passed to the model as context in `--mode file`
- `LCG_BACKUP_COUNT` (default `3`) — number of backup copies (`<file>.bak`, `<file>.bak.1`, …) kept for `--mode file`; `0` disables them
- `LCG_RESULT_FOLDER` (default `~/.config/lcg/gpt_results`) — folder for saved results
- `LCG_RESULT_HISTORY` (default `$(LCG_RESULT_FOLDER)/lcg_history.json`) — JSON history path
- `LCG_PROMPT_FOLDER` (default `~/.config/lcg/gpt_sys_prompts`) — folder for system prompts
- `LCG_PROMPT_ID` (default `1`) — default system prompt ID
- `LCG_BROWSER_PATH` — custom browser executable path for `--browser` flag
- `LCG_JWT_TOKEN` — JWT token for proxy provider
- `LCG_DEBUG_FILE` / `--debug-file` — append full activity log (queries, prompts, request and response bodies) to the given file
- `LCG_JWT_TOKEN` — API key for `proxy` and `apimira` providers
- `LCG_API_KEY_FILE` (default `.openai_api_key`, for `apimira`: `.apimira_api_key`) — API key file in `$HOME`, stored with `0600` permissions
- `LCG_NO_HISTORY` — if `1`/`true`, disables history writes for the process
- `LCG_ALLOW_EXECUTION` — if `1`/`true`, enables command execution via `(e)` action menu
- `LCG_SERVER_PORT` (default `8080`), `LCG_SERVER_HOST` (default `localhost`) — HTTP server settings
@@ -73,6 +95,9 @@ Clipboard support requires `xclip` or `xsel`.
- `--prompt-id, --pid` choose built-in prompt (1–5)
- `--timeout, -t` request timeout (sec)
- `--no-history, --nh` disable writing/updating JSON history for this run
- `--mode` output mode: `stdout` (default) or `file`
- `--output-file, -o` output file for `--mode file` (default `./lcg-out-script.sh`)
- `--backup-count` number of backup copies kept for `--mode file` (overrides `LCG_BACKUP_COUNT`, default `3`)
- `--debug, -d` show debug information (request parameters and prompts)
- `--version, -v` print version; `--help, -h` help