chore: test deploy snapshot
This commit is contained in:
@@ -54,6 +54,8 @@ const envSchema = z.object({
|
||||
WEB_PUSH_VAPID_PUBLIC_KEY: z.string().optional(),
|
||||
WEB_PUSH_VAPID_PRIVATE_KEY: z.string().optional(),
|
||||
WEB_PUSH_SUBJECT: z.string().default('mailto:how2ice@naver.com'),
|
||||
OPENAI_API_KEY: z.string().optional(),
|
||||
OPENAI_ORGANIZATION_ID: z.string().optional(),
|
||||
APNS_KEY_ID: z.string().optional(),
|
||||
APNS_TEAM_ID: z.string().optional(),
|
||||
APNS_BUNDLE_ID: z.string().optional(),
|
||||
|
||||
@@ -2855,6 +2855,7 @@ export async function registerChatRoutes(app: FastifyInstance) {
|
||||
mode: z.enum(['queue', 'direct']).optional(),
|
||||
parentRequestId: z.string().trim().min(1).max(120).optional().nullable(),
|
||||
sessionId: z.string().trim().min(1).max(120).optional().nullable(),
|
||||
codexModel: z.string().trim().max(120).optional().nullable(),
|
||||
}).parse(request.body ?? {});
|
||||
const managedContext = await resolveManagedChatShareContext(params.token);
|
||||
const tokenPayload = resolveChatSharePayloadFromManagedResource(managedContext.managedResource) ?? parseChatShareToken(params.token);
|
||||
@@ -2947,11 +2948,14 @@ export async function registerChatRoutes(app: FastifyInstance) {
|
||||
resolvedRoomContext.activeRoom.sessionId,
|
||||
payload.text,
|
||||
{
|
||||
mode: payload.mode === 'direct' ? 'direct' : 'queue',
|
||||
requestOrigin: 'composer',
|
||||
sharedResourceTokenId: managedContext.managedResource?.token.id ?? tokenPayload.managedResourceTokenId ?? null,
|
||||
parentRequestId: resolvedParentRequestId,
|
||||
clientId: shareSnapshot.targetRequest.requesterClientId ?? shareSnapshot.conversation?.clientId ?? null,
|
||||
mode: payload.mode === 'direct' ? 'direct' : 'queue',
|
||||
requestOrigin: 'composer',
|
||||
sharedResourceTokenId: managedContext.managedResource?.token.id ?? tokenPayload.managedResourceTokenId ?? null,
|
||||
parentRequestId: resolvedParentRequestId,
|
||||
contextOverride: Object.prototype.hasOwnProperty.call(payload, 'codexModel')
|
||||
? { codexModel: payload.codexModel ?? null }
|
||||
: undefined,
|
||||
clientId: shareSnapshot.targetRequest.requesterClientId ?? shareSnapshot.conversation?.clientId ?? null,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
resolveChatContextAppOrigin,
|
||||
resolveChatContextAppDomain,
|
||||
rewriteCodexOutputWithChatResources,
|
||||
sanitizeChatContextOverride,
|
||||
summarizeActivityProgressLine,
|
||||
shouldSendOfflineChatNotification,
|
||||
shouldUseAgenticCodexReply,
|
||||
@@ -127,6 +128,29 @@ test('filterInactiveOfflineNotificationClientIds excludes only actively viewing
|
||||
);
|
||||
});
|
||||
|
||||
test('sanitizeChatContextOverride drops undefined codexModel without touching explicit null', () => {
|
||||
assert.deepEqual(
|
||||
sanitizeChatContextOverride({
|
||||
codexModel: undefined,
|
||||
chatTypeId: 'general-request',
|
||||
} as any),
|
||||
{
|
||||
chatTypeId: 'general-request',
|
||||
},
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
sanitizeChatContextOverride({
|
||||
codexModel: null,
|
||||
chatTypeId: 'general-request',
|
||||
}),
|
||||
{
|
||||
codexModel: null,
|
||||
chatTypeId: 'general-request',
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
test('shouldSendOfflineChatNotification blocks chat push when app setting disables room notifications', () => {
|
||||
assert.equal(
|
||||
shouldSendOfflineChatNotification({
|
||||
|
||||
@@ -111,6 +111,25 @@ type ChatContext = {
|
||||
customContextContent?: string | null;
|
||||
};
|
||||
|
||||
export function sanitizeChatContextOverride(contextOverride?: Partial<ChatContext> | null) {
|
||||
if (!contextOverride) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const normalizedOverride = {
|
||||
...contextOverride,
|
||||
};
|
||||
|
||||
if (
|
||||
Object.prototype.hasOwnProperty.call(normalizedOverride, 'codexModel')
|
||||
&& normalizedOverride.codexModel === undefined
|
||||
) {
|
||||
delete normalizedOverride.codexModel;
|
||||
}
|
||||
|
||||
return normalizedOverride;
|
||||
}
|
||||
|
||||
type ChatPromptContextRef = {
|
||||
key: 'prompt_parent_question';
|
||||
promptTitle: string;
|
||||
@@ -5674,6 +5693,7 @@ export class ChatService {
|
||||
) {
|
||||
const normalizedSessionId = sessionId.trim();
|
||||
const trimmedText = text.trim();
|
||||
const normalizedContextOverride = sanitizeChatContextOverride(options?.contextOverride);
|
||||
|
||||
if (!normalizedSessionId || !trimmedText) {
|
||||
return null;
|
||||
@@ -5700,7 +5720,10 @@ export class ChatService {
|
||||
topMenu: '',
|
||||
focusedComponentId: null,
|
||||
pageUrl: '',
|
||||
codexModel: conversation?.codexModel ?? null,
|
||||
codexModel:
|
||||
Object.prototype.hasOwnProperty.call(normalizedContextOverride ?? {}, 'codexModel')
|
||||
? normalizedContextOverride?.codexModel ?? null
|
||||
: conversation?.codexModel ?? null,
|
||||
chatTypeId: parentRequest?.chatTypeId ?? conversation?.chatTypeId ?? conversation?.lastChatTypeId ?? null,
|
||||
chatTypeLabel: parentRequest?.chatTypeLabel ?? conversation?.contextLabel ?? '',
|
||||
chatTypeDescription: conversation?.contextDescription ?? '',
|
||||
@@ -5713,7 +5736,7 @@ export class ChatService {
|
||||
options?.mode === 'direct' ? 'direct' : 'queue',
|
||||
{
|
||||
...baseContext,
|
||||
...(options?.contextOverride ?? {}),
|
||||
...(normalizedContextOverride ?? {}),
|
||||
},
|
||||
{
|
||||
omitPromptHistory: options?.omitPromptHistory,
|
||||
|
||||
Reference in New Issue
Block a user