File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
functional-samples/ai.gemini-on-device-audio-scribe Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ chrome.runtime.onMessage.addListener(async ({ data }) => {
2323 // Check if it's an audio file
2424 const audio = await fetch ( data . objectUrl ) ;
2525 content = await audio . blob ( ) ;
26- if ( ! content . type || ! content . type . startsWidth ( 'audio/' ) ) {
26+ if ( ! content . type || ! content . type . startsWith ( 'audio/' ) ) {
2727 return ;
2828 }
2929 } catch ( e ) {
@@ -46,10 +46,13 @@ chrome.runtime.onMessage.addListener(async ({ data }) => {
4646 const session = await LanguageModel . create ( {
4747 expectedInputs : [ { type : 'audio' } ]
4848 } ) ;
49- const stream = session . promptStreaming ( [
50- { type : 'audio' , content } ,
51- 'transcribe this audio'
52- ] ) ;
49+ const stream = session . promptStreaming ( [ {
50+ role : 'user' ,
51+ content : [
52+ { type : 'text' , value : 'transcribe this audio' } ,
53+ { type : 'audio' , value : content }
54+ ]
55+ } ] ) ;
5356
5457 // Render streamed response
5558 let first = true ;
You can’t perform that action at this time.
0 commit comments