koishi-plugin-memesluna 0.2.7 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +67 -1
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -535,7 +535,9 @@ var Config = import_koishi2.Schema.object({
535
535
  selfUrl: import_koishi2.Schema.string().default("").description("服务公开地址,不填则优先使用 server.selfUrl"),
536
536
  injectVariables: import_koishi2.Schema.boolean().default(true).description("是否向 ChatLuna 注入 {{endpoint}} 和 {{memesluna}} 变量"),
537
537
  variableRefreshIntervalMs: import_koishi2.Schema.number().min(30 * 1e3).max(60 * 60 * 1e3).default(5 * 60 * 1e3).description("变量刷新间隔(毫秒)"),
538
- injectVariablesPrompt: import_koishi2.Schema.string().role("textarea").default(`你可以使用表情包来丰富你的回复。表情包列表是{endpoint},基础URL是{base_url},你要把基础URL拼接到路径前面,不要加文件名,只加路径,用发送图片的方式发送。`).description("注入到 ChatLuna {{memesluna}} 变量的提示词模板,支持 {endpoint} 和 {base_url} 占位符")
538
+ injectVariablesPrompt: import_koishi2.Schema.string().role("textarea").default(`你可以使用表情包来丰富你的回复。可用的表情包合集如下:
539
+ {endpoint}
540
+ 使用方法:直接用 {base_url} 拼接路径即可,例如 {base_url}/memesluna/yuzu ,访问该URL会自动随机返回一张图片。绝对不要在路径后面添加任何文件名或数字(如 /1.png、/25.png),否则会404。只需要发送合集路径,服务器会自动随机选图。`).description("注入到 ChatLuna {{memesluna}} 变量的提示词模板,支持 {endpoint} 和 {base_url} 占位符")
539
541
  });
540
542
  var name = "memesluna";
541
543
 
@@ -1388,6 +1390,39 @@ function buildAdminHtml(basePath) {
1388
1390
  color: #64748b;
1389
1391
  }
1390
1392
 
1393
+ .folder-card .folder-desc {
1394
+ font-size: 0.78rem;
1395
+ color: #94a3b8;
1396
+ margin-top: 2px;
1397
+ overflow: hidden;
1398
+ text-overflow: ellipsis;
1399
+ white-space: nowrap;
1400
+ }
1401
+
1402
+ .folder-card .folder-path {
1403
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
1404
+ font-size: 0.72rem;
1405
+ color: #a5b4fc;
1406
+ margin-top: 2px;
1407
+ }
1408
+
1409
+ .desc-editor {
1410
+ display: flex;
1411
+ align-items: center;
1412
+ gap: 0.5rem;
1413
+ margin-bottom: 0.8rem;
1414
+ }
1415
+
1416
+ .desc-editor input {
1417
+ flex: 1;
1418
+ }
1419
+
1420
+ .desc-display {
1421
+ font-size: 0.88rem;
1422
+ color: #64748b;
1423
+ margin-bottom: 0.5rem;
1424
+ }
1425
+
1391
1426
  .image-grid {
1392
1427
  display: grid;
1393
1428
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
@@ -1488,6 +1523,11 @@ function buildAdminHtml(basePath) {
1488
1523
  <button id="delete-collection" class="btn btn-sm btn-outline-danger">删除合集</button>
1489
1524
  </div>
1490
1525
  </div>
1526
+ <div id="detail-path" class="desc-display" style="font-family:monospace;color:#a5b4fc;font-size:0.82rem"></div>
1527
+ <div class="desc-editor">
1528
+ <input id="desc-input" class="form-control form-control-sm" placeholder="为这个合集添加描述,例如:千恋万花的丛雨表情包" />
1529
+ <button id="save-desc" class="btn btn-sm btn-outline-primary">保存描述</button>
1530
+ </div>
1491
1531
 
1492
1532
  <div class="row g-3 mb-3">
1493
1533
  <div class="col-md-6">
@@ -1601,6 +1641,17 @@ function buildAdminHtml(basePath) {
1601
1641
  nameEl.className = 'folder-name'
1602
1642
  nameEl.textContent = col.name
1603
1643
  info.appendChild(nameEl)
1644
+ if (col.description) {
1645
+ var descEl = document.createElement('div')
1646
+ descEl.className = 'folder-desc'
1647
+ descEl.textContent = col.description
1648
+ descEl.title = col.description
1649
+ info.appendChild(descEl)
1650
+ }
1651
+ var pathEl = document.createElement('div')
1652
+ pathEl.className = 'folder-path'
1653
+ pathEl.textContent = BASE_PATH + '/' + col.name
1654
+ info.appendChild(pathEl)
1604
1655
  var meta = document.createElement('div')
1605
1656
  meta.className = 'folder-meta'
1606
1657
  meta.textContent = '本地 ' + (col.localCount || 0) + ' / 外链 ' + (col.linkCount || 0)
@@ -1615,6 +1666,9 @@ function buildAdminHtml(basePath) {
1615
1666
  byId('view-folders').style.display = 'none'
1616
1667
  byId('view-detail').style.display = 'block'
1617
1668
  byId('detail-title').textContent = name
1669
+ byId('detail-path').textContent = '端点路径: ' + BASE_PATH + '/' + name
1670
+ var col = state.collections.find(function(c) { return c.name === name })
1671
+ byId('desc-input').value = (col && col.description) ? col.description : ''
1618
1672
  refreshCollectionResources()
1619
1673
  }
1620
1674
 
@@ -1810,6 +1864,18 @@ function buildAdminHtml(basePath) {
1810
1864
 
1811
1865
  byId('back-to-folders').addEventListener('click', backToFolders)
1812
1866
 
1867
+ byId('save-desc').addEventListener('click', async function() {
1868
+ if (!state.selectedCollection) return
1869
+ var desc = byId('desc-input').value.trim()
1870
+ await request(BASE_PATH + '/api/admin/collections/' + encodeURIComponent(state.selectedCollection) + '/description', {
1871
+ method: 'PATCH',
1872
+ body: JSON.stringify({ description: desc }),
1873
+ })
1874
+ var col = state.collections.find(function(c) { return c.name === state.selectedCollection })
1875
+ if (col) col.description = desc
1876
+ showAlert('描述已保存', 'success')
1877
+ })
1878
+
1813
1879
  byId('refresh-resources').addEventListener('click', function() {
1814
1880
  refreshCollectionResources()
1815
1881
  showAlert('已刷新', 'success')
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-memesluna",
3
3
  "description": "Image Forward service for Koishi with ChatLuna integration",
4
- "version": "0.2.7",
4
+ "version": "0.2.9",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "types": "lib/index.d.ts",