viewerchat

package
v0.0.0-...-2adc0db Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

Agent runs one viewer-chat turn with Eino Responses + in-process tools.

func NewAgent

func NewAgent(cfg Config) *Agent

NewAgent builds an Agent. Ops must be non-nil.

func (*Agent) Run

func (a *Agent) Run(ctx context.Context, in TurnInput, send func(Event) error, tl turnLogger) (TurnResult, error)

Run executes the agent loop and emits SSE text (and relies on caller for trip_updated/done).

type ClientMessage

type ClientMessage struct {
	Role    string
	Content string
}

ClientMessage is a normalized chat message.

type Config

type Config struct {
	APIKey  string
	Model   string
	Ops     Ops
	Log     *slog.Logger
	MaxIter int
}

Config wires the OpenAI Responses agent.

type Event

type Event struct {
	Type   string `json:"type"`
	Text   string `json:"text,omitempty"`
	Status string `json:"status,omitempty"`
	Error  string `json:"error,omitempty"`
	Done   bool   `json:"done,omitempty"`
}

Event is one SSE data payload for Persona (parseSSEEvent maps these).

type Handler

type Handler struct {
	Agent *Agent
	Log   *slog.Logger
}

Handler serves POST chat for one trip.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request, tripID, userSub string)

ServeHTTP runs one chat turn as an SSE stream.

type MutateResult

type MutateResult = tripops.MutateResult

Re-export result types used by tools and tests.

type Ops

type Ops = tripops.Ops

Ops is the shared trip agent surface (same as HTTP/MCP).

type Request

type Request struct {
	Messages []clientMsg    `json:"messages"`
	Context  map[string]any `json:"context,omitempty"`
	Metadata map[string]any `json:"metadata,omitempty"`
	Day      int            `json:"day,omitempty"`
}

Request is the JSON body Persona posts (plus optional day context).

type TripSummary

type TripSummary = tripops.TripSummary

Re-export result types used by tools and tests.

type TurnInput

type TurnInput struct {
	TripID   string
	UserSub  string
	Messages []ClientMessage
	Day      int
}

TurnInput is one Persona chat turn.

type TurnResult

type TurnResult struct {
	Text        string
	TripUpdated bool
}

TurnResult summarizes one completed turn.

type VersionEntry

type VersionEntry = tripops.VersionEntry

Re-export result types used by tools and tests.

type YAMLResult

type YAMLResult = tripops.YAMLResult

Re-export result types used by tools and tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL