mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-01-07 21:44:02 -05:00
feat: implement CLI support for metadata display (Phase 4)
This commit is contained in:
@@ -104,6 +104,7 @@ type Flags struct {
|
||||
Notification bool `long:"notification" yaml:"notification" description:"Send desktop notification when command completes"`
|
||||
NotificationCommand string `long:"notification-command" yaml:"notificationCommand" description:"Custom command to run for notifications (overrides built-in notifications)"`
|
||||
Thinking domain.ThinkingLevel `long:"thinking" yaml:"thinking" description:"Set reasoning/thinking level (e.g., off, low, medium, high, or numeric tokens for Anthropic or Google Gemini)"`
|
||||
ShowMetadata bool `long:"show-metadata" description:"Print metadata to stderr"`
|
||||
Debug int `long:"debug" description:"Set debug level (0=off, 1=basic, 2=detailed, 3=trace)" default:"0"`
|
||||
}
|
||||
|
||||
@@ -459,6 +460,7 @@ func (o *Flags) BuildChatOptions() (ret *domain.ChatOptions, err error) {
|
||||
Voice: o.Voice,
|
||||
Notification: o.Notification || o.NotificationCommand != "",
|
||||
NotificationCommand: o.NotificationCommand,
|
||||
ShowMetadata: o.ShowMetadata,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -85,9 +85,12 @@ func (o *Chatter) Send(request *domain.ChatRequest, opts *domain.ChatOptions) (s
|
||||
printedStream = true
|
||||
}
|
||||
case domain.StreamTypeUsage:
|
||||
// Placeholder for metadata handling
|
||||
// Future logic: Store usage in session or context
|
||||
if opts.ShowMetadata && update.Usage != nil {
|
||||
fmt.Fprintf(os.Stderr, "\n[Metadata] Input: %d | Output: %d | Total: %d\n",
|
||||
update.Usage.InputTokens, update.Usage.OutputTokens, update.Usage.TotalTokens)
|
||||
}
|
||||
case domain.StreamTypeError:
|
||||
fmt.Fprintf(os.Stderr, "Error: %s\n", update.Content)
|
||||
errChan <- errors.New(update.Content)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ type ChatOptions struct {
|
||||
Voice string
|
||||
Notification bool
|
||||
NotificationCommand string
|
||||
ShowMetadata bool
|
||||
}
|
||||
|
||||
// NormalizeMessages remove empty messages and ensure messages order user-assist-user
|
||||
|
||||
Reference in New Issue
Block a user