mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
Merge branch 'main' into memory_usage3
This commit is contained in:
@@ -62,6 +62,7 @@ describe('fetchJson', () => {
|
|||||||
const res = new EventEmitter() as IncomingMessage;
|
const res = new EventEmitter() as IncomingMessage;
|
||||||
res.statusCode = 302;
|
res.statusCode = 302;
|
||||||
res.headers = { location: 'https://example.com/final' };
|
res.headers = { location: 'https://example.com/final' };
|
||||||
|
res.resume = vi.fn();
|
||||||
(callback as (res: IncomingMessage) => void)(res);
|
(callback as (res: IncomingMessage) => void)(res);
|
||||||
res.emit('end');
|
res.emit('end');
|
||||||
return new EventEmitter() as ClientRequest;
|
return new EventEmitter() as ClientRequest;
|
||||||
@@ -85,6 +86,7 @@ describe('fetchJson', () => {
|
|||||||
const res = new EventEmitter() as IncomingMessage;
|
const res = new EventEmitter() as IncomingMessage;
|
||||||
res.statusCode = 301;
|
res.statusCode = 301;
|
||||||
res.headers = { location: 'https://example.com/final-permanent' };
|
res.headers = { location: 'https://example.com/final-permanent' };
|
||||||
|
res.resume = vi.fn();
|
||||||
(callback as (res: IncomingMessage) => void)(res);
|
(callback as (res: IncomingMessage) => void)(res);
|
||||||
res.emit('end');
|
res.emit('end');
|
||||||
return new EventEmitter() as ClientRequest;
|
return new EventEmitter() as ClientRequest;
|
||||||
|
|||||||
@@ -31,7 +31,11 @@ export async function fetchJson<T>(
|
|||||||
if (!res.headers.location) {
|
if (!res.headers.location) {
|
||||||
return reject(new Error('No location header in redirect response'));
|
return reject(new Error('No location header in redirect response'));
|
||||||
}
|
}
|
||||||
fetchJson<T>(res.headers.location, redirectCount++)
|
res.resume();
|
||||||
|
fetchJson<T>(
|
||||||
|
new URL(res.headers.location, url).toString(),
|
||||||
|
redirectCount + 1,
|
||||||
|
)
|
||||||
.then(resolve)
|
.then(resolve)
|
||||||
.catch(reject);
|
.catch(reject);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export class ModelRouterService {
|
|||||||
*/
|
*/
|
||||||
async route(context: RoutingContext): Promise<RoutingDecision> {
|
async route(context: RoutingContext): Promise<RoutingDecision> {
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
let decision: RoutingDecision;
|
let decision: RoutingDecision | undefined;
|
||||||
|
|
||||||
const [enableNumericalRouting, thresholdValue] = await Promise.all([
|
const [enableNumericalRouting, thresholdValue] = await Promise.all([
|
||||||
this.config.getNumericalRoutingEnabled(),
|
this.config.getNumericalRoutingEnabled(),
|
||||||
@@ -117,10 +117,10 @@ export class ModelRouterService {
|
|||||||
);
|
);
|
||||||
} finally {
|
} finally {
|
||||||
const event = new ModelRoutingEvent(
|
const event = new ModelRoutingEvent(
|
||||||
decision!.model,
|
decision?.model || 'unknown',
|
||||||
decision!.metadata.source,
|
decision?.metadata?.source || 'unknown',
|
||||||
decision!.metadata.latencyMs,
|
decision?.metadata?.latencyMs || 0,
|
||||||
decision!.metadata.reasoning,
|
decision?.metadata?.reasoning,
|
||||||
failed,
|
failed,
|
||||||
error_message,
|
error_message,
|
||||||
this.config.getApprovalMode(),
|
this.config.getApprovalMode(),
|
||||||
|
|||||||
Reference in New Issue
Block a user