@cartanova/qgrid-cli 2.15.3 → 2.15.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/dist/application/qgrid/qgrid.frame.js +168 -12
- package/bundle/dist/application/qgrid/qgrid.types.js +6 -3
- package/bundle/dist/application/request-log/request-log.model.js +4 -3
- package/bundle/dist/application/sonamu.generated.js +20 -5
- package/bundle/dist/application/sonamu.generated.sso.js +5 -3
- package/bundle/dist/i18n/en.js +2 -1
- package/bundle/dist/i18n/ko.js +2 -1
- package/bundle/dist/i18n/sd.generated.js +6 -1
- package/bundle/dist/migrations/20261109110340_alter_request_logs_add1_alter1.js +15 -0
- package/bundle/dist/utils/providers/grok/grok-types.js +1 -1
- package/bundle/dist/utils/providers/grok/grok-voice-client.js +4 -2
- package/bundle/dist/utils/providers/openai/openai-backend-protocol.js +6 -54
- package/bundle/dist/utils/providers/openai/openai-direct-client.js +2 -2
- package/bundle/dist/utils/providers/openai/openai-dispatcher.js +47 -19
- package/bundle/dist/utils/providers/openai/openai-image-generation.js +1 -2
- package/bundle/dist/utils/providers/openai/openai-realtime-protocol.js +389 -0
- package/bundle/dist/utils/providers/openai/openai-voice-client.js +460 -0
- package/bundle/src/application/qgrid/qgrid.frame.test.ts +43 -6
- package/bundle/src/application/qgrid/qgrid.frame.ts +246 -14
- package/bundle/src/application/qgrid/qgrid.types.ts +14 -2
- package/bundle/src/application/request-log/request-log.entity.json +17 -2
- package/bundle/src/application/request-log/request-log.model.test.ts +17 -0
- package/bundle/src/application/request-log/request-log.model.ts +11 -3
- package/bundle/src/application/sonamu.generated.http +2 -0
- package/bundle/src/application/sonamu.generated.sso.ts +2 -0
- package/bundle/src/application/sonamu.generated.ts +14 -0
- package/bundle/src/i18n/en.ts +1 -0
- package/bundle/src/i18n/ko.ts +1 -0
- package/bundle/src/i18n/sd.generated.ts +6 -0
- package/bundle/src/migrations/20261109110340_alter_request_logs_add1_alter1.ts +15 -0
- package/bundle/src/utils/providers/grok/grok-types.ts +2 -0
- package/bundle/src/utils/providers/grok/grok-voice-client.test.ts +2 -0
- package/bundle/src/utils/providers/grok/grok-voice-client.ts +2 -0
- package/bundle/src/utils/providers/openai/openai-backend-protocol.test.ts +8 -69
- package/bundle/src/utils/providers/openai/openai-backend-protocol.ts +7 -86
- package/bundle/src/utils/providers/openai/openai-direct-client.test.ts +0 -15
- package/bundle/src/utils/providers/openai/openai-direct-client.ts +3 -1
- package/bundle/src/utils/providers/openai/openai-dispatcher.test.ts +19 -93
- package/bundle/src/utils/providers/openai/openai-dispatcher.ts +98 -47
- package/bundle/src/utils/providers/openai/openai-image-generation.test.ts +6 -4
- package/bundle/src/utils/providers/openai/openai-image-generation.ts +0 -6
- package/bundle/src/utils/providers/openai/openai-realtime-protocol.ts +550 -0
- package/bundle/src/utils/providers/openai/openai-voice-client.test.ts +582 -0
- package/bundle/src/utils/providers/openai/openai-voice-client.ts +744 -0
- package/bundle/web-dist/client/assets/index-DyrPRt6O.css +1 -0
- package/bundle/web-dist/client/assets/index-Wi8Wxte6.js +104 -0
- package/bundle/web-dist/client/assets/{logs-Dw-GrMuH.js → logs-Bdg3wJV2.js} +1 -1
- package/bundle/web-dist/client/assets/{monit-BaFFiVKs.js → monit-DcwHRAKu.js} +1 -1
- package/bundle/web-dist/client/assets/{routes-R1xBZYVT.js → routes-lxVC1DDJ.js} +1 -1
- package/bundle/web-dist/client/assets/{settings-Bw_NXAx8.js → settings-C0VCdd1C.js} +1 -1
- package/bundle/web-dist/client/assets/{show-BH7nfFtF.js → show-B7QRPxsY.js} +2 -2
- package/bundle/web-dist/client/assets/{tokens-BPmRr7mD.js → tokens-CNRSm9sc.js} +1 -1
- package/bundle/web-dist/client/assets/{use-oauth-login-flow-B_MGbC3a.js → use-oauth-login-flow-eQnMzp8A.js} +1 -1
- package/bundle/web-dist/client/assets/{use-update-token-mutation-Dcq7Yv2R.js → use-update-token-mutation-KnwyYQjb.js} +1 -1
- package/bundle/web-dist/client/assets/voice-BydIuS0A.js +1 -0
- package/bundle/web-dist/client/index.html +2 -2
- package/bundle/web-dist/client/voice-samples/grok/altair.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/ara.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/atlas.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/aurora.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/carina.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/castor.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/celeste.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/cosmo.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/eve.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/helios.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/helix.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/iris.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/kepler.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/leo.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/liora.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/lumen.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/luna.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/lux.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/naksh.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/orion.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/perseus.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/rex.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/rigel.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/sal.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/sirius.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/ursa.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/zagan.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/grok/zenith.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/openai/alloy.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/openai/ash.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/openai/ballad.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/openai/cedar.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/openai/coral.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/openai/echo.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/openai/marin.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/openai/sage.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/openai/shimmer.mp3 +0 -0
- package/bundle/web-dist/client/voice-samples/openai/verse.mp3 +0 -0
- package/bundle/web-dist/server/assets/link-DrdV092C.js +4919 -0
- package/bundle/web-dist/server/assets/{logs-6289J29J.js → logs-BmBpBe-j.js} +13 -6
- package/bundle/web-dist/server/assets/{monit-YVvwJuAF.js → monit-Db1WrIls.js} +2 -2
- package/bundle/web-dist/server/assets/{plus-z5Hy__3C.js → plus-CW9y_K7l.js} +1 -1
- package/bundle/web-dist/server/assets/{refresh-cw-CNm0CERy.js → refresh-cw-CRgcH5bT.js} +1 -1
- package/bundle/web-dist/server/assets/{request-model-DIuPZZwu.js → request-model-DRF7hmJC.js} +1 -1
- package/bundle/web-dist/server/assets/{routes-DVWRvqn0.js → routes-CARZj7or.js} +4 -4
- package/bundle/web-dist/server/assets/{services.generated-CqS8DCjT.js → services.generated-B6QpnL_N.js} +7 -0
- package/bundle/web-dist/server/assets/{settings-CXwnKiMG.js → settings-B4jdpP5N.js} +4 -4
- package/bundle/web-dist/server/assets/{show-G1t8dOEh.js → show-D8r2sVK0.js} +17 -9
- package/bundle/web-dist/server/assets/{tokens-Di1vDwm5.js → tokens-TDQguTdh.js} +5 -5
- package/bundle/web-dist/server/assets/{use-oauth-login-flow-BUAcW_pK.js → use-oauth-login-flow-du7pOh_H.js} +1 -1
- package/bundle/web-dist/server/assets/{use-update-token-mutation-oH0O0n-g.js → use-update-token-mutation-DA6HiiWS.js} +1 -1
- package/bundle/web-dist/server/assets/voice-C2HfwkGp.js +668 -0
- package/bundle/web-dist/server/entry-server.generated.js +125 -4989
- package/bundle/web-dist/server/voice-samples/grok/altair.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/ara.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/atlas.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/aurora.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/carina.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/castor.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/celeste.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/cosmo.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/eve.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/helios.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/helix.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/iris.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/kepler.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/leo.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/liora.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/lumen.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/luna.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/lux.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/naksh.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/orion.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/perseus.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/rex.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/rigel.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/sal.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/sirius.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/ursa.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/zagan.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/grok/zenith.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/openai/alloy.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/openai/ash.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/openai/ballad.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/openai/cedar.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/openai/coral.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/openai/echo.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/openai/marin.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/openai/sage.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/openai/shimmer.mp3 +0 -0
- package/bundle/web-dist/server/voice-samples/openai/verse.mp3 +0 -0
- package/package.json +1 -1
- package/skills/qgrid/SKILL.md +5 -5
- package/skills/qgrid/references/ai-sdk-provider-contract.md +4 -0
- package/skills/qgrid/references/decision-rationale.md +13 -3
- package/skills/qgrid/references/openai-codex-runtime.md +17 -5
- package/skills/qgrid/references/request-log-run-lifecycle.md +7 -2
- package/skills/qgrid/references/sonamu-api-web-flow.md +6 -2
- package/skills/qgrid/references/verification-and-debugging.md +3 -3
- package/bundle/web-dist/client/assets/index-BakMhnHZ.js +0 -104
- package/bundle/web-dist/client/assets/index-DLo1QCw7.css +0 -1
|
@@ -70,11 +70,19 @@ import {
|
|
|
70
70
|
openAICallbackRedirectUri,
|
|
71
71
|
startOpenAICallbackRelay,
|
|
72
72
|
} from "../../utils/providers/openai/openai-callback-relay";
|
|
73
|
+
import { type OpenAIDispatcher } from "../../utils/providers/openai/openai-dispatcher";
|
|
73
74
|
import {
|
|
74
75
|
buildOpenAIAuthUrl,
|
|
75
76
|
exchangeOpenAICode,
|
|
76
77
|
generateOpenAIPKCE,
|
|
77
78
|
} from "../../utils/providers/openai/openai-oauth";
|
|
79
|
+
import {
|
|
80
|
+
OPENAI_REALTIME_DEFAULT_SPEECH_MODEL,
|
|
81
|
+
OPENAI_REALTIME_DEFAULT_TRANSCRIPTION_MODEL,
|
|
82
|
+
OPENAI_REALTIME_DEFAULT_VOICE,
|
|
83
|
+
wrapPcmAsWav,
|
|
84
|
+
} from "../../utils/providers/openai/openai-realtime-protocol";
|
|
85
|
+
import { OpenAIVoiceInputError } from "../../utils/providers/openai/openai-voice-client";
|
|
78
86
|
import {
|
|
79
87
|
type FinishRunParams,
|
|
80
88
|
MICRO_USD,
|
|
@@ -364,8 +372,10 @@ function rejectImageGenerationStream(args: QueryInput): void {
|
|
|
364
372
|
|
|
365
373
|
function rejectInvalidImageQuery(args: QueryInput): void {
|
|
366
374
|
const standalone = args.model === `openai/${CODEX_IMAGE_GENERATION_MODEL}`;
|
|
375
|
+
// OpenAI chat models also run explicit image requests through standalone Images.
|
|
376
|
+
const openaiImage = args.imageGeneration === true && args.model?.startsWith("openai/") === true;
|
|
367
377
|
|
|
368
|
-
if (!standalone && args.imageGeneration !== "auto") return;
|
|
378
|
+
if (!standalone && !openaiImage && args.imageGeneration !== "auto") return;
|
|
369
379
|
|
|
370
380
|
if (standalone && args.imageGeneration !== true) {
|
|
371
381
|
throw new BadRequestException(
|
|
@@ -378,7 +388,7 @@ function rejectInvalidImageQuery(args: QueryInput): void {
|
|
|
378
388
|
if (args.tools?.length || args.jsonSchema !== undefined) {
|
|
379
389
|
throw new BadRequestException(
|
|
380
390
|
SD("error.detail")(
|
|
381
|
-
"qgrid:
|
|
391
|
+
"qgrid: OpenAI and automatic image generation do not support caller tools or structured output.",
|
|
382
392
|
),
|
|
383
393
|
);
|
|
384
394
|
}
|
|
@@ -388,9 +398,7 @@ function rejectInvalidImageQuery(args: QueryInput): void {
|
|
|
388
398
|
args.imageGenerationOptions.outputFormat !== "png"
|
|
389
399
|
) {
|
|
390
400
|
throw new BadRequestException(
|
|
391
|
-
SD("error.detail")(
|
|
392
|
-
"qgrid: automatic and standalone image generation only support PNG output.",
|
|
393
|
-
),
|
|
401
|
+
SD("error.detail")("qgrid: OpenAI and automatic image generation only support PNG output."),
|
|
394
402
|
);
|
|
395
403
|
}
|
|
396
404
|
}
|
|
@@ -542,6 +550,25 @@ function grokVoice(): VoiceDispatcher {
|
|
|
542
550
|
return { transcribe: transcribe.bind(dispatcher), speak: speak.bind(dispatcher) };
|
|
543
551
|
}
|
|
544
552
|
|
|
553
|
+
function openaiVoice(): OpenAIDispatcher {
|
|
554
|
+
const dispatcher = QgridDispatcher.openaiDispatcher;
|
|
555
|
+
|
|
556
|
+
if (!dispatcher) {
|
|
557
|
+
throw QgridDispatcher.startupState.openai === "failed"
|
|
558
|
+
? new InternalServerErrorException(SD("qgrid.dispatcherFailed")("OpenAI"))
|
|
559
|
+
: new ServiceUnavailableException(SD("qgrid.dispatcherStarting")("OpenAI"));
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
return dispatcher;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
type VoiceProvider = "grok" | "openai";
|
|
566
|
+
|
|
567
|
+
/** Voice endpoints route by model prefix; no model means Grok, the original provider. */
|
|
568
|
+
function voiceProvider(model: string | undefined): VoiceProvider {
|
|
569
|
+
return model?.startsWith("openai/") ? "openai" : "grok";
|
|
570
|
+
}
|
|
571
|
+
|
|
545
572
|
class TooManyRequestsException extends SoException {
|
|
546
573
|
constructor(message: LocalizedString) {
|
|
547
574
|
super(429, message);
|
|
@@ -580,6 +607,10 @@ function throwGrokCallerError(cause: unknown): never {
|
|
|
580
607
|
throw new BadRequestException(SD("qgrid.grokInvalidRequest")(cause.message));
|
|
581
608
|
}
|
|
582
609
|
|
|
610
|
+
if (cause instanceof OpenAIVoiceInputError) {
|
|
611
|
+
throw new BadRequestException(SD("qgrid.openaiVoiceInvalidRequest")(cause.message));
|
|
612
|
+
}
|
|
613
|
+
|
|
583
614
|
if (cause instanceof GrokContentPolicyError) {
|
|
584
615
|
throw new BadRequestException(SD("qgrid.grokContentPolicy")(cause.message));
|
|
585
616
|
}
|
|
@@ -654,16 +685,23 @@ function parseMediaInput<S extends z.ZodType>(schema: S, value: z.input<S>): z.i
|
|
|
654
685
|
|
|
655
686
|
async function resolveGrokTokenSelection(
|
|
656
687
|
tokenName: string | undefined,
|
|
688
|
+
): Promise<MediaTokenSelection> {
|
|
689
|
+
return resolveMediaTokenSelection("grok", tokenName);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
async function resolveMediaTokenSelection(
|
|
693
|
+
provider: VoiceProvider,
|
|
694
|
+
tokenName: string | undefined,
|
|
657
695
|
): Promise<MediaTokenSelection> {
|
|
658
696
|
if (!tokenName) return {};
|
|
659
697
|
|
|
660
|
-
if (!tokenName.startsWith(
|
|
698
|
+
if (!tokenName.startsWith(`${provider}/`)) {
|
|
661
699
|
throw new BadRequestException(
|
|
662
700
|
SD("error.detail")("Token provider does not match model provider"),
|
|
663
701
|
);
|
|
664
702
|
}
|
|
665
703
|
|
|
666
|
-
const token = await TokenModel.findActiveByProviderAndName("A",
|
|
704
|
+
const token = await TokenModel.findActiveByProviderAndName("A", provider, tokenName);
|
|
667
705
|
|
|
668
706
|
if (!token) {
|
|
669
707
|
throw new BadRequestException(SD("error.detail")(`Active token not found: ${tokenName}`));
|
|
@@ -678,9 +716,18 @@ interface RoutedModelId {
|
|
|
678
716
|
}
|
|
679
717
|
|
|
680
718
|
function routeModelId(model: string | undefined, fallback: string): RoutedModelId {
|
|
681
|
-
|
|
719
|
+
return routeProviderModelId("grok", model, fallback);
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
function routeProviderModelId(
|
|
723
|
+
provider: VoiceProvider,
|
|
724
|
+
model: string | undefined,
|
|
725
|
+
fallback: string,
|
|
726
|
+
): RoutedModelId {
|
|
727
|
+
const prefix = `${provider}/`;
|
|
728
|
+
const id = model ? model.slice(prefix.length) : fallback;
|
|
682
729
|
|
|
683
|
-
return { id, route:
|
|
730
|
+
return { id, route: `${prefix}${id}` };
|
|
684
731
|
}
|
|
685
732
|
|
|
686
733
|
type GeneratedImage = GenerateImagesOutput["images"][number];
|
|
@@ -738,6 +785,7 @@ async function startMediaRun(
|
|
|
738
785
|
requested_model_name: start.model,
|
|
739
786
|
project_name: start.projectName,
|
|
740
787
|
is_image_generation: start.kind === "image",
|
|
788
|
+
media_kind: start.kind,
|
|
741
789
|
});
|
|
742
790
|
}
|
|
743
791
|
|
|
@@ -777,8 +825,20 @@ type MediaLogSuccess = {
|
|
|
777
825
|
response: string;
|
|
778
826
|
steps: MediaLogSteps;
|
|
779
827
|
cost?: GrokMediaCost;
|
|
828
|
+
/** Speech only: time to the first audio byte, measured from the same start as `durationMs`. */
|
|
829
|
+
ttftMs?: number;
|
|
780
830
|
};
|
|
781
831
|
|
|
832
|
+
// Speech rows embed browser-playable audio so the request-log detail page can play it, as image
|
|
833
|
+
// rows embed their images. Other formats (raw PCM, mu-law, A-law) keep the byte-count placeholder.
|
|
834
|
+
const LOG_PLAYABLE_AUDIO = new Set(["audio/wav", "audio/mpeg"]);
|
|
835
|
+
|
|
836
|
+
function speechResponseForLog(b64: string, mimeType: string, byteLength: number): string {
|
|
837
|
+
return LOG_PLAYABLE_AUDIO.has(mimeType)
|
|
838
|
+
? `<audio src="data:${mimeType};base64,${b64}"></audio>`
|
|
839
|
+
: `[audio ${mimeType} ${byteLength} bytes]`;
|
|
840
|
+
}
|
|
841
|
+
|
|
782
842
|
function mediaToolSteps(
|
|
783
843
|
kind: MediaKind,
|
|
784
844
|
steps: MediaLogSteps,
|
|
@@ -838,6 +898,7 @@ function mediaFinishFields(success: Omit<MediaLogSuccess, "steps">): FinishRunPa
|
|
|
838
898
|
cache_read_tokens: 0,
|
|
839
899
|
cache_creation_tokens: 0,
|
|
840
900
|
duration_ms: success.durationMs,
|
|
901
|
+
...(success.ttftMs !== undefined && { ttft_ms: success.ttftMs }),
|
|
841
902
|
...mediaCostFields(success.kind, success.model, success.cost),
|
|
842
903
|
};
|
|
843
904
|
}
|
|
@@ -906,7 +967,10 @@ async function dispatchMediaCall<T>(
|
|
|
906
967
|
return result;
|
|
907
968
|
}
|
|
908
969
|
|
|
909
|
-
|
|
970
|
+
/** `firstOutputAt` is the epoch-ms first audio byte; the endpoint turns it into `ttftMs`. */
|
|
971
|
+
type MediaRunLog = Omit<MediaLogSuccess, "kind" | "model" | "durationMs" | "ttftMs"> & {
|
|
972
|
+
firstOutputAt?: number;
|
|
973
|
+
};
|
|
910
974
|
|
|
911
975
|
/**
|
|
912
976
|
* A one-shot media endpoint: open the run, make the provider call, then log the result. `dispatch`
|
|
@@ -922,15 +986,17 @@ async function runMediaEndpoint<T>(
|
|
|
922
986
|
const requestLogId = await startMediaRun(start.logger, start);
|
|
923
987
|
const startedAt = Date.now();
|
|
924
988
|
|
|
925
|
-
const {
|
|
926
|
-
|
|
927
|
-
|
|
989
|
+
const {
|
|
990
|
+
output,
|
|
991
|
+
log: { firstOutputAt, ...log },
|
|
992
|
+
} = await dispatchMediaCall(requestLogId, (signal) => dispatch(signal, requestLogId));
|
|
928
993
|
|
|
929
994
|
await finishMediaRun(requestLogId, {
|
|
930
995
|
...log,
|
|
931
996
|
kind: start.kind,
|
|
932
997
|
model: start.model,
|
|
933
998
|
durationMs: Date.now() - startedAt,
|
|
999
|
+
...(firstOutputAt !== undefined && { ttftMs: Math.max(0, firstOutputAt - startedAt) }),
|
|
934
1000
|
});
|
|
935
1001
|
|
|
936
1002
|
return output;
|
|
@@ -1012,6 +1078,166 @@ async function finishVideoRun(
|
|
|
1012
1078
|
|
|
1013
1079
|
const GROK_TTS_LOG_MODEL = "grok/tts";
|
|
1014
1080
|
|
|
1081
|
+
/**
|
|
1082
|
+
* OpenAI realtime transcription (openai/<id>): /realtime/calls + sideband, the Codex shape. The
|
|
1083
|
+
* server reports no language; `durationSec` is computed from the PCM qgrid sent.
|
|
1084
|
+
*/
|
|
1085
|
+
async function transcribeOpenAI(input: TranscribeInput): Promise<TranscribeOutput> {
|
|
1086
|
+
const dispatcher = openaiVoice();
|
|
1087
|
+
const selection = await resolveMediaTokenSelection("openai", input.tokenName);
|
|
1088
|
+
|
|
1089
|
+
const { id, route } = routeProviderModelId(
|
|
1090
|
+
"openai",
|
|
1091
|
+
input.model,
|
|
1092
|
+
OPENAI_REALTIME_DEFAULT_TRANSCRIPTION_MODEL,
|
|
1093
|
+
);
|
|
1094
|
+
|
|
1095
|
+
const audio = new Uint8Array(Buffer.from(input.audio, "base64"));
|
|
1096
|
+
|
|
1097
|
+
const start = {
|
|
1098
|
+
kind: "stt",
|
|
1099
|
+
model: route,
|
|
1100
|
+
prompt: `[audio ${input.mediaType} ${audio.byteLength} bytes]`,
|
|
1101
|
+
projectName: input.projectName,
|
|
1102
|
+
logger: input.logger,
|
|
1103
|
+
} as const;
|
|
1104
|
+
|
|
1105
|
+
return runMediaEndpoint(start, async (signal, requestLogId) => {
|
|
1106
|
+
const dispatched = await dispatcher.transcribe({
|
|
1107
|
+
audio,
|
|
1108
|
+
mediaType: input.mediaType,
|
|
1109
|
+
model: id,
|
|
1110
|
+
language: input.language,
|
|
1111
|
+
prompt: input.prompt,
|
|
1112
|
+
signal,
|
|
1113
|
+
...selection,
|
|
1114
|
+
});
|
|
1115
|
+
|
|
1116
|
+
const { text, durationSec, callId, transport, fallbackReason } = dispatched.result;
|
|
1117
|
+
|
|
1118
|
+
const output: TranscribeOutput = {
|
|
1119
|
+
text,
|
|
1120
|
+
durationSec,
|
|
1121
|
+
model: route,
|
|
1122
|
+
tokenName: dispatched.tokenName,
|
|
1123
|
+
};
|
|
1124
|
+
|
|
1125
|
+
if (input.language) output.language = input.language;
|
|
1126
|
+
|
|
1127
|
+
if (requestLogId !== undefined) output.requestLogId = requestLogId;
|
|
1128
|
+
|
|
1129
|
+
const log: MediaRunLog = {
|
|
1130
|
+
tokenName: output.tokenName,
|
|
1131
|
+
response: output.text,
|
|
1132
|
+
steps: [
|
|
1133
|
+
{
|
|
1134
|
+
toolCallId: "transcription:0",
|
|
1135
|
+
args: {
|
|
1136
|
+
kind: "stt",
|
|
1137
|
+
model: route,
|
|
1138
|
+
transport,
|
|
1139
|
+
fallbackReason,
|
|
1140
|
+
mediaType: input.mediaType,
|
|
1141
|
+
audioBytes: audio.byteLength,
|
|
1142
|
+
language: input.language,
|
|
1143
|
+
prompt: input.prompt,
|
|
1144
|
+
durationSec,
|
|
1145
|
+
},
|
|
1146
|
+
result: JSON.stringify({ text, durationSec, callId }),
|
|
1147
|
+
},
|
|
1148
|
+
],
|
|
1149
|
+
};
|
|
1150
|
+
|
|
1151
|
+
return { output, log };
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
/**
|
|
1156
|
+
* OpenAI realtime speech (openai/<id>): a conversational realtime model repeating the text over
|
|
1157
|
+
* the direct realtime socket. Output is PCM16 24 kHz, wrapped as WAV unless `format` is pcm.
|
|
1158
|
+
*/
|
|
1159
|
+
async function speakOpenAI(input: SpeakInput): Promise<SpeakOutput> {
|
|
1160
|
+
const dispatcher = openaiVoice();
|
|
1161
|
+
const selection = await resolveMediaTokenSelection("openai", input.tokenName);
|
|
1162
|
+
|
|
1163
|
+
const { id, route } = routeProviderModelId(
|
|
1164
|
+
"openai",
|
|
1165
|
+
input.model,
|
|
1166
|
+
OPENAI_REALTIME_DEFAULT_SPEECH_MODEL,
|
|
1167
|
+
);
|
|
1168
|
+
|
|
1169
|
+
if (input.format !== undefined && input.format !== "wav" && input.format !== "pcm") {
|
|
1170
|
+
throw new BadRequestException(
|
|
1171
|
+
SD("qgrid.openaiVoiceInvalidRequest")(
|
|
1172
|
+
`format ${input.format} is not available; realtime speech returns wav or pcm`,
|
|
1173
|
+
),
|
|
1174
|
+
);
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
const request = {
|
|
1178
|
+
text: input.text,
|
|
1179
|
+
model: id,
|
|
1180
|
+
voice: input.voice ?? OPENAI_REALTIME_DEFAULT_VOICE,
|
|
1181
|
+
instructions: input.instructions,
|
|
1182
|
+
format: input.format,
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
const start = {
|
|
1186
|
+
kind: "tts",
|
|
1187
|
+
model: route,
|
|
1188
|
+
prompt: input.text,
|
|
1189
|
+
projectName: input.projectName,
|
|
1190
|
+
logger: input.logger,
|
|
1191
|
+
} as const;
|
|
1192
|
+
|
|
1193
|
+
return runMediaEndpoint(start, async (signal, requestLogId) => {
|
|
1194
|
+
const dispatched = await dispatcher.speak({ ...request, signal, ...selection });
|
|
1195
|
+
const { audio, mediaType, transcript, usage, firstAudioAt } = dispatched.result;
|
|
1196
|
+
|
|
1197
|
+
const output: SpeakOutput = {
|
|
1198
|
+
audio: Buffer.from(audio).toString("base64"),
|
|
1199
|
+
mimeType: mediaType,
|
|
1200
|
+
tokenName: dispatched.tokenName,
|
|
1201
|
+
};
|
|
1202
|
+
|
|
1203
|
+
if (requestLogId !== undefined) output.requestLogId = requestLogId;
|
|
1204
|
+
|
|
1205
|
+
// pcm output is always 24 kHz PCM16, so the log copy is wrapped as WAV to stay playable.
|
|
1206
|
+
const logAudio =
|
|
1207
|
+
mediaType === "audio/wav"
|
|
1208
|
+
? output.audio
|
|
1209
|
+
: Buffer.from(wrapPcmAsWav(audio)).toString("base64");
|
|
1210
|
+
|
|
1211
|
+
const log: MediaRunLog = {
|
|
1212
|
+
tokenName: output.tokenName,
|
|
1213
|
+
response: speechResponseForLog(logAudio, "audio/wav", audio.byteLength),
|
|
1214
|
+
firstOutputAt: firstAudioAt,
|
|
1215
|
+
steps: [
|
|
1216
|
+
{
|
|
1217
|
+
toolCallId: "speech:0",
|
|
1218
|
+
args: {
|
|
1219
|
+
kind: "tts",
|
|
1220
|
+
model: route,
|
|
1221
|
+
transport: "realtime-ws",
|
|
1222
|
+
voice: request.voice,
|
|
1223
|
+
format: request.format ?? "wav",
|
|
1224
|
+
instructions: input.instructions,
|
|
1225
|
+
characters: input.text.length,
|
|
1226
|
+
},
|
|
1227
|
+
result: JSON.stringify({
|
|
1228
|
+
mimeType: mediaType,
|
|
1229
|
+
audioBytes: audio.byteLength,
|
|
1230
|
+
transcript,
|
|
1231
|
+
usage,
|
|
1232
|
+
}),
|
|
1233
|
+
},
|
|
1234
|
+
],
|
|
1235
|
+
};
|
|
1236
|
+
|
|
1237
|
+
return { output, log };
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1015
1241
|
class QgridFrameClass extends BaseFrameClass {
|
|
1016
1242
|
constructor() {
|
|
1017
1243
|
super("Qgrid");
|
|
@@ -1962,6 +2188,9 @@ class QgridFrameClass extends BaseFrameClass {
|
|
|
1962
2188
|
@api({ httpMethod: "POST", clients: ["axios", "tanstack-mutation"] })
|
|
1963
2189
|
async transcribe(params: TranscribeInput): Promise<TranscribeOutput> {
|
|
1964
2190
|
const input = parseMediaInput(TranscribeInput, params);
|
|
2191
|
+
const provider = voiceProvider(input.model);
|
|
2192
|
+
|
|
2193
|
+
if (provider === "openai") return transcribeOpenAI(input);
|
|
1965
2194
|
const voice = grokVoice();
|
|
1966
2195
|
const selection = await resolveGrokTokenSelection(input.tokenName);
|
|
1967
2196
|
const { id, route } = routeModelId(input.model, GROK_STT_DEFAULT_MODEL);
|
|
@@ -2026,6 +2255,8 @@ class QgridFrameClass extends BaseFrameClass {
|
|
|
2026
2255
|
@api({ httpMethod: "POST", clients: ["axios", "tanstack-mutation"] })
|
|
2027
2256
|
async speak(params: SpeakInput): Promise<SpeakOutput> {
|
|
2028
2257
|
const input = parseMediaInput(SpeakInput, params);
|
|
2258
|
+
|
|
2259
|
+
if (voiceProvider(input.model) === "openai") return speakOpenAI(input);
|
|
2029
2260
|
const voice = grokVoice();
|
|
2030
2261
|
const selection = await resolveGrokTokenSelection(input.tokenName);
|
|
2031
2262
|
const route = input.model ?? GROK_TTS_LOG_MODEL;
|
|
@@ -2059,7 +2290,8 @@ class QgridFrameClass extends BaseFrameClass {
|
|
|
2059
2290
|
|
|
2060
2291
|
const log: MediaRunLog = {
|
|
2061
2292
|
tokenName: output.tokenName,
|
|
2062
|
-
response:
|
|
2293
|
+
response: speechResponseForLog(output.audio, output.mimeType, audioBytes),
|
|
2294
|
+
firstOutputAt: dispatched.result.firstByteAt,
|
|
2063
2295
|
steps: [
|
|
2064
2296
|
{
|
|
2065
2297
|
toolCallId: "speech:0",
|
|
@@ -502,8 +502,13 @@ export const VideoStatusOutput = z.object({
|
|
|
502
502
|
|
|
503
503
|
export type VideoStatusOutput = z.infer<typeof VideoStatusOutput>;
|
|
504
504
|
|
|
505
|
+
// Voice endpoints accept Grok and OpenAI ids; the frame routes by prefix.
|
|
506
|
+
const VoiceModelId = z
|
|
507
|
+
.string()
|
|
508
|
+
.regex(/^(grok|openai)\/[A-Za-z0-9._-]+$/, "model must be grok/<id> or openai/<id>");
|
|
509
|
+
|
|
505
510
|
export const TranscribeInput = z.object({
|
|
506
|
-
model:
|
|
511
|
+
model: VoiceModelId.optional(),
|
|
507
512
|
// Base64 audio bytes (no data: prefix), at most MEDIA_MAX_INLINE_BYTES decoded.
|
|
508
513
|
audio: z
|
|
509
514
|
.string()
|
|
@@ -515,6 +520,11 @@ export const TranscribeInput = z.object({
|
|
|
515
520
|
),
|
|
516
521
|
mediaType: z.string().regex(/^audio\/[A-Za-z0-9.+-]+$/, "mediaType must be audio/*"),
|
|
517
522
|
language: z.string().min(1).max(16).optional(),
|
|
523
|
+
// OpenAI realtime transcription only: domain vocabulary or style hint for the model.
|
|
524
|
+
// Honored by gpt-4o-mini-transcribe, gpt-4o-transcribe, gpt-transcribe, gpt-live-transcribe.
|
|
525
|
+
// gpt-realtime-whisper rejects it (400 before the upstream call); whisper-1 accepts it but the
|
|
526
|
+
// upstream ignores it, so spelling is not steered.
|
|
527
|
+
prompt: z.string().min(1).max(2_000).optional(),
|
|
518
528
|
...MediaCallOptions,
|
|
519
529
|
});
|
|
520
530
|
|
|
@@ -532,11 +542,13 @@ export const TranscribeOutput = z.object({
|
|
|
532
542
|
export type TranscribeOutput = z.infer<typeof TranscribeOutput>;
|
|
533
543
|
|
|
534
544
|
export const SpeakInput = z.object({
|
|
535
|
-
model:
|
|
545
|
+
model: VoiceModelId.optional(),
|
|
536
546
|
text: z.string().min(1).max(15_000),
|
|
537
547
|
voice: z.string().min(1).max(64).optional(),
|
|
538
548
|
language: z.string().min(1).max(16).optional(),
|
|
539
549
|
format: z.enum(["mp3", "wav", "pcm", "mulaw", "alaw"]).optional(),
|
|
550
|
+
// OpenAI realtime speech only: style guidance appended to the verbatim-repeat instruction.
|
|
551
|
+
instructions: z.string().min(1).max(2_000).optional(),
|
|
540
552
|
...MediaCallOptions,
|
|
541
553
|
});
|
|
542
554
|
|
|
@@ -220,6 +220,13 @@
|
|
|
220
220
|
"type": "boolean",
|
|
221
221
|
"desc": "structured output(jsonSchema) 요청 여부 (목록 구분 표시용)",
|
|
222
222
|
"dbDefault": "false"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"name": "media_kind",
|
|
226
|
+
"type": "enum",
|
|
227
|
+
"id": "RequestLogMediaKind",
|
|
228
|
+
"nullable": true,
|
|
229
|
+
"desc": "미디어 엔드포인트 종류(image/video/stt/tts). 텍스트 요청은 null (목록 Fmt 표시용)"
|
|
223
230
|
}
|
|
224
231
|
],
|
|
225
232
|
"indexes": [
|
|
@@ -311,7 +318,8 @@
|
|
|
311
318
|
"error_message",
|
|
312
319
|
"tool_call_count",
|
|
313
320
|
"is_image_generation",
|
|
314
|
-
"is_structured"
|
|
321
|
+
"is_structured",
|
|
322
|
+
"media_kind"
|
|
315
323
|
],
|
|
316
324
|
"P": [
|
|
317
325
|
"id",
|
|
@@ -339,7 +347,8 @@
|
|
|
339
347
|
"response_json_ok",
|
|
340
348
|
"tool_call_count",
|
|
341
349
|
"is_image_generation",
|
|
342
|
-
"is_structured"
|
|
350
|
+
"is_structured",
|
|
351
|
+
"media_kind"
|
|
343
352
|
],
|
|
344
353
|
"C": [
|
|
345
354
|
"id",
|
|
@@ -386,6 +395,12 @@
|
|
|
386
395
|
"succeeded": "성공",
|
|
387
396
|
"error": "에러",
|
|
388
397
|
"aborted": "중단"
|
|
398
|
+
},
|
|
399
|
+
"RequestLogMediaKind": {
|
|
400
|
+
"image": "이미지",
|
|
401
|
+
"video": "비디오",
|
|
402
|
+
"stt": "음성 인식",
|
|
403
|
+
"tts": "음성 합성"
|
|
389
404
|
}
|
|
390
405
|
}
|
|
391
406
|
}
|
|
@@ -154,6 +154,23 @@ describe("RequestLogModel TTFT", () => {
|
|
|
154
154
|
}),
|
|
155
155
|
);
|
|
156
156
|
});
|
|
157
|
+
|
|
158
|
+
it("prefers an explicit ttft_ms for runs without generate steps", async () => {
|
|
159
|
+
const ubRegister = vi.fn();
|
|
160
|
+
const transaction = vi.fn(async (cb: (trx: { ubUpsert: () => Promise<number[]> }) => void) =>
|
|
161
|
+
cb({ ubUpsert: vi.fn(async () => [7]) }),
|
|
162
|
+
);
|
|
163
|
+
const derived = vi.spyOn(RequestLogModel, "firstGenerateStepTtft").mockResolvedValue(55);
|
|
164
|
+
vi.spyOn(
|
|
165
|
+
RequestLogModel as unknown as { getPuri: () => { ubRegister: typeof ubRegister; transaction: typeof transaction } },
|
|
166
|
+
"getPuri",
|
|
167
|
+
).mockReturnValue({ ubRegister, transaction });
|
|
168
|
+
|
|
169
|
+
await RequestLogModel.finishRun(7, { status: "error", error_message: "boom", ttft_ms: 240 });
|
|
170
|
+
|
|
171
|
+
expect(ubRegister).toHaveBeenCalledWith("request_logs", expect.objectContaining({ id: 7, ttft_ms: 240 }));
|
|
172
|
+
expect(derived).not.toHaveBeenCalled();
|
|
173
|
+
});
|
|
157
174
|
});
|
|
158
175
|
|
|
159
176
|
describe("RequestLogModel toolsView", () => {
|
|
@@ -22,7 +22,11 @@ import {
|
|
|
22
22
|
type ProviderId,
|
|
23
23
|
} from "../../utils/providers/common/provider-types";
|
|
24
24
|
import { type RequestLogStepSaveParams } from "../request-log-step/request-log-step.types";
|
|
25
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
type RequestLogMediaKind,
|
|
27
|
+
type RequestLogSubsetKey,
|
|
28
|
+
type RequestLogSubsetMapping,
|
|
29
|
+
} from "../sonamu.generated";
|
|
26
30
|
import { requestLogLoaderQueries, requestLogSubsetQueries } from "../sonamu.generated.sso";
|
|
27
31
|
import { renderJsonSchemaZodText, renderParsedJsonSchemaTypeText } from "./json-schema-type-text";
|
|
28
32
|
import {
|
|
@@ -111,9 +115,11 @@ export interface FinishRunParams {
|
|
|
111
115
|
image_cost_method?: string | null;
|
|
112
116
|
is_image_generation?: boolean;
|
|
113
117
|
response_json_ok?: boolean | null;
|
|
118
|
+
/** Explicit TTFT for runs without generate steps (speech); otherwise derived from the steps. */
|
|
119
|
+
ttft_ms?: number;
|
|
114
120
|
}
|
|
115
121
|
|
|
116
|
-
type FinishRunUpdate = Partial<FinishRunParams> & { id: number
|
|
122
|
+
type FinishRunUpdate = Partial<FinishRunParams> & { id: number };
|
|
117
123
|
|
|
118
124
|
export type RunProgressUpdate = { token_name?: string; model_name?: string; ttft_ms?: number };
|
|
119
125
|
|
|
@@ -544,6 +550,7 @@ class RequestLogModelClass extends BaseModelClass<
|
|
|
544
550
|
is_image_generation?: boolean;
|
|
545
551
|
is_structured?: boolean;
|
|
546
552
|
json_schema?: string | null;
|
|
553
|
+
media_kind?: RequestLogMediaKind | null;
|
|
547
554
|
}): Promise<number> {
|
|
548
555
|
const wdb = this.getPuri("w");
|
|
549
556
|
|
|
@@ -569,6 +576,7 @@ class RequestLogModelClass extends BaseModelClass<
|
|
|
569
576
|
json_schema: params.json_schema ?? null,
|
|
570
577
|
is_structured:
|
|
571
578
|
params.is_structured ?? (params.json_schema !== null && params.json_schema !== undefined),
|
|
579
|
+
media_kind: params.media_kind ?? null,
|
|
572
580
|
};
|
|
573
581
|
|
|
574
582
|
if (params.history !== undefined) row.history = params.history;
|
|
@@ -643,7 +651,7 @@ class RequestLogModelClass extends BaseModelClass<
|
|
|
643
651
|
for (const key of fields) copyDefined(update, params, key);
|
|
644
652
|
|
|
645
653
|
if (params.history !== undefined) update.history = params.history;
|
|
646
|
-
update.ttft_ms = (await this.firstGenerateStepTtft(requestLogId)) ?? 0;
|
|
654
|
+
update.ttft_ms = params.ttft_ms ?? (await this.firstGenerateStepTtft(requestLogId)) ?? 0;
|
|
647
655
|
|
|
648
656
|
// 서버 run 경로는 step 에서 확정한 exact cost 와 출처를 넘긴다. 출처 없이 끝난 외부/legacy
|
|
649
657
|
// run 은 저장된 모델+usage 로 여기서 확정해, 읽기 경로가 다시 계산하지 않게 한다.
|
|
@@ -702,6 +702,7 @@ Content-Type: application/json
|
|
|
702
702
|
"audio": "AUDIO",
|
|
703
703
|
"mediaType": "MEDIATYPE",
|
|
704
704
|
"language": "LANGUAGE",
|
|
705
|
+
"prompt": "PROMPT",
|
|
705
706
|
"tokenName": "TOKENNAME",
|
|
706
707
|
"projectName": "PROJECTNAME",
|
|
707
708
|
"logger": false
|
|
@@ -720,6 +721,7 @@ Content-Type: application/json
|
|
|
720
721
|
"voice": "VOICE",
|
|
721
722
|
"language": "LANGUAGE",
|
|
722
723
|
"format": "mp3",
|
|
724
|
+
"instructions": "INSTRUCTIONS",
|
|
723
725
|
"tokenName": "TOKENNAME",
|
|
724
726
|
"projectName": "PROJECTNAME",
|
|
725
727
|
"logger": false
|
|
@@ -55,6 +55,7 @@ export const requestLogSubsetQueries = {
|
|
|
55
55
|
tool_call_count: "request_logs.tool_call_count",
|
|
56
56
|
is_image_generation: "request_logs.is_image_generation",
|
|
57
57
|
is_structured: "request_logs.is_structured",
|
|
58
|
+
media_kind: "request_logs.media_kind",
|
|
58
59
|
});
|
|
59
60
|
},
|
|
60
61
|
P: (qbWrapper: PuriWrapper<DatabaseSchemaExtend>) => {
|
|
@@ -85,6 +86,7 @@ export const requestLogSubsetQueries = {
|
|
|
85
86
|
tool_call_count: "request_logs.tool_call_count",
|
|
86
87
|
is_image_generation: "request_logs.is_image_generation",
|
|
87
88
|
is_structured: "request_logs.is_structured",
|
|
89
|
+
media_kind: "request_logs.media_kind",
|
|
88
90
|
});
|
|
89
91
|
},
|
|
90
92
|
C: (qbWrapper: PuriWrapper<DatabaseSchemaExtend>) => {
|
|
@@ -139,6 +139,16 @@ export const RequestLogStatusLabel = {
|
|
|
139
139
|
error: "에러",
|
|
140
140
|
aborted: "중단",
|
|
141
141
|
};
|
|
142
|
+
export const RequestLogMediaKind = z
|
|
143
|
+
.enum(["image", "video", "stt", "tts"])
|
|
144
|
+
.describe("RequestLogMediaKind");
|
|
145
|
+
export type RequestLogMediaKind = z.infer<typeof RequestLogMediaKind>;
|
|
146
|
+
export const RequestLogMediaKindLabel = {
|
|
147
|
+
image: "이미지",
|
|
148
|
+
video: "비디오",
|
|
149
|
+
stt: "음성 인식",
|
|
150
|
+
tts: "음성 합성",
|
|
151
|
+
};
|
|
142
152
|
|
|
143
153
|
// Enums: RequestLogStep
|
|
144
154
|
export const RequestLogStepType = z.enum(["generate", "tool_call"]).describe("RequestLogStepType");
|
|
@@ -203,6 +213,7 @@ export const RequestLogBaseSchema = z.object({
|
|
|
203
213
|
tool_call_count: z.int(),
|
|
204
214
|
is_image_generation: z.boolean(),
|
|
205
215
|
is_structured: z.boolean(),
|
|
216
|
+
media_kind: RequestLogMediaKind.nullable(),
|
|
206
217
|
});
|
|
207
218
|
export type RequestLogBaseSchema = z.infer<typeof RequestLogBaseSchema> & {
|
|
208
219
|
readonly __hasDefault__: readonly [
|
|
@@ -239,6 +250,7 @@ export type RequestLogBaseSchema = z.infer<typeof RequestLogBaseSchema> & {
|
|
|
239
250
|
"tool_call_count",
|
|
240
251
|
"is_image_generation",
|
|
241
252
|
"is_structured",
|
|
253
|
+
"media_kind",
|
|
242
254
|
"id",
|
|
243
255
|
];
|
|
244
256
|
readonly __json__: readonly ["history", "input_images", "tools"];
|
|
@@ -445,6 +457,7 @@ export const RequestLogSubsetA = z.object({
|
|
|
445
457
|
tool_call_count: z.int(),
|
|
446
458
|
is_image_generation: z.boolean(),
|
|
447
459
|
is_structured: z.boolean(),
|
|
460
|
+
media_kind: RequestLogMediaKind.nullable(),
|
|
448
461
|
});
|
|
449
462
|
export type RequestLogSubsetA = z.infer<typeof RequestLogSubsetA>;
|
|
450
463
|
export const RequestLogSubsetP = z.object({
|
|
@@ -474,6 +487,7 @@ export const RequestLogSubsetP = z.object({
|
|
|
474
487
|
tool_call_count: z.int(),
|
|
475
488
|
is_image_generation: z.boolean(),
|
|
476
489
|
is_structured: z.boolean(),
|
|
490
|
+
media_kind: RequestLogMediaKind.nullable(),
|
|
477
491
|
});
|
|
478
492
|
export type RequestLogSubsetP = z.infer<typeof RequestLogSubsetP>;
|
|
479
493
|
export const RequestLogSubsetC = z.object({
|
package/bundle/src/i18n/en.ts
CHANGED
|
@@ -58,6 +58,7 @@ export default {
|
|
|
58
58
|
"qgrid.grokContentPolicy": (detail: string) =>
|
|
59
59
|
`Grok generation blocked by content policy: ${detail}`,
|
|
60
60
|
"qgrid.grokInvalidRequest": (detail: string) => `Invalid Grok request: ${detail}`,
|
|
61
|
+
"qgrid.openaiVoiceInvalidRequest": (detail: string) => `Invalid OpenAI voice request: ${detail}`,
|
|
61
62
|
"qgrid.grokLoginFailed": (detail: string) => `Grok login failed: ${detail}`,
|
|
62
63
|
"qgrid.grokNotOAuthToken": "Grok login returned credentials that are not an xAI OAuth token",
|
|
63
64
|
"qgrid.grokNoWorkers": (detail: string) => `No Grok token is available: ${detail}`,
|
package/bundle/src/i18n/ko.ts
CHANGED
|
@@ -59,6 +59,7 @@ export default {
|
|
|
59
59
|
"qgrid.grokContentPolicy": (detail: string) =>
|
|
60
60
|
`콘텐츠 정책 위반으로 Grok 생성이 차단되었습니다: ${detail}`,
|
|
61
61
|
"qgrid.grokInvalidRequest": (detail: string) => `잘못된 Grok 요청입니다: ${detail}`,
|
|
62
|
+
"qgrid.openaiVoiceInvalidRequest": (detail: string) => `잘못된 OpenAI 음성 요청입니다: ${detail}`,
|
|
62
63
|
"qgrid.grokLoginFailed": (detail: string) => `Grok 로그인에 실패했습니다: ${detail}`,
|
|
63
64
|
"qgrid.grokNotOAuthToken": "Grok 로그인 결과가 xAI OAuth 토큰이 아닙니다",
|
|
64
65
|
"qgrid.grokNoWorkers": (detail: string) => `사용 가능한 Grok 토큰이 없습니다: ${detail}`,
|
|
@@ -250,6 +250,8 @@ const entityLabels = {
|
|
|
250
250
|
"entity.RequestLog.tool_call_count": "tool call 횟수",
|
|
251
251
|
"entity.RequestLog.is_image_generation": "이미지 생성 turn 여부 (quota 귀속용)",
|
|
252
252
|
"entity.RequestLog.is_structured": "structured output(jsonSchema) 요청 여부 (목록 구분 표시용)",
|
|
253
|
+
"entity.RequestLog.media_kind":
|
|
254
|
+
"미디어 엔드포인트 종류(image/video/stt/tts). 텍스트 요청은 null (목록 Fmt 표시용)",
|
|
253
255
|
"enum.RequestLogOrderBy.id-desc": "ID최신순",
|
|
254
256
|
"enum.RequestLogOrderBy.id-asc": "ID오래된순",
|
|
255
257
|
"enum.RequestLogOrderBy.created_at-desc": "등록일시최신순",
|
|
@@ -275,6 +277,10 @@ const entityLabels = {
|
|
|
275
277
|
"enum.RequestLogStatus.succeeded": "성공",
|
|
276
278
|
"enum.RequestLogStatus.error": "에러",
|
|
277
279
|
"enum.RequestLogStatus.aborted": "중단",
|
|
280
|
+
"enum.RequestLogMediaKind.image": "이미지",
|
|
281
|
+
"enum.RequestLogMediaKind.video": "비디오",
|
|
282
|
+
"enum.RequestLogMediaKind.stt": "음성 인식",
|
|
283
|
+
"enum.RequestLogMediaKind.tts": "음성 합성",
|
|
278
284
|
"entity.RequestLogStep": "RequestLogStep",
|
|
279
285
|
"entity.RequestLogStep.id": "ID",
|
|
280
286
|
"entity.RequestLogStep.created_at": "등록일시",
|