门禁兼容修复

This commit is contained in:
andy committed 2026-09-05 17:36:23 +08:00
1 parent f60b416949
commit 801c0af692
18 files changed
+257 -87

No files matched your search

+9 -8
View File
@@ -20,12 +20,13 @@ import (
// transport. Its token authenticates callers of this service and is never a
// provider credential.
type DashScopeChatOptions struct {
AppID string
AuthToken string
AllowedOrigins []string
MaxBodyBytes int64
RunTimeout time.Duration
Logger *log.Logger
AppID string
AuthToken string
AllowLegacyShortToken bool
AllowedOrigins []string
MaxBodyBytes int64
RunTimeout time.Duration
Logger *log.Logger
}
// DashScopeChatHandler adapts the provider-neutral ChatUseCase to the narrow
@@ -48,8 +49,8 @@ func NewDashScopeChatHandler(chat ChatUseCase, options DashScopeChatOptions) (*D
if !validDashScopeAppID(options.AppID) {
return nil, errors.New("DashScope-compatible app ID is invalid")
}
if !validChatToken(options.AuthToken) {
return nil, errors.New("DashScope-compatible auth token must contain at least 32 printable ASCII characters")
if !validChatToken(options.AuthToken, options.AllowLegacyShortToken) {
return nil, errors.New("DashScope-compatible auth token is outside the configured printable ASCII length policy")
}
if options.MaxBodyBytes <= 0 || options.MaxBodyBytes > maximumChatBodyBytes {
return nil, errors.New("DashScope-compatible max body bytes is outside the supported range")