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:
Deng Junhai 2024-03-31 17:40:19 +08:00
parent ae063e943a
commit 807ff59438
5 changed files with 6 additions and 15 deletions

View File

@ -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

View File

@ -4,9 +4,8 @@ import (
"chat/adapter"
"chat/connection"
"chat/utils"
"time"
"github.com/go-redis/redis/v8"
"time"
)
func IncrErrorRequest(cache *redis.Client) {

View File

@ -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)

View File

@ -11,9 +11,8 @@ import (
"chat/manager/conversation"
"chat/utils"
"fmt"
"runtime/debug"
"github.com/gin-gonic/gin"
"runtime/debug"
)
const defaultMessage = "empty response"

View File

@ -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) {