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.

feat(notes): edit meeting notes and build a people library

clementchena7775544167d
diff --git a/Sources/Cicada/AppModel.swift b/Sources/Cicada/AppModel.swift
index 7d67562..6b4e03f 100644
--- a/Sources/Cicada/AppModel.swift
+++ b/Sources/Cicada/AppModel.swift
@@ -889,6 +889,14 @@ final class AppModel: ObservableObject {
notes.generate(for: id)
}
+ /// A hand edit of summary/topics/names: stored with the meeting and shown at once.
+ func saveEditedNotes(_ edited: MeetingNotes, session id: String) {
+ var next = edited
+ next.updatedAt = Date()
+ store.setNotes(id, next)
+ notes.applyEdited(next, id: id)
+ }
+
// MARK: Display (live notes / subtitle bar / nothing)
/// 录屏时可见: every place that shows it (settings, menu bar panel, 显示 menu, the notes
@@ -1421,6 +1429,28 @@ final class AppModel: ObservableObject {
if after != before { speakerUndo?.text = L("\(before) 已改成 \(after)") } else { speakerUndo = nil }
}
+ /// A click on 对方 / 说话人 in the transcript: ask for a name without making the user find
+ /// the speaker strip first. It only names this meeting's voice; remembering the voiceprint is
+ /// still an explicit 记住这个声音 step with its own consent alert.
+ func promptSpeakerName(session id: String, voice: Int) {
+ guard let s = store.session(id) else { return }
+ let n = SpeakerLabels.voiceNumbers(s)[voice] ?? 0
+ let current = SpeakerLabels.names(s)[n] ?? ""
+ let field = NSTextField(frame: NSRect(x: 0, y: 0, width: 260, height: 24))
+ field.stringValue = current
+ field.placeholderString = L("输入名字")
+ let alert = NSAlert()
+ alert.messageText = L("这个人是谁?")
+ alert.informativeText = L("写上名字后,这场记录会按这个名字显示。要下次自动认出,再点“记住这个声音”。")
+ alert.accessoryView = field
+ alert.addButton(withTitle: L("保存"))
+ alert.addButton(withTitle: L("取消"))
+ alert.window.initialFirstResponder = field
+ guard alert.runModal() == .alertFirstButtonReturn else { return }
+ let name = field.stringValue.trimmingCharacters(in: .whitespacesAndNewlines)
+ if !name.isEmpty { renameSpeaker(session: id, voice: voice, name) }
+ }
+
/// Two voices are one person. While listening the voiceprints merge too, which 撤销 can't take back.
func mergeSpeaker(session id: String, _ from: Int, into: Int) {
guard let s = store.session(id) else { return }
@@ -1541,6 +1571,56 @@ final class AppModel: ObservableObject {
speakerProfiles = profiles.all()
}
+ func saveSpeakerProfileNotes(id: UUID, notes: String) {
+ guard profiles.setNotes(id: id, notes) else { return }
+ speakerProfiles = profiles.all()
+ }
+
+ /// Summarise how this person talks from the lines already bound to their voiceprint. This is a
+ /// communication-style note (length, questions, directness), not a personality diagnosis.
+ @discardableResult
+ func analyzeSpeakerStyle(id: UUID) -> String? {
+ guard let profile = profiles.snapshot().first(where: { $0.id == id }) else { return nil }
+ var texts: [String] = []
+ for session in store.sessions {
+ guard let refs = session.voiceProfiles else { continue }
+ for line in session.lines where line.speaker == "them" {
+ guard let voice = line.voice, refs[String(voice)]?.id == id else { continue }
+ let text = line.src.trimmingCharacters(in: .whitespacesAndNewlines)
+ if text.count >= 4 { texts.append(text) }
+ }
+ }
+ guard !texts.isEmpty else { return nil }
+ let joined = texts.joined(separator: " ")
+ let chars = joined.filter { !$0.isWhitespace }.count
+ let avg = Double(chars) / Double(texts.count)
+ let questions = texts.filter { $0.contains("?") || $0.contains("?") }.count
+ let hedges = count(["可能", "也许", "大概", "应该", "我觉得", "不确定", "或许"], in: joined)
+ let direct = count(["必须", "一定", "肯定", "直接", "明确", "需要", "马上", "推进", "决定", "要"], in: joined)
+ let first = count(["我", "我们"], in: joined)
+ var parts: [String] = ["基于 \(texts.count) 句发言"]
+ parts.append(avg >= 22 ? "句子偏长,信息密度高" : avg >= 10 ? "句子长度适中" : "表达简短,偏要点式")
+ if Double(questions) / Double(texts.count) >= 0.12 { parts.append("常用提问推动对话") }
+ if direct >= max(3, texts.count / 10) { parts.append("常给判断、要求和下一步") }
+ if hedges >= max(3, texts.count / 12) { parts.append("措辞较谨慎,常留余地") }
+ if first >= max(3, texts.count / 8) { parts.append("常用“我/我们”表达立场") }
+ let style = parts.joined(separator: ";") + "。只归纳说话方式,不是心理测评。"
+ _ = profiles.setStyle(id: profile.id, style)
+ speakerProfiles = profiles.all()
+ return style
+ }
+
+ private func count(_ words: [String], in text: String) -> Int {
+ words.reduce(0) { total, word in
+ var n = 0, range = text.startIndex..<text.endIndex
+ while let r = text.range(of: word, range: range) {
+ n += 1
+ range = r.upperBound..<text.endIndex
+ }
+ return total + n
+ }
+ }
+
func deleteSpeakerProfile(id: UUID) {
profiles.delete(id: id)
speakerProfiles = profiles.all()
diff --git a/Sources/Cicada/Notes.swift b/Sources/Cicada/Notes.swift
index d56e57b..7f2d1bd 100644
--- a/Sources/Cicada/Notes.swift
+++ b/Sources/Cicada/Notes.swift
@@ -213,6 +213,13 @@ final class NotesEngine: ObservableObject {
Task { await update(id, final: false) }
}
+ /// A hand edit in the notes window: keep the editor's text, not the next AI pass's copy.
+ func applyEdited(_ edited: MeetingNotes, id: String) {
+ guard shownID == id else { return }
+ notes = edited
+ objectWillChange.send()
+ }
+
/// Show a stored meeting's notes (the window shows the live meeting when there is one).
func show(_ id: String) {
shownID = id
diff --git a/Sources/Cicada/NotesEditorView.swift b/Sources/Cicada/NotesEditorView.swift
new file mode 100644
index 0000000..43ae60a
--- /dev/null
+++ b/Sources/Cicada/NotesEditorView.swift
@@ -0,0 +1,170 @@
+import SwiftUI
+
+/// Edit the notes by hand. Names and terms are what speech recognition gets wrong most, so they
+/// are fields of their own; the AI's text stays a draft until the user saves it.
+struct NotesEditorView: View {
+ @ObservedObject var model: AppModel
+ let sessionID: String
+ @State private var draft: MeetingNotes
+ @Environment(\.dismiss) private var dismiss
+
+ init(model: AppModel, sessionID: String) {
+ self.model = model
+ self.sessionID = sessionID
+ _draft = State(initialValue: model.store.session(sessionID)?.notes ?? MeetingNotes())
+ }
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 0) {
+ HStack {
+ VStack(alignment: .leading, spacing: 3) {
+ Text("编辑纪要").font(.system(size: 18, weight: .bold))
+ Text("改完保存在这场会议里;人名和术语也会用于以后整理。")
+ .font(.system(size: 11)).foregroundStyle(Palette.tertiary)
+ }
+ Spacer()
+ Button("取消") { dismiss() }.buttonStyle(.plain)
+ .font(.system(size: 13)).foregroundStyle(Palette.secondary)
+ SoftButton("保存", dark: true) { save() }
+ }
+ .padding(.horizontal, 20).padding(.top, 18).padding(.bottom, 14)
+
+ Divider()
+
+ ScrollView {
+ VStack(alignment: .leading, spacing: 18) {
+ field("纪要标题") {
+ TextField("例如:招商局软件工厂沟通", text: optional(\.title))
+ .textFieldStyle(.roundedBorder)
+ }
+
+ field("总结") {
+ editor($draft.summary, height: 110)
+ }
+
+ if !draft.topics.isEmpty {
+ section("议题")
+ ForEach(draft.topics.indices, id: \.self) { i in
+ VStack(alignment: .leading, spacing: 6) {
+ TextField("议题标题", text: $draft.topics[i].title)
+ .textFieldStyle(.roundedBorder)
+ editor($draft.topics[i].summary, height: 64)
+ ForEach(draft.topics[i].points.indices, id: \.self) { j in
+ HStack(spacing: 6) {
+ Text("·").foregroundStyle(Palette.tertiary)
+ TextField("要点", text: $draft.topics[i].points[j])
+ .textFieldStyle(.roundedBorder)
+ }
+ }
+ }
+ .padding(10)
+ .background(RoundedRectangle(cornerRadius: 10).fill(Palette.raised))
+ }
+ }
+
+ if !draft.conclusions.isEmpty {
+ section("结论")
+ ForEach(draft.conclusions.indices, id: \.self) { i in
+ item($draft.conclusions[i], prefix: "结论")
+ }
+ }
+ if !draft.todos.isEmpty {
+ section("待办")
+ ForEach(draft.todos.indices, id: \.self) { i in
+ item($draft.todos[i], prefix: "待办")
+ }
+ }
+
+ if !draft.terms.isEmpty {
+ section("人名和术语")
+ Text("名字写对后,纪要里所有人名会按这里显示;识别错的写法放在“听成”里。")
+ .font(.system(size: 11)).foregroundStyle(Palette.tertiary)
+ ForEach(draft.terms.indices, id: \.self) { i in
+ VStack(alignment: .leading, spacing: 6) {
+ HStack(spacing: 8) {
+ TextField("正确名字/术语", text: $draft.terms[i].name)
+ .textFieldStyle(.roundedBorder)
+ TextField("说明(公司、职位…)", text: $draft.terms[i].note)
+ .textFieldStyle(.roundedBorder)
+ }
+ TextField("听成(逗号分隔)", text: Binding(
+ get: { draft.terms[i].heard.joined(separator: ",") },
+ set: { draft.terms[i].heard = $0.split(whereSeparator: { $0 == "," || $0 == "," })
+ .map { $0.trimmingCharacters(in: .whitespaces) }.filter { !$0.isEmpty } }
+ ))
+ .textFieldStyle(.roundedBorder)
+ .font(.system(size: 11))
+ }
+ .padding(10)
+ .background(RoundedRectangle(cornerRadius: 10).fill(Palette.raised))
+ }
+ }
+ }
+ .padding(20)
+ }
+ }
+ .frame(width: 720, height: 680)
+ .background(Color.white)
+ }
+
+ private func save() {
+ draft.updatedAt = Date()
+ model.saveEditedNotes(draft, session: sessionID)
+ dismiss()
+ }
+
+ private func optional(_ key: WritableKeyPath<MeetingNotes, String?>) -> Binding<String> {
+ Binding(get: { draft[keyPath: key] ?? "" },
+ set: { draft[keyPath: key] = $0.isEmpty ? nil : $0 })
+ }
+
+ private func field<Content: View>(_ title: String, @ViewBuilder content: () -> Content) -> some View {
+ VStack(alignment: .leading, spacing: 6) {
+ Text(title).font(.system(size: 12, weight: .semibold)).foregroundStyle(Palette.secondary)
+ content()
+ }
+ }
+
+ private func section(_ title: String) -> some View {
+ Text(title).font(.system(size: 13, weight: .bold)).foregroundStyle(Palette.ink)
+ .padding(.top, 4)
+ }
+
+ private func editor(_ text: Binding<String>, height: CGFloat) -> some View {
+ TextEditor(text: text)
+ .font(.system(size: 13))
+ .scrollContentBackground(.hidden)
+ .padding(7)
+ .frame(minHeight: height)
+ .background(RoundedRectangle(cornerRadius: 8).fill(Palette.raised))
+ .overlay(RoundedRectangle(cornerRadius: 8).stroke(Palette.line, lineWidth: 1))
+ }
+
+ private func item(_ item: Binding<NoteItem>, prefix: String) -> some View {
+ VStack(alignment: .leading, spacing: 6) {
+ TextField("\(prefix)内容", text: item.text).textFieldStyle(.roundedBorder)
+ TextField("负责人(可空)", text: Binding(
+ get: { item.wrappedValue.owner ?? "" },
+ set: { item.wrappedValue.owner = $0.isEmpty ? nil : $0 }
+ )).textFieldStyle(.roundedBorder).font(.system(size: 11))
+ }
+ .padding(10)
+ .background(RoundedRectangle(cornerRadius: 10).fill(Palette.raised))
+ }
+}
+
+/// The small 编辑 control that opens `NotesEditorView`; no state outside the button.
+struct NotesEditButton: View {
+ @ObservedObject var model: AppModel
+ let session: Session
+ @State private var shown = false
+
+ var body: some View {
+ Button("编辑") { shown = true }
+ .buttonStyle(.plain)
+ .font(.system(size: 13))
+ .foregroundStyle(Palette.secondary)
+ .help("手动改纪要、人名和术语")
+ .sheet(isPresented: $shown) { NotesEditorView(model: model, sessionID: session.id) }
+ }
+}
diff --git a/Sources/Cicada/NotesWindow.swift b/Sources/Cicada/NotesWindow.swift
index 45e5183..9ab1b8c 100644
--- a/Sources/Cicada/NotesWindow.swift
+++ b/Sources/Cicada/NotesWindow.swift
@@ -362,6 +362,8 @@ struct NotesWindowView: View {
.contentShape(Rectangle())
}
.buttonStyle(.plain).help("结束这场会议").padding(.trailing, 4)
+ } else if let s = session, !engine.notes.isEmpty {
+ NotesEditButton(model: model, session: s)
}
iconButton(wide ? "rectangle.split.2x1.fill" : "rectangle.split.2x1", help: wide ? L("收窄") : L("纪要和原话并排")) {
setWidth(wide ? 460 : 820, nil)
diff --git a/Sources/Cicada/SettingsWindow.swift b/Sources/Cicada/SettingsWindow.swift
index fa33568..9e900c1 100644
--- a/Sources/Cicada/SettingsWindow.swift
+++ b/Sources/Cicada/SettingsWindow.swift
@@ -748,7 +748,7 @@ struct SettingsView: View {
Toggle("记住说话人", isOn: $settings.speakerMemory)
.toggleStyle(.switch).labelsHidden().controlSize(.small).tint(Palette.ink)
}
- SettingsRow(title: L("声纹库"), detail: L("\(model.speakerProfiles.count) 个人")) {
+ SettingsRow(title: L("人员库"), detail: L("\(model.speakerProfiles.count) 个人 · 声纹和备注")) {
SoftButton(L("管理")) { model.speakerLibraryShown = true }
}
SettingsRow(title: L("记录文件夹"), divider: false) {
diff --git a/Sources/Cicada/SpeakerLibraryView.swift b/Sources/Cicada/SpeakerLibraryView.swift
index 942d0d6..b7e21b1 100644
--- a/Sources/Cicada/SpeakerLibraryView.swift
+++ b/Sources/Cicada/SpeakerLibraryView.swift
@@ -1,12 +1,14 @@
import AppKit
import SwiftUI
-/// The local voiceprint library. Voiceprints are biometric data: every row can be removed here,
-/// and nothing is uploaded.
+/// The local people library: voices remembered by voiceprint, plus what the user knows about the
+/// person and a note on how they tend to talk. Voiceprints are biometric data: every row can be
+/// removed here, and nothing is uploaded.
struct SpeakerLibraryView: View {
@ObservedObject var model: AppModel
@State private var editing: UUID?
@State private var draft = ""
+ @State private var detail: SpeakerProfile?
@Environment(\.dismiss) private var dismiss
private var profiles: [SpeakerProfile] { model.speakerProfiles }
@@ -15,8 +17,8 @@ struct SpeakerLibraryView: View {
VStack(alignment: .leading, spacing: 14) {
HStack {
VStack(alignment: .leading, spacing: 3) {
- Text(L("声纹库")).font(.system(size: 20, weight: .bold)).foregroundStyle(Palette.ink)
- Text(L("只保存在这台 Mac;删除后,以前的会议记录不会受影响。"))
+ Text(L("人员库")).font(.system(size: 20, weight: .bold)).foregroundStyle(Palette.ink)
+ Text(L("声纹只保存在这台 Mac;可以写备注、看说话风格,也可以删除。"))
.font(.system(size: 11)).foregroundStyle(Palette.tertiary)
}
Spacer()
@@ -37,34 +39,50 @@ struct SpeakerLibraryView: View {
ScrollView {
VStack(spacing: 0) {
ForEach(profiles) { p in
- HStack(spacing: 12) {
- Circle().fill(Palette.accentPale).frame(width: 28, height: 28)
- .overlay(Text(String(p.name.prefix(1))).font(.system(size: 12, weight: .bold))
- .foregroundStyle(Palette.accentInk))
- VStack(alignment: .leading, spacing: 2) {
+ VStack(alignment: .leading, spacing: 6) {
+ HStack(spacing: 12) {
+ Circle().fill(Palette.accentPale).frame(width: 28, height: 28)
+ .overlay(Text(String(p.name.prefix(1))).font(.system(size: 12, weight: .bold))
+ .foregroundStyle(Palette.accentInk))
+ VStack(alignment: .leading, spacing: 2) {
+ if editing == p.id {
+ TextField(L("名字"), text: $draft)
+ .textFieldStyle(.roundedBorder)
+ .onSubmit { save(p) }
+ } else {
+ Text(p.name).font(.system(size: 13, weight: .semibold)).foregroundStyle(Palette.ink)
+ }
+ Text(L("\(p.sampleCount) 段样本 · 最近 \(seen(p.lastSeenAt))"))
+ .font(.system(size: 11)).foregroundStyle(Palette.tertiary)
+ }
+ Spacer()
if editing == p.id {
- TextField(L("名字"), text: $draft)
- .textFieldStyle(.roundedBorder)
- .onSubmit { save(p) }
+ SoftButton(L("保存"), dark: true) { save(p) }
+ Button(L("取消")) { editing = nil }.buttonStyle(.plain)
+ .font(.system(size: 12)).foregroundStyle(Palette.secondary)
} else {
- Text(p.name).font(.system(size: 13, weight: .semibold)).foregroundStyle(Palette.ink)
+ Button(L("资料")) { detail = p }.buttonStyle(.plain)
+ .font(.system(size: 12)).foregroundStyle(Palette.secondary)
+ Button(L("分析")) { analyze(p) }.buttonStyle(.plain)
+ .font(.system(size: 12)).foregroundStyle(Palette.secondary)
+ Button(L("改名")) { editing = p.id; draft = p.name }.buttonStyle(.plain)
+ .font(.system(size: 12)).foregroundStyle(Palette.secondary)
+ Button(L("删除")) { delete(p) }.buttonStyle(.plain)
+ .font(.system(size: 12)).foregroundStyle(Palette.accentInk)
}
- Text(L("\(p.sampleCount) 段样本 · 最近 \(seen(p.lastSeenAt))"))
- .font(.system(size: 11)).foregroundStyle(Palette.tertiary)
}
- Spacer()
- if editing == p.id {
- SoftButton(L("保存"), dark: true) { save(p) }
- Button(L("取消")) { editing = nil }.buttonStyle(.plain)
- .font(.system(size: 12)).foregroundStyle(Palette.secondary)
- } else {
- Button(L("改名")) { editing = p.id; draft = p.name }.buttonStyle(.plain)
- .font(.system(size: 12)).foregroundStyle(Palette.secondary)
- Button(L("删除")) { delete(p) }.buttonStyle(.plain)
- .font(.system(size: 12)).foregroundStyle(Palette.accentInk)
+ if let style = p.style, !style.isEmpty {
+ Text(style).font(.system(size: 11)).foregroundStyle(Palette.secondary)
+ .lineLimit(3).fixedSize(horizontal: false, vertical: true)
+ .padding(.leading, 40)
+ }
+ if let notes = p.notes, !notes.isEmpty {
+ Text(notes).font(.system(size: 11)).foregroundStyle(Palette.tertiary)
+ .lineLimit(2).fixedSize(horizontal: false, vertical: true)
+ .padding(.leading, 40)
}
}
- .padding(.horizontal, 12).frame(minHeight: 54)
+ .padding(.horizontal, 12).padding(.vertical, 8).frame(minHeight: 54)
Divider().padding(.leading, 52)
}
}
@@ -80,8 +98,9 @@ struct SpeakerLibraryView: View {
}
}
.padding(24)
- .frame(width: 520, height: 440)
+ .frame(width: 640, height: 520)
.background(Color(red: 0.965, green: 0.969, blue: 0.976))
+ .sheet(item: $detail) { p in SpeakerProfileEditor(model: model, profile: p) }
}
private func save(_ p: SpeakerProfile) {
@@ -89,6 +108,17 @@ struct SpeakerLibraryView: View {
editing = nil
}
+ private func analyze(_ p: SpeakerProfile) {
+ guard model.analyzeSpeakerStyle(id: p.id) != nil else {
+ let a = NSAlert()
+ a.messageText = L("还没有这个人的发言")
+ a.informativeText = L("先在会议里给这个声音命名并记住,分析会从已绑定到这个声纹的发言里归纳。")
+ a.addButton(withTitle: L("知道了"))
+ a.runModal()
+ return
+ }
+ }
+
private func delete(_ p: SpeakerProfile) {
let a = NSAlert()
a.messageText = L("删除“\(p.name)”的声纹?")
@@ -115,3 +145,59 @@ struct SpeakerLibraryView: View {
return f.localizedString(for: date, relativeTo: Date())
}
}
+
+/// Edit the human part of a person's profile; the voiceprint itself stays untouched.
+struct SpeakerProfileEditor: View {
+ @ObservedObject var model: AppModel
+ let profile: SpeakerProfile
+ @State private var name: String
+ @State private var notes: String
+ @Environment(\.dismiss) private var dismiss
+
+ init(model: AppModel, profile: SpeakerProfile) {
+ self.model = model
+ self.profile = profile
+ _name = State(initialValue: profile.name)
+ _notes = State(initialValue: profile.notes ?? "")
+ }
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 14) {
+ Text(L("人员资料")).font(.system(size: 18, weight: .bold))
+ TextField(L("名字"), text: $name).textFieldStyle(.roundedBorder)
+ VStack(alignment: .leading, spacing: 6) {
+ Text(L("备注(公司、职位、下次要记住的事)"))
+ .font(.system(size: 11, weight: .semibold)).foregroundStyle(Palette.secondary)
+ TextEditor(text: $notes)
+ .font(.system(size: 13))
+ .padding(7)
+ .frame(minHeight: 140)
+ .background(RoundedRectangle(cornerRadius: 8).fill(Palette.raised))
+ .overlay(RoundedRectangle(cornerRadius: 8).stroke(Palette.line, lineWidth: 1))
+ }
+ if let style = profile.style, !style.isEmpty {
+ VStack(alignment: .leading, spacing: 4) {
+ Text(L("说话风格")).font(.system(size: 11, weight: .semibold)).foregroundStyle(Palette.secondary)
+ Text(style).font(.system(size: 12)).foregroundStyle(Palette.secondary)
+ .fixedSize(horizontal: false, vertical: true)
+ Text(L("这是从发言内容做的表达方式归纳,不是心理测评。"))
+ .font(.system(size: 10)).foregroundStyle(Palette.tertiary)
+ }
+ }
+ Spacer()
+ HStack {
+ Spacer()
+ Button(L("取消")) { dismiss() }.buttonStyle(.plain)
+ SoftButton(L("保存"), dark: true) {
+ let clean = name.trimmingCharacters(in: .whitespacesAndNewlines)
+ if !clean.isEmpty { model.renameSpeakerProfile(id: profile.id, to: clean) }
+ model.saveSpeakerProfileNotes(id: profile.id, notes: notes)
+ dismiss()
+ }
+ }
+ }
+ .padding(20)
+ .frame(width: 460, height: 430)
+ .background(Color.white)
+ }
+}
diff --git a/Sources/Cicada/SpeakerProfiles.swift b/Sources/Cicada/SpeakerProfiles.swift
index 1475a7e..f1b78cb 100644
--- a/Sources/Cicada/SpeakerProfiles.swift
+++ b/Sources/Cicada/SpeakerProfiles.swift
@@ -13,6 +13,11 @@ struct SpeakerProfile: Codable, Identifiable, Equatable {
var lastSeenAt: Date?
/// When the user agreed to keep this voice. Absent for a profile made before this field existed.
var consentAt: Date?
+ /// Notes the user keeps about this person: company, role, what to remember.
+ var notes: String? = nil
+ /// A local communication-style summary (from what they said, not a psychological test).
+ var style: String? = nil
+ var styleUpdatedAt: Date? = nil
}
/// What a meeting remembers about a local voice id: enough to show the name even if the global
@@ -194,6 +199,33 @@ final class SpeakerProfileStore: @unchecked Sendable {
return updated
}
+ @discardableResult
+ func setNotes(id: UUID, _ notes: String, at date: Date = Date()) -> Bool {
+ var updated = false
+ mutate { profiles in
+ guard let i = profiles.firstIndex(where: { $0.id == id }) else { return }
+ let clean = notes.trimmingCharacters(in: .whitespacesAndNewlines)
+ profiles[i].notes = clean.isEmpty ? nil : String(clean.prefix(2000))
+ profiles[i].updatedAt = date
+ updated = true
+ }
+ return updated
+ }
+
+ @discardableResult
+ func setStyle(id: UUID, _ style: String, at date: Date = Date()) -> Bool {
+ var updated = false
+ mutate { profiles in
+ guard let i = profiles.firstIndex(where: { $0.id == id }) else { return }
+ let clean = style.trimmingCharacters(in: .whitespacesAndNewlines)
+ profiles[i].style = clean.isEmpty ? nil : String(clean.prefix(2000))
+ profiles[i].styleUpdatedAt = date
+ profiles[i].updatedAt = date
+ updated = true
+ }
+ return updated
+ }
+
func delete(id: UUID) {
mutate { $0.removeAll { $0.id == id } }
}
diff --git a/Sources/Cicada/Views.swift b/Sources/Cicada/Views.swift
index 5f4953f..ad88906 100644
--- a/Sources/Cicada/Views.swift
+++ b/Sources/Cicada/Views.swift
@@ -1201,6 +1201,10 @@ struct MainWindowView: View {
.buttonStyle(.plain)
.help(showQuotes ? L("收起原话") : L("在纪要旁显示原话"))
}
+ // Edit the notes, names and terms by hand (not while the meeting is being written).
+ if active == "notes", let notes = (s.id == store.liveID ? model.notes.notes : s.notes), !notes.isEmpty {
+ NotesEditButton(model: model, session: s)
+ }
// Not while the meeting is still going, nor before an import has its text.
Button { sharing = s } label: {
Text("分享…").font(.system(size: 13)).foregroundStyle(Palette.secondary)
@@ -1513,6 +1517,23 @@ struct MainWindowView: View {
.menuStyle(.borderlessButton).menuIndicator(.visible).fixedSize()
.help(L("这句是谁说的"))
} else if let speaker { SpeakerTag(number: speaker) }
+ else if let s = shownSession, let v = l.voice {
+ // A one-to-one call (or a voice not on show yet): make 对方 clickable to name.
+ Menu {
+ Button(L("标记人名…")) { model.promptSpeakerName(session: s.id, voice: v) }
+ if model.settings.speakerMemory, s.id != model.store.liveID {
+ Button(L("记住这个声音…")) { model.rememberSpeaker(session: s.id, voice: v) }
+ }
+ } label: {
+ HStack(spacing: 3) {
+ Text("对方").font(.system(size: 11, weight: .semibold)).foregroundStyle(Palette.secondary)
+ Image(systemName: "chevron.down").font(.system(size: 7, weight: .bold)).foregroundStyle(Palette.tertiary)
+ }
+ .contentShape(Rectangle())
+ }
+ .menuStyle(.borderlessButton).menuIndicator(.hidden).fixedSize()
+ .help(L("标记这个人叫什么"))
+ }
else if shownSession?.sourceFile == nil {
// An imported file has no "other side": its lines carry no label.
if me { MeTag() } else {