Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Auto-sync from GitHub Actions
Browse files- .gitignore +1 -0
- README.md +6 -1
- mcp_server.py +5 -2
- ui_nicegui.py +32 -1
.gitignore
CHANGED
|
@@ -20,3 +20,4 @@ CLAUDE.md
|
|
| 20 |
docs/
|
| 21 |
.*/
|
| 22 |
/AGENTS.md
|
|
|
|
|
|
| 20 |
docs/
|
| 21 |
.*/
|
| 22 |
/AGENTS.md
|
| 23 |
+
test/
|
README.md
CHANGED
|
@@ -523,6 +523,11 @@ HF Space 在无流量时会进入休眠状态,首次请求需要等待冷启
|
|
| 523 |
- 仅支持中文 / 英文双语查找
|
| 524 |
- 如果检索结果不理想,欢迎点击「没搜到?」按钮提交反馈,帮助持续优化引擎
|
| 525 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 526 |
|
| 527 |
|
| 528 |
## 搜索统计
|
|
@@ -532,4 +537,4 @@ HF Space 在无流量时会进入休眠状态,首次请求需要等待冷启
|
|
| 532 |
## 友情链接
|
| 533 |
|
| 534 |
- 本项目中借鉴了[Good Anima](https://github.com/ShiroEirin/comfyui-good-anima)项目中关于Anima模型提示词书写的相关内容
|
| 535 |
-
- [Linux Do社区](https://linux.do/)
|
|
|
|
| 523 |
- 仅支持中文 / 英文双语查找
|
| 524 |
- 如果检索结果不理想,欢迎点击「没搜到?」按钮提交反馈,帮助持续优化引擎
|
| 525 |
|
| 526 |
+
## 支持项目
|
| 527 |
+
|
| 528 |
+
DanbooruSearch 会继续免费开放。如果这个小工具刚好帮你省了点时间,可以自愿赞赏一点维护成本;赞赏不解锁任何功能、不提高额度、不影响搜索结果,也不会获得特殊待遇。量力而行就好,未成年人请勿赞赏。
|
| 529 |
+
|
| 530 |
+
微信赞赏码:<https://akizukipic.oss-cn-beijing.aliyuncs.com/img/202501120027592.png>
|
| 531 |
|
| 532 |
|
| 533 |
## 搜索统计
|
|
|
|
| 537 |
## 友情链接
|
| 538 |
|
| 539 |
- 本项目中借鉴了[Good Anima](https://github.com/ShiroEirin/comfyui-good-anima)项目中关于Anima模型提示词书写的相关内容
|
| 540 |
+
- [Linux Do社区](https://linux.do/)
|
mcp_server.py
CHANGED
|
@@ -532,12 +532,15 @@ prompt 内部分三层组装,同一语义不跨层重复:
|
|
| 532 |
### 第三层:空间叙事(NL Tags Block)
|
| 533 |
|
| 534 |
有语法结构的连续描述,负责 hard tags 和 soft phrases 难以精确表达的内容。
|
|
|
|
|
|
|
| 535 |
|
| 536 |
**包含:**
|
| 537 |
- 镜头取景:angle, shot distance, framing (close-up, wide shot, dutch angle…)
|
| 538 |
- 光线:方向、质感、色温 (rim light, volumetric god rays, warm key light…)
|
| 539 |
- 色彩调性:palette, color grading (monochromatic indigo, vibrant cel-shaded…)
|
| 540 |
- 空间布局:谁在左边、谁在右边、前后层次
|
|
|
|
| 541 |
- 多角色空间关系与动作归属
|
| 542 |
- 手和道具的精确接触关系
|
| 543 |
- 视线引导与构图层级
|
|
@@ -545,9 +548,9 @@ prompt 内部分三层组装,同一语义不跨层重复:
|
|
| 545 |
- 景深、虚化、清晰区域
|
| 546 |
|
| 547 |
**规则:**
|
| 548 |
-
- 严格 2 到 3 句英文。
|
| 549 |
- 不重复已在 hard tags 中出现的外观/服装。
|
| 550 |
-
- 不写离散 tag 列表、不写文学比喻、世界观解释。
|
| 551 |
- 使用客观、具体、视觉化的描述。
|
| 552 |
|
| 553 |
---
|
|
|
|
| 532 |
### 第三层:空间叙事(NL Tags Block)
|
| 533 |
|
| 534 |
有语法结构的连续描述,负责 hard tags 和 soft phrases 难以精确表达的内容。
|
| 535 |
+
特别提示:画面的逻辑需要由空间叙事描述。例如:如果场景有大风,那么画面各处的风向应当一致。如果场景是室内,那么室内桌椅板凳的布局和位置必须合理。
|
| 536 |
+
这些画面逻辑应由自然语言部分负责描述。
|
| 537 |
|
| 538 |
**包含:**
|
| 539 |
- 镜头取景:angle, shot distance, framing (close-up, wide shot, dutch angle…)
|
| 540 |
- 光线:方向、质感、色温 (rim light, volumetric god rays, warm key light…)
|
| 541 |
- 色彩调性:palette, color grading (monochromatic indigo, vibrant cel-shaded…)
|
| 542 |
- 空间布局:谁在左边、谁在右边、前后层次
|
| 543 |
+
- 空间逻辑合理性叙述:场景光照方向、风向一致,室内布局合理,角色与物品互动合理
|
| 544 |
- 多角色空间关系与动作归属
|
| 545 |
- 手和道具的精确接触关系
|
| 546 |
- 视线引导与构图层级
|
|
|
|
| 548 |
- 景深、虚化、清晰区域
|
| 549 |
|
| 550 |
**规则:**
|
| 551 |
+
- 严格 2 到 3 句英文。严禁过长,否则会严重破坏模型性能。
|
| 552 |
- 不重复已在 hard tags 中出现的外观/服装。
|
| 553 |
+
- 不写离散 tag 列表、不写文学比喻、复杂修辞、高阶词汇、世界观解释。语言应尽量简明扼要。
|
| 554 |
- 使用客观、具体、视觉化的描述。
|
| 555 |
|
| 556 |
---
|
ui_nicegui.py
CHANGED
|
@@ -88,6 +88,16 @@ OPTIONAL_COLS = {
|
|
| 88 |
_CONFIG_LS_KEY = 'danbooru_search_config'
|
| 89 |
_CONFIG_VERSION = 6
|
| 90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
# 搜索模式预设
|
| 92 |
_SEARCH_MODE_PRESETS: dict[str, dict] = {
|
| 93 |
'精确查词': {'top_k': 20, 'limit': 10, 'popularity_weight': 0.15, 'use_segmentation': False, 'group_mode': 'off', 'max_per_group': 2},
|
|
@@ -200,6 +210,7 @@ class DanbooruSearchUI:
|
|
| 200 |
|
| 201 |
self.mcp_notice = None
|
| 202 |
self.notice_expansion = None
|
|
|
|
| 203 |
|
| 204 |
# 表格显示选项开关
|
| 205 |
self.sw_semantic = None
|
|
@@ -239,6 +250,21 @@ class DanbooruSearchUI:
|
|
| 239 |
except AttributeError:
|
| 240 |
pass
|
| 241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
def _mark_interaction(self, e=None):
|
| 243 |
if not self.current_search_interacted:
|
| 244 |
self.current_search_interacted = True
|
|
@@ -491,6 +517,8 @@ class DanbooruSearchUI:
|
|
| 491 |
</script>
|
| 492 |
''')
|
| 493 |
|
|
|
|
|
|
|
| 494 |
with ui.column().classes('w-full max-w-7xl mx-auto p-4 gap-4'):
|
| 495 |
|
| 496 |
# ── 初始化提示 ──
|
|
@@ -547,6 +575,9 @@ class DanbooruSearchUI:
|
|
| 547 |
with ui.element('div').classes('w-full text-center py-4 mt-2'):
|
| 548 |
self.search_count_label = ui.html('正在加载数据...').classes('text-xs text-gray-400')
|
| 549 |
self._update_footer_text()
|
|
|
|
|
|
|
|
|
|
| 550 |
|
| 551 |
# ── 公告栏(标签组 + MCP)─────────────────────────────────────────────
|
| 552 |
|
|
@@ -614,7 +645,7 @@ class DanbooruSearchUI:
|
|
| 614 |
- **检索限制**:仅支持中/英双语查找 ,更推荐中文(CN/EN only,CN is preferred)
|
| 615 |
- **标签范围**:仅显示特征、角色与作品标签,且频数须 ≥ 100 (General, Character & Copyright only, Freq ≥ 100)
|
| 616 |
- **集成与接口**:[ComfyUI 插件](https://github.com/SuzumiyaAkizuki/ComfyUI-DanbooruSearcher) · [API 文档](/api/docs) · [MCP 接入](https://github.com/SuzumiyaAkizuki/DanbooruSearchOnline#mcp-接口)
|
| 617 |
-
- **支持作者**:如果觉得好用,欢迎点击顶部给本 Space 点个 **Like ❤️**,或前往 [GitHub](https://github.com/SuzumiyaAkizuki/DanbooruSearchOnline) 点个 **Star ⭐**!
|
| 618 |
- **🚀 首次使用?[点击查看使用指南](http://intro.sakizuki.site/index.html)**,了解五种搜索模式与进阶技巧
|
| 619 |
""").classes('text-sm text-gray-800 px-4 pb-3')
|
| 620 |
|
|
|
|
| 88 |
_CONFIG_LS_KEY = 'danbooru_search_config'
|
| 89 |
_CONFIG_VERSION = 6
|
| 90 |
|
| 91 |
+
SPONSOR_IMAGE_URL = "https://akizukipic.oss-cn-beijing.aliyuncs.com/img/202501120027592.png"
|
| 92 |
+
SPONSOR_TOOLCHAIN_URL = "http://intro.sakizuki.site/index.html"
|
| 93 |
+
SPONSOR_NOTICE_TEXT = "喜欢的话,可以请作者喝杯咖啡"
|
| 94 |
+
SPONSOR_TITLE = "谢谢你愿意支持"
|
| 95 |
+
SPONSOR_BODY = (
|
| 96 |
+
"如果你喜欢这个小工具,可以自愿赞赏一点维护成本。"
|
| 97 |
+
"它会继续免费开放;赞赏不会解锁任何额外功能、不会提高额度、不会影响搜索结果,"
|
| 98 |
+
"量力而行就好,未成年人请勿赞赏。"
|
| 99 |
+
)
|
| 100 |
+
|
| 101 |
# 搜索模式预设
|
| 102 |
_SEARCH_MODE_PRESETS: dict[str, dict] = {
|
| 103 |
'精确查词': {'top_k': 20, 'limit': 10, 'popularity_weight': 0.15, 'use_segmentation': False, 'group_mode': 'off', 'max_per_group': 2},
|
|
|
|
| 210 |
|
| 211 |
self.mcp_notice = None
|
| 212 |
self.notice_expansion = None
|
| 213 |
+
self.sponsor_dialog = None
|
| 214 |
|
| 215 |
# 表格显示选项开关
|
| 216 |
self.sw_semantic = None
|
|
|
|
| 250 |
except AttributeError:
|
| 251 |
pass
|
| 252 |
|
| 253 |
+
def _build_sponsor_dialog(self):
|
| 254 |
+
with ui.dialog() as self.sponsor_dialog, ui.card().classes('w-full max-w-sm'):
|
| 255 |
+
with ui.column().classes('w-full items-center gap-2 text-center'):
|
| 256 |
+
ui.label(SPONSOR_TITLE).classes('text-base font-bold text-gray-800')
|
| 257 |
+
ui.label(SPONSOR_BODY).classes('text-sm text-gray-600 leading-relaxed')
|
| 258 |
+
ui.image(SPONSOR_IMAGE_URL).classes('w-60 max-w-full rounded border border-gray-200')
|
| 259 |
+
ui.label('微信赞赏码').classes('text-xs text-gray-400')
|
| 260 |
+
ui.link(
|
| 261 |
+
'如果你想继续折腾,也可以看看基于这个小工具的更多工具链',
|
| 262 |
+
SPONSOR_TOOLCHAIN_URL,
|
| 263 |
+
new_tab=True,
|
| 264 |
+
).classes('text-xs text-blue-500 hover:text-blue-700 hover:underline')
|
| 265 |
+
with ui.row().classes('w-full justify-end'):
|
| 266 |
+
ui.button('关闭', on_click=self.sponsor_dialog.close).props('flat color=grey-7')
|
| 267 |
+
|
| 268 |
def _mark_interaction(self, e=None):
|
| 269 |
if not self.current_search_interacted:
|
| 270 |
self.current_search_interacted = True
|
|
|
|
| 517 |
</script>
|
| 518 |
''')
|
| 519 |
|
| 520 |
+
self._build_sponsor_dialog()
|
| 521 |
+
|
| 522 |
with ui.column().classes('w-full max-w-7xl mx-auto p-4 gap-4'):
|
| 523 |
|
| 524 |
# ── 初始化提示 ──
|
|
|
|
| 575 |
with ui.element('div').classes('w-full text-center py-4 mt-2'):
|
| 576 |
self.search_count_label = ui.html('正在加载数据...').classes('text-xs text-gray-400')
|
| 577 |
self._update_footer_text()
|
| 578 |
+
ui.button(SPONSOR_NOTICE_TEXT, on_click=self.sponsor_dialog.open) \
|
| 579 |
+
.props('flat dense no-caps color=grey-6') \
|
| 580 |
+
.classes('text-xs mt-1')
|
| 581 |
|
| 582 |
# ── 公告栏(标签组 + MCP)─────────────────────────────────────────────
|
| 583 |
|
|
|
|
| 645 |
- **检索限制**:仅支持中/英双语查找 ,更推荐中文(CN/EN only,CN is preferred)
|
| 646 |
- **标签范围**:仅显示特征、角色与作品标签,且频数须 ≥ 100 (General, Character & Copyright only, Freq ≥ 100)
|
| 647 |
- **集成与接口**:[ComfyUI 插件](https://github.com/SuzumiyaAkizuki/ComfyUI-DanbooruSearcher) · [API 文档](/api/docs) · [MCP 接入](https://github.com/SuzumiyaAkizuki/DanbooruSearchOnline#mcp-接口)
|
| 648 |
+
- **支持作者**:如果觉得好用,欢迎点击顶部给本 Space 点个 **Like ❤️**,或前往 [GitHub](https://github.com/SuzumiyaAkizuki/DanbooruSearchOnline) 点个 **Star ⭐**!也可以自愿赞赏一点维护成本;不影响任何功能使用。
|
| 649 |
- **🚀 首次使用?[点击查看使用指南](http://intro.sakizuki.site/index.html)**,了解五种搜索模式与进阶技巧
|
| 650 |
""").classes('text-sm text-gray-800 px-4 pb-3')
|
| 651 |
|