Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-03-08 21:58:46 +08:00
commit 98ac7b6481
11 changed files with 475 additions and 201 deletions

View File

@ -1,4 +1,5 @@
{ {
"ai": "Artificial Intelligence",
"aiContinueWrite": "Continue writing", "aiContinueWrite": "Continue writing",
"aiTranslate": "Translate", "aiTranslate": "Translate",
"aiExtractSummary": "Extract summary", "aiExtractSummary": "Extract summary",

View File

@ -1,4 +1,5 @@
{ {
"ai": "Inteligencia Artificial",
"aiContinueWrite": "Continuar escribiendo", "aiContinueWrite": "Continuar escribiendo",
"aiTranslate": "Traducir", "aiTranslate": "Traducir",
"aiExtractSummary": "Extraer resumen", "aiExtractSummary": "Extraer resumen",

View File

@ -1,4 +1,5 @@
{ {
"ai": "Intelligence Artificielle",
"aiContinueWrite": "Continuer à écrire", "aiContinueWrite": "Continuer à écrire",
"aiTranslate": "Traduire", "aiTranslate": "Traduire",
"aiExtractSummary": "Résumé de l'extrait", "aiExtractSummary": "Résumé de l'extrait",

View File

@ -1,4 +1,5 @@
{ {
"ai": "人工智能",
"aiContinueWrite": "續寫", "aiContinueWrite": "續寫",
"aiTranslate": "翻譯", "aiTranslate": "翻譯",
"aiExtractSummary": "提取摘要", "aiExtractSummary": "提取摘要",

View File

@ -1,4 +1,5 @@
{ {
"ai": "人工智能",
"aiContinueWrite": "续写", "aiContinueWrite": "续写",
"aiTranslate": "翻译", "aiTranslate": "翻译",
"aiExtractSummary": "提取摘要", "aiExtractSummary": "提取摘要",

View File

@ -5,16 +5,16 @@
"Properties": { "Properties": {
"id": "20230304000547-ibldj1z", "id": "20230304000547-ibldj1z",
"title": "Artificial Intelligence", "title": "Artificial Intelligence",
"updated": "20230305102525" "updated": "20230308213745"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000646-2lycahn", "ID": "20230308213723-d3esro1",
"Type": "NodeHeading", "Type": "NodeHeading",
"HeadingLevel": 2, "HeadingLevel": 2,
"Properties": { "Properties": {
"id": "20230304000646-2lycahn", "id": "20230308213723-d3esro1",
"updated": "20230304000646" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
@ -24,11 +24,11 @@
] ]
}, },
{ {
"ID": "20230304000646-g8eokbs", "ID": "20230308213723-q8a5kbd",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000646-g8eokbs", "id": "20230308213723-q8a5kbd",
"updated": "20230304000646" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
@ -48,12 +48,12 @@
] ]
}, },
{ {
"ID": "20230304000646-ampo9ng", "ID": "20230308213723-gznor89",
"Type": "NodeHeading", "Type": "NodeHeading",
"HeadingLevel": 2, "HeadingLevel": 2,
"Properties": { "Properties": {
"id": "20230304000646-ampo9ng", "id": "20230308213723-gznor89",
"updated": "20230304000646" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
@ -63,18 +63,18 @@
] ]
}, },
{ {
"ID": "20230304000646-a5e7srt", "ID": "20230308213723-r46h6mw",
"Type": "NodeList", "Type": "NodeList",
"ListData": { "ListData": {
"Typ": 1 "Typ": 1
}, },
"Properties": { "Properties": {
"id": "20230304000646-a5e7srt", "id": "20230308213723-r46h6mw",
"updated": "20230305102525" "updated": "20230308213739"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000646-0aseguf", "ID": "20230308213723-9yri7ka",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"Typ": 1, "Typ": 1,
@ -83,16 +83,16 @@
"Num": 1 "Num": 1
}, },
"Properties": { "Properties": {
"id": "20230304000646-0aseguf", "id": "20230308213723-9yri7ka",
"updated": "20230304000646" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000646-z4uyi78", "ID": "20230308213723-wgq5x45",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000646-z4uyi78", "id": "20230308213723-wgq5x45",
"updated": "20230304000646" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
@ -104,7 +104,7 @@
] ]
}, },
{ {
"ID": "20230304000646-6207b6r", "ID": "20230308213723-obctww8",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"Typ": 1, "Typ": 1,
@ -113,16 +113,16 @@
"Num": 2 "Num": 2
}, },
"Properties": { "Properties": {
"id": "20230304000646-6207b6r", "id": "20230308213723-obctww8",
"updated": "20230305102525" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000646-t8nos3j", "ID": "20230308213723-rerhr3p",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000646-t8nos3j", "id": "20230308213723-rerhr3p",
"updated": "20230304000646" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
@ -132,32 +132,32 @@
] ]
}, },
{ {
"ID": "20230304000646-aj5szch", "ID": "20230308213723-pyed7a2",
"Type": "NodeList", "Type": "NodeList",
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20230304000646-aj5szch", "id": "20230308213723-pyed7a2",
"updated": "20230305102525" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000646-po7r7lt", "ID": "20230308213723-lakya6i",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"BulletChar": 42, "BulletChar": 42,
"Marker": "Kg==" "Marker": "Kg=="
}, },
"Properties": { "Properties": {
"id": "20230304000646-po7r7lt", "id": "20230308213723-lakya6i",
"updated": "20230304000646" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000646-nxfk9qb", "ID": "20230308213723-2sruo2o",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000646-nxfk9qb", "id": "20230308213723-2sruo2o",
"updated": "20230304000646" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
@ -178,23 +178,23 @@
] ]
}, },
{ {
"ID": "20230304000646-78w2ck5", "ID": "20230308213723-5vfosvz",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"BulletChar": 42, "BulletChar": 42,
"Marker": "Kg==" "Marker": "Kg=="
}, },
"Properties": { "Properties": {
"id": "20230304000646-78w2ck5", "id": "20230308213723-5vfosvz",
"updated": "20230305102525" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000646-2blt9e0", "ID": "20230308213723-cxomjan",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000646-2blt9e0", "id": "20230308213723-cxomjan",
"updated": "20230305102525" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
@ -215,23 +215,23 @@
] ]
}, },
{ {
"ID": "20230304000646-zrv15q4", "ID": "20230308213723-fj3oskr",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"BulletChar": 42, "BulletChar": 42,
"Marker": "Kg==" "Marker": "Kg=="
}, },
"Properties": { "Properties": {
"id": "20230304000646-zrv15q4", "id": "20230308213723-fj3oskr",
"updated": "20230304000646" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000646-m2luurq", "ID": "20230308213723-pvngelo",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000646-m2luurq", "id": "20230308213723-pvngelo",
"updated": "20230304000646" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
@ -252,23 +252,23 @@
] ]
}, },
{ {
"ID": "20230304000646-8swnrqn", "ID": "20230308213723-objm7mx",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"BulletChar": 42, "BulletChar": 42,
"Marker": "Kg==" "Marker": "Kg=="
}, },
"Properties": { "Properties": {
"id": "20230304000646-8swnrqn", "id": "20230308213723-objm7mx",
"updated": "20230304171533" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000646-33hvl2k", "ID": "20230308213723-x64pmnz",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000646-33hvl2k", "id": "20230308213723-x64pmnz",
"updated": "20230304171533" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
@ -287,13 +287,59 @@
] ]
} }
] ]
},
{
"ID": "20230308213723-fi8mg6o",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230308213723-fi8mg6o",
"updated": "20230308213723"
},
"Children": [
{
"ID": "20230308213723-11ww633",
"Type": "NodeParagraph",
"Properties": {
"id": "20230308213723-11ww633",
"updated": "20230308213723"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "SIYUAN_OPENAI_API_BASE_URL"
},
{
"Type": "NodeText",
"Data": " specifies the base address of the API server, the default is "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "https://api.openai.com/v1"
},
{
"Type": "NodeText",
"Data": " (optional)"
}
]
}
]
} }
] ]
} }
] ]
}, },
{ {
"ID": "20230304000646-pyi5cq7", "ID": "20230308213723-5m7aqfs",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"Typ": 1, "Typ": 1,
@ -302,16 +348,16 @@
"Num": 3 "Num": 3
}, },
"Properties": { "Properties": {
"id": "20230304000646-pyi5cq7", "id": "20230308213723-5m7aqfs",
"updated": "20230304000646" "updated": "20230308213730"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000646-jscziux", "ID": "20230308213723-i5y2zf5",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000646-jscziux", "id": "20230308213723-i5y2zf5",
"updated": "20230304000646" "updated": "20230308213730"
}, },
"Children": [ "Children": [
{ {
@ -320,12 +366,51 @@
}, },
{ {
"Type": "NodeTextMark", "Type": "NodeTextMark",
"TextMarkType": "code", "TextMarkType": "kbd",
"TextMarkTextContent": "/AI Chat" "TextMarkTextContent": "/AI Chat"
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": " to invoke the dialog box, enter a question or demand and confirm" "Data": " to call up the dialog box, enter a question or demand and confirm"
}
]
}
]
},
{
"ID": "20230308213723-la05np0",
"Type": "NodeListItem",
"ListData": {
"Typ": 1,
"Delimiter": 46,
"Marker": "NC4=",
"Num": 4
},
"Properties": {
"id": "20230308213723-la05np0",
"updated": "20230308213739"
},
"Children": [
{
"ID": "20230308213723-mjv4wg6",
"Type": "NodeParagraph",
"Properties": {
"id": "20230308213723-mjv4wg6",
"updated": "20230308213739"
},
"Children": [
{
"Type": "NodeText",
"Data": "You can also perform more operations through the block menu "
},
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "Artificial Intelligence"
},
{
"Type": "NodeText",
"Data": ""
} }
] ]
} }
@ -334,18 +419,14 @@
] ]
}, },
{ {
"ID": "20230304000646-cahbmm9", "ID": "20230308213723-50hrqrb",
"Type": "NodeHeading", "Type": "NodeHeading",
"HeadingLevel": 2, "HeadingLevel": 2,
"Properties": { "Properties": {
"id": "20230304000646-cahbmm9", "id": "20230308213723-50hrqrb",
"updated": "20230304000723" "updated": "20230308213745"
}, },
"Children": [ "Children": [
{
"Type": "NodeText",
"Data": ""
},
{ {
"Type": "NodeTextMark", "Type": "NodeTextMark",
"TextMarkType": "tag", "TextMarkType": "tag",
@ -358,65 +439,65 @@
] ]
}, },
{ {
"ID": "20230304000646-zgzs8kh", "ID": "20230308213723-ji4g66t",
"Type": "NodeList", "Type": "NodeList",
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20230304000646-zgzs8kh", "id": "20230308213723-ji4g66t",
"updated": "20230304000646" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000646-25xgeq6", "ID": "20230308213723-5vbcwdu",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"BulletChar": 42, "BulletChar": 42,
"Marker": "Kg==" "Marker": "Kg=="
}, },
"Properties": { "Properties": {
"id": "20230304000646-25xgeq6", "id": "20230308213723-5vbcwdu",
"updated": "20230304000646" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000646-wqg9ni0", "ID": "20230308213723-ekc7o7y",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000646-wqg9ni0", "id": "20230308213723-ekc7o7y",
"updated": "20230304000646" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "Text entered through this function dialog is sent to OpenAI" "Data": "This function will send the relevant text to OpenAI"
} }
] ]
} }
] ]
}, },
{ {
"ID": "20230304000646-m3ojnfs", "ID": "20230308213723-7su9wm3",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"BulletChar": 42, "BulletChar": 42,
"Marker": "Kg==" "Marker": "Kg=="
}, },
"Properties": { "Properties": {
"id": "20230304000646-m3ojnfs", "id": "20230308213723-7su9wm3",
"updated": "20230304000646" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000646-xpeou1e", "ID": "20230308213723-yb9xt3u",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000646-xpeou1e", "id": "20230308213723-yb9xt3u",
"updated": "20230304000646" "updated": "20230308213723"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "Using this function to call the OpenAI API will incur a certain fee" "Data": "There will be a fee for calling the OpenAI API"
} }
] ]
} }

View File

@ -5,7 +5,7 @@
"Properties": { "Properties": {
"id": "20230303235619-ex5l63e", "id": "20230303235619-ex5l63e",
"title": "人工智能", "title": "人工智能",
"updated": "20230305102554" "updated": "20230308213530"
}, },
"Children": [ "Children": [
{ {
@ -70,7 +70,7 @@
}, },
"Properties": { "Properties": {
"id": "20230303235749-kurfjky", "id": "20230303235749-kurfjky",
"updated": "20230305102554" "updated": "20230308213454"
}, },
"Children": [ "Children": [
{ {
@ -171,7 +171,7 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": " 指定 API Key必须" "Data": " 指定 API Key必须"
} }
] ]
} }
@ -208,7 +208,7 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": " 指定超时时间(秒),默认为 30 秒(可选)" "Data": " 指定超时时间(秒),默认为 30 秒(可选)"
} }
] ]
} }
@ -245,7 +245,7 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": " 指定代理,默认为空,即不使用代理(可选)" "Data": " 指定代理,默认为空,即不使用代理(可选)"
} }
] ]
} }
@ -282,11 +282,52 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": " 指定 tokens 数量,默认为 0即使用模型默认值" "Data": " 指定 tokens 数量,默认为 0即使用模型默认值可选"
}
]
}
]
},
{
"ID": "20230308213215-ichxvb3",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230308213215-ichxvb3"
},
"Children": [
{
"ID": "20230308213215-uyvki9p",
"Type": "NodeParagraph",
"Properties": {
"id": "20230308213215-uyvki9p",
"updated": "20230308213337"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "SIYUAN_OPENAI_API_BASE_URL"
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "(可选)" "Data": " 指定 API 服务端基础地址,默认为 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "https://api.openai.com/v1"
},
{
"Type": "NodeText",
"Data": "​(可选)"
} }
] ]
} }
@ -307,7 +348,7 @@
}, },
"Properties": { "Properties": {
"id": "20230303235958-fxi5kan", "id": "20230303235958-fxi5kan",
"updated": "20230304000517" "updated": "20230308213418"
}, },
"Children": [ "Children": [
{ {
@ -315,7 +356,7 @@
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230303235958-1ksxnm3", "id": "20230303235958-1ksxnm3",
"updated": "20230304000517" "updated": "20230308213418"
}, },
"Children": [ "Children": [
{ {
@ -324,12 +365,51 @@
}, },
{ {
"Type": "NodeTextMark", "Type": "NodeTextMark",
"TextMarkType": "code", "TextMarkType": "kbd",
"TextMarkTextContent": "/AI Chat" "TextMarkTextContent": "/AI Chat"
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": " 唤起对话框,输入提问或者需求后确认" "Data": " 唤起对话框,输入提问或者需求后确认"
}
]
}
]
},
{
"ID": "20230308213345-fid8dlp",
"Type": "NodeListItem",
"ListData": {
"Typ": 1,
"Delimiter": 46,
"Marker": "NC4=",
"Num": 4
},
"Properties": {
"id": "20230308213345-fid8dlp",
"updated": "20230308213454"
},
"Children": [
{
"ID": "20230308213345-qp2zzeg",
"Type": "NodeParagraph",
"Properties": {
"id": "20230308213345-qp2zzeg",
"updated": "20230308213454"
},
"Children": [
{
"Type": "NodeText",
"Data": "也可以通过块标菜单 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "人工智能"
},
{
"Type": "NodeText",
"Data": " 进行更多操作"
} }
] ]
} }
@ -367,7 +447,7 @@
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20230304000206-b18o0sx", "id": "20230304000206-b18o0sx",
"updated": "20230304000500" "updated": "20230308213530"
}, },
"Children": [ "Children": [
{ {
@ -378,7 +458,8 @@
"Marker": "Kg==" "Marker": "Kg=="
}, },
"Properties": { "Properties": {
"id": "20230304000230-nh7oris" "id": "20230304000230-nh7oris",
"updated": "20230308213519"
}, },
"Children": [ "Children": [
{ {
@ -386,12 +467,12 @@
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000230-ageb8a2", "id": "20230304000230-ageb8a2",
"updated": "20230304000300" "updated": "20230308213519"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "通过该功能对话框输入的文本会发送至 OpenAI" "Data": "该功能会将相关文本发送至 OpenAI"
} }
] ]
} }
@ -406,7 +487,7 @@
}, },
"Properties": { "Properties": {
"id": "20230304000207-89ot2j9", "id": "20230304000207-89ot2j9",
"updated": "20230304000500" "updated": "20230308213530"
}, },
"Children": [ "Children": [
{ {
@ -414,12 +495,12 @@
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000207-34w52pv", "id": "20230304000207-34w52pv",
"updated": "20230304000500" "updated": "20230308213530"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "使用该功能调用 OpenAI API 会产生一定费用" "Data": "调用 OpenAI API 会产生一定费用"
} }
] ]
} }

View File

@ -5,16 +5,16 @@
"Properties": { "Properties": {
"id": "20230304000829-9jwu3po", "id": "20230304000829-9jwu3po",
"title": "人工智能", "title": "人工智能",
"updated": "20230305102546" "updated": "20230308213648"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000837-o6ep7ny", "ID": "20230308213628-wj4dxxx",
"Type": "NodeHeading", "Type": "NodeHeading",
"HeadingLevel": 2, "HeadingLevel": 2,
"Properties": { "Properties": {
"id": "20230304000837-o6ep7ny", "id": "20230308213628-wj4dxxx",
"updated": "20230304000837" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
@ -24,11 +24,11 @@
] ]
}, },
{ {
"ID": "20230304000837-c7i5f98", "ID": "20230308213628-td1ykoz",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000837-c7i5f98", "id": "20230308213628-td1ykoz",
"updated": "20230304000837" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
@ -48,12 +48,12 @@
] ]
}, },
{ {
"ID": "20230304000837-0amynjf", "ID": "20230308213628-jlzf0ki",
"Type": "NodeHeading", "Type": "NodeHeading",
"HeadingLevel": 2, "HeadingLevel": 2,
"Properties": { "Properties": {
"id": "20230304000837-0amynjf", "id": "20230308213628-jlzf0ki",
"updated": "20230304000837" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
@ -63,18 +63,18 @@
] ]
}, },
{ {
"ID": "20230304000837-t0swnf6", "ID": "20230308213628-fkt9ihv",
"Type": "NodeList", "Type": "NodeList",
"ListData": { "ListData": {
"Typ": 1 "Typ": 1
}, },
"Properties": { "Properties": {
"id": "20230304000837-t0swnf6", "id": "20230308213628-fkt9ihv",
"updated": "20230305102546" "updated": "20230308213648"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000837-udv9xqz", "ID": "20230308213628-s9q9diq",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"Typ": 1, "Typ": 1,
@ -83,16 +83,16 @@
"Num": 1 "Num": 1
}, },
"Properties": { "Properties": {
"id": "20230304000837-udv9xqz", "id": "20230308213628-s9q9diq",
"updated": "20230304000837" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000837-8mb86a9", "ID": "20230308213628-q59kzpm",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000837-8mb86a9", "id": "20230308213628-q59kzpm",
"updated": "20230304000837" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
@ -104,7 +104,7 @@
] ]
}, },
{ {
"ID": "20230304000837-ktv65zx", "ID": "20230308213628-2bnvc4r",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"Typ": 1, "Typ": 1,
@ -113,16 +113,16 @@
"Num": 2 "Num": 2
}, },
"Properties": { "Properties": {
"id": "20230304000837-ktv65zx", "id": "20230308213628-2bnvc4r",
"updated": "20230305102546" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000837-rvncpuv", "ID": "20230308213628-m4d5rpm",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000837-rvncpuv", "id": "20230308213628-m4d5rpm",
"updated": "20230304000837" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
@ -132,32 +132,32 @@
] ]
}, },
{ {
"ID": "20230304000837-8z180b1", "ID": "20230308213628-qpozqny",
"Type": "NodeList", "Type": "NodeList",
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20230304000837-8z180b1", "id": "20230308213628-qpozqny",
"updated": "20230305102546" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000837-zwu0am4", "ID": "20230308213628-2vi7j3h",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"BulletChar": 42, "BulletChar": 42,
"Marker": "Kg==" "Marker": "Kg=="
}, },
"Properties": { "Properties": {
"id": "20230304000837-zwu0am4", "id": "20230308213628-2vi7j3h",
"updated": "20230304000837" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000837-mx4nbyd", "ID": "20230308213628-tmkbk2e",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000837-mx4nbyd", "id": "20230308213628-tmkbk2e",
"updated": "20230304000837" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
@ -178,23 +178,23 @@
] ]
}, },
{ {
"ID": "20230304000837-71slt0q", "ID": "20230308213628-1desi9f",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"BulletChar": 42, "BulletChar": 42,
"Marker": "Kg==" "Marker": "Kg=="
}, },
"Properties": { "Properties": {
"id": "20230304000837-71slt0q", "id": "20230308213628-1desi9f",
"updated": "20230305102546" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000837-t2um8y2", "ID": "20230308213628-sk97619",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000837-t2um8y2", "id": "20230308213628-sk97619",
"updated": "20230305102546" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
@ -215,23 +215,23 @@
] ]
}, },
{ {
"ID": "20230304000837-tk4s9l8", "ID": "20230308213628-4jq7xca",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"BulletChar": 42, "BulletChar": 42,
"Marker": "Kg==" "Marker": "Kg=="
}, },
"Properties": { "Properties": {
"id": "20230304000837-tk4s9l8", "id": "20230308213628-4jq7xca",
"updated": "20230304000837" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000837-bvv20rq", "ID": "20230308213628-k0f3rx6",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000837-bvv20rq", "id": "20230308213628-k0f3rx6",
"updated": "20230304000837" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
@ -252,23 +252,23 @@
] ]
}, },
{ {
"ID": "20230304000837-sd6h4qn", "ID": "20230308213628-hn7rn67",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"BulletChar": 42, "BulletChar": 42,
"Marker": "Kg==" "Marker": "Kg=="
}, },
"Properties": { "Properties": {
"id": "20230304000837-sd6h4qn", "id": "20230308213628-hn7rn67",
"updated": "20230304171553" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000837-y8kj8ki", "ID": "20230308213628-iqb8u0o",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000837-y8kj8ki", "id": "20230308213628-iqb8u0o",
"updated": "20230304171553" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
@ -282,7 +282,53 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": " 指定 tokens 數量,默認為 0即使用模型默認值可選" "Data": " 指定 tokens 數量,默認為 0即使用模型默認值可選"
}
]
}
]
},
{
"ID": "20230308213628-lt8tt00",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230308213628-lt8tt00",
"updated": "20230308213628"
},
"Children": [
{
"ID": "20230308213628-knxr1iu",
"Type": "NodeParagraph",
"Properties": {
"id": "20230308213628-knxr1iu",
"updated": "20230308213628"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "SIYUAN_OPENAI_API_BASE_URL"
},
{
"Type": "NodeText",
"Data": " 指定 API 服務端基礎地址,默認為 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "https://api.openai.com/v1"
},
{
"Type": "NodeText",
"Data": "​(可選)"
} }
] ]
} }
@ -293,7 +339,7 @@
] ]
}, },
{ {
"ID": "20230304000837-8aacttx", "ID": "20230308213628-x6hemjt",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"Typ": 1, "Typ": 1,
@ -302,16 +348,16 @@
"Num": 3 "Num": 3
}, },
"Properties": { "Properties": {
"id": "20230304000837-8aacttx", "id": "20230308213628-x6hemjt",
"updated": "20230304000837" "updated": "20230308213642"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000837-xsmvy3a", "ID": "20230308213628-hqonun0",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000837-xsmvy3a", "id": "20230308213628-hqonun0",
"updated": "20230304000837" "updated": "20230308213642"
}, },
"Children": [ "Children": [
{ {
@ -320,7 +366,7 @@
}, },
{ {
"Type": "NodeTextMark", "Type": "NodeTextMark",
"TextMarkType": "code", "TextMarkType": "kbd",
"TextMarkTextContent": "/AI Chat" "TextMarkTextContent": "/AI Chat"
}, },
{ {
@ -330,22 +376,57 @@
] ]
} }
] ]
},
{
"ID": "20230308213628-yjr823g",
"Type": "NodeListItem",
"ListData": {
"Typ": 1,
"Delimiter": 46,
"Marker": "NC4=",
"Num": 4
},
"Properties": {
"id": "20230308213628-yjr823g",
"updated": "20230308213648"
},
"Children": [
{
"ID": "20230308213628-14mj10g",
"Type": "NodeParagraph",
"Properties": {
"id": "20230308213628-14mj10g",
"updated": "20230308213648"
},
"Children": [
{
"Type": "NodeText",
"Data": "也可以通過塊標菜單 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "人工智能"
},
{
"Type": "NodeText",
"Data": " 進行更多操作"
}
]
}
]
} }
] ]
}, },
{ {
"ID": "20230304000837-507o2cp", "ID": "20230308213628-72djdf5",
"Type": "NodeHeading", "Type": "NodeHeading",
"HeadingLevel": 2, "HeadingLevel": 2,
"Properties": { "Properties": {
"id": "20230304000837-507o2cp", "id": "20230308213628-72djdf5",
"updated": "20230304000912" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{
"Type": "NodeText",
"Data": ""
},
{ {
"Type": "NodeTextMark", "Type": "NodeTextMark",
"TextMarkType": "tag", "TextMarkType": "tag",
@ -358,65 +439,65 @@
] ]
}, },
{ {
"ID": "20230304000837-16zrrs8", "ID": "20230308213628-wrvk8y7",
"Type": "NodeList", "Type": "NodeList",
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20230304000837-16zrrs8", "id": "20230308213628-wrvk8y7",
"updated": "20230304000837" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000837-2pmo4r2", "ID": "20230308213628-1vdivab",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"BulletChar": 42, "BulletChar": 42,
"Marker": "Kg==" "Marker": "Kg=="
}, },
"Properties": { "Properties": {
"id": "20230304000837-2pmo4r2", "id": "20230308213628-1vdivab",
"updated": "20230304000837" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000837-olsbuqw", "ID": "20230308213628-7s4csia",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000837-olsbuqw", "id": "20230308213628-7s4csia",
"updated": "20230304000837" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "通過該功能對話框輸入的文本會發送至 OpenAI" "Data": "該功能會將相關文本發送至 OpenAI"
} }
] ]
} }
] ]
}, },
{ {
"ID": "20230304000837-ma9tqg8", "ID": "20230308213628-1y4ugxr",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"BulletChar": 42, "BulletChar": 42,
"Marker": "Kg==" "Marker": "Kg=="
}, },
"Properties": { "Properties": {
"id": "20230304000837-ma9tqg8", "id": "20230308213628-1y4ugxr",
"updated": "20230304000837" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
"ID": "20230304000837-1n86ajy", "ID": "20230308213628-mjreimk",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20230304000837-1n86ajy", "id": "20230308213628-mjreimk",
"updated": "20230304000837" "updated": "20230308213628"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "使用該功能調用 OpenAI API 會產生一定費用" "Data": "調用 OpenAI API 會產生一定費用"
} }
] ]
} }

View File

@ -22,6 +22,7 @@ import (
"github.com/88250/lute/ast" "github.com/88250/lute/ast"
"github.com/88250/lute/parse" "github.com/88250/lute/parse"
gogpt "github.com/sashabaranov/go-gpt3"
"github.com/siyuan-note/siyuan/kernel/treenode" "github.com/siyuan-note/siyuan/kernel/treenode"
"github.com/siyuan-note/siyuan/kernel/util" "github.com/siyuan-note/siyuan/kernel/util"
) )
@ -47,18 +48,24 @@ func ChatGPTWithAction(ids []string, action string) (ret string) {
var cachedContextMsg []string var cachedContextMsg []string
func chatGPT(msg string, cloud bool) (ret string) { func chatGPT(msg string, cloud bool) (ret string) {
ret, retCtxMsgs := chatGPTContinueWrite(msg, cachedContextMsg, cloud) ret, retCtxMsgs, err := chatGPTContinueWrite(msg, cachedContextMsg, cloud)
if nil != err {
return
}
cachedContextMsg = append(cachedContextMsg, retCtxMsgs...) cachedContextMsg = append(cachedContextMsg, retCtxMsgs...)
return return
} }
func chatGPTWithAction(msg string, action string, cloud bool) (ret string) { func chatGPTWithAction(msg string, action string, cloud bool) (ret string) {
msg = action + ":\n\n" + msg msg = action + ":\n\n" + msg
ret, _ = chatGPTContinueWrite(msg, nil, cloud) ret, _, err := chatGPTContinueWrite(msg, nil, cloud)
if nil != err {
return
}
return return
} }
func chatGPTContinueWrite(msg string, contextMsgs []string, cloud bool) (ret string, retContextMsgs []string) { func chatGPTContinueWrite(msg string, contextMsgs []string, cloud bool) (ret string, retContextMsgs []string, err error) {
util.PushEndlessProgress("Requesting...") util.PushEndlessProgress("Requesting...")
defer util.ClearPushProgress(100) defer util.ClearPushProgress(100)
@ -66,19 +73,19 @@ func chatGPTContinueWrite(msg string, contextMsgs []string, cloud bool) (ret str
contextMsgs = contextMsgs[len(contextMsgs)-7:] contextMsgs = contextMsgs[len(contextMsgs)-7:]
} }
c := util.NewOpenAIClient() var gpt GPT
if cloud {
gpt = &CloudGPT{}
} else {
gpt = &OpenAIGPT{c: util.NewOpenAIClient()}
}
buf := &bytes.Buffer{} buf := &bytes.Buffer{}
for i := 0; i < 7; i++ { for i := 0; i < 7; i++ {
var part string part, stop, chatErr := gpt.chat(msg, contextMsgs)
var stop bool
if cloud {
part, stop = CloudChatGPT(msg, contextMsgs)
} else {
part, stop = util.ChatGPT(msg, contextMsgs, c)
}
buf.WriteString(part) buf.WriteString(part)
if stop { if stop || nil != chatErr {
break break
} }
@ -138,3 +145,22 @@ func getBlocksContent(ids []string) string {
} }
return buf.String() return buf.String()
} }
type GPT interface {
chat(msg string, contextMsgs []string) (partRet string, stop bool, err error)
}
type OpenAIGPT struct {
c *gogpt.Client
}
func (gpt *OpenAIGPT) chat(msg string, contextMsgs []string) (partRet string, stop bool, err error) {
return util.ChatGPT(msg, contextMsgs, gpt.c)
}
type CloudGPT struct {
}
func (gpt *CloudGPT) chat(msg string, contextMsgs []string) (partRet string, stop bool, err error) {
return CloudChatGPT(msg, contextMsgs)
}

View File

@ -36,7 +36,7 @@ import (
var ErrFailedToConnectCloudServer = errors.New("failed to connect cloud server") var ErrFailedToConnectCloudServer = errors.New("failed to connect cloud server")
func CloudChatGPT(msg string, contextMsgs []string) (ret string, stop bool) { func CloudChatGPT(msg string, contextMsgs []string) (ret string, stop bool, err error) {
if nil == Conf.User { if nil == Conf.User {
return return
} }
@ -57,7 +57,7 @@ func CloudChatGPT(msg string, contextMsgs []string) (ret string, stop bool) {
requestResult := gulu.Ret.NewResult() requestResult := gulu.Ret.NewResult()
request := httpclient.NewCloudRequest30s() request := httpclient.NewCloudRequest30s()
_, err := request. _, err = request.
SetSuccessResult(requestResult). SetSuccessResult(requestResult).
SetCookies(&http.Cookie{Name: "symphony", Value: Conf.User.UserToken}). SetCookies(&http.Cookie{Name: "symphony", Value: Conf.User.UserToken}).
SetBody(payload). SetBody(payload).

View File

@ -37,7 +37,7 @@ var (
OpenAIAPIBaseURL = "https://api.openai.com/v1" OpenAIAPIBaseURL = "https://api.openai.com/v1"
) )
func ChatGPT(msg string, contextMsgs []string, c *gogpt.Client) (ret string, stop bool) { func ChatGPT(msg string, contextMsgs []string, c *gogpt.Client) (ret string, stop bool, err error) {
var reqMsgs []gogpt.ChatCompletionMessage var reqMsgs []gogpt.ChatCompletionMessage
for _, ctxMsg := range contextMsgs { for _, ctxMsg := range contextMsgs {