-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08ddc35
commit e7f5926
Showing
17 changed files
with
514 additions
and
316 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
namespace App\Http\Livewire; | ||
|
||
use App\Services\openAIService; | ||
use Livewire\Component; | ||
use Livewire\WithFileUploads; | ||
|
||
class TranscribeBox extends Component | ||
{ | ||
use WithFileUploads; | ||
|
||
public $file; | ||
|
||
public $language; | ||
|
||
public $availableLanguages = [ | ||
'English' => 'en', | ||
'German' => 'de', | ||
'Greek' => 'el', | ||
'Spanish' => 'es', | ||
'French' => 'fr', | ||
'Italian' => 'it', | ||
'Portuguese' => 'pt', | ||
]; | ||
|
||
protected $openAIService; | ||
|
||
public $message = []; | ||
|
||
public function boot(openAIService $openAIService) | ||
{ | ||
$this->openAIService = $openAIService; | ||
} | ||
|
||
public function transcribe() | ||
{ | ||
$this->validate([ | ||
'file' => 'required|mimes:mp3,mp4,wav,mpeg,mpga,m4a,webm|max:25000', | ||
'language' => 'required', | ||
]); | ||
$filePath = $this->file->storeAs($this->file->getClientOriginalName()); | ||
$response = $this->openAIService->transcribe($filePath, $this->availableLanguages[$this->language]); | ||
$this->message = [ | ||
'duration' => $response->duration, | ||
'text' => $response->text, | ||
]; | ||
} | ||
|
||
public function render() | ||
{ | ||
return view('livewire.transcribe-box.transcribe-box'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
|
||
class ChatBox extends Model | ||
{ | ||
protected $table = 'chatboxes'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.