dsh-whale-whispers 2.0.7 → 2.0.8
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.
- package/index.js +11 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -914,12 +914,19 @@ async function sessionTitleOf(sessionId) {
|
|
|
914
914
|
const lines = source ? source.split(/\r?\n/) : []
|
|
915
915
|
let at = path ? lines.findIndex((l) => l.trim().startsWith('- ') && normalise(splitLine(l)) === wanted) : -1
|
|
916
916
|
if (at === -1) {
|
|
917
|
-
// 句子可能写在别的对话文件里(例如早期按 sid
|
|
917
|
+
// 句子可能写在别的对话文件里(例如早期按 sid 落盘但没带对话名),再扫一遍所有文件。
|
|
918
|
+
// 不带 conv 时 append 写的是 config 里的 legacy 文件(resolveTarget),所以先认它;目录也要用 quotesDir()(会读 config),不能写死 DEFAULT_DIR。
|
|
919
|
+
const quoteDir = await quotesDir()
|
|
920
|
+
const legacyPath = (await resolveTarget()).path
|
|
921
|
+
const altPaths = []
|
|
922
|
+
if (legacyPath && legacyPath !== path) altPaths.push(legacyPath)
|
|
918
923
|
let altNames = []
|
|
919
|
-
try { altNames = (await readdir(
|
|
924
|
+
try { altNames = (await readdir(quoteDir)).filter((n) => n.endsWith('.md')) } catch { altNames = [] }
|
|
920
925
|
for (const name of altNames) {
|
|
921
|
-
const alt =
|
|
922
|
-
if (alt
|
|
926
|
+
const alt = quoteDir + '/' + name
|
|
927
|
+
if (alt !== path && altPaths.indexOf(alt) === -1) altPaths.push(alt)
|
|
928
|
+
}
|
|
929
|
+
for (const alt of altPaths) {
|
|
923
930
|
let altSource = ''
|
|
924
931
|
try { altSource = await readFile(alt, 'utf8') } catch { continue }
|
|
925
932
|
const altLines = altSource.split(/\r?\n/)
|