| Server IP : 121.121.20.254 / Your IP : 216.73.216.133 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/AIWEBSTATION/wp-content/plugins/ai-engine/classes/query/ |
Upload File : |
<?php
class Meow_MWAI_Query_Transcribe extends Meow_MWAI_Query_Base {
public string $url = '';
public ?string $path = null;
public ?string $audioData = null;
public ?string $mimeType = null;
// Core Content
public ?Meow_MWAI_Query_DroppedFile $attachedFile = null;
public function __construct( $message = '', $model = 'whisper-1' ) {
parent::__construct( $message );
$this->set_model( $model );
$this->feature = 'transcription';
}
public function set_url( $url ) {
$this->url = $url;
}
public function set_path( $path ) {
$this->path = $path;
}
public function set_audio_data( $data, $mimeType = null ) {
$this->audioData = $data;
$this->mimeType = $mimeType;
}
/**
* Add a file to the attachedFile property.
* This maintains compatibility with the unified file upload architecture.
*/
public function add_file( Meow_MWAI_Query_DroppedFile $file ): void {
$this->attachedFile = $file;
}
/**
* Get all attached files as a normalized array.
* Transcribe queries only support single file attachment.
*
* @return Meow_MWAI_Query_DroppedFile[] Array of attached files
*/
public function getAttachments(): array {
if ( $this->attachedFile ) {
return [ $this->attachedFile ];
}
return [];
}
// Based on the params of the query, update the attributes
public function inject_params( array $params ): void {
parent::inject_params( $params );
$params = $this->convert_keys( $params );
if ( !empty( $params['url'] ) ) {
$this->set_url( $params['url'] );
}
if ( !empty( $params['path'] ) ) {
$this->set_path( $params['path'] );
}
if ( !empty( $params['audioData'] ) || !empty( $params['audio_data'] ) ) {
$audioData = $params['audioData'] ?? $params['audio_data'];
$mimeType = $params['mimeType'] ?? $params['mime_type'] ?? null;
$this->set_audio_data( $audioData, $mimeType );
}
}
#endregion
}