mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-02-12 06:55:08 -05:00
fix: improve dry run output formatting and config path error handling
## CHANGES - Remove leading newline from DryRunResponse constant - Add newline separator in SendStream method output - Add newline separator in Send method output - Improve GetDefaultConfigPath error handling logic - Add stderr error message for config access failures - Return empty string when config file doesn't exist
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
"github.com/danielmiessler/fabric/internal/plugins"
|
||||
)
|
||||
|
||||
const DryRunResponse = "\nDry run: Fake response sent by DryRun plugin\n"
|
||||
const DryRunResponse = "Dry run: Fake response sent by DryRun plugin\n"
|
||||
|
||||
type Client struct {
|
||||
*plugins.PluginBase
|
||||
@@ -108,6 +108,7 @@ func (c *Client) constructRequest(msgs []*chat.ChatCompletionMessage, opts *doma
|
||||
func (c *Client) SendStream(msgs []*chat.ChatCompletionMessage, opts *domain.ChatOptions, channel chan string) error {
|
||||
request := c.constructRequest(msgs, opts)
|
||||
channel <- request
|
||||
channel <- "\n"
|
||||
channel <- DryRunResponse
|
||||
close(channel)
|
||||
return nil
|
||||
@@ -116,7 +117,7 @@ func (c *Client) SendStream(msgs []*chat.ChatCompletionMessage, opts *domain.Cha
|
||||
func (c *Client) Send(_ context.Context, msgs []*chat.ChatCompletionMessage, opts *domain.ChatOptions) (string, error) {
|
||||
request := c.constructRequest(msgs, opts)
|
||||
|
||||
return request + DryRunResponse, nil
|
||||
return request + "\n" + DryRunResponse, nil
|
||||
}
|
||||
|
||||
func (c *Client) Setup() error {
|
||||
|
||||
Reference in New Issue
Block a user