Fix shared-bot Telegram agent resolution and add effort badge
- TelegramService: build the chat context with the session owner instead of the bot owner, so a public/shared bot resolves the agent for foreign sessions; credentials/CLI permission stay with the bot owner. - Agent cards: render an effort badge next to the model badge when an agent has an explicit reasoning effort set. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
e395927a67
commit
e6770bb5f8
3 files changed
+13
-1
No files matched your search
@@ -164,7 +164,10 @@ public class TelegramService
|
|||||||
|
|
||||||
private async Task HandleMessage(long chatId, string userText, string botToken, string botUserId, SessionRecord session)
|
private async Task HandleMessage(long chatId, string userText, string botToken, string botUserId, SessionRecord session)
|
||||||
{
|
{
|
||||||
var ctx = await _chatService.PrepareContext(session.SessionId, botUserId, _settings.GetInt("MaxIterations", 100));
|
// Kontext mit dem Session-Besitzer aufbauen, nicht mit dem Bot-Besitzer:
|
||||||
|
// bei einem geteilten Bot können sich beide unterscheiden, und PrepareContext
|
||||||
|
// lehnt fremde Sessions ab. Credentials/CLI-Berechtigung bleiben beim Bot-Besitzer (botUserId, s.u.).
|
||||||
|
var ctx = await _chatService.PrepareContext(session.SessionId, session.UserId, _settings.GetInt("MaxIterations", 100));
|
||||||
if (ctx == null)
|
if (ctx == null)
|
||||||
{
|
{
|
||||||
await SendMessage(chatId, botToken, "❌ Kein Agent konfiguriert. Bitte weise der Session im Web-UI einen Agent zu.");
|
await SendMessage(chatId, botToken, "❌ Kein Agent konfiguriert. Bitte weise der Session im Web-UI einen Agent zu.");
|
||||||
|
|||||||
@@ -121,6 +121,12 @@
|
|||||||
color: var(--secondary);
|
color: var(--secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.badge-effort {
|
||||||
|
background: rgb(from var(--info) r g b / .1);
|
||||||
|
border-color: rgb(from var(--info) r g b / .25);
|
||||||
|
color: var(--info);
|
||||||
|
}
|
||||||
|
|
||||||
.section-add-btn {
|
.section-add-btn {
|
||||||
font-size: var(--font-size);
|
font-size: var(--font-size);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,12 +153,15 @@ function buildAgentCard(agent, skills) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const effort = (agent.effort || ``).toLowerCase()
|
||||||
|
|
||||||
card.innerHTML = `
|
card.innerHTML = `
|
||||||
<div class="card-image">${imageHtml}</div>
|
<div class="card-image">${imageHtml}</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="card-title-row">
|
<div class="card-title-row">
|
||||||
<span class="card-title">${esc(agent.name)}</span>
|
<span class="card-title">${esc(agent.name)}</span>
|
||||||
<span class="badge">${prettyModelName(agent.model)}</span>
|
<span class="badge">${prettyModelName(agent.model)}</span>
|
||||||
|
${effort ? `<span class="badge badge-effort">${effort}</span>` : ``}
|
||||||
</div>
|
</div>
|
||||||
${badges.length ? `<div class="card-badges">${badges.join('')}</div>` : ''}
|
${badges.length ? `<div class="card-badges">${badges.join('')}</div>` : ''}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user