Documentation
¶
Index ¶
- func NewCmdInfo(f util.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command
- func RunOnce(client *HivemindClient, message string, out func(string)) error
- func RunTUI(client *HivemindClient) error
- type ChatMessage
- type ChatOptions
- type HivemindClient
- type StreamCallback
- type ToolCallCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCmdInfo ¶
func RunOnce ¶
func RunOnce(client *HivemindClient, message string, out func(string)) error
RunOnce performs a single chat request (non-interactive mode) with streaming output to stdout.
func RunTUI ¶
func RunTUI(client *HivemindClient) error
RunTUI starts the interactive chat TUI using direct terminal output. This approach avoids alt-screen mode so that text can be freely selected and copied.
Types ¶
type ChatMessage ¶
ChatMessage is a single message in the OpenAI Chat Completions format.
type ChatOptions ¶
type ChatOptions struct {
ServerAddr string
Session string
Model string
genericclioptions.IOStreams
// contains filtered or unexported fields
}
func NewChatOptions ¶
func NewChatOptions(f util.Factory, ioStreams genericclioptions.IOStreams) *ChatOptions
func (*ChatOptions) Complete ¶
func (o *ChatOptions) Complete(args []string) error
type HivemindClient ¶
type HivemindClient struct {
BaseURL string
SessionKey string
Model string
HTTPClient *http.Client
}
HivemindClient is the HTTP client for hivemind /v1/chat/completions.
func NewHivemindClient ¶
func NewHivemindClient(baseURL, sessionKey, model string, httpClient *http.Client) *HivemindClient
NewHivemindClient creates a new client.
func (*HivemindClient) Chat ¶
func (c *HivemindClient) Chat(ctx context.Context, messages []ChatMessage) (string, error)
Chat sends messages and returns the full response (non-streaming).
func (*HivemindClient) ChatStream ¶
func (c *HivemindClient) ChatStream(ctx context.Context, messages []ChatMessage, cb StreamCallback, toolCb ToolCallCallback) (string, error)
ChatStream sends messages and streams the response, calling cb for each delta. toolCb is called when a tool call is detected (may be nil). Returns the full assistant reply when done.
type StreamCallback ¶
type StreamCallback func(delta string)
StreamCallback is called for each text delta during streaming.
type ToolCallCallback ¶
type ToolCallCallback func(name string)
ToolCallCallback is called when a tool call is detected in the stream. name is the tool function name, arguments is the JSON arguments string.