mirror of
https://github.com/Wx-2025/ST-Amily2-Chat-Optimisation.git
synced 2026-06-07 08:35:51 +00:00
Compare commits
2 Commits
2b66354838
...
e9c992c6d7
| Author | SHA1 | Date | |
|---|---|---|---|
| e9c992c6d7 | |||
| 105f0a79db |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Amily2号聊天优化助手",
|
"name": "Amily2号聊天优化助手",
|
||||||
"display_name": "Amily2号助手",
|
"display_name": "Amily2号助手",
|
||||||
"version": "1.8.1",
|
"version": "1.8.2",
|
||||||
"author": "Wx-2025",
|
"author": "Wx-2025",
|
||||||
"description": "一个拥有独立UI的智能引擎,正文优化、自动总结、记忆表格、rag向量、隐藏楼层、剧情推进等多功能整合。",
|
"description": "一个拥有独立UI的智能引擎,正文优化、自动总结、记忆表格、rag向量、隐藏楼层、剧情推进等多功能整合。",
|
||||||
"minSillyTavernVersion": "1.10.0",
|
"minSillyTavernVersion": "1.10.0",
|
||||||
@@ -52,5 +52,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -167,78 +167,65 @@ function injectChatTableStyles() {
|
|||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 卡片式布局 (RPG风格) */
|
/* 表格布局 (RPG风格) */
|
||||||
.amily2-game-cards-container {
|
.amily2-table-wrapper {
|
||||||
display: flex;
|
width: 100%;
|
||||||
flex-direction: column;
|
overflow-x: auto; /* 允许横向滚动 */
|
||||||
gap: 10px;
|
-webkit-overflow-scrolling: touch;
|
||||||
}
|
|
||||||
|
|
||||||
.amily2-game-card {
|
|
||||||
background: rgba(30, 35, 45, 0.6);
|
|
||||||
border: 1px solid rgba(100, 149, 237, 0.15);
|
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
padding: 12px;
|
border: 1px solid rgba(100, 149, 237, 0.15);
|
||||||
position: relative;
|
background: rgba(30, 35, 45, 0.4);
|
||||||
transition: all 0.2s ease;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.amily2-game-card:hover {
|
.amily2-data-table {
|
||||||
background: rgba(40, 50, 70, 0.8);
|
width: 100%;
|
||||||
border-color: rgba(0, 191, 255, 0.4);
|
border-collapse: collapse;
|
||||||
box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
|
font-size: 0.9em;
|
||||||
transform: translateX(2px);
|
white-space: nowrap; /* 防止换行,保持表格整洁 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.amily2-game-card::before {
|
.amily2-data-table th,
|
||||||
content: '';
|
.amily2-data-table td {
|
||||||
position: absolute;
|
padding: 10px 12px;
|
||||||
left: 0; top: 10px; bottom: 10px;
|
text-align: left;
|
||||||
width: 3px;
|
|
||||||
background: #00bfff;
|
|
||||||
border-radius: 0 2px 2px 0;
|
|
||||||
opacity: 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.amily2-card-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
padding-bottom: 5px;
|
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
.amily2-card-title {
|
.amily2-data-table th {
|
||||||
font-size: 1.1em;
|
background: rgba(20, 25, 35, 0.8);
|
||||||
font-weight: bold;
|
|
||||||
color: #00bfff;
|
color: #00bfff;
|
||||||
text-shadow: 0 0 5px rgba(0, 191, 255, 0.3);
|
font-weight: 600;
|
||||||
}
|
|
||||||
|
|
||||||
.amily2-card-body {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
|
||||||
gap: 8px 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.amily2-card-attr {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
font-size: 0.9em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.amily2-card-label {
|
|
||||||
color: #5a6a7e;
|
|
||||||
font-size: 0.8em;
|
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
margin-bottom: 2px;
|
letter-spacing: 0.5px;
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 2;
|
||||||
|
border-bottom: 2px solid rgba(0, 191, 255, 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.amily2-card-value {
|
.amily2-data-table tr:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.amily2-data-table tr:last-child td {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.amily2-data-table td {
|
||||||
color: #e0e0e0;
|
color: #e0e0e0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 第一列特殊样式 (通常是名称/ID) */
|
||||||
|
.amily2-data-table td:first-child {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #fff;
|
||||||
|
border-left: 3px solid transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.amily2-data-table tr:hover td:first-child {
|
||||||
|
border-left-color: #00bfff;
|
||||||
|
}
|
||||||
|
|
||||||
/* 滚动条 */
|
/* 滚动条 */
|
||||||
.amily2-game-sidebar::-webkit-scrollbar,
|
.amily2-game-sidebar::-webkit-scrollbar,
|
||||||
.amily2-game-panel::-webkit-scrollbar {
|
.amily2-game-panel::-webkit-scrollbar {
|
||||||
@@ -386,71 +373,48 @@ function renderTablesToHtml(tables, highlights) {
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
// 内容面板 (卡片式渲染)
|
// 内容面板 (表格渲染)
|
||||||
let cardsHtml = '';
|
let tableHtml = '';
|
||||||
|
|
||||||
// 如果是单行表格(如时空栏),使用特殊布局
|
// 构建表头
|
||||||
if (table.rows.length === 1) {
|
const theadHtml = `
|
||||||
const row = table.rows[0];
|
<thead>
|
||||||
cardsHtml += `<div class="amily2-game-card" style="border-left: 3px solid #00bfff;">
|
<tr>
|
||||||
<div class="amily2-card-body" style="grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));">
|
${table.headers.map(header => `<th>${header}</th>`).join('')}
|
||||||
${row.map((cell, colIndex) => {
|
</tr>
|
||||||
const header = table.headers[colIndex];
|
</thead>
|
||||||
const highlightKey = `${table.originalIndex}-0-${colIndex}`;
|
`;
|
||||||
const isHighlighted = highlights.has(highlightKey);
|
|
||||||
const style = isHighlighted ? 'style="color: #00ff7f;"' : '';
|
|
||||||
return `
|
|
||||||
<div class="amily2-card-attr">
|
|
||||||
<span class="amily2-card-label">${header}</span>
|
|
||||||
<span class="amily2-card-value" ${style}>${cell}</span>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
}).join('')}
|
|
||||||
</div>
|
|
||||||
</div>`;
|
|
||||||
} else {
|
|
||||||
// 多行表格,每行一个卡片
|
|
||||||
table.rows.forEach((row, rowIndex) => {
|
|
||||||
const rowStatus = table.rowStatuses ? table.rowStatuses[rowIndex] : 'normal';
|
|
||||||
if (rowStatus === 'pending-deletion') return;
|
|
||||||
|
|
||||||
// 假设第一列是标题/名称
|
// 构建表体
|
||||||
const titleCell = row[0];
|
let tbodyHtml = '<tbody>';
|
||||||
const otherCells = row.slice(1);
|
table.rows.forEach((row, rowIndex) => {
|
||||||
const otherHeaders = table.headers.slice(1);
|
const rowStatus = table.rowStatuses ? table.rowStatuses[rowIndex] : 'normal';
|
||||||
|
if (rowStatus === 'pending-deletion') return;
|
||||||
|
|
||||||
cardsHtml += `
|
tbodyHtml += '<tr>';
|
||||||
<div class="amily2-game-card">
|
row.forEach((cell, colIndex) => {
|
||||||
<div class="amily2-card-header">
|
const highlightKey = `${table.originalIndex}-${rowIndex}-${colIndex}`;
|
||||||
<span class="amily2-card-title">${titleCell}</span>
|
const isHighlighted = highlights.has(highlightKey);
|
||||||
<span style="font-size: 0.8em; color: #555;">#${rowIndex + 1}</span>
|
const style = isHighlighted ? 'style="color: #00ff7f; font-weight: bold;"' : '';
|
||||||
</div>
|
tbodyHtml += `<td ${style}>${cell}</td>`;
|
||||||
<div class="amily2-card-body">
|
|
||||||
${otherCells.map((cell, i) => {
|
|
||||||
const colIndex = i + 1;
|
|
||||||
const header = otherHeaders[i];
|
|
||||||
const highlightKey = `${table.originalIndex}-${rowIndex}-${colIndex}`;
|
|
||||||
const isHighlighted = highlights.has(highlightKey);
|
|
||||||
const style = isHighlighted ? 'style="color: #00ff7f;"' : '';
|
|
||||||
return `
|
|
||||||
<div class="amily2-card-attr">
|
|
||||||
<span class="amily2-card-label">${header}</span>
|
|
||||||
<span class="amily2-card-value" ${style}>${cell}</span>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
}).join('')}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
});
|
});
|
||||||
}
|
tbodyHtml += '</tr>';
|
||||||
|
});
|
||||||
|
tbodyHtml += '</tbody>';
|
||||||
|
|
||||||
|
tableHtml = `
|
||||||
|
<div class="amily2-table-wrapper">
|
||||||
|
<table class="amily2-data-table">
|
||||||
|
${theadHtml}
|
||||||
|
${tbodyHtml}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
contentHtml += `
|
contentHtml += `
|
||||||
<div id="game-panel-${index}" class="amily2-game-panel ${isActive}">
|
<div id="game-panel-${index}" class="amily2-game-panel ${isActive}">
|
||||||
<div class="amily2-panel-title"><i class="fas ${icon}"></i> ${table.name}</div>
|
<div class="amily2-panel-title"><i class="fas ${icon}"></i> ${table.name}</div>
|
||||||
<div class="amily2-game-cards-container">
|
${tableHtml}
|
||||||
${cardsHtml}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
});
|
});
|
||||||
@@ -556,6 +520,17 @@ export function updateOrInsertTableInChat() {
|
|||||||
lastMessage.appendChild(container);
|
lastMessage.appendChild(container);
|
||||||
bindSwipePreventer(container);
|
bindSwipePreventer(container);
|
||||||
|
|
||||||
|
// 绑定鼠标滚轮横向滚动事件
|
||||||
|
const tableWrappers = container.querySelectorAll('.amily2-table-wrapper');
|
||||||
|
tableWrappers.forEach(wrapper => {
|
||||||
|
wrapper.addEventListener('wheel', (e) => {
|
||||||
|
if (e.deltaY !== 0) {
|
||||||
|
e.preventDefault();
|
||||||
|
wrapper.scrollLeft += e.deltaY;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// 绑定折叠按钮事件
|
// 绑定折叠按钮事件
|
||||||
const toggleBtn = container.querySelector('.amily2-table-toggle');
|
const toggleBtn = container.querySelector('.amily2-table-toggle');
|
||||||
if (toggleBtn) {
|
if (toggleBtn) {
|
||||||
|
|||||||
Reference in New Issue
Block a user