mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-05 03:08:13 +00:00
Generated the JSON contracts of providers, the runtime, and services at compile time (#1150)
This commit is contained in:
1 parent
e954881fda
commit
24e3c22db3
140 files changed
+1415
-292
No files matched your search
@@ -18,11 +18,11 @@ public partial class RustService
|
||||
using var response = await this.http.PostAsJsonAsync(
|
||||
"/media/jobs",
|
||||
new CreateMediaJobRequest(inputPath, outputPath, OpusBitrateBps: opusBitrateBps),
|
||||
this.jsonRustSerializerOptions,
|
||||
JSON_OPTIONS,
|
||||
token);
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
var result = await response.Content.ReadFromJsonAsync<CreateMediaJobResponse>(this.jsonRustSerializerOptions, token);
|
||||
var result = await response.Content.ReadFromJsonAsync<CreateMediaJobResponse>(JSON_OPTIONS, token);
|
||||
return result?.JobId ?? throw new InvalidOperationException("The Rust runtime did not return a media job ID.");
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public partial class RustService
|
||||
continue;
|
||||
|
||||
var json = line["data:".Length..].Trim();
|
||||
var mediaEvent = JsonSerializer.Deserialize<MediaJobEvent>(json, this.jsonRustSerializerOptions);
|
||||
var mediaEvent = JsonSerializer.Deserialize<MediaJobEvent>(json, JSON_OPTIONS);
|
||||
if (mediaEvent is not null)
|
||||
yield return mediaEvent;
|
||||
|
||||
|
||||
Reference in new issue
Block a user