From 0b2f58105266d337864c0e8a00d513cffeb35f80 Mon Sep 17 00:00:00 2001 From: terwer Date: Tue, 10 Dec 2024 21:22:56 +0800 Subject: [PATCH 1/3] chore(main): release siyuan-plugin-publisher 1.30.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 15 ++++++++++++++- package.json | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 42777a82..35c30adc 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.29.3" + ".": "1.30.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cce67b2..82a4d44d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [1.30.0](https://github.com/terwer/siyuan-plugin-publisher/compare/siyuan-plugin-publisher-v1.29.3...siyuan-plugin-publisher-v1.30.0) (2024-12-10) + + +### Features + +* add prompt manage for ai && fix ai bugs ([ff884e0](https://github.com/terwer/siyuan-plugin-publisher/commit/ff884e0fd8189bb1cae7666b304ffad07baa888f)) +* fix ai bugs ([41bd058](https://github.com/terwer/siyuan-plugin-publisher/commit/41bd058d63353644e0a77d3b9e24ce88960210ed)) + + +### Miscellaneous + +* fix types ([61637b2](https://github.com/terwer/siyuan-plugin-publisher/commit/61637b2f00cef0383c46057a0a1d8783c6141dfd)) + ## [1.29.3](https://github.com/terwer/siyuan-plugin-publisher/compare/siyuan-plugin-publisher-v1.29.2...siyuan-plugin-publisher-v1.29.3) (2024-12-03) ### Bug Fixes * [#1502](https://github.com/terwer/siyuan-plugin-publisher/issues/1502) image replace error in some cases ([fdf0d9e](https://github.com/terwer/siyuan-plugin-publisher/commit/fdf0d9e56d485fe4dcca200cdeefe8bc5ac174da)) @@ -648,4 +661,4 @@ * **deps-dev:** bump vite-plugin-static-copy from 0.16.0 to 0.17.0 ([feea39d](https://github.com/terwer/siyuan-plugin-publisher/commit/feea39d39bff74051fe0d68153b0628b00bff53f)) * **deps-dev:** bump vitest from 0.32.4 to 0.33.0 ([f2ce507](https://github.com/terwer/siyuan-plugin-publisher/commit/f2ce507ea537601d7dba21de84524274ec1cbee4)) * release 0.8.0 ([29336cd](https://github.com/terwer/siyuan-plugin-publisher/commit/29336cd847064971bc842e44aee75a8e90c226a8)) -* 优化构建流程 ([f4aeea1](https://github.com/terwer/siyuan-plugin-publisher/commit/f4aeea1c618638a7774105a87b3e690d6d5d3927)) \ No newline at end of file +* 优化构建流程 ([f4aeea1](https://github.com/terwer/siyuan-plugin-publisher/commit/f4aeea1c618638a7774105a87b3e690d6d5d3927)) diff --git a/package.json b/package.json index 71528ef2..e17213b4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "siyuan-plugin-publisher", - "version": "1.29.3", + "version": "1.30.0", "description": "Publish articles from Siyuan Notes to platforms such as Yuque, Notion, Cnblogs, WordPress, Typecho, Hexo, Zhihu and more", "repository": "terwer/siyuan-plugin-publisher", "homepage": "https://github.com/terwer/siyuan-plugin-publisher", From 73a5b6988a336073a10318b4ca3ada63b388d79b Mon Sep 17 00:00:00 2001 From: terwer Date: Tue, 10 Dec 2024 21:26:08 +0800 Subject: [PATCH 2/3] feat: fix ai bugs --- CHANGELOG.md | 11 +---------- plugin.json | 2 +- src/extensions/manifest.json | 2 +- src/extensions/mv2/manifest-v2-for-firefox.json | 2 +- src/pages/AiChat.vue | 5 +++-- widget.json | 2 +- 6 files changed, 8 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82a4d44d..fb4a9368 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,29 +1,20 @@ # Changelog ## [1.30.0](https://github.com/terwer/siyuan-plugin-publisher/compare/siyuan-plugin-publisher-v1.29.3...siyuan-plugin-publisher-v1.30.0) (2024-12-10) - - ### Features - * add prompt manage for ai && fix ai bugs ([ff884e0](https://github.com/terwer/siyuan-plugin-publisher/commit/ff884e0fd8189bb1cae7666b304ffad07baa888f)) * fix ai bugs ([41bd058](https://github.com/terwer/siyuan-plugin-publisher/commit/41bd058d63353644e0a77d3b9e24ce88960210ed)) - - ### Miscellaneous - * fix types ([61637b2](https://github.com/terwer/siyuan-plugin-publisher/commit/61637b2f00cef0383c46057a0a1d8783c6141dfd)) - ## [1.29.3](https://github.com/terwer/siyuan-plugin-publisher/compare/siyuan-plugin-publisher-v1.29.2...siyuan-plugin-publisher-v1.29.3) (2024-12-03) ### Bug Fixes * [#1502](https://github.com/terwer/siyuan-plugin-publisher/issues/1502) image replace error in some cases ([fdf0d9e](https://github.com/terwer/siyuan-plugin-publisher/commit/fdf0d9e56d485fe4dcca200cdeefe8bc5ac174da)) ## [1.29.2](https://github.com/terwer/siyuan-plugin-publisher/compare/siyuan-plugin-publisher-v1.29.1...siyuan-plugin-publisher-v1.29.2) (2024-12-02) * [#1495](https://github.com/terwer/siyuan-plugin-publisher/issues/1495) support more path link ([0163276](https://github.com/terwer/siyuan-plugin-publisher/commit/0163276efb64f8e837733a3a2ae8b7fe8d86bd16)) * gitlab image exist case ([3f81f0c](https://github.com/terwer/siyuan-plugin-publisher/commit/3f81f0c51f38597ffad426e04b9c4016ebcc05af)) -### Miscellaneous * update docs ([df4c220](https://github.com/terwer/siyuan-plugin-publisher/commit/df4c2201d24136aa535ff9174ad733cb3e2ecf50)) ## [1.29.1](https://github.com/terwer/siyuan-plugin-publisher/compare/siyuan-plugin-publisher-v1.29.0...siyuan-plugin-publisher-v1.29.1) (2024-12-02) ## [1.29.0](https://github.com/terwer/siyuan-plugin-publisher/compare/siyuan-plugin-publisher-v1.28.0...siyuan-plugin-publisher-v1.29.0) (2024-11-27) -### Features * [#1231](https://github.com/terwer/siyuan-plugin-publisher/issues/1231) hexo slug error ([3fdfeea](https://github.com/terwer/siyuan-plugin-publisher/commit/3fdfeea12872b17ee9314421c4056ddd0886c58b)) * auto read siyuan api url via docker ([1d755bd](https://github.com/terwer/siyuan-plugin-publisher/commit/1d755bd554658dc4459bd6cbbd251ce0ad1e01c0)) ## [1.28.0](https://github.com/terwer/siyuan-plugin-publisher/compare/siyuan-plugin-publisher-v1.27.0...siyuan-plugin-publisher-v1.28.0) (2024-11-26) @@ -661,4 +652,4 @@ * **deps-dev:** bump vite-plugin-static-copy from 0.16.0 to 0.17.0 ([feea39d](https://github.com/terwer/siyuan-plugin-publisher/commit/feea39d39bff74051fe0d68153b0628b00bff53f)) * **deps-dev:** bump vitest from 0.32.4 to 0.33.0 ([f2ce507](https://github.com/terwer/siyuan-plugin-publisher/commit/f2ce507ea537601d7dba21de84524274ec1cbee4)) * release 0.8.0 ([29336cd](https://github.com/terwer/siyuan-plugin-publisher/commit/29336cd847064971bc842e44aee75a8e90c226a8)) -* 优化构建流程 ([f4aeea1](https://github.com/terwer/siyuan-plugin-publisher/commit/f4aeea1c618638a7774105a87b3e690d6d5d3927)) +* 优化构建流程 ([f4aeea1](https://github.com/terwer/siyuan-plugin-publisher/commit/f4aeea1c618638a7774105a87b3e690d6d5d3927)) \ No newline at end of file diff --git a/plugin.json b/plugin.json index 3a758680..c2d3d887 100644 --- a/plugin.json +++ b/plugin.json @@ -2,7 +2,7 @@ "name": "siyuan-plugin-publisher", "author": "terwer", "url": "https://github.com/terwer/siyuan-plugin-publisher", - "version": "1.29.3", + "version": "1.30.0", "minAppVersion": "2.9.0", "backends": [ "windows", diff --git a/src/extensions/manifest.json b/src/extensions/manifest.json index 425be05d..5d19c0e5 100644 --- a/src/extensions/manifest.json +++ b/src/extensions/manifest.json @@ -1,6 +1,6 @@ { "name": "思源笔记发布辅助工具", - "version": "1.29.3", + "version": "1.30.0", "manifest_version": 3, "author": "terwer", "icons": { diff --git a/src/extensions/mv2/manifest-v2-for-firefox.json b/src/extensions/mv2/manifest-v2-for-firefox.json index 45722c9a..a4ae7eb0 100644 --- a/src/extensions/mv2/manifest-v2-for-firefox.json +++ b/src/extensions/mv2/manifest-v2-for-firefox.json @@ -1,6 +1,6 @@ { "name": "开发版 - 思源笔记发布辅助工具", - "version": "1.29.3", + "version": "1.30.0", "manifest_version": 2, "author": "terwer", "icons": { diff --git a/src/pages/AiChat.vue b/src/pages/AiChat.vue index 9bd1e025..662a436d 100644 --- a/src/pages/AiChat.vue +++ b/src/pages/AiChat.vue @@ -232,9 +232,10 @@ const insertPromptToChat = (prompt: string) => { if (!prompt) return if (prompt.includes(CURRENT_CONTEXT)) { formData.usePage = true + } else { + formData.usePage = false } - formData.inputText = "" - formData.inputText = `${formData.inputText.trim()}\n${prompt}`.trim() + formData.inputText = prompt // ElMessage.info(`已插入 Prompt:${prompt}`) } diff --git a/widget.json b/widget.json index cea19fcd..57c8df95 100644 --- a/widget.json +++ b/widget.json @@ -2,7 +2,7 @@ "name": "sy-post-publisher", "author": "terwer", "url": "https://github.com/terwer/sy-post-publisher", - "version": "1.29.3", + "version": "1.30.0", "minAppVersion": "2.9.0", "backends": [ "windows", From e177845e3ba5cce35df170dedf61080970bfcfc7 Mon Sep 17 00:00:00 2001 From: terwer Date: Tue, 10 Dec 2024 21:37:28 +0800 Subject: [PATCH 3/3] feat: fix ai bugs --- siyuan/index.ts | 14 +++++++++++--- siyuan/invoke/widgetInvoke.ts | 4 ++-- src/pages/AiChat.vue | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/siyuan/index.ts b/siyuan/index.ts index 3041ff80..0a8cc022 100644 --- a/siyuan/index.ts +++ b/siyuan/index.ts @@ -23,20 +23,20 @@ * questions. */ -import { App, confirm, getFrontend, Model, IObject, Plugin } from "siyuan" +import { App, confirm, getFrontend, IObject, Model, Plugin } from "siyuan" import { SiyuanConfig, SiyuanKernelApi } from "zhi-siyuan-api" import { createSiyuanAppLogger } from "./appLogger" import { WidgetInvoke } from "./invoke/widgetInvoke" import { Topbar } from "./topbar" import { ILogger } from "zhi-lib-base" - -import "./index.styl" import { ConfigManager } from "~/siyuan/store/config.ts" import MenuUtils from "~/siyuan/utils/menuUtils.ts" import { PluginInvoke } from "~/siyuan/invoke/pluginInvoke.ts" import { icons } from "~/siyuan/utils/svg.ts" import { PreferenceConfigManager } from "~/siyuan/store/preferenceConfigManager.ts" +import "./index.styl" + /** * 发布工具插件入口 * @@ -177,5 +177,13 @@ export default class PublisherPlugin extends Plugin { label: this.i18n.publishToQuick, submenu: quickMenus, }) + // AI聊天 + context.push({ + iconHTML: `${icons.iconEye}`, + label: this.i18n.aiChat, + click: async () => { + await this.widgetInvoke.showPublisherAiChatDialog(pageId) + }, + }) } } diff --git a/siyuan/invoke/widgetInvoke.ts b/siyuan/invoke/widgetInvoke.ts index 781b6680..c825bbcf 100644 --- a/siyuan/invoke/widgetInvoke.ts +++ b/siyuan/invoke/widgetInvoke.ts @@ -64,8 +64,8 @@ export class WidgetInvoke { await this.showTab(`/`, this.pluginInstance.i18n.articleManage) } - public async showPublisherAiChatDialog() { - let pageId: string | undefined = WidgetPageUtils.getPageId() + public async showPublisherAiChatDialog(pageId?: string) { + pageId = pageId ?? WidgetPageUtils.getPageId() if (pageId == "") { pageId = undefined } diff --git a/src/pages/AiChat.vue b/src/pages/AiChat.vue index 662a436d..36b22a2e 100644 --- a/src/pages/AiChat.vue +++ b/src/pages/AiChat.vue @@ -176,7 +176,7 @@ const formData = reactive({ chatOutput: "", isLoading: false, showPage: !StrUtil.isEmptyString(id), - usePage: false, + usePage: !StrUtil.isEmptyString(id), siyuanPost: {} as Post, })