mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on speech rec
This commit is contained in:
parent
5128ca45a7
commit
025c9abc90
@ -73,6 +73,17 @@ class BaseIntent
|
|||||||
return new $className($state, $data);
|
return new $className($state, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getField($field)
|
||||||
|
{
|
||||||
|
foreach ($this->data->entities as $entity) {
|
||||||
|
if ($entity->type === $field) {
|
||||||
|
return $entity->entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
throw new Exception(trans('texts.intent_not_supported'));
|
throw new Exception(trans('texts.intent_not_supported'));
|
||||||
|
29
app/Ninja/Intents/WebApp/NavigateToIntent.php
Normal file
29
app/Ninja/Intents/WebApp/NavigateToIntent.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Ninja\Intents\WebApp;
|
||||||
|
|
||||||
|
use App\Models\Account;
|
||||||
|
use App\Ninja\Intents\BaseIntent;
|
||||||
|
|
||||||
|
class NavigateToIntent extends BaseIntent
|
||||||
|
{
|
||||||
|
public function process()
|
||||||
|
{
|
||||||
|
$location = $this->getField('Location');
|
||||||
|
$location = str_replace(' ', '_', $location);
|
||||||
|
|
||||||
|
$map = [
|
||||||
|
'report' => 'reports',
|
||||||
|
];
|
||||||
|
|
||||||
|
if (isset($map[$location])) {
|
||||||
|
$location = $map[$location];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array($location, array_merge(Account::$basicSettings, Account::$advancedSettings))) {
|
||||||
|
$location = '/settings/' . $location;
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect($location);
|
||||||
|
}
|
||||||
|
}
|
@ -134,7 +134,6 @@
|
|||||||
recognition.onend = function() {
|
recognition.onend = function() {
|
||||||
recognizing = false;
|
recognizing = false;
|
||||||
$('.fa-microphone').show();
|
$('.fa-microphone').show();
|
||||||
$('#search').val('');
|
|
||||||
if (ignore_onend) {
|
if (ignore_onend) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -174,8 +173,8 @@
|
|||||||
|
|
||||||
function onMicrophoneClick() {
|
function onMicrophoneClick() {
|
||||||
//$('#search').val('create new invoice for edgar a po number of 1234');
|
//$('#search').val('create new invoice for edgar a po number of 1234');
|
||||||
$('#search').val('create a task for edgar');
|
//$('#search').val('create a task for edgar');
|
||||||
//$('#search').val('show me all vendors');
|
$('#search').val('go to localization');
|
||||||
$('#search-form').submit();
|
$('#search-form').submit();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user