Skip to content

知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.

chore: lsctl notesReplay takes lines per update, and the log says when a Ling reply was cut at max_tokens

wqugurue70a8a209ad9
diff --git a/Sources/Cicada/AppModel.swift b/Sources/Cicada/AppModel.swift
index db024d4..0b2fad1 100644
--- a/Sources/Cicada/AppModel.swift
+++ b/Sources/Cicada/AppModel.swift
@@ -1785,7 +1785,9 @@ final class AppModel: ObservableObject {
openNotesWindow()
if v.count == 4 { notesWindow.place(NSRect(x: v[0], y: v[1], width: v[2], height: v[3])) }
case "notesFrame": debugLog("notes window frame=\(String(describing: notesWindow.frame)) visible=\(notesWindow.isVisible) policy=\(NSApp.activationPolicy() == .regular ? "regular" : "accessory")")
- case "notesReplay": Task { await notes.replay(arg) }
+ case "notesReplay": // <id>[,<lines per update>]
+ let parts = arg.split(separator: ",").map(String.init)
+ Task { await notes.replay(parts[0], step: parts.count > 1 ? Int(parts[1]) ?? 4 : 4) }
case "notesShow": notes.show(arg)
case "notesCapturable": notesWindow.setCapturable(arg != "off")
case "notesShare": setNotesCapturable(arg != "off") // the setting itself, as its badge or switch does
diff --git a/Sources/Cicada/Ling.swift b/Sources/Cicada/Ling.swift
index 3fa7eaf..762c70e 100644
--- a/Sources/Cicada/Ling.swift
+++ b/Sources/Cicada/Ling.swift
@@ -488,7 +488,8 @@ final class LingClient: ObservableObject {
}
let ms = Int(Date().timeIntervalSince(started) * 1000)
let usage = root["usage"] as? [String: Any]
- debugLog("ling: \(priority) ok \(ms) ms tokens=\(usage?["prompt_tokens"] ?? "?")/\(usage?["completion_tokens"] ?? "?")")
+ // A reply cut at max_tokens is usually half a JSON object: say so, or it reads as a bad reply.
+ debugLog("ling: \(priority) ok \(ms) ms tokens=\(usage?["prompt_tokens"] ?? "?")/\(usage?["completion_tokens"] ?? "?")\(finish == "length" ? " cut at max_tokens" : "")")
report(call, priority, at: started, queued: queued, outcome: "ok",
tokens: (usage?["prompt_tokens"] as? Int ?? 0, usage?["completion_tokens"] as? Int ?? 0))
if rateLimitedAt != nil { rateLimitedAt = nil }