From 21b7024ff193d76f9babbf937b7f54f9606307c6 Mon Sep 17 00:00:00 2001 From: XiaoXiaoJiangYun <33343036+XiaoXiaoJiangYun@users.noreply.github.com> Date: Fri, 10 Nov 2023 16:32:56 +0800 Subject: [PATCH 1/2] Update python_replacement.js to fix first run prompts library If you are first time to run prompts library, you will always use temple because you didn't have file in the uxp storage DataFolder. --- utility/sdapi/python_replacement.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utility/sdapi/python_replacement.js b/utility/sdapi/python_replacement.js index c16524b..5fb0852 100644 --- a/utility/sdapi/python_replacement.js +++ b/utility/sdapi/python_replacement.js @@ -393,6 +393,12 @@ async function loadPromptShortcut(file_name) { return json } } catch (e) { + const file = await folder.createFile('prompt_shortcut.json', {type: storage.types.file, overwrite: true}); + if (file.isFile) { + await file.write('{}', {append: false}); + data = {}; + return file; + } console.warn(e) return {} } From 0d06ed6ad3a97b6b543188fe79b295d8112877fd Mon Sep 17 00:00:00 2001 From: Abdullah Alfaraj <7842232+AbdullahAlfaraj@users.noreply.github.com> Date: Wed, 29 Nov 2023 08:41:20 +0300 Subject: [PATCH 2/2] Return the data instead of the file --- utility/sdapi/python_replacement.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utility/sdapi/python_replacement.js b/utility/sdapi/python_replacement.js index 5fb0852..f3bca02 100644 --- a/utility/sdapi/python_replacement.js +++ b/utility/sdapi/python_replacement.js @@ -397,7 +397,7 @@ async function loadPromptShortcut(file_name) { if (file.isFile) { await file.write('{}', {append: false}); data = {}; - return file; + return data } console.warn(e) return {}