mirror of
https://github.com/coaidev/coai.git
synced 2025-05-19 13:00: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
|
package adapter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
adaptercommon "chat/adapter/common"
|
"chat/adapter/common"
|
||||||
"chat/globals"
|
"chat/globals"
|
||||||
"chat/utils"
|
"chat/utils"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -30,7 +30,6 @@ func NewChatRequest(conf globals.ChannelConfig, props *adaptercommon.ChatProps,
|
|||||||
retries := conf.GetRetry()
|
retries := conf.GetRetry()
|
||||||
props.Current++
|
props.Current++
|
||||||
|
|
||||||
fmt.Println(IsAvailableError(err))
|
|
||||||
if IsAvailableError(err) {
|
if IsAvailableError(err) {
|
||||||
if isQPSOverLimit(props.OriginalModel, err) {
|
if isQPSOverLimit(props.OriginalModel, err) {
|
||||||
// sleep for 0.5s to avoid qps limit
|
// sleep for 0.5s to avoid qps limit
|
||||||
|
@ -4,9 +4,8 @@ import (
|
|||||||
"chat/adapter"
|
"chat/adapter"
|
||||||
"chat/connection"
|
"chat/connection"
|
||||||
"chat/utils"
|
"chat/utils"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/go-redis/redis/v8"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func IncrErrorRequest(cache *redis.Client) {
|
func IncrErrorRequest(cache *redis.Client) {
|
||||||
|
@ -2,20 +2,15 @@ package channel
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"chat/adapter"
|
"chat/adapter"
|
||||||
adaptercommon "chat/adapter/common"
|
"chat/adapter/common"
|
||||||
"chat/globals"
|
"chat/globals"
|
||||||
"chat/utils"
|
"chat/utils"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/go-redis/redis/v8"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewChatRequest(group string, props *adaptercommon.ChatProps, hook globals.Hook) error {
|
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)
|
ticker := ConduitInstance.GetTicker(props.OriginalModel, group)
|
||||||
if ticker == nil || ticker.IsEmpty() {
|
if ticker == nil || ticker.IsEmpty() {
|
||||||
return fmt.Errorf("cannot find channel for model %s", props.OriginalModel)
|
return fmt.Errorf("cannot find channel for model %s", props.OriginalModel)
|
||||||
|
@ -11,9 +11,8 @@ import (
|
|||||||
"chat/manager/conversation"
|
"chat/manager/conversation"
|
||||||
"chat/utils"
|
"chat/utils"
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime/debug"
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"runtime/debug"
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultMessage = "empty response"
|
const defaultMessage = "empty response"
|
||||||
|
@ -4,9 +4,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/go-redis/redis/v8"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Incr(cache *redis.Client, key string, delta int64) (int64, error) {
|
func Incr(cache *redis.Client, key string, delta int64) (int64, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user