mirror of
https://github.com/eryajf/chatgpt-dingtalk.git
synced 2025-10-07 09:01:03 +08:00
refactor: prompt.content + ?
=> prompt.prefix + ? + prompt.suffix
(#141)
This commit is contained in:
@@ -13,10 +13,10 @@ func GeneratePrompt(msg string) (rst string, err error) {
|
||||
for _, prompt := range *public.Prompt {
|
||||
if strings.HasPrefix(msg, prompt.Title) {
|
||||
if strings.TrimSpace(msg) == prompt.Title {
|
||||
rst = fmt.Sprintf("%s:\n%s", prompt.Title, prompt.Content)
|
||||
rst = fmt.Sprintf("%s:\n%s___输入内容___%s", prompt.Title, prompt.Prefix, prompt.Suffix)
|
||||
err = errors.New("消息内容为空") // 当提示词之后没有文本,抛出异常,以便直接返回Prompt所代表的内容
|
||||
} else {
|
||||
rst = prompt.Content + strings.Replace(msg, prompt.Title, "", -1)
|
||||
rst = prompt.Prefix + strings.TrimSpace(strings.Replace(msg, prompt.Title, "", -1)) + prompt.Suffix
|
||||
}
|
||||
return
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user