fix: `TypeError: Cannot read properties of undefined (reading 'authType')` (#3914)
This commit is contained in:
parent
a071f604e3
commit
764809753a
|
@ -215,7 +215,7 @@ export async function main() {
|
||||||
'event.timestamp': new Date().toISOString(),
|
'event.timestamp': new Date().toISOString(),
|
||||||
prompt: input,
|
prompt: input,
|
||||||
prompt_id,
|
prompt_id,
|
||||||
auth_type: config.getContentGeneratorConfig().authType!,
|
auth_type: config.getContentGeneratorConfig()?.authType,
|
||||||
prompt_length: input.length,
|
prompt_length: input.length,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ export async function runNonInteractive(
|
||||||
console.error(
|
console.error(
|
||||||
parseAndFormatApiError(
|
parseAndFormatApiError(
|
||||||
error,
|
error,
|
||||||
config.getContentGeneratorConfig().authType,
|
config.getContentGeneratorConfig()?.authType,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|
|
@ -226,7 +226,7 @@ export const useGeminiStream = (
|
||||||
new UserPromptEvent(
|
new UserPromptEvent(
|
||||||
trimmedQuery.length,
|
trimmedQuery.length,
|
||||||
prompt_id,
|
prompt_id,
|
||||||
config.getContentGeneratorConfig().authType!,
|
config.getContentGeneratorConfig()?.authType,
|
||||||
trimmedQuery,
|
trimmedQuery,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -408,7 +408,7 @@ export const useGeminiStream = (
|
||||||
type: MessageType.ERROR,
|
type: MessageType.ERROR,
|
||||||
text: parseAndFormatApiError(
|
text: parseAndFormatApiError(
|
||||||
eventValue.error,
|
eventValue.error,
|
||||||
config.getContentGeneratorConfig().authType,
|
config.getContentGeneratorConfig()?.authType,
|
||||||
undefined,
|
undefined,
|
||||||
config.getModel(),
|
config.getModel(),
|
||||||
DEFAULT_GEMINI_FLASH_MODEL,
|
DEFAULT_GEMINI_FLASH_MODEL,
|
||||||
|
@ -588,7 +588,7 @@ export const useGeminiStream = (
|
||||||
type: MessageType.ERROR,
|
type: MessageType.ERROR,
|
||||||
text: parseAndFormatApiError(
|
text: parseAndFormatApiError(
|
||||||
getErrorMessage(error) || 'Unknown error',
|
getErrorMessage(error) || 'Unknown error',
|
||||||
config.getContentGeneratorConfig().authType,
|
config.getContentGeneratorConfig()?.authType,
|
||||||
undefined,
|
undefined,
|
||||||
config.getModel(),
|
config.getModel(),
|
||||||
DEFAULT_GEMINI_FLASH_MODEL,
|
DEFAULT_GEMINI_FLASH_MODEL,
|
||||||
|
|
|
@ -172,7 +172,7 @@ export class GeminiChat {
|
||||||
this.config.getModel(),
|
this.config.getModel(),
|
||||||
durationMs,
|
durationMs,
|
||||||
prompt_id,
|
prompt_id,
|
||||||
this.config.getContentGeneratorConfig().authType!,
|
this.config.getContentGeneratorConfig()?.authType,
|
||||||
usageMetadata,
|
usageMetadata,
|
||||||
responseText,
|
responseText,
|
||||||
),
|
),
|
||||||
|
@ -194,7 +194,7 @@ export class GeminiChat {
|
||||||
errorMessage,
|
errorMessage,
|
||||||
durationMs,
|
durationMs,
|
||||||
prompt_id,
|
prompt_id,
|
||||||
this.config.getContentGeneratorConfig().authType!,
|
this.config.getContentGeneratorConfig()?.authType,
|
||||||
errorType,
|
errorType,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -96,13 +96,13 @@ export class UserPromptEvent {
|
||||||
'event.timestamp': string; // ISO 8601
|
'event.timestamp': string; // ISO 8601
|
||||||
prompt_length: number;
|
prompt_length: number;
|
||||||
prompt_id: string;
|
prompt_id: string;
|
||||||
auth_type: string;
|
auth_type?: string;
|
||||||
prompt?: string;
|
prompt?: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
prompt_length: number,
|
prompt_length: number,
|
||||||
prompt_Id: string,
|
prompt_Id: string,
|
||||||
auth_type: string,
|
auth_type?: string,
|
||||||
prompt?: string,
|
prompt?: string,
|
||||||
) {
|
) {
|
||||||
this['event.name'] = 'user_prompt';
|
this['event.name'] = 'user_prompt';
|
||||||
|
@ -167,14 +167,14 @@ export class ApiErrorEvent {
|
||||||
status_code?: number | string;
|
status_code?: number | string;
|
||||||
duration_ms: number;
|
duration_ms: number;
|
||||||
prompt_id: string;
|
prompt_id: string;
|
||||||
auth_type: string;
|
auth_type?: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
model: string,
|
model: string,
|
||||||
error: string,
|
error: string,
|
||||||
duration_ms: number,
|
duration_ms: number,
|
||||||
prompt_id: string,
|
prompt_id: string,
|
||||||
auth_type: string,
|
auth_type?: string,
|
||||||
error_type?: string,
|
error_type?: string,
|
||||||
status_code?: number | string,
|
status_code?: number | string,
|
||||||
) {
|
) {
|
||||||
|
@ -205,13 +205,13 @@ export class ApiResponseEvent {
|
||||||
total_token_count: number;
|
total_token_count: number;
|
||||||
response_text?: string;
|
response_text?: string;
|
||||||
prompt_id: string;
|
prompt_id: string;
|
||||||
auth_type: string;
|
auth_type?: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
model: string,
|
model: string,
|
||||||
duration_ms: number,
|
duration_ms: number,
|
||||||
prompt_id: string,
|
prompt_id: string,
|
||||||
auth_type: string,
|
auth_type?: string,
|
||||||
usage_data?: GenerateContentResponseUsageMetadata,
|
usage_data?: GenerateContentResponseUsageMetadata,
|
||||||
response_text?: string,
|
response_text?: string,
|
||||||
error?: string,
|
error?: string,
|
||||||
|
|
Loading…
Reference in New Issue