mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 00:38:49 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
27a054c928
9 changed files with 128 additions and 0 deletions
|
|
@ -1,4 +1,16 @@
|
|||
{
|
||||
"aiContinueWrite": "Continue writing",
|
||||
"aiTranslate": "Translate",
|
||||
"aiExtractSummary": "Extract summary",
|
||||
"aiTranslate_zh_CN": "Chinese",
|
||||
"aiTranslate_ja_JP": "Japanese",
|
||||
"aiTranslate_ko_KR": "Korean",
|
||||
"aiTranslate_en_US": "English",
|
||||
"aiTranslate_es_ES": "Spanish",
|
||||
"aiTranslate_fr_FR": "French",
|
||||
"aiTranslate_de_DE": "German",
|
||||
"aiBrainStorm": "Brainstorm",
|
||||
"aiFixGrammarSpell": "Fix grammar and spelling",
|
||||
"attributeView": "Attribute View",
|
||||
"mgmt": "Management",
|
||||
"spaceRepetition": "Spaced Repetition",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,16 @@
|
|||
{
|
||||
"aiContinueWrite": "Continuar escribiendo",
|
||||
"aiTranslate": "Traducir",
|
||||
"aiExtractSummary": "Extraer resumen",
|
||||
"aiTranslate_zh_CN": "Chino",
|
||||
"aiTranslate_ja_JP": "Japonés",
|
||||
"aiTranslate_ko_KR": "Coreano",
|
||||
"aiTranslate_en_US": "Inglés",
|
||||
"aiTranslate_es_ES": "Español",
|
||||
"aiTranslate_fr_FR": "Francés",
|
||||
"aiTranslate_de_DE": "Alemán",
|
||||
"aiBrainStorm": "Lluvia de ideas",
|
||||
"aiFixGrammarSpell": "Corregir gramática y ortografía",
|
||||
"attributeView": "Vista de atributos",
|
||||
"mgmt": "Administración",
|
||||
"spaceRepetition": "Repetición Espaciada",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,16 @@
|
|||
{
|
||||
"aiContinueWrite": "Continuer à écrire",
|
||||
"aiTranslate": "Traduire",
|
||||
"aiExtractSummary": "Résumé de l'extrait",
|
||||
"aiTranslate_zh_CN": "Chinois",
|
||||
"aiTranslate_ja_JP": "Japonais",
|
||||
"aiTranslate_ko_KR": "Coréen",
|
||||
"aiTranslate_en_US": "Anglais",
|
||||
"aiTranslate_es_ES": "Espagnol",
|
||||
"aiTranslate_fr_FR": "Français",
|
||||
"aiTranslate_de_DE": "Allemand",
|
||||
"aiBrainStorm": "Remue-méninges",
|
||||
"aiFixGrammarSpell": "Corrige la grammaire et l'orthographe",
|
||||
"attributeView": "Vista de atributos",
|
||||
"mgmt": "Gestion",
|
||||
"spaceRepetition": "Répétition espacée",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,16 @@
|
|||
{
|
||||
"aiContinueWrite": "續寫",
|
||||
"aiTranslate": "翻譯",
|
||||
"aiExtractSummary": "提取摘要",
|
||||
"aiTranslate_zh_CN": "中文",
|
||||
"aiTranslate_ja_JP": "日文",
|
||||
"aiTranslate_ko_KR": "韓文",
|
||||
"aiTranslate_en_US": "英文",
|
||||
"aiTranslate_es_ES": "西班牙文",
|
||||
"aiTranslate_fr_FR": "法文",
|
||||
"aiTranslate_de_DE": "德文",
|
||||
"aiBrainStorm": "頭腦風暴",
|
||||
"aiFixGrammarSpell": "修正語法和拼寫",
|
||||
"attributeView": "屬性視圖",
|
||||
"mgmt": "管理",
|
||||
"spaceRepetition": "間隔重複",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,16 @@
|
|||
{
|
||||
"aiContinueWrite": "续写",
|
||||
"aiTranslate": "翻译",
|
||||
"aiExtractSummary": "提取摘要",
|
||||
"aiTranslate_zh_CN": "中文",
|
||||
"aiTranslate_ja_JP": "日文",
|
||||
"aiTranslate_ko_KR": "韩文",
|
||||
"aiTranslate_en_US": "英文",
|
||||
"aiTranslate_es_ES": "西班牙文",
|
||||
"aiTranslate_fr_FR": "法文",
|
||||
"aiTranslate_de_DE": "德文",
|
||||
"aiBrainStorm": "头脑风暴",
|
||||
"aiFixGrammarSpell": "修正语法和拼写",
|
||||
"attributeView": "属性视图",
|
||||
"mgmt": "管理",
|
||||
"spaceRepetition": "间隔重复",
|
||||
|
|
|
|||
|
|
@ -89,3 +89,37 @@ func chatGPTSummary(c *gin.Context) {
|
|||
}
|
||||
ret.Data = model.ChatGPTSummary(ids)
|
||||
}
|
||||
|
||||
func chatGPTBrainStorm(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
idsArg := arg["ids"].([]interface{})
|
||||
var ids []string
|
||||
for _, id := range idsArg {
|
||||
ids = append(ids, id.(string))
|
||||
}
|
||||
ret.Data = model.ChatGPTBrainStorm(ids)
|
||||
}
|
||||
|
||||
func chatGPTFixGrammarSpell(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
idsArg := arg["ids"].([]interface{})
|
||||
var ids []string
|
||||
for _, id := range idsArg {
|
||||
ids = append(ids, id.(string))
|
||||
}
|
||||
ret.Data = model.ChatGPTFixGrammarSpell(ids)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -332,4 +332,6 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
ginServer.Handle("POST", "/api/ai/chatGPTContinueWriteBlocks", model.CheckAuth, chatGPTContinueWriteBlocks)
|
||||
ginServer.Handle("POST", "/api/ai/chatGPTTranslate", model.CheckAuth, chatGPTTranslate)
|
||||
ginServer.Handle("POST", "/api/ai/chatGPTSummary", model.CheckAuth, chatGPTSummary)
|
||||
ginServer.Handle("POST", "/api/ai/chatGPTBrainStorm", model.CheckAuth, chatGPTBrainStorm)
|
||||
ginServer.Handle("POST", "/api/ai/chatGPTFixGrammarSpell", model.CheckAuth, chatGPTFixGrammarSpell)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,26 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func ChatGPTFixGrammarSpell(ids []string) (ret string) {
|
||||
if !isOpenAIAPIEnabled() {
|
||||
return
|
||||
}
|
||||
|
||||
msg := getBlocksContent(ids)
|
||||
ret = util.ChatGPTFixGrammarSpell(msg, Conf.Lang)
|
||||
return
|
||||
}
|
||||
|
||||
func ChatGPTBrainStorm(ids []string) (ret string) {
|
||||
if !isOpenAIAPIEnabled() {
|
||||
return
|
||||
}
|
||||
|
||||
msg := getBlocksContent(ids)
|
||||
ret = util.ChatGPTBrainStorm(msg, Conf.Lang)
|
||||
return
|
||||
}
|
||||
|
||||
func ChatGPTSummary(ids []string) (ret string) {
|
||||
if !isOpenAIAPIEnabled() {
|
||||
return
|
||||
|
|
|
|||
|
|
@ -57,6 +57,18 @@ func ChatGPTSummary(msg string, lang string) (ret string) {
|
|||
return
|
||||
}
|
||||
|
||||
func ChatGPTBrainStorm(msg string, lang string) (ret string) {
|
||||
msg = "Brainstorm ideas as follows, the result is in {" + lang + "}:\n" + msg
|
||||
ret, _ = ChatGPTContinueWrite(msg, nil)
|
||||
return
|
||||
}
|
||||
|
||||
func ChatGPTFixGrammarSpell(msg string, lang string) (ret string) {
|
||||
msg = "Fix grammar and spelling as follows, the result is in {" + lang + "}:\n" + msg
|
||||
ret, _ = ChatGPTContinueWrite(msg, nil)
|
||||
return
|
||||
}
|
||||
|
||||
func ChatGPTContinueWrite(msg string, contextMsgs []string) (ret string, retContextMsgs []string) {
|
||||
if "" == OpenAIAPIKey {
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue