mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-12 03:13:41 +08:00
feat: 支持CozeV3
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package coze
|
||||
|
||||
import "github.com/songquanpeng/one-api/relay/adaptor/coze/constant/event"
|
||||
import (
|
||||
"github.com/songquanpeng/one-api/relay/adaptor/coze/constant/event"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func event2StopReason(e *string) string {
|
||||
if e == nil || *e == event.Message {
|
||||
@@ -8,3 +11,16 @@ func event2StopReason(e *string) string {
|
||||
}
|
||||
return "stop"
|
||||
}
|
||||
|
||||
func splitOnDoubleNewline(data []byte, atEOF bool) (advance int, token []byte, err error) {
|
||||
if atEOF && len(data) == 0 {
|
||||
return 0, nil, nil
|
||||
}
|
||||
if i := strings.Index(string(data), "\n\n"); i >= 0 {
|
||||
return i + 1, data[0:i], nil
|
||||
}
|
||||
if atEOF {
|
||||
return len(data), data, nil
|
||||
}
|
||||
return 0, nil, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user