allways create question with auditory, fix after discuss
This commit is contained in:
parent
e54d9a1666
commit
86769e3c02
@ -114,7 +114,11 @@ func (r *GigaChatTaskScheduler) handleMessage(ctx context.Context, msg MessageGi
|
|||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
updJson, err = r.gigaChatClient.SendMsg(ctx, audience, question)
|
updJson, err = r.gigaChatClient.SendMsg(ctx, audience, question)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
break
|
if err = json.Unmarshal([]byte(updJson), &resp); err == nil {
|
||||||
|
question.Title = resp.Title
|
||||||
|
question.Description = resp.Description
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if errors.Is(err, model.EmptyResponseErrorGigaChat) {
|
if errors.Is(err, model.EmptyResponseErrorGigaChat) {
|
||||||
@ -126,18 +130,6 @@ func (r *GigaChatTaskScheduler) handleMessage(ctx context.Context, msg MessageGi
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(updJson), &resp)
|
|
||||||
if err != nil {
|
|
||||||
r.logger.Error("failed to unmarshal GigaChat response", zap.String("raw", updJson), zap.Error(err))
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
question.Title = resp.Title
|
|
||||||
question.Description = resp.Description
|
|
||||||
question.Auditory = msg.ID
|
question.Auditory = msg.ID
|
||||||
|
|
||||||
_, err = r.dal.QuestionRepo.CreateQuestion(ctx, &question)
|
_, err = r.dal.QuestionRepo.CreateQuestion(ctx, &question)
|
||||||
|
Loading…
Reference in New Issue
Block a user