fix(computer-svc): stream для завершенных задач + Timeweb env vars

- Исправлен Stream() в computer.go: для completed/failed/cancelled задач
  сразу отправляется финальное событие и канал закрывается (ранее
  соединение зависало с socket hang up)
- Добавлены TIMEWEB_* переменные в docker-compose.yml для computer-svc
  (LLM через Timeweb Cloud AI для России)
- UI компоненты webui обновлены

Made-with: Cursor
This commit is contained in:
home
2026-02-27 05:17:42 +03:00
parent 06fe57c765
commit 120fbbaafb
19 changed files with 391 additions and 126 deletions

View File

@@ -645,6 +645,31 @@ func (c *Computer) GetUserTasks(ctx context.Context, userID string, limit, offse
}
func (c *Computer) Stream(ctx context.Context, taskID string) (<-chan TaskEvent, error) {
task, err := c.taskRepo.GetByID(ctx, taskID)
if err != nil {
return nil, fmt.Errorf("task not found: %w", err)
}
if task.Status == StatusCompleted || task.Status == StatusFailed || task.Status == StatusCancelled {
ch := make(chan TaskEvent, 1)
go func() {
eventType := EventTaskCompleted
if task.Status == StatusFailed {
eventType = EventTaskFailed
}
ch <- TaskEvent{
TaskID: taskID,
Type: eventType,
Status: task.Status,
Progress: task.Progress,
Message: task.Message,
Timestamp: time.Now(),
}
close(ch)
}()
return ch, nil
}
return c.eventBus.Subscribe(taskID), nil
}