feat: ship Wave 5-6 multi-surface hygiene, optimization, and bug fixes
This commit is contained in:
parent
01ef3293cf
commit
66b6b45ba9
399 changed files with 17828 additions and 11330 deletions
|
|
@ -62,7 +62,7 @@ public class SttController : ControllerBase
|
|||
return StatusCode(StatusCodes.Status415UnsupportedMediaType, new { error = "unsupported_media_type" });
|
||||
}
|
||||
|
||||
var form = await Request.ReadFormAsync();
|
||||
var form = await Request.ReadFormAsync(HttpContext.RequestAborted);
|
||||
var file = form.Files.GetFile("file") ?? form.Files.GetFile("audio");
|
||||
if (file == null || file.Length == 0)
|
||||
{
|
||||
|
|
@ -70,7 +70,7 @@ public class SttController : ControllerBase
|
|||
}
|
||||
|
||||
await using var memoryStream = new MemoryStream();
|
||||
await file.CopyToAsync(memoryStream);
|
||||
await file.CopyToAsync(memoryStream, HttpContext.RequestAborted);
|
||||
var language = form["language"].ToString();
|
||||
var prompt = form["prompt"].ToString();
|
||||
var request = new SttTranscribeRequest(
|
||||
|
|
@ -89,9 +89,14 @@ public class SttController : ControllerBase
|
|||
memoryStream.ToArray(),
|
||||
file.ContentType ?? "application/octet-stream",
|
||||
file.FileName ?? "recording.bin",
|
||||
recordUsage: false);
|
||||
recordUsage: false,
|
||||
cancellationToken: HttpContext.RequestAborted);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (OperationCanceledException) when (HttpContext.RequestAborted.IsCancellationRequested)
|
||||
{
|
||||
return StatusCode(499);
|
||||
}
|
||||
catch (SttProviderUnavailableException)
|
||||
{
|
||||
return StatusCode(StatusCodes.Status503ServiceUnavailable, new { error = "stt_provider_unavailable" });
|
||||
|
|
@ -112,20 +117,4 @@ public class SttController : ControllerBase
|
|||
var suppliedDigest = SHA256.HashData(Encoding.UTF8.GetBytes(supplied));
|
||||
return CryptographicOperations.FixedTimeEquals(configuredDigest, suppliedDigest);
|
||||
}
|
||||
|
||||
[HttpGet("providers")]
|
||||
[Authorize(Policy = "ManagerOrAbove")]
|
||||
public async Task<IActionResult> GetActiveProviders()
|
||||
{
|
||||
var endpoints = await _sttService.GetAllEndpointsAsync();
|
||||
return Ok(endpoints);
|
||||
}
|
||||
|
||||
[HttpPost("test")]
|
||||
[Authorize(Policy = "ManagerOrAbove")]
|
||||
public async Task<IActionResult> TestConnection([FromQuery] int endpointId = 0)
|
||||
{
|
||||
var result = await _sttService.TestEndpointAsync(endpointId);
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue