Skip to content

Commit 9fd7d82

Browse files
committed
feat(config): add PROJECTS_LIST_LIMIT for /projects list
1 parent b34d9ea commit 9fd7d82

6 files changed

Lines changed: 20 additions & 2 deletions

File tree

.env.example

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ OPENCODE_MODEL_ID=big-pickle
3636
# Bot Configuration (optional)
3737
# Maximum number of sessions shown in /sessions (default: 10)
3838
# SESSIONS_LIST_LIMIT=10
39+
40+
# Maximum number of projects shown in /projects (default: 10)
41+
# PROJECTS_LIST_LIMIT=10
42+
3943
# Bot locale: en or ru (default: en)
4044
# BOT_LOCALE=en
4145

@@ -53,3 +57,12 @@ OPENCODE_MODEL_ID=big-pickle
5357
# Code File Settings (optional)
5458
# Maximum file size in KB to send as document (default: 100)
5559
# CODE_FILE_MAX_SIZE_KB=100
60+
61+
# Speech-to-Text / Voice Recognition (optional)
62+
# Enable voice message transcription by setting a Whisper-compatible API URL.
63+
# Works with OpenAI, Groq, or any Whisper-compatible endpoint.
64+
# If STT_API_URL is not set, voice messages will get a "not configured" reply.
65+
# STT_API_URL=
66+
# STT_API_KEY=
67+
# STT_MODEL=
68+
# STT_LANGUAGE=

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ OPENCODE_MODEL_ID=big-pickle
255255

256256
# Bot options (optional)
257257
# SESSIONS_LIST_LIMIT=10
258+
# PROJECTS_LIST_LIMIT=10
258259
# BOT_LOCALE=en # en or ru
259260

260261
# File output options (optional)
@@ -275,6 +276,7 @@ OPENCODE_MODEL_ID=big-pickle
275276
| `OPENCODE_SERVER_PASSWORD` | OpenCode auth password | No | empty |
276277
| `LOG_LEVEL` | Logging level | No | `info` |
277278
| `SESSIONS_LIST_LIMIT` | Max sessions shown in `/sessions` | No | `10` |
279+
| `PROJECTS_LIST_LIMIT` | Max projects shown in `/projects` | No | `10` |
278280
| `BOT_LOCALE` | Bot locale (`en` or `ru`) | No | `en` |
279281
| `CODE_FILE_MAX_SIZE_KB` | Max code file size to send | No | `100` |
280282

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ When installed via npm, the configuration wizard handles the initial setup. The
137137
| `OPENCODE_MODEL_ID` | Default model ID | Yes | `big-pickle` |
138138
| `BOT_LOCALE` | Bot UI language (`en` or `ru`) | No | `en` |
139139
| `SESSIONS_LIST_LIMIT` | Max sessions shown in `/sessions` | No | `10` |
140+
| `PROJECTS_LIST_LIMIT` | Max projects shown in `/projects` | No | `10` |
140141
| `SERVICE_MESSAGES_INTERVAL_SEC` | Service messages interval (thinking + tool calls); keep `>=2` to avoid Telegram rate limits, `0` = immediate | No | `5` |
141142
| `HIDE_THINKING_MESSAGES` | Hide `💭 Thinking...` service messages | No | `false` |
142143
| `HIDE_TOOL_CALL_MESSAGES` | Hide tool-call service messages (`💻 bash ...`, `📖 read ...`, etc.) | No | `false` |

src/bot/commands/projects.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import { createMainKeyboard } from "../utils/keyboard.js";
1515
import { ensureActiveInlineMenu, replyWithInlineMenu } from "../handlers/inline-menu.js";
1616
import { logger } from "../../utils/logger.js";
1717
import { t } from "../../i18n/index.js";
18+
import { config } from "../../config.js";
1819

1920
const MAX_INLINE_BUTTON_LABEL_LENGTH = 64;
20-
const MAX_PROJECTS_TO_SHOW = 10;
2121

2222
function formatProjectButtonLabel(label: string, isActive: boolean): string {
2323
const prefix = isActive ? "✅ " : "";
@@ -34,7 +34,7 @@ export async function projectsCommand(ctx: CommandContext<Context>) {
3434
try {
3535
await syncSessionDirectoryCache();
3636
const projects = await getProjects();
37-
const projectsToShow = projects.slice(0, MAX_PROJECTS_TO_SHOW);
37+
const projectsToShow = projects.slice(0, config.bot.projectsListLimit);
3838

3939
if (projectsToShow.length === 0) {
4040
await ctx.reply(t("projects.empty"));

src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export const config = {
106106
},
107107
bot: {
108108
sessionsListLimit: getOptionalPositiveIntEnvVar("SESSIONS_LIST_LIMIT", 10),
109+
projectsListLimit: getOptionalPositiveIntEnvVar("PROJECTS_LIST_LIMIT", 10),
109110
locale: getOptionalLocaleEnvVar("BOT_LOCALE", "en"),
110111
serviceMessagesIntervalSec: getOptionalNonNegativeIntEnvVarFromKeys(
111112
["SERVICE_MESSAGES_INTERVAL_SEC", "TOOL_MESSAGES_INTERVAL_SEC"],

tests/stt/client.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ vi.mock("../../src/config.js", () => ({
3333
server: { logLevel: "error" },
3434
bot: {
3535
sessionsListLimit: 10,
36+
projectsListLimit: 10,
3637
locale: "en",
3738
serviceMessagesIntervalSec: 5,
3839
hideThinkingMessages: false,

0 commit comments

Comments
 (0)