Initial commit: 查词学英语 MVP

- 流式查询(SSE 实时展示生成过程)
- 三维度数据模型:history(查询)/ words(单词档案)/ roots(词根档案)
- 词根拆解与发音拼读训练(词根点击揭晓历史词例)
- 词义/同义例句跨查询累积,同义项自动合并
- 历史与词库分页、多维度搜索
- 模型:Qwen3.6-35B-A3B(硅基流动,可 LLM_MODEL 切换)
This commit is contained in:
2026-08-29 08:44:43 +08:00
commit 37b75c2d21
11 changed files with 3160 additions and 0 deletions
+344
View File
@@ -0,0 +1,344 @@
:root {
--bg: #f4f6fa;
--card: #ffffff;
--primary: #3b6ef5;
--primary-dark: #2c55c7;
--text: #1f2733;
--muted: #6b7686;
--border: #e2e7ef;
--tag-bg: #eaf0ff;
--danger: #e5484d;
}
* { box-sizing: border-box; }
body {
margin: 0;
font-family: -apple-system, "PingFang SC", "Segoe UI", sans-serif;
background: var(--bg);
color: var(--text);
}
header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 14px 24px;
background: var(--card);
border-bottom: 1px solid var(--border);
position: sticky;
top: 0;
z-index: 10;
}
header h1 { font-size: 20px; margin: 0; }
.nav-btn {
border: 1px solid var(--border);
background: transparent;
padding: 8px 18px;
border-radius: 8px;
cursor: pointer;
font-size: 14px;
margin-left: 8px;
}
.nav-btn.active {
background: var(--primary);
color: #fff;
border-color: var(--primary);
}
.view { max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; }
.hidden { display: none !important; }
.card {
background: var(--card);
border: 1px solid var(--border);
border-radius: 12px;
padding: 20px;
margin-bottom: 20px;
}
label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 6px; }
label:first-child { margin-top: 0; }
textarea, input[type="text"] {
width: 100%;
border: 1px solid var(--border);
border-radius: 8px;
padding: 10px 12px;
font-size: 15px;
font-family: inherit;
resize: vertical;
}
textarea:focus, input:focus { outline: 2px solid var(--primary); border-color: transparent; }
.word-input-row { display: flex; gap: 8px; }
.word-input-row input { flex: 1; }
.btn {
border: none;
border-radius: 8px;
padding: 10px 18px;
font-size: 14px;
cursor: pointer;
white-space: nowrap;
}
.btn.primary { background: var(--primary); color: #fff; margin-top: 16px; width: 100%; font-size: 15px; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.primary:disabled { background: #a9befa; cursor: wait; }
.btn.secondary { background: var(--tag-bg); color: var(--primary); }
.btn.ghost { background: transparent; border: 1px solid var(--border); }
.btn.danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.word-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; min-height: 10px; }
.word-tag {
display: inline-flex;
align-items: center;
gap: 6px;
background: var(--tag-bg);
color: var(--primary);
padding: 4px 12px;
border-radius: 999px;
font-size: 14px;
}
.word-tag button {
border: none;
background: none;
color: var(--primary);
cursor: pointer;
font-size: 14px;
padding: 0;
}
.status { margin-top: 12px; font-size: 14px; }
.status.error { color: var(--danger); }
.status.info { color: var(--muted); }
/* 单词结果卡片 */
.word-card { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 20px; overflow: hidden; }
.word-card .word-head {
background: linear-gradient(135deg, #3b6ef5, #6a8dff);
color: #fff;
padding: 18px 20px;
display: flex;
align-items: center;
gap: 14px;
flex-wrap: wrap;
}
.word-head .word-title { font-size: 24px; font-weight: 700; }
.word-head .phonetic { opacity: 0.9; font-size: 16px; }
.speak-btn {
border: none;
background: rgba(255,255,255,0.2);
color: #fff;
border-radius: 999px;
width: 34px; height: 34px;
cursor: pointer;
font-size: 15px;
}
.speak-btn:hover { background: rgba(255,255,255,0.35); }
.word-body { padding: 16px 20px; }
.sense-block { margin-bottom: 20px; }
.sense-block:last-child { margin-bottom: 0; }
.sense-title {
font-size: 15px;
font-weight: 700;
color: var(--primary);
margin-bottom: 8px;
padding-bottom: 6px;
border-bottom: 2px solid var(--tag-bg);
}
.example-list { margin: 0; padding: 0; list-style: none; }
.example-list li { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.example-list li:last-child { border-bottom: none; }
.example-en { font-size: 15px; }
.example-en b { color: var(--primary); }
.example-zh { font-size: 13px; color: var(--muted); margin-top: 2px; }
/* 历史 */
.history-item {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
padding: 12px 4px;
border-bottom: 1px solid var(--border);
cursor: pointer;
}
.history-item:hover { background: #f8faff; }
.history-sentence { flex: 1; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.history-empty { color: var(--muted); text-align: center; padding: 30px 0; }
/* 编辑态 */
.editing textarea, .editing input[type="text"] { font-size: 14px; background: #fbfcff; }
.detail-toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
/* 固定在顶部的原句卡(header 高度约 61px */
.sentence-card {
position: sticky;
top: 62px;
z-index: 5;
box-shadow: 0 2px 10px rgba(31, 39, 51, 0.08);
}
.sentence-en { font-size: 15px; font-weight: 600; }
.sentence-zh { font-size: 13px; color: var(--muted); margin-top: 6px; }
.back-btn { margin-bottom: 12px; }
/* AI 流式生成窗口 */
.stream-box {
margin-top: 14px;
border: 1px solid var(--border);
border-radius: 10px;
background: #0f1622;
overflow: auto;
max-height: 180px;
min-height: 80px;
}
.stream-box .stream-label {
position: sticky;
top: 0;
background: #0f1622;
color: #7ee787;
font-size: 12px;
padding: 6px 12px 4px;
border-bottom: 1px solid #26303f;
}
.stream-box pre {
margin: 0;
padding: 8px 12px 12px;
color: #9fb3c8;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 11px;
line-height: 1.5;
white-space: pre-wrap;
word-break: break-all;
}
/* 句子分词选词区 */
.word-tokens {
display: flex;
flex-wrap: wrap;
gap: 8px;
padding: 12px;
border: 1px dashed var(--border);
border-radius: 10px;
background: #fafbfe;
min-height: 20px;
}
.tokens-empty { color: var(--muted); font-size: 13px; }
.word-token {
border: 1px solid var(--border);
background: #fff;
color: var(--text);
border-radius: 999px;
padding: 5px 14px;
font-size: 14px;
cursor: pointer;
transition: all 0.12s ease;
}
.word-token:hover { border-color: var(--primary); color: var(--primary); }
.word-token.selected {
background: var(--primary);
border-color: var(--primary);
color: #fff;
}
.word-token.selected::after { content: " ✓"; }
/* 词根拆解 */
.roots-row { display: flex; flex-wrap: wrap; gap: 8px; }
.root-chip {
display: inline-flex;
align-items: baseline;
gap: 6px;
background: #fff7e6;
border: 1px solid #f2dfb8;
border-radius: 8px;
padding: 6px 10px;
cursor: pointer;
line-height: 1.3;
}
.root-chip:hover { border-color: #e5a53b; }
.root-part { font-size: 15px; font-weight: 700; color: #b06f0e; }
.root-phon { font-size: 12px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
.root-mean { font-size: 12px; color: var(--text); }
.root-type { font-size: 11px; color: #fff; background: #e5a53b; border-radius: 4px; padding: 1px 5px; align-self: center; }
.roots-edit { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
/* 我的词库 */
.word-lib-item {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
padding: 10px 4px;
border-bottom: 1px solid var(--border);
cursor: pointer;
}
.word-lib-item:hover { background: #fffaf0; }
.word-lib-main { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
/* 词根历史面板(点击词根芯片触发) */
.root-panel {
margin-top: 10px;
background: #fffaf0;
border: 1px solid #f2dfb8;
border-radius: 10px;
padding: 12px 14px;
}
.root-panel-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.root-panel-loading { font-size: 13px; color: var(--muted); }
.root-group { margin-bottom: 10px; }
.root-group:last-of-type { margin-bottom: 4px; }
.root-group-label { font-size: 12px; color: #b06f0e; font-weight: 600; margin-bottom: 4px; }
.root-group-words { display: flex; flex-wrap: wrap; gap: 6px; }
.root-word {
border: 1px solid var(--border);
background: #fff;
border-radius: 999px;
padding: 4px 12px;
font-size: 13px;
cursor: pointer;
display: inline-flex;
align-items: baseline;
gap: 6px;
}
.root-word:hover { border-color: #e5a53b; background: #fff7e6; }
.root-panel-note { font-size: 12px; color: var(--muted); margin-top: 6px; }
.root-speak { border: none; background: none; cursor: pointer; padding: 0 2px; align-self: center; }
/* 词根面板:含义点击揭晓 */
.root-word .root-word-mean {
display: none;
font-size: 12px;
color: #b06f0e;
font-weight: 600;
}
.root-word.revealed { background: #fff7e6; border-color: #e5a53b; }
.root-word.revealed .root-word-mean { display: inline; }
/* 揭晓区:词根含义 + 单词词义 */
.root-word-senses {
display: block;
font-size: 11px;
color: var(--muted);
font-weight: 400;
margin-top: 2px;
}
/* 分页 */
.pager {
display: flex;
align-items: center;
gap: 8px;
margin-top: 12px;
}
.pager-info { font-size: 13px; color: var(--muted); margin-right: auto; }
.pager .btn[disabled] { opacity: 0.4; cursor: default; }
/* 搜索框 */
.search-box {
margin: 10px 0 4px;
}