common/model/gigachat.go
2025-06-06 17:05:34 +03:00

50 lines
1.7 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package model
import (
"errors"
)
type GigaChatMessage struct {
Role string `json:"role"`
Content string `json:"content"`
}
type GigaChatRequest struct {
Model string `json:"model"`
Stream bool `json:"stream"`
UpdateInterval int `json:"update_interval"`
Messages []GigaChatMessage `json:"messages"`
}
type GigaChatResponse struct {
Choices []struct {
Message struct {
Role string `json:"role"`
Content string `json:"content"`
} `json:"message"`
} `json:"choices"`
}
const CreatePrompt = `Ты маркетолог и копирайтер. Твоя задача — переформулировать маркетинговый вопрос так, чтобы он лучше подходил определённой целевой аудитории по полу и возрасту.
Ответ должен строго состоять из двух строк:
{
"title": "<переформулированный заголовок>",
"description": "<переформулированное описание>"
}
Я напишу возраст, пол, заголовок и описание вопроса, а ты вернёшь только отформатированный результат.`
var ReworkQuestionPrompt string = "%s %s пол.\n%s\n%s"
var EmptyResponseErrorGigaChat = errors.New("empty response from GigaChat try again")
type GigaChatAudience struct {
ID int64 `json:"id"`
QuizID int64 `json:"quiz_id"`
Sex int32 `json:"sex"` // 0 - female, 1 - male, 2 - not sex
Age string `json:"age"`
Deleted bool `json:"deleted"`
CreatedAt int64 `json:"created_at"`
}