fix: fix unnecessary progress bar residue in midjourney format

This commit is contained in:
Zhang Minghan 2024-01-29 17:04:05 +08:00
parent d4819f8041
commit 5570814f89

View File

@ -59,18 +59,20 @@ func (c *ChatInstance) CreateStreamChatRequest(props *ChatProps, callback global
return fmt.Errorf("format error: please provide available prompt")
}
if err := callback("```progress\n"); err != nil {
return err
}
url, err := c.CreateStreamImagineTask(prompt, func(progress int) error {
if progress == 0 {
if err := callback("```progress\n"); err != nil {
return err
}
} else if progress == 100 {
if err := callback("```\n"); err != nil {
return err
}
}
return callback(fmt.Sprintf("%d\n", progress))
})
if err := callback("```\n"); err != nil {
return err
}
if err != nil {
return fmt.Errorf("error from midjourney: %s", err.Error())
}