user-scoped channel sessions, whatsapp disconnect cleanup, browser relay token fix
Channel session IDs now include userId (channel-{provider}-{userId}-{contextId})
to prevent cross-user contamination in multi-user setups. WhatsApp disconnect
properly logs out and clears cached auth. Browser relay uses server-derived token
directly.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -153,7 +153,7 @@ async function handleCommand(ctx: CommandContext): Promise<boolean> {
|
||||
await send('No models available.');
|
||||
return true;
|
||||
}
|
||||
const current = getSessionModel('telegram', telegramId);
|
||||
const current = getSessionModel('telegram', ctx.userId, telegramId);
|
||||
const grouped = new Map<string, string[]>();
|
||||
for (const m of models) {
|
||||
const list = grouped.get(m.provider) ?? [];
|
||||
@@ -170,7 +170,7 @@ async function handleCommand(ctx: CommandContext): Promise<boolean> {
|
||||
}
|
||||
|
||||
if (lower === '!model') {
|
||||
const current = getSessionModel('telegram', telegramId);
|
||||
const current = getSessionModel('telegram', ctx.userId, telegramId);
|
||||
await send(
|
||||
current
|
||||
? `Current model: *${current}*`
|
||||
@@ -182,7 +182,7 @@ async function handleCommand(ctx: CommandContext): Promise<boolean> {
|
||||
if (lower.startsWith('!model ')) {
|
||||
const requested = content.slice('!model '.length).trim();
|
||||
if (!requested) {
|
||||
const current = getSessionModel('telegram', telegramId);
|
||||
const current = getSessionModel('telegram', ctx.userId, telegramId);
|
||||
await send(current ? `Current model: *${current}*` : 'No active session yet.');
|
||||
return true;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ async function handleCommand(ctx: CommandContext): Promise<boolean> {
|
||||
await send(`Model not found: \`${requested}\`\nUse \`!models\` to see available models.`);
|
||||
return true;
|
||||
}
|
||||
setSessionModel('telegram', telegramId, match.id);
|
||||
setSessionModel('telegram', ctx.userId, telegramId, match.id);
|
||||
await send(`Model switched to *${match.id}*. The new model will be used on your next message.`);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user