|
@@ -27,13 +27,17 @@ func NewGenerateAiAnswerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
|
|
|
func (l *GenerateAiAnswerLogic) GenerateAiAnswer(req *types.GenerateAiAnswerReq) (*types.GenerateAiAnswerResp, error) {
|
|
|
resp := types.GenerateAiAnswerResp{}
|
|
|
prompt := fmt.Sprintf(`
|
|
|
-请根据用户输入的消息,优化用户输入的内容。
|
|
|
+请根据用户输入的内容,包括角色、目标用户和背景介绍优化用户输入的内容。
|
|
|
用户输入内容:%s
|
|
|
-`, req.Content)
|
|
|
|
|
|
+# 回复要求
|
|
|
+- 如果优化成功,只返回具体的优化后的内容
|
|
|
+- 如果未优化成功,只返回优化失败的原因
|
|
|
+`, req.Content)
|
|
|
+ systemPrompt := "你是一个写作高手,帮助用户撰写或优化文案"
|
|
|
baseUrl := l.svcCtx.Config.Fastgpt.BASE_URL
|
|
|
apiKey := l.svcCtx.Config.Fastgpt.API_KEY
|
|
|
- answer, err := fastgpt.ChatWithCustomConfig(baseUrl, apiKey, prompt)
|
|
|
+ answer, err := fastgpt.ChatWithCustomConfig(baseUrl, apiKey, systemPrompt, prompt)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|