feat(ui): refactor IM channels list layout and form\n\n- Change IM channel form from dialog to drawer for better UX\n- Convert channel list from vertical layout to responsive grid cards\n- Move edit/delete actions into a dropdown menu for cleaner card design\n- Replace platform radio group with a select dropdown in the add channel form
This commit is contained in:
@@ -213,9 +213,13 @@ func (h *Handler) setupStopEventHandler(
|
||||
eventBus.On(event.EventStop, func(ctx context.Context, evt event.Event) error {
|
||||
logger.Infof(ctx, "Received stop event, cancelling async operations for session: %s", sessionID)
|
||||
cancel()
|
||||
assistantMessage.Content = "用户停止了本次对话"
|
||||
// Use session's tenant for message update (ctx may have effectiveTenantID when using shared agent)
|
||||
updateCtx := context.WithValue(ctx, types.TenantIDContextKey, sessionTenantID)
|
||||
// Preserve whatever has been streamed so far; do not overwrite Content.
|
||||
// Use session's tenant for message update (ctx may have effectiveTenantID when using shared agent).
|
||||
// Use WithoutCancel so the GORM UPDATE survives the upcoming ctx.Done triggered by cancel()/client disconnect.
|
||||
updateCtx := context.WithValue(
|
||||
context.WithoutCancel(ctx),
|
||||
types.TenantIDContextKey, sessionTenantID,
|
||||
)
|
||||
h.completeAssistantMessage(updateCtx, assistantMessage, "") // empty query: stopped conversations are not indexed
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -615,7 +615,15 @@ func (h *Handler) executeQA(reqCtx *qaRequestContext, mode qaMode, generateTitle
|
||||
}
|
||||
// Agent mode: complete the assistant message in defer (normal mode does it via event handler)
|
||||
if mode == qaModeAgent {
|
||||
updateCtx := context.WithValue(streamCtx.asyncCtx, types.TenantIDContextKey, reqCtx.session.TenantID)
|
||||
// Use WithoutCancel so a user-triggered stop (which cancels
|
||||
// asyncCtx) doesn't also cancel the GORM UPDATE that persists
|
||||
// AgentSteps/Content. Without this, cancelled-ctx makes
|
||||
// GORM skip the write and the agent's intermediate steps
|
||||
// (thinking / tool_call history) are lost on page refresh.
|
||||
updateCtx := context.WithValue(
|
||||
context.WithoutCancel(streamCtx.asyncCtx),
|
||||
types.TenantIDContextKey, reqCtx.session.TenantID,
|
||||
)
|
||||
h.completeAssistantMessage(updateCtx, streamCtx.assistantMessage, reqCtx.query)
|
||||
logger.Infof(streamCtx.asyncCtx, "Agent QA service completed for session: %s", sessionID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user