首次提交

This commit is contained in:
DelLevin-Home
2026-01-29 20:25:13 +08:00
commit 75a86d3254
8 changed files with 177 additions and 0 deletions

24
.github/workflows/release.yml vendored Normal file
View File

@@ -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

23
.gitignore vendored Normal file
View File

@@ -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

0
.hotreload Normal file
View File

21
LICENSE Normal file
View File

@@ -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.

5
README-en.md Normal file
View File

@@ -0,0 +1,5 @@
# AI Tag By Baitu
## Introduction

14
README.md Normal file
View File

@@ -0,0 +1,14 @@
# AI Tag By Baitu
## 介绍
这是一个根据文章内容交由AI生成文章标签的工具。
## 后续优化
1. 加入其他ai提供商的api接口
2. AI审阅文章的时候汇总以前的标签进行参考
3. 优化界面
4. 不仅能添加标签,也可以添加其他的文章属性
5. 文章字数过大时候的考虑。比如一篇文章2w字以上

10
manifest.json Normal file
View File

@@ -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
}

80
styles.css Normal file
View File

@@ -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); /* 背景色区分 */
}