|
@@ -191,7 +191,7 @@ func openaiRequest(messages string, template []custom_types.ContactFieldTemplate
|
|
|
"chat_history": messages,
|
|
|
"external_id": uuid.New().String(),
|
|
|
}
|
|
|
- logx.Infof("bodyData: %+v", bodyData)
|
|
|
+ logx.Info("bodyData: %+v", bodyData)
|
|
|
bodyBytes, err := json.Marshal(bodyData)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
@@ -330,7 +330,7 @@ func (l *CronTask) UpdateContactFields(botID string, receiverID string, fields [
|
|
|
} else {
|
|
|
f, _ := l.svcCtx.DB.ContactField.Query().Where(contactfield.ContactID(c.ID), contactfield.FormID(field.DataIndex)).First(l.ctx)
|
|
|
if f == nil {
|
|
|
- if field.Value != nil && len(field.Value) > 0 {
|
|
|
+ if field.Value != nil && len(field.Value) > 0 && field.Value[0] != "" {
|
|
|
_, err := l.svcCtx.DB.ContactField.Create().
|
|
|
SetContactID(c.ID).
|
|
|
SetFormID(field.DataIndex).
|
|
@@ -342,8 +342,8 @@ func (l *CronTask) UpdateContactFields(botID string, receiverID string, fields [
|
|
|
}
|
|
|
} else {
|
|
|
if field.Value != nil {
|
|
|
- if len(field.Value) == 0 {
|
|
|
- field.Value = []string{""}
|
|
|
+ if len(field.Value) == 0 || field.Value[0] == "" {
|
|
|
+ continue
|
|
|
}
|
|
|
_, err := l.svcCtx.DB.ContactField.UpdateOneID(f.ID).
|
|
|
SetValue(field.Value).
|