fix: 非openai 渠道使用 SystemPrompt 设置会panic

This commit is contained in:
Xyfacai
2025-09-15 19:38:31 +08:00
parent 05c2dde38f
commit 63f94e7669

View File

@@ -90,7 +90,8 @@ func TextHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *types
if info.ChannelSetting.SystemPrompt != "" {
// 如果有系统提示,则将其添加到请求中
request := convertedRequest.(*dto.GeneralOpenAIRequest)
request, ok := convertedRequest.(*dto.GeneralOpenAIRequest)
if ok {
containSystemPrompt := false
for _, message := range request.Messages {
if message.Role == request.GetSystemRoleName() {
@@ -127,6 +128,7 @@ func TextHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *types
}
}
}
}
jsonData, err := common.Marshal(convertedRequest)
if err != nil {