Skip to content

Commit

Permalink
feat: fix ai bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Dec 10, 2024
1 parent 73a5b69 commit e177845
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
14 changes: 11 additions & 3 deletions siyuan/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

/**
* 发布工具插件入口
*
Expand Down Expand Up @@ -177,5 +177,13 @@ export default class PublisherPlugin extends Plugin {
label: this.i18n.publishToQuick,
submenu: quickMenus,
})
// AI聊天
context.push({
iconHTML: `<span class="iconfont-icon">${icons.iconEye}</span>`,
label: this.i18n.aiChat,
click: async () => {
await this.widgetInvoke.showPublisherAiChatDialog(pageId)
},
})
}
}
4 changes: 2 additions & 2 deletions siyuan/invoke/widgetInvoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/AiChat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const formData = reactive({
chatOutput: "",
isLoading: false,
showPage: !StrUtil.isEmptyString(id),
usePage: false,
usePage: !StrUtil.isEmptyString(id),
siyuanPost: {} as Post,
})
Expand Down

0 comments on commit e177845

Please sign in to comment.