| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Query 词组织器</title>
- <style>
- *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
- body {
- font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Noto Sans SC',
- 'Helvetica Neue', sans-serif;
- background: #f2f2f2;
- min-height: 100vh;
- padding: 32px 24px;
- color: #1a1a1a;
- }
- .container {
- max-width: 980px;
- margin: 0 auto;
- background: #fff;
- border-radius: 18px;
- padding: 36px 40px 40px;
- box-shadow: 0 2px 16px rgba(0,0,0,0.07);
- }
- h1 {
- font-size: 17px;
- font-weight: 600;
- color: #888;
- margin-bottom: 28px;
- letter-spacing: 0.02em;
- }
- .dimensions { display: flex; flex-direction: column; }
- .dim-group {
- padding: 4px 0;
- border-bottom: 1px solid #f2f2f2;
- }
- .dim-group:last-child { border-bottom: none; }
- .level-row {
- display: flex;
- align-items: flex-start;
- padding: 7px 0;
- gap: 10px;
- }
- .level-row.indent { margin-left: 78px; }
- .dim-label {
- font-size: 12.5px;
- color: #999;
- min-width: 68px;
- padding-top: 6px;
- flex-shrink: 0;
- display: flex;
- align-items: center;
- gap: 3px;
- }
- .dim-label::before { content: '·'; color: #bbb; }
- .sub-label {
- font-size: 11.5px;
- color: #bbb;
- min-width: 56px;
- padding-top: 6px;
- flex-shrink: 0;
- }
- .chips-wrap {
- display: flex;
- flex-wrap: wrap;
- gap: 7px;
- align-items: center;
- flex: 1;
- }
- .chip {
- padding: 5px 15px;
- border-radius: 20px;
- font-size: 13px;
- cursor: pointer;
- border: 1.5px solid #e2e2e2;
- background: #fff;
- color: #666;
- transition: border-color .12s, background .12s, color .12s;
- user-select: none;
- white-space: nowrap;
- line-height: 1.4;
- }
- .chip:hover { border-color: #c0c0c0; color: #333; }
- .chip.none-active {
- background: #1a1a1a;
- border-color: #1a1a1a;
- color: #fff;
- font-weight: 500;
- }
- .chip.none-active:hover { background: #333; border-color: #333; }
- .chip.selected {
- background: #1a1a1a;
- border-color: #1a1a1a;
- color: #fff;
- font-weight: 500;
- }
- .chip.selected:hover { background: #333; border-color: #333; }
- .placeholder-text {
- font-size: 13px;
- color: #ccc;
- font-style: italic;
- padding: 6px 0;
- }
- .preview-section {
- margin-top: 28px;
- padding: 18px 20px;
- background: #fafafa;
- border-radius: 12px;
- border: 1.5px solid #ebebeb;
- }
- .preview-header {
- font-size: 11px;
- color: #aaa;
- font-weight: 600;
- text-transform: uppercase;
- letter-spacing: 0.08em;
- margin-bottom: 12px;
- }
- .preview-tags {
- display: flex;
- flex-wrap: wrap;
- gap: 6px;
- min-height: 34px;
- align-items: center;
- margin-bottom: 14px;
- }
- .preview-tag {
- background: #1a1a1a;
- color: #fff;
- padding: 4px 11px;
- border-radius: 7px;
- font-size: 13px;
- }
- .preview-sep { color: #d0d0d0; font-size: 14px; font-weight: 300; }
- .preview-empty { color: #ccc; font-size: 13px; }
- .preview-path {
- font-size: 12px;
- color: #bbb;
- margin-bottom: 14px;
- min-height: 18px;
- font-family: monospace;
- letter-spacing: 0.01em;
- }
- .btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
- .btn {
- padding: 6px 18px;
- border-radius: 9px;
- font-size: 13px;
- cursor: pointer;
- border: 1.5px solid #e2e2e2;
- background: #fff;
- color: #555;
- transition: all .12s;
- }
- .btn:hover { background: #f5f5f5; }
- .btn-dark { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
- .btn-dark:hover { background: #333; border-color: #333; }
- .history-section { margin-top: 20px; }
- .history-list { margin-top: 8px; }
- .history-item {
- font-size: 12.5px;
- color: #888;
- padding: 5px 0;
- border-bottom: 1px solid #f5f5f5;
- cursor: pointer;
- display: flex;
- align-items: center;
- gap: 8px;
- transition: color .1s;
- }
- .history-item:hover { color: #333; }
- .hist-num { font-size: 10px; color: #ccc; min-width: 20px; }
- </style>
- </head>
- <body>
- <div class="container">
- <h1>Query 词组织器</h1>
- <div class="dimensions" id="dimensions"></div>
- <div class="preview-section">
- <div class="preview-header">Query 预览</div>
- <div class="preview-tags" id="previewTags">
- <span class="preview-empty">(请选择维度标签)</span>
- </div>
- <div class="preview-path" id="previewPath"></div>
- <div class="btn-row">
- <button class="btn btn-dark" id="copyBtn" onclick="copyQuery()">复制 Query</button>
- <button class="btn" onclick="clearAll()">清空</button>
- <button class="btn" onclick="saveQuery()">保存记录</button>
- </div>
- </div>
- <div class="history-section" id="histSection" style="display:none">
- <div class="preview-header" style="margin-top:0">历史记录</div>
- <div class="history-list" id="histList"></div>
- </div>
- </div>
- <script>
- const DIMS = [
- {
- "id": "substance",
- "label": "实质",
- "type": "flat",
- "items": [
- "人像",
- "信息"
- ]
- },
- {
- "id": "form",
- "label": "形式",
- "type": "flat",
- "items": [
- "真实感",
- "写实风格",
- "实景拍摄",
- "版面设计",
- "版面解构"
- ]
- },
- {
- "id": "modality",
- "label": "模态",
- "type": "flat",
- "items": [
- "图片",
- "视频"
- ]
- },
- {
- "id": "action",
- "label": "动作",
- "type": "hierarchical",
- "data": {
- "获取": {
- "搜索": [
- "检索",
- "下载"
- ],
- "查询": [
- "调取"
- ],
- "录入": [
- "上传",
- "拍摄",
- "录音",
- "键入"
- ],
- "引用": [
- "选取"
- ]
- },
- "提取": {
- "物理提取": [
- "裁切",
- "抠取",
- "抽帧"
- ],
- "化学提取": [
- "识别",
- "反推",
- "解构"
- ]
- },
- "生成": {
- "元素生成": [
- "元素生成"
- ],
- "关系生成": [
- "数组生成",
- "结构生成"
- ]
- },
- "修改": {
- "增": [
- "添加",
- "叠加"
- ],
- "删": [
- "抹除",
- "剪除"
- ],
- "变": [
- "重述",
- "风格化",
- "转换",
- "替换",
- "调整",
- "增强"
- ]
- }
- }
- },
- {
- "id": "type",
- "label": "类型",
- "type": "hierarchical",
- "data": {
- "程序控制类型": {
- "指令": [
- "提示词",
- "负向提示词",
- "描述"
- ],
- "参数": [
- "生成参数",
- "规格参数",
- "模型权重"
- ],
- "评估": [
- "评分",
- "评语"
- ],
- "流程": [
- "工作流",
- "批处理"
- ]
- },
- "数据复用类型": {
- "原子": [
- "数字人",
- "版式"
- ],
- "序列": [
- "模板"
- ]
- },
- "内容类型": {
- "素材/化学变化": [
- "参考图",
- "参考视频",
- "参考音频",
- "对标内容",
- "分镜图",
- "转场",
- "蒙版",
- "控制图",
- "运动轨迹",
- "滤镜",
- "构图布局"
- ],
- "素材/物理变化": [
- "截图",
- "视频片段",
- "转场片段",
- "关键帧",
- "音效",
- "特效"
- ],
- "半成品/序列": [
- "大纲",
- "脚本",
- "分镜脚本",
- "剪辑脚本",
- "配音文案"
- ],
- "半成品/原子": [
- "底图",
- "样图",
- "分镜视频"
- ],
- "半成品/组合": [
- "图层组合",
- "拼图"
- ],
- "准成品": [
- "歌词",
- "配音",
- "BGM",
- "字幕",
- "标题",
- "正文"
- ],
- "成品": [
- "成品图",
- "视频成品",
- "合成图"
- ]
- },
- "知识类型": {
- "知识库": [
- "知识库"
- ]
- }
- }
- },
- {
- "id": "tool_type",
- "label": "工具类型",
- "type": "flat",
- "items": [
- "AI 模型",
- "桌面 APP",
- "云端 Web",
- "API·CLI",
- "插件扩展"
- ]
- },
- {
- "id": "suffix",
- "label": "后缀",
- "type": "flat",
- "default": null,
- "items": [
- "怎么做"
- ]
- }
- ];
- const state = {};
- DIMS.forEach(d => { state[d.id] = { l0: d.default !== undefined ? d.default : null, l1: null, l2: null }; });
- function makeRow(indent) {
- const el = document.createElement('div');
- el.className = 'level-row' + (indent ? ' indent' : '');
- return el;
- }
- function makeLabel(text, small) {
- const el = document.createElement('span');
- el.className = small ? 'sub-label' : 'dim-label';
- el.textContent = text;
- return el;
- }
- function makeChipsWrap() {
- const el = document.createElement('div');
- el.className = 'chips-wrap';
- return el;
- }
- function makeChip(label, cls, onClick) {
- const btn = document.createElement('button');
- btn.className = 'chip ' + cls;
- btn.textContent = label;
- btn.addEventListener('click', onClick);
- return btn;
- }
- function renderDim(dimId) {
- const dim = DIMS.find(d => d.id === dimId);
- const grp = document.querySelector('.dim-group[data-id="' + dimId + '"]');
- grp.innerHTML = '';
- const sel = state[dimId];
- if (dim.type === 'empty') {
- const row = makeRow(false);
- row.appendChild(makeLabel(dim.label, false));
- const ph = document.createElement('span');
- ph.className = 'placeholder-text';
- ph.textContent = '(暂无,留位)';
- row.appendChild(ph);
- grp.appendChild(row);
- return;
- }
- if (dim.type === 'flat') {
- const row = makeRow(false);
- row.appendChild(makeLabel(dim.label, false));
- if (!dim.items || !dim.items.length) {
- const ph = document.createElement('span');
- ph.className = 'placeholder-text';
- ph.textContent = '(待填写)';
- row.appendChild(ph);
- } else {
- const chips = makeChipsWrap();
- chips.appendChild(makeChip('无', sel.l0 == null ? 'none-active' : '', () => {
- state[dimId].l0 = null; renderDim(dimId); updateQuery();
- }));
- dim.items.forEach(item => {
- chips.appendChild(makeChip(item, sel.l0 === item ? 'selected' : '', () => {
- state[dimId].l0 = item; renderDim(dimId); updateQuery();
- }));
- });
- row.appendChild(chips);
- }
- grp.appendChild(row);
- return;
- }
- if (dim.type === 'hierarchical') {
- const row0 = makeRow(false);
- row0.appendChild(makeLabel(dim.label, false));
- const chips0 = makeChipsWrap();
- chips0.appendChild(makeChip('无', sel.l0 == null ? 'none-active' : '', () => {
- state[dimId] = { l0: null, l1: null, l2: null }; renderDim(dimId); updateQuery();
- }));
- Object.keys(dim.data).forEach(key => {
- chips0.appendChild(makeChip(key, sel.l0 === key ? 'selected' : '', () => {
- state[dimId] = { l0: key, l1: null, l2: null }; renderDim(dimId); updateQuery();
- }));
- });
- row0.appendChild(chips0);
- grp.appendChild(row0);
- if (sel.l0 && dim.data[sel.l0]) {
- const L1keys = Object.keys(dim.data[sel.l0]);
- const row1 = makeRow(true);
- row1.appendChild(makeLabel(sel.l0, true));
- const chips1 = makeChipsWrap();
- chips1.appendChild(makeChip('无', sel.l1 == null ? 'none-active' : '', () => {
- state[dimId].l1 = null; state[dimId].l2 = null; renderDim(dimId); updateQuery();
- }));
- L1keys.forEach(key => {
- chips1.appendChild(makeChip(key, sel.l1 === key ? 'selected' : '', () => {
- state[dimId].l1 = key; state[dimId].l2 = null; renderDim(dimId); updateQuery();
- }));
- });
- row1.appendChild(chips1);
- grp.appendChild(row1);
- }
- if (sel.l0 && sel.l1 && dim.data[sel.l0] && dim.data[sel.l0][sel.l1]) {
- const L2items = dim.data[sel.l0][sel.l1];
- const row2 = makeRow(true);
- row2.appendChild(makeLabel(sel.l1, true));
- const chips2 = makeChipsWrap();
- chips2.appendChild(makeChip('无', sel.l2 == null ? 'none-active' : '', () => {
- state[dimId].l2 = null; renderDim(dimId); updateQuery();
- }));
- L2items.forEach(item => {
- chips2.appendChild(makeChip(item, sel.l2 === item ? 'selected' : '', () => {
- state[dimId].l2 = item; renderDim(dimId); updateQuery();
- }));
- });
- row2.appendChild(chips2);
- grp.appendChild(row2);
- }
- }
- }
- function getSelections() {
- return DIMS.map(dim => {
- if (dim.type === 'empty') return null;
- const sel = state[dim.id];
- if (dim.type === 'flat') {
- return sel.l0 ? { dim: dim.label, path: [sel.l0], val: sel.l0 } : null;
- }
- if (dim.type === 'hierarchical') {
- const path = [sel.l0, sel.l1, sel.l2].filter(Boolean);
- if (!path.length) return null;
- return { dim: dim.label, path, val: path[path.length - 1] };
- }
- return null;
- }).filter(Boolean);
- }
- function updateQuery() {
- const sels = getSelections();
- const tagsEl = document.getElementById('previewTags');
- const pathEl = document.getElementById('previewPath');
- tagsEl.innerHTML = '';
- pathEl.textContent = '';
- if (!sels.length) {
- tagsEl.innerHTML = '<span class="preview-empty">(请选择维度标签)</span>';
- return;
- }
- sels.forEach((s, i) => {
- if (i > 0) {
- const sep = document.createElement('span');
- sep.className = 'preview-sep';
- sep.textContent = '·';
- tagsEl.appendChild(sep);
- }
- const tag = document.createElement('span');
- tag.className = 'preview-tag';
- tag.textContent = s.val;
- tagsEl.appendChild(tag);
- });
- pathEl.textContent = sels.map(s => '[' + s.dim + '] ' + s.path.join(' › ')).join(' ');
- }
- function getQueryText() {
- return getSelections().map(s => s.val).join(' ');
- }
- function copyQuery() {
- const text = getQueryText();
- if (!text) return;
- navigator.clipboard.writeText(text).then(() => {
- const btn = document.getElementById('copyBtn');
- btn.textContent = '已复制 ✓';
- setTimeout(() => { btn.textContent = '复制 Query'; }, 1600);
- });
- }
- function clearAll() {
- DIMS.forEach(d => { state[d.id] = { l0: null, l1: null, l2: null }; });
- DIMS.forEach(d => renderDim(d.id));
- updateQuery();
- }
- let histCount = 0;
- function saveQuery() {
- const text = getQueryText();
- const path = getSelections().map(s => '[' + s.dim + '] ' + s.path.join('›')).join(' ');
- if (!text) return;
- histCount++;
- const section = document.getElementById('histSection');
- const list = document.getElementById('histList');
- section.style.display = 'block';
- const item = document.createElement('div');
- item.className = 'history-item';
- item.innerHTML =
- '<span class="hist-num">#' + histCount + '</span>' +
- '<span>' + text + '</span>' +
- '<span style="color:#ddd;font-size:11px;margin-left:auto">' + path + '</span>';
- item.addEventListener('click', () => navigator.clipboard.writeText(text));
- list.prepend(item);
- }
- (function init() {
- const root = document.getElementById('dimensions');
- DIMS.forEach(dim => {
- const grp = document.createElement('div');
- grp.className = 'dim-group';
- grp.dataset.id = dim.id;
- root.appendChild(grp);
- renderDim(dim.id);
- });
- updateQuery();
- })();
- </script>
- </body>
- </html>
|