mirror of
https://github.com/coaidev/coai.git
synced 2025-05-19 04:50:14 +09:00
fix: fix midjourney chunk stacking problem (#156) and stop signal cannot trigger in some channel formats issue
Co-Authored-By: Minghan Zhang <112773885+zmh-program@users.noreply.github.com>
This commit is contained in:
parent
ae063e943a
commit
807ff59438
@ -1,7 +1,7 @@
|
||||
package adapter
|
||||
|
||||
import (
|
||||
adaptercommon "chat/adapter/common"
|
||||
"chat/adapter/common"
|
||||
"chat/globals"
|
||||
"chat/utils"
|
||||
"fmt"
|
||||
@ -30,7 +30,6 @@ func NewChatRequest(conf globals.ChannelConfig, props *adaptercommon.ChatProps,
|
||||
retries := conf.GetRetry()
|
||||
props.Current++
|
||||
|
||||
fmt.Println(IsAvailableError(err))
|
||||
if IsAvailableError(err) {
|
||||
if isQPSOverLimit(props.OriginalModel, err) {
|
||||
// sleep for 0.5s to avoid qps limit
|
||||
|
@ -4,9 +4,8 @@ import (
|
||||
"chat/adapter"
|
||||
"chat/connection"
|
||||
"chat/utils"
|
||||
"time"
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
"time"
|
||||
)
|
||||
|
||||
func IncrErrorRequest(cache *redis.Client) {
|
||||
|
@ -2,20 +2,15 @@ package channel
|
||||
|
||||
import (
|
||||
"chat/adapter"
|
||||
adaptercommon "chat/adapter/common"
|
||||
"chat/adapter/common"
|
||||
"chat/globals"
|
||||
"chat/utils"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
"time"
|
||||
)
|
||||
|
||||
func NewChatRequest(group string, props *adaptercommon.ChatProps, hook globals.Hook) error {
|
||||
if err := AuditContent(props); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ticker := ConduitInstance.GetTicker(props.OriginalModel, group)
|
||||
if ticker == nil || ticker.IsEmpty() {
|
||||
return fmt.Errorf("cannot find channel for model %s", props.OriginalModel)
|
||||
|
@ -11,9 +11,8 @@ import (
|
||||
"chat/manager/conversation"
|
||||
"chat/utils"
|
||||
"fmt"
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"runtime/debug"
|
||||
)
|
||||
|
||||
const defaultMessage = "empty response"
|
||||
|
@ -4,9 +4,8 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Incr(cache *redis.Client, key string, delta int64) (int64, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user