claude-telegram-bot 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bot.mjs +9 -5
- package/package.json +1 -1
package/bot.mjs
CHANGED
|
@@ -379,7 +379,7 @@ async function send(chatId, text) {
|
|
|
379
379
|
}
|
|
380
380
|
|
|
381
381
|
// ── Claude 실행 ───────────────────────────────────────────────────────────
|
|
382
|
-
function runClaude(prompt, sessionId) {
|
|
382
|
+
function runClaude(prompt, sessionId, opts = {}) {
|
|
383
383
|
return new Promise((resolve) => {
|
|
384
384
|
const args = [
|
|
385
385
|
"-p",
|
|
@@ -389,13 +389,17 @@ function runClaude(prompt, sessionId) {
|
|
|
389
389
|
"--permission-mode",
|
|
390
390
|
cfg.permissionMode || "acceptEdits",
|
|
391
391
|
];
|
|
392
|
+
const model = state.model || cfg.model; // /model 로 바꾸면 state.model 우선
|
|
392
393
|
const brevity =
|
|
393
394
|
cfg.appendSystemPrompt ??
|
|
394
395
|
"This reply is delivered over Telegram. Be concise — short paragraphs and lists, no filler intro/summary, avoid large tables. Reply in the user's language.";
|
|
395
|
-
//
|
|
396
|
-
const
|
|
396
|
+
// opts.modelHint: 현재 모델을 주입 → 답변 끝에 상위 모델 권유 제안(판단은 Claude 본인)
|
|
397
|
+
const modelHint = opts.modelHint
|
|
398
|
+
? `Current model: ${model || "claude (default)"}. Model tiers (low→high): haiku → sonnet → opus. If this question seems to require more capability than the current model, append one short line at the very end of your reply: 💡 \`/model sonnet\` (or \`/model opus\`) for a stronger answer. Omit the suggestion for simple questions.`
|
|
399
|
+
: null;
|
|
400
|
+
// 페르소나(cfg.persona) + 간결 지침 + 모델 힌트를 함께 주입 → 멀티 봇(역할별) 운영용
|
|
401
|
+
const appendSys = [cfg.persona, brevity, modelHint].filter(Boolean).join("\n\n");
|
|
397
402
|
if (appendSys) args.push("--append-system-prompt", appendSys);
|
|
398
|
-
const model = state.model || cfg.model; // /model 로 바꾸면 state.model 우선
|
|
399
403
|
if (model) args.push("--model", model);
|
|
400
404
|
if (sessionId) args.push("--resume", sessionId);
|
|
401
405
|
|
|
@@ -788,7 +792,7 @@ async function handle(msg) {
|
|
|
788
792
|
await send(chatId, t(l, "attachFail", e.message));
|
|
789
793
|
}
|
|
790
794
|
}
|
|
791
|
-
const res = await runClaude(prompt, state.sessionId);
|
|
795
|
+
const res = await runClaude(prompt, state.sessionId, { modelHint: true });
|
|
792
796
|
if (res.sessionId) {
|
|
793
797
|
state.sessionId = res.sessionId;
|
|
794
798
|
saveState(state);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-telegram-bot",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Drive Claude Code from Telegram — messages run headless `claude -p` in a project dir and replies come back to the chat. Zero dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|