mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Working on speech rec
This commit is contained in:
parent
4abb5dd2c5
commit
f8b5f179a8
@ -321,7 +321,7 @@ if (! defined('APP_NAME')) {
|
||||
define('FIREFOX_PDF_HELP_URL', 'https://support.mozilla.org/en-US/kb/view-pdf-files-firefox');
|
||||
|
||||
define('MSBOT_LOGIN_URL', 'https://login.microsoftonline.com/common/oauth2/v2.0/token');
|
||||
define('MSBOT_LUIS_URL', 'https://api.projectoxford.ai/luis/v1/application');
|
||||
define('MSBOT_LUIS_URL', 'https://westus.api.cognitive.microsoft.com/luis/v2.0/apps');
|
||||
define('SKYPE_API_URL', 'https://apis.skype.com/v3');
|
||||
define('MSBOT_STATE_URL', 'https://state.botframework.com/v3');
|
||||
|
||||
|
@ -100,6 +100,7 @@ class BotController extends Controller
|
||||
public function handleCommand()
|
||||
{
|
||||
$data = $this->parseMessage(request()->command);
|
||||
//dd($data);
|
||||
$intent = BaseIntent::createIntent(BOT_PLATFORM_WEB_APP, false, $data);
|
||||
return $intent->process();
|
||||
}
|
||||
@ -153,7 +154,8 @@ class BotController extends Controller
|
||||
$subKey = env('MSBOT_LUIS_SUBSCRIPTION_KEY');
|
||||
$message = rawurlencode($message);
|
||||
|
||||
$url = sprintf('%s?id=%s&subscription-key=%s&q=%s', MSBOT_LUIS_URL, $appId, $subKey, $message);
|
||||
$url = sprintf('%s/%s?subscription-key=%s&verbose=true&q=%s', MSBOT_LUIS_URL, $appId, $subKey, $message);
|
||||
//$url = sprintf('%s?id=%s&subscription-key=%s&q=%s', MSBOT_LUIS_URL, $appId, $subKey, $message);
|
||||
$data = file_get_contents($url);
|
||||
$data = json_decode($data);
|
||||
|
||||
|
@ -51,7 +51,7 @@ class BaseIntent
|
||||
if ($state && ! $entityType) {
|
||||
$entityType = $state->current->entityType;
|
||||
}
|
||||
|
||||
$entityType = $entityType ?: 'client';
|
||||
$entityType = ucwords(strtolower($entityType));
|
||||
if ($entityType == 'Recurring') {
|
||||
$entityType = 'RecurringInvoice';
|
||||
|
17
app/Ninja/Intents/WebApp/FindClientIntent.php
Normal file
17
app/Ninja/Intents/WebApp/FindClientIntent.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Intents\WebApp;
|
||||
|
||||
use App\Ninja\Intents\BaseIntent;
|
||||
|
||||
class FindClientIntent extends BaseIntent
|
||||
{
|
||||
public function process()
|
||||
{
|
||||
$client = $this->requestClient();
|
||||
|
||||
$url = $client ? $client->present()->url : '/clients';
|
||||
|
||||
return redirect($url);
|
||||
}
|
||||
}
|
17
app/Ninja/Intents/WebApp/FindInvoiceIntent.php
Normal file
17
app/Ninja/Intents/WebApp/FindInvoiceIntent.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Intents\WebApp;
|
||||
|
||||
use App\Ninja\Intents\InvoiceIntent;
|
||||
|
||||
class FindInvoiceIntent extends InvoiceIntent
|
||||
{
|
||||
public function process()
|
||||
{
|
||||
$invoice = $this->requestInvoice();
|
||||
|
||||
$url = $invoice ? $invoice->present()->url : '/invoices';
|
||||
|
||||
return redirect($url);
|
||||
}
|
||||
}
|
17
app/Ninja/Intents/WebApp/FindQuoteIntent.php
Normal file
17
app/Ninja/Intents/WebApp/FindQuoteIntent.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Intents\WebApp;
|
||||
|
||||
use App\Ninja\Intents\InvoiceIntent;
|
||||
|
||||
class FindQuoteIntent extends InvoiceIntent
|
||||
{
|
||||
public function process()
|
||||
{
|
||||
$invoice = $this->requestInvoice();
|
||||
|
||||
$url = $invoice ? $invoice->present()->url : '/quotes';
|
||||
|
||||
return redirect($url);
|
||||
}
|
||||
}
|
@ -8,6 +8,12 @@ class ListCreditIntent extends BaseIntent
|
||||
{
|
||||
public function process()
|
||||
{
|
||||
return redirect('/credits');
|
||||
if ($client = $this->requestClient()) {
|
||||
$url = $client->present()->url . '#credits';
|
||||
} else {
|
||||
$url = '/credits';
|
||||
}
|
||||
|
||||
return redirect($url);
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,12 @@ class ListInvoiceIntent extends InvoiceIntent
|
||||
{
|
||||
public function process()
|
||||
{
|
||||
return redirect('/invoices');
|
||||
if ($client = $this->requestClient()) {
|
||||
$url = $client->present()->url . '#invoices';
|
||||
} else {
|
||||
$url = '/invoices';
|
||||
}
|
||||
|
||||
return redirect($url);
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,12 @@ class ListPaymentIntent extends BaseIntent
|
||||
{
|
||||
public function process()
|
||||
{
|
||||
return redirect('/payments');
|
||||
if ($client = $this->requestClient()) {
|
||||
$url = $client->present()->url . '#payments';
|
||||
} else {
|
||||
$url = '/payments';
|
||||
}
|
||||
|
||||
return redirect($url);
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,12 @@ class ListQuotesIntent extends BaseIntent
|
||||
{
|
||||
public function process()
|
||||
{
|
||||
return redirect('/quotes');
|
||||
if ($client = $this->requestClient()) {
|
||||
$url = $client->present()->url . '#quotes';
|
||||
} else {
|
||||
$url = '/quotes';
|
||||
}
|
||||
|
||||
return redirect($url);
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,12 @@ class ListRecurringInvoiceIntent extends BaseIntent
|
||||
{
|
||||
public function process()
|
||||
{
|
||||
return redirect('/recurring_invoices');
|
||||
if ($client = $this->requestClient()) {
|
||||
$url = $client->present()->url . '#recurring_invoices';
|
||||
} else {
|
||||
$url = '/recurring_invoices';
|
||||
}
|
||||
|
||||
return redirect($url);
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,12 @@ class ListTaskIntent extends BaseIntent
|
||||
{
|
||||
public function process()
|
||||
{
|
||||
return redirect('/tasks');
|
||||
if ($client = $this->requestClient()) {
|
||||
$url = $client->present()->url . '#tasks';
|
||||
} else {
|
||||
$url = '/tasks';
|
||||
}
|
||||
|
||||
return redirect($url);
|
||||
}
|
||||
}
|
||||
|
@ -172,9 +172,8 @@
|
||||
}
|
||||
|
||||
function onMicrophoneClick() {
|
||||
$('#search').val('new payment for invoice 1279');
|
||||
//$('#search').val('invoice for edgar');
|
||||
//$('#search').val('create a task for edgar');
|
||||
//$('#search').val("show me all of edgar's credits");
|
||||
$('#search').val("show me edgar's credits");
|
||||
$('#search-form').submit();
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user