fix(go): nil pointer dereference in ZhipuAI Embed method (#17219)

This commit is contained in:
euvre
2026-07-22 13:59:06 +08:00
committed by GitHub
parent e8f4584fec
commit bab7302265

View File

@@ -530,7 +530,7 @@ func (z *ZhipuAIModel) Embed(modelName *string, texts []string, apiConfig *APICo
reqBody := map[string]interface{}{}
reqBody["model"] = modelName
reqBody["input"] = texts
if embeddingConfig.Dimension > 0 {
if embeddingConfig != nil && embeddingConfig.Dimension > 0 {
reqBody["dimensions"] = embeddingConfig.Dimension
}