Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WhisperAX demo doesn't copy with streaming #173

Open
iGerman00 opened this issue Jun 23, 2024 · 3 comments
Open

WhisperAX demo doesn't copy with streaming #173

iGerman00 opened this issue Jun 23, 2024 · 3 comments
Labels
enhancement Improves existing code

Comments

@iGerman00
Copy link

Recently it was brought to my attention that the copy button doesn't really work when streaming or using eager mode. It really should and should also probably be bound to Cmd+C. Me and my friends use it quite often as a quick way to live transcribe something. I've modified it locally but thought I'd bring it to your attention, too. It would also be really nice to get an updated TestFlight build every now and again.

Proposition:

.toolbar(content: {
                ToolbarItem {
                    Button {
                        if (!enableEagerDecoding) {
                            let fullTranscript = formatSegments(confirmedSegments + unconfirmedSegments, withTimestamps: enableTimestamps).joined(separator: "\n")
                            #if os(iOS)
                            UIPasteboard.general.string = fullTranscript
                            #elseif os(macOS)
                            NSPasteboard.general.clearContents()
                            NSPasteboard.general.setString(fullTranscript, forType: .string)
                            #endif
                        } else {
                            #if os(iOS)
                            UIPasteboard.general.string = confirmedText + hypothesisText
                            #elseif os(macOS)
                            NSPasteboard.general.clearContents()
                            NSPasteboard.general.setString(confirmedText + hypothesisText, forType: .string)
                            #endif
                        }
                    } label: {
                        Label("Copy Text", systemImage: "doc.on.doc")
                    }
                    .keyboardShortcut("c", modifiers: .command)
                    .foregroundColor(.primary)
                    .frame(minWidth: 0, maxWidth: .infinity)
                }
            })
        }
@ZachNagengast
Copy link
Contributor

Good callout. This makes sense because the eager mode doesn't use these segments internally. It's definitely a TODO for the sample app. As a workaround, we recently added the ability to select the text manually with your cursor now.

@ZachNagengast ZachNagengast added the enhancement Improves existing code label Jun 24, 2024
@ZachNagengast
Copy link
Contributor

@iGerman00 Do you want to submit this proposal as a PR?

@iGerman00
Copy link
Author

If the code looks acceptable to you, sure. I'm not very familiar with Xcode/Swift

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves existing code
Projects
Status: TODO
Development

No branches or pull requests

2 participants