9 changed files with 166 additions and 86 deletions
@ -1,24 +1,41 @@ |
|||||
/** @odoo-module **/ |
/** @odoo-module **/ |
||||
import {CommandPalette} from "@web/core/commands/command_palette"; |
import {CommandPalette} from "@web/core/commands/command_palette"; |
||||
import {patch} from "@web/core/utils/patch"; |
import {patch} from "@web/core/utils/patch"; |
||||
|
import {useService} from "@web/core/utils/hooks"; |
||||
import rpc from 'web.rpc'; |
import rpc from 'web.rpc'; |
||||
|
|
||||
patch(CommandPalette.prototype, '@web/core/commands/command_palette', { |
patch(CommandPalette.prototype, '@web/core/commands/command_palette', { |
||||
setup() { |
setup() { |
||||
this._super.apply(); |
this._super.apply(); |
||||
|
this.notification = useService("notification"); |
||||
}, |
}, |
||||
//This function is used to recognize the voice
|
//This function is used to recognize the voice
|
||||
async recordVoice(event) { |
async recordVoice(event) { |
||||
if (location.href.includes('http:')) { |
if (location.href.includes('http:')) { |
||||
|
const closeFun = this.notification.add( |
||||
|
"Recording....", |
||||
|
{ |
||||
|
title: "Recording", |
||||
|
type: "success", |
||||
|
sticky: true |
||||
|
}, |
||||
|
); |
||||
|
setTimeout(() => closeFun(), 15000) |
||||
var response = await rpc.query({ |
var response = await rpc.query({ |
||||
model: 'voice.recognition', |
model: 'voice.recognition', |
||||
method: 'recognize_speech', |
method: 'recognize_speech', |
||||
args: [,], |
args: [], |
||||
}) |
}) |
||||
if (response) { |
if (response) { |
||||
this.state.searchValue = response |
this.state.searchValue = response |
||||
} |
} else { |
||||
else{ |
this.notification.add( |
||||
this.state.searchValue = "Your voice could not be recognizing......" |
"Couldn't recognize the voice, please try again.", |
||||
|
{ |
||||
|
title: "Recording", |
||||
|
type: "info", |
||||
|
}, |
||||
|
) |
||||
} |
} |
||||
} |
} |
||||
}, |
}, |
||||
|
Loading…
Reference in new issue