mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-04 23:40:48 +00:00
wip: refactoring tui
This commit is contained in:
parent
641e9ff664
commit
5e738ce7d3
12 changed files with 938 additions and 467 deletions
|
|
@ -1,7 +1,8 @@
|
|||
package logs
|
||||
|
||||
import (
|
||||
"context"
|
||||
// "context"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
||||
"github.com/charmbracelet/bubbles/key"
|
||||
|
|
@ -41,18 +42,16 @@ func (i *tableCmp) Init() tea.Cmd {
|
|||
|
||||
func (i *tableCmp) fetchLogs() tea.Cmd {
|
||||
return func() tea.Msg {
|
||||
ctx := context.Background()
|
||||
// ctx := context.Background()
|
||||
|
||||
var logs []logging.Log
|
||||
var err error
|
||||
|
||||
// Limit the number of logs to improve performance
|
||||
const logLimit = 100
|
||||
if i.app.CurrentSession.ID == "" {
|
||||
logs, err = i.app.Logs.ListAll(ctx, logLimit)
|
||||
} else {
|
||||
logs, err = i.app.Logs.ListBySession(ctx, i.app.CurrentSession.ID)
|
||||
}
|
||||
// TODO: Logs service not implemented in API yet
|
||||
logs = []logging.Log{}
|
||||
err = fmt.Errorf("logs service not implemented")
|
||||
|
||||
if err != nil {
|
||||
slog.Error("Failed to fetch logs", "error", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue