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",
"aiTranslate": "Translate",
"aiExtractSummary": "Extract summary",

View File

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

View File

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

View File

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

View File

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

View File

@ -5,16 +5,16 @@
"Properties": {
"id": "20230304000547-ibldj1z",
"title": "Artificial Intelligence",
"updated": "20230305102525"
"updated": "20230308213745"
},
"Children": [
{
"ID": "20230304000646-2lycahn",
"ID": "20230308213723-d3esro1",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20230304000646-2lycahn",
"updated": "20230304000646"
"id": "20230308213723-d3esro1",
"updated": "20230308213723"
},
"Children": [
{
@ -24,11 +24,11 @@
]
},
{
"ID": "20230304000646-g8eokbs",
"ID": "20230308213723-q8a5kbd",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000646-g8eokbs",
"updated": "20230304000646"
"id": "20230308213723-q8a5kbd",
"updated": "20230308213723"
},
"Children": [
{
@ -48,12 +48,12 @@
]
},
{
"ID": "20230304000646-ampo9ng",
"ID": "20230308213723-gznor89",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20230304000646-ampo9ng",
"updated": "20230304000646"
"id": "20230308213723-gznor89",
"updated": "20230308213723"
},
"Children": [
{
@ -63,18 +63,18 @@
]
},
{
"ID": "20230304000646-a5e7srt",
"ID": "20230308213723-r46h6mw",
"Type": "NodeList",
"ListData": {
"Typ": 1
},
"Properties": {
"id": "20230304000646-a5e7srt",
"updated": "20230305102525"
"id": "20230308213723-r46h6mw",
"updated": "20230308213739"
},
"Children": [
{
"ID": "20230304000646-0aseguf",
"ID": "20230308213723-9yri7ka",
"Type": "NodeListItem",
"ListData": {
"Typ": 1,
@ -83,16 +83,16 @@
"Num": 1
},
"Properties": {
"id": "20230304000646-0aseguf",
"updated": "20230304000646"
"id": "20230308213723-9yri7ka",
"updated": "20230308213723"
},
"Children": [
{
"ID": "20230304000646-z4uyi78",
"ID": "20230308213723-wgq5x45",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000646-z4uyi78",
"updated": "20230304000646"
"id": "20230308213723-wgq5x45",
"updated": "20230308213723"
},
"Children": [
{
@ -104,7 +104,7 @@
]
},
{
"ID": "20230304000646-6207b6r",
"ID": "20230308213723-obctww8",
"Type": "NodeListItem",
"ListData": {
"Typ": 1,
@ -113,16 +113,16 @@
"Num": 2
},
"Properties": {
"id": "20230304000646-6207b6r",
"updated": "20230305102525"
"id": "20230308213723-obctww8",
"updated": "20230308213723"
},
"Children": [
{
"ID": "20230304000646-t8nos3j",
"ID": "20230308213723-rerhr3p",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000646-t8nos3j",
"updated": "20230304000646"
"id": "20230308213723-rerhr3p",
"updated": "20230308213723"
},
"Children": [
{
@ -132,32 +132,32 @@
]
},
{
"ID": "20230304000646-aj5szch",
"ID": "20230308213723-pyed7a2",
"Type": "NodeList",
"ListData": {},
"Properties": {
"id": "20230304000646-aj5szch",
"updated": "20230305102525"
"id": "20230308213723-pyed7a2",
"updated": "20230308213723"
},
"Children": [
{
"ID": "20230304000646-po7r7lt",
"ID": "20230308213723-lakya6i",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230304000646-po7r7lt",
"updated": "20230304000646"
"id": "20230308213723-lakya6i",
"updated": "20230308213723"
},
"Children": [
{
"ID": "20230304000646-nxfk9qb",
"ID": "20230308213723-2sruo2o",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000646-nxfk9qb",
"updated": "20230304000646"
"id": "20230308213723-2sruo2o",
"updated": "20230308213723"
},
"Children": [
{
@ -178,23 +178,23 @@
]
},
{
"ID": "20230304000646-78w2ck5",
"ID": "20230308213723-5vfosvz",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230304000646-78w2ck5",
"updated": "20230305102525"
"id": "20230308213723-5vfosvz",
"updated": "20230308213723"
},
"Children": [
{
"ID": "20230304000646-2blt9e0",
"ID": "20230308213723-cxomjan",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000646-2blt9e0",
"updated": "20230305102525"
"id": "20230308213723-cxomjan",
"updated": "20230308213723"
},
"Children": [
{
@ -215,23 +215,23 @@
]
},
{
"ID": "20230304000646-zrv15q4",
"ID": "20230308213723-fj3oskr",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230304000646-zrv15q4",
"updated": "20230304000646"
"id": "20230308213723-fj3oskr",
"updated": "20230308213723"
},
"Children": [
{
"ID": "20230304000646-m2luurq",
"ID": "20230308213723-pvngelo",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000646-m2luurq",
"updated": "20230304000646"
"id": "20230308213723-pvngelo",
"updated": "20230308213723"
},
"Children": [
{
@ -252,23 +252,23 @@
]
},
{
"ID": "20230304000646-8swnrqn",
"ID": "20230308213723-objm7mx",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230304000646-8swnrqn",
"updated": "20230304171533"
"id": "20230308213723-objm7mx",
"updated": "20230308213723"
},
"Children": [
{
"ID": "20230304000646-33hvl2k",
"ID": "20230308213723-x64pmnz",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000646-33hvl2k",
"updated": "20230304171533"
"id": "20230308213723-x64pmnz",
"updated": "20230308213723"
},
"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",
"ListData": {
"Typ": 1,
@ -302,16 +348,16 @@
"Num": 3
},
"Properties": {
"id": "20230304000646-pyi5cq7",
"updated": "20230304000646"
"id": "20230308213723-5m7aqfs",
"updated": "20230308213730"
},
"Children": [
{
"ID": "20230304000646-jscziux",
"ID": "20230308213723-i5y2zf5",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000646-jscziux",
"updated": "20230304000646"
"id": "20230308213723-i5y2zf5",
"updated": "20230308213730"
},
"Children": [
{
@ -320,12 +366,51 @@
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkType": "kbd",
"TextMarkTextContent": "/AI Chat"
},
{
"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",
"HeadingLevel": 2,
"Properties": {
"id": "20230304000646-cahbmm9",
"updated": "20230304000723"
"id": "20230308213723-50hrqrb",
"updated": "20230308213745"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "tag",
@ -358,65 +439,65 @@
]
},
{
"ID": "20230304000646-zgzs8kh",
"ID": "20230308213723-ji4g66t",
"Type": "NodeList",
"ListData": {},
"Properties": {
"id": "20230304000646-zgzs8kh",
"updated": "20230304000646"
"id": "20230308213723-ji4g66t",
"updated": "20230308213723"
},
"Children": [
{
"ID": "20230304000646-25xgeq6",
"ID": "20230308213723-5vbcwdu",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230304000646-25xgeq6",
"updated": "20230304000646"
"id": "20230308213723-5vbcwdu",
"updated": "20230308213723"
},
"Children": [
{
"ID": "20230304000646-wqg9ni0",
"ID": "20230308213723-ekc7o7y",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000646-wqg9ni0",
"updated": "20230304000646"
"id": "20230308213723-ekc7o7y",
"updated": "20230308213723"
},
"Children": [
{
"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",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230304000646-m3ojnfs",
"updated": "20230304000646"
"id": "20230308213723-7su9wm3",
"updated": "20230308213723"
},
"Children": [
{
"ID": "20230304000646-xpeou1e",
"ID": "20230308213723-yb9xt3u",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000646-xpeou1e",
"updated": "20230304000646"
"id": "20230308213723-yb9xt3u",
"updated": "20230308213723"
},
"Children": [
{
"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": {
"id": "20230303235619-ex5l63e",
"title": "人工智能",
"updated": "20230305102554"
"updated": "20230308213530"
},
"Children": [
{
@ -70,7 +70,7 @@
},
"Properties": {
"id": "20230303235749-kurfjky",
"updated": "20230305102554"
"updated": "20230308213454"
},
"Children": [
{
@ -171,7 +171,7 @@
},
{
"Type": "NodeText",
"Data": " 指定 API Key必须"
"Data": " 指定 API Key必须"
}
]
}
@ -208,7 +208,7 @@
},
{
"Type": "NodeText",
"Data": " 指定超时时间(秒),默认为 30 秒(可选)"
"Data": " 指定超时时间(秒),默认为 30 秒(可选)"
}
]
}
@ -245,7 +245,7 @@
},
{
"Type": "NodeText",
"Data": " 指定代理,默认为空,即不使用代理(可选)"
"Data": " 指定代理,默认为空,即不使用代理(可选)"
}
]
}
@ -282,11 +282,52 @@
},
{
"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",
"Data": "(可选)"
"Data": " 指定 API 服务端基础地址,默认为 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "https://api.openai.com/v1"
},
{
"Type": "NodeText",
"Data": "​(可选)"
}
]
}
@ -307,7 +348,7 @@
},
"Properties": {
"id": "20230303235958-fxi5kan",
"updated": "20230304000517"
"updated": "20230308213418"
},
"Children": [
{
@ -315,7 +356,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20230303235958-1ksxnm3",
"updated": "20230304000517"
"updated": "20230308213418"
},
"Children": [
{
@ -324,12 +365,51 @@
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkType": "kbd",
"TextMarkTextContent": "/AI Chat"
},
{
"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": {},
"Properties": {
"id": "20230304000206-b18o0sx",
"updated": "20230304000500"
"updated": "20230308213530"
},
"Children": [
{
@ -378,7 +458,8 @@
"Marker": "Kg=="
},
"Properties": {
"id": "20230304000230-nh7oris"
"id": "20230304000230-nh7oris",
"updated": "20230308213519"
},
"Children": [
{
@ -386,12 +467,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000230-ageb8a2",
"updated": "20230304000300"
"updated": "20230308213519"
},
"Children": [
{
"Type": "NodeText",
"Data": "通过该功能对话框输入的文本会发送至 OpenAI"
"Data": "该功能会将相关文本发送至 OpenAI"
}
]
}
@ -406,7 +487,7 @@
},
"Properties": {
"id": "20230304000207-89ot2j9",
"updated": "20230304000500"
"updated": "20230308213530"
},
"Children": [
{
@ -414,12 +495,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000207-34w52pv",
"updated": "20230304000500"
"updated": "20230308213530"
},
"Children": [
{
"Type": "NodeText",
"Data": "使用该功能调用 OpenAI API 会产生一定费用"
"Data": "调用 OpenAI API 会产生一定费用"
}
]
}

View File

@ -5,16 +5,16 @@
"Properties": {
"id": "20230304000829-9jwu3po",
"title": "人工智能",
"updated": "20230305102546"
"updated": "20230308213648"
},
"Children": [
{
"ID": "20230304000837-o6ep7ny",
"ID": "20230308213628-wj4dxxx",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20230304000837-o6ep7ny",
"updated": "20230304000837"
"id": "20230308213628-wj4dxxx",
"updated": "20230308213628"
},
"Children": [
{
@ -24,11 +24,11 @@
]
},
{
"ID": "20230304000837-c7i5f98",
"ID": "20230308213628-td1ykoz",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000837-c7i5f98",
"updated": "20230304000837"
"id": "20230308213628-td1ykoz",
"updated": "20230308213628"
},
"Children": [
{
@ -48,12 +48,12 @@
]
},
{
"ID": "20230304000837-0amynjf",
"ID": "20230308213628-jlzf0ki",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20230304000837-0amynjf",
"updated": "20230304000837"
"id": "20230308213628-jlzf0ki",
"updated": "20230308213628"
},
"Children": [
{
@ -63,18 +63,18 @@
]
},
{
"ID": "20230304000837-t0swnf6",
"ID": "20230308213628-fkt9ihv",
"Type": "NodeList",
"ListData": {
"Typ": 1
},
"Properties": {
"id": "20230304000837-t0swnf6",
"updated": "20230305102546"
"id": "20230308213628-fkt9ihv",
"updated": "20230308213648"
},
"Children": [
{
"ID": "20230304000837-udv9xqz",
"ID": "20230308213628-s9q9diq",
"Type": "NodeListItem",
"ListData": {
"Typ": 1,
@ -83,16 +83,16 @@
"Num": 1
},
"Properties": {
"id": "20230304000837-udv9xqz",
"updated": "20230304000837"
"id": "20230308213628-s9q9diq",
"updated": "20230308213628"
},
"Children": [
{
"ID": "20230304000837-8mb86a9",
"ID": "20230308213628-q59kzpm",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000837-8mb86a9",
"updated": "20230304000837"
"id": "20230308213628-q59kzpm",
"updated": "20230308213628"
},
"Children": [
{
@ -104,7 +104,7 @@
]
},
{
"ID": "20230304000837-ktv65zx",
"ID": "20230308213628-2bnvc4r",
"Type": "NodeListItem",
"ListData": {
"Typ": 1,
@ -113,16 +113,16 @@
"Num": 2
},
"Properties": {
"id": "20230304000837-ktv65zx",
"updated": "20230305102546"
"id": "20230308213628-2bnvc4r",
"updated": "20230308213628"
},
"Children": [
{
"ID": "20230304000837-rvncpuv",
"ID": "20230308213628-m4d5rpm",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000837-rvncpuv",
"updated": "20230304000837"
"id": "20230308213628-m4d5rpm",
"updated": "20230308213628"
},
"Children": [
{
@ -132,32 +132,32 @@
]
},
{
"ID": "20230304000837-8z180b1",
"ID": "20230308213628-qpozqny",
"Type": "NodeList",
"ListData": {},
"Properties": {
"id": "20230304000837-8z180b1",
"updated": "20230305102546"
"id": "20230308213628-qpozqny",
"updated": "20230308213628"
},
"Children": [
{
"ID": "20230304000837-zwu0am4",
"ID": "20230308213628-2vi7j3h",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230304000837-zwu0am4",
"updated": "20230304000837"
"id": "20230308213628-2vi7j3h",
"updated": "20230308213628"
},
"Children": [
{
"ID": "20230304000837-mx4nbyd",
"ID": "20230308213628-tmkbk2e",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000837-mx4nbyd",
"updated": "20230304000837"
"id": "20230308213628-tmkbk2e",
"updated": "20230308213628"
},
"Children": [
{
@ -178,23 +178,23 @@
]
},
{
"ID": "20230304000837-71slt0q",
"ID": "20230308213628-1desi9f",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230304000837-71slt0q",
"updated": "20230305102546"
"id": "20230308213628-1desi9f",
"updated": "20230308213628"
},
"Children": [
{
"ID": "20230304000837-t2um8y2",
"ID": "20230308213628-sk97619",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000837-t2um8y2",
"updated": "20230305102546"
"id": "20230308213628-sk97619",
"updated": "20230308213628"
},
"Children": [
{
@ -215,23 +215,23 @@
]
},
{
"ID": "20230304000837-tk4s9l8",
"ID": "20230308213628-4jq7xca",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230304000837-tk4s9l8",
"updated": "20230304000837"
"id": "20230308213628-4jq7xca",
"updated": "20230308213628"
},
"Children": [
{
"ID": "20230304000837-bvv20rq",
"ID": "20230308213628-k0f3rx6",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000837-bvv20rq",
"updated": "20230304000837"
"id": "20230308213628-k0f3rx6",
"updated": "20230308213628"
},
"Children": [
{
@ -252,23 +252,23 @@
]
},
{
"ID": "20230304000837-sd6h4qn",
"ID": "20230308213628-hn7rn67",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230304000837-sd6h4qn",
"updated": "20230304171553"
"id": "20230308213628-hn7rn67",
"updated": "20230308213628"
},
"Children": [
{
"ID": "20230304000837-y8kj8ki",
"ID": "20230308213628-iqb8u0o",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000837-y8kj8ki",
"updated": "20230304171553"
"id": "20230308213628-iqb8u0o",
"updated": "20230308213628"
},
"Children": [
{
@ -282,7 +282,53 @@
},
{
"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",
"ListData": {
"Typ": 1,
@ -302,16 +348,16 @@
"Num": 3
},
"Properties": {
"id": "20230304000837-8aacttx",
"updated": "20230304000837"
"id": "20230308213628-x6hemjt",
"updated": "20230308213642"
},
"Children": [
{
"ID": "20230304000837-xsmvy3a",
"ID": "20230308213628-hqonun0",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000837-xsmvy3a",
"updated": "20230304000837"
"id": "20230308213628-hqonun0",
"updated": "20230308213642"
},
"Children": [
{
@ -320,7 +366,7 @@
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkType": "kbd",
"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",
"HeadingLevel": 2,
"Properties": {
"id": "20230304000837-507o2cp",
"updated": "20230304000912"
"id": "20230308213628-72djdf5",
"updated": "20230308213628"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "tag",
@ -358,65 +439,65 @@
]
},
{
"ID": "20230304000837-16zrrs8",
"ID": "20230308213628-wrvk8y7",
"Type": "NodeList",
"ListData": {},
"Properties": {
"id": "20230304000837-16zrrs8",
"updated": "20230304000837"
"id": "20230308213628-wrvk8y7",
"updated": "20230308213628"
},
"Children": [
{
"ID": "20230304000837-2pmo4r2",
"ID": "20230308213628-1vdivab",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230304000837-2pmo4r2",
"updated": "20230304000837"
"id": "20230308213628-1vdivab",
"updated": "20230308213628"
},
"Children": [
{
"ID": "20230304000837-olsbuqw",
"ID": "20230308213628-7s4csia",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000837-olsbuqw",
"updated": "20230304000837"
"id": "20230308213628-7s4csia",
"updated": "20230308213628"
},
"Children": [
{
"Type": "NodeText",
"Data": "通過該功能對話框輸入的文本會發送至 OpenAI"
"Data": "該功能會將相關文本發送至 OpenAI"
}
]
}
]
},
{
"ID": "20230304000837-ma9tqg8",
"ID": "20230308213628-1y4ugxr",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230304000837-ma9tqg8",
"updated": "20230304000837"
"id": "20230308213628-1y4ugxr",
"updated": "20230308213628"
},
"Children": [
{
"ID": "20230304000837-1n86ajy",
"ID": "20230308213628-mjreimk",
"Type": "NodeParagraph",
"Properties": {
"id": "20230304000837-1n86ajy",
"updated": "20230304000837"
"id": "20230308213628-mjreimk",
"updated": "20230308213628"
},
"Children": [
{
"Type": "NodeText",
"Data": "使用該功能調用 OpenAI API 會產生一定費用"
"Data": "調用 OpenAI API 會產生一定費用"
}
]
}

View File

@ -22,6 +22,7 @@ import (
"github.com/88250/lute/ast"
"github.com/88250/lute/parse"
gogpt "github.com/sashabaranov/go-gpt3"
"github.com/siyuan-note/siyuan/kernel/treenode"
"github.com/siyuan-note/siyuan/kernel/util"
)
@ -47,18 +48,24 @@ func ChatGPTWithAction(ids []string, action string) (ret string) {
var cachedContextMsg []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...)
return
}
func chatGPTWithAction(msg string, action string, cloud bool) (ret string) {
msg = action + ":\n\n" + msg
ret, _ = chatGPTContinueWrite(msg, nil, cloud)
ret, _, err := chatGPTContinueWrite(msg, nil, cloud)
if nil != err {
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...")
defer util.ClearPushProgress(100)
@ -66,19 +73,19 @@ func chatGPTContinueWrite(msg string, contextMsgs []string, cloud bool) (ret str
contextMsgs = contextMsgs[len(contextMsgs)-7:]
}
c := util.NewOpenAIClient()
var gpt GPT
if cloud {
gpt = &CloudGPT{}
} else {
gpt = &OpenAIGPT{c: util.NewOpenAIClient()}
}
buf := &bytes.Buffer{}
for i := 0; i < 7; i++ {
var part string
var stop bool
if cloud {
part, stop = CloudChatGPT(msg, contextMsgs)
} else {
part, stop = util.ChatGPT(msg, contextMsgs, c)
}
part, stop, chatErr := gpt.chat(msg, contextMsgs)
buf.WriteString(part)
if stop {
if stop || nil != chatErr {
break
}
@ -138,3 +145,22 @@ func getBlocksContent(ids []string) 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")
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 {
return
}
@ -57,7 +57,7 @@ func CloudChatGPT(msg string, contextMsgs []string) (ret string, stop bool) {
requestResult := gulu.Ret.NewResult()
request := httpclient.NewCloudRequest30s()
_, err := request.
_, err = request.
SetSuccessResult(requestResult).
SetCookies(&http.Cookie{Name: "symphony", Value: Conf.User.UserToken}).
SetBody(payload).

View File

@ -37,7 +37,7 @@ var (
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
for _, ctxMsg := range contextMsgs {