dsh-tg-bridge 1.20.0 → 1.20.1

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/i18n/en/core.mjs CHANGED
@@ -165,6 +165,7 @@ export default {
165
165
  'msg.voiceNotRecognized': 'Could not make out the voice message{detail}',
166
166
  'prompt.photo': 'Look at the image at {path} and describe it in detail: text (verbatim, keeping its language), interface elements, objects.',
167
167
  'prompt.file': 'The user sent a file: {path} ({type}, {size} bytes).',
168
+ 'prompt.voice': '🎤 This is a transcript of a voice message, produced by speech recognition. Names, Latin words, file names and rare terms may be misheard. If a word makes no sense, ask what was meant instead of guessing — the text below is what was heard, not what was said.\n\n{text}',
168
169
  'prompt.note': 'The request: {note}',
169
170
  'prompt.fileText': 'The user sent a text file: {path} ({type}, {size} bytes). Its content is between the markers:\n<file>\n{body}\n</file>',
170
171
  'prompt.photoMidTurn': 'The image arrived mid-turn, so only its path is attached: if you cannot open images, say so in one line.',
package/i18n/ru/core.mjs CHANGED
@@ -165,6 +165,7 @@ export default {
165
165
  'msg.voiceNotRecognized': 'Не распознал голосовое{detail}',
166
166
  'prompt.photo': 'Посмотри изображение по пути {path} и подробно опиши, что на нём: текст (дословно, с сохранением языка), элементы интерфейса, объекты.',
167
167
  'prompt.file': 'Пользователь прислал файл: {path} ({type}, {size} байт).',
168
+ 'prompt.voice': '🎤 Это расшифровка голосового сообщения, сделанная распознаванием речи. Имена, латиница, имена файлов и редкие слова могут быть перевраны. Если слово выглядит бессмысленно, спроси, что имелось в виду, вместо того чтобы додумывать: ниже — то, что услышано, а не то, что сказано.\n\n{text}',
168
169
  'prompt.note': 'Просьба: {note}',
169
170
  'prompt.fileText': 'Пользователь прислал текстовый файл: {path} ({type}, {size} байт). Содержимое между маркерами:\n<file>\n{body}\n</file>',
170
171
  'prompt.photoMidTurn': 'Картинка пришла во время хода, поэтому приложен только путь: если не можешь открыть изображение, скажи это одной строкой.',
package/i18n/zh/core.mjs CHANGED
@@ -165,6 +165,7 @@ export default {
165
165
  'msg.voiceNotRecognized': '没能识别这条语音{detail}',
166
166
  'prompt.photo': '查看路径 {path} 的图片并详细描述:文字(逐字,保留原语言)、界面元素、物体。',
167
167
  'prompt.file': '用户发来文件:{path}({type},{size} 字节)。',
168
+ 'prompt.voice': '🎤 这是语音消息的转写文本,由语音识别生成。人名、拉丁字母、文件名和生僻词可能听错。如果某个词看起来没有意义,请询问本意,不要自行猜测:下面是被听到的内容,不一定是原话。\n\n{text}',
168
169
  'prompt.note': '请求:{note}',
169
170
  'prompt.fileText': '用户发来文本文件:{path}({type},{size} 字节)。内容在标记之间:\n<file>\n{body}\n</file>',
170
171
  'prompt.photoMidTurn': '图片是在本轮进行中发来的,只附上了路径:如果无法打开图片,请用一句话说明。',
package/media.mjs CHANGED
@@ -140,6 +140,20 @@ export async function readVoiceIntoText(msg, chatId, threadId, lang) {
140
140
  return heard;
141
141
  }
142
142
 
143
+ /**
144
+ * A transcript as the turn should read it: the words, plus the fact that they
145
+ * came out of a speech recogniser.
146
+ *
147
+ * Without the note the model treats a misheard name as a deliberate word and
148
+ * answers the wrong question — "dodge" heard as "дождь" turns a car into
149
+ * weather. The note asks for a question where the guessing would start, and it
150
+ * is part of the prompt rather than the chat: the person already sees the
151
+ * transcript echoed above the reply.
152
+ */
153
+ export function voicePromptText(heard, lang) {
154
+ return t(lang, 'prompt.voice', { text: String(heard ?? '').trim() });
155
+ }
156
+
143
157
  /**
144
158
  * Attachments -> the prompt text that hands them to the turn.
145
159
  *
@@ -168,14 +182,14 @@ export async function mediaPrompt(msgs, chatId, threadId, lang, opts = {}) {
168
182
  continue;
169
183
  }
170
184
  const heard = await readVoiceIntoText(msg, chatId, threadId, lang);
171
- if (heard) parts.push(heard);
185
+ if (heard) parts.push(voicePromptText(heard, lang));
172
186
  continue;
173
187
  }
174
188
  // An audio file sent as a document is a voice note with a different
175
189
  // wrapper: transcribe it instead of handing over a path nobody can listen to.
176
190
  if (msg.document?.mime_type?.startsWith('audio/') && voiceOn) {
177
191
  const heard = await readVoiceIntoText({ ...msg, audio: msg.document }, chatId, threadId, lang);
178
- if (heard) parts.push(heard);
192
+ if (heard) parts.push(voicePromptText(heard, lang));
179
193
  continue;
180
194
  }
181
195
  // Photo handling: the turn's own model reads the file through `read_image`.
package/model-probe.mjs CHANGED
@@ -59,8 +59,12 @@ export function firstProvider() {
59
59
  if (found.baseUrl && found.keyEnv) break;
60
60
  }
61
61
  }
62
- const baseUrl = (process.env.UNOROUTER_BASE_URL || found.baseUrl || '').trim().replace(/\/+$/, '');
63
- const keyEnv = process.env.UNOROUTER_API_KEY ? 'UNOROUTER_API_KEY' : found.keyEnv;
62
+ // The profile row is the source of truth. These two overrides exist for the
63
+ // one case the file cannot describe — pointing the probe at a different host
64
+ // while debugging — and they carry no provider name, because the package is
65
+ // public and a name here would ship someone's vendor with it.
66
+ const baseUrl = (process.env.DSH_PROBE_BASE_URL || found.baseUrl || '').trim().replace(/\/+$/, '');
67
+ const keyEnv = (process.env.DSH_PROBE_KEY_ENV || '').trim() || found.keyEnv;
64
68
  cachedProvider = baseUrl ? { baseUrl, keyEnv } : null;
65
69
  return cachedProvider;
66
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-tg-bridge",
3
- "version": "1.20.0",
3
+ "version": "1.20.1",
4
4
  "description": "Telegram bridge for DeepSeek Harness: text, voice, photos and project-per-topic sessions without opening the desktop app",
5
5
  "type": "module",
6
6
  "main": "plugin-bridge.mjs",