commit 75a86d32540d21cad6519779a49caf78a45e077b Author: DelLevin-Home Date: Thu Jan 29 20:25:13 2026 +0800 首次提交 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0cd2f2b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,24 @@ +name: Release Obsidian plugin + +on: + push: + tags: + - "*" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + tag="${GITHUB_REF#refs/tags/}" + + gh release create "$tag" \ + --title="$tag" \ + --draft \ + main.js manifest.json styles.css \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..93a3b52 --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +# vscode +.vscode + +# Intellij +*.iml +.idea + +# npm +node_modules + +# Don't include the compiled main.js file in the repo. +# They should be uploaded to GitHub releases instead. +main.js + +# Exclude sourcemaps +*.map + +# obsidian +data.json + +# Exclude macOS Finder (System Explorer) View States +.DS_Store +.history diff --git a/.hotreload b/.hotreload new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d5b13d7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 BaiTu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README-en.md b/README-en.md new file mode 100644 index 0000000..cb5c5c3 --- /dev/null +++ b/README-en.md @@ -0,0 +1,5 @@ +# AI Tag By Baitu + + +## Introduction + diff --git a/README.md b/README.md new file mode 100644 index 0000000..45cc445 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# AI Tag By Baitu + + +## 介绍 + +这是一个根据文章内容,交由AI生成文章标签的工具。 + + +## 后续优化 +1. 加入其他ai提供商的api接口 +2. AI审阅文章的时候汇总以前的标签,进行参考 +3. 优化界面 +4. 不仅能添加标签,也可以添加其他的文章属性 +5. 文章字数过大时候的考虑。比如一篇文章2w字以上 \ No newline at end of file diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..018c7b7 --- /dev/null +++ b/manifest.json @@ -0,0 +1,10 @@ +{ + "id": "ai-tag-baitu-plugin", + "name": "AI Tag By Baitu", + "version": "0.1.0", + "minAppVersion": "1.0", + "description": "调用本地ollama生成文章标签", + "author": "Baitu", + "authorUrl": "https://www.iletter.top", + "isDesktopOnly": true +} \ No newline at end of file diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..92c8a1f --- /dev/null +++ b/styles.css @@ -0,0 +1,80 @@ +.ai-tag-modal .tags-container { + margin-bottom: 1em; + max-height: 300px; + overflow-y: auto; + padding-right: 5px; + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-m); + padding: 0.5em; +} + +.ai-tag-modal .tag-item { + display: flex; + align-items: center; + margin-bottom: 0.3em; + gap: 0.5em; +} + +.ai-tag-modal .tag-input { + flex-grow: 1; + margin: 0; + padding: 0.2em 0.4em; + font-size: var(--font-ui-small); +} + +.ai-tag-modal .remove-tag-btn { + margin: 0; + padding: 0 0.4em; + cursor: pointer; + background-color: transparent; + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-s); + color: var(--text-error); + font-weight: bold; + height: calc(var(--input-height) - 2px); + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; +} + +.ai-tag-modal .remove-tag-btn:hover { + background-color: var(--background-modifier-hover); + color: var(--text-error-hover); +} + +.ai-tag-modal .add-tag-btn { + margin-bottom: 1em; + align-self: flex-start; + width: fit-content; +} + +/* --- 新增样式 --- */ +.ai-tag-modal .ai-thought-details { + margin-bottom: 1em; + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-m); + overflow: hidden; /* 防止内容溢出 */ +} + +.ai-tag-modal .ai-thought-summary { + padding: 0.5em 0.8em; + background-color: var(--background-secondary-alt); + cursor: pointer; + font-weight: bold; + margin: 0; /* 重置默认margin */ +} + +.ai-tag-modal .ai-thought-details[open] .ai-thought-summary { + border-bottom: 1px solid var(--background-modifier-border); +} + +.ai-tag-modal .ai-raw-output { + padding: 0.5em 0.8em; + white-space: pre-wrap; /* 保留换行符并自动换行 */ + font-family: var(--font-monospace); /* 使用等宽字体,便于阅读代码或结构化文本 */ + font-size: var(--font-smallest); + max-height: 200px; /* 限制最大高度,配合滚动 */ + overflow-y: auto; + background-color: var(--background-primary-alt); /* 背景色区分 */ +} \ No newline at end of file