mirror of
https://github.com/coaidev/coai.git
synced 2025-05-29 01:40:17 +09:00
fix: fix unnecessary progress bar residue in midjourney format
This commit is contained in:
parent
d4819f8041
commit
5570814f89
@ -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())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user