mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2026-03-22 15:39:06 +08:00
fix: categorize search tokens as prompt tokens
Co-Authored-By: sha.zhou@jina.ai <sha.zhou@jina.ai>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import https from 'https';
|
||||
import { TokenTracker } from "../utils/token-tracker";
|
||||
import { SearchResponse } from '../types';
|
||||
import { SearchResponse, TOKEN_CATEGORIES } from '../types';
|
||||
import { JINA_API_KEY } from "../config";
|
||||
|
||||
export function search(query: string, tracker?: TokenTracker): Promise<{ response: SearchResponse, tokens: number }> {
|
||||
@@ -63,7 +63,7 @@ export function search(query: string, tracker?: TokenTracker): Promise<{ respons
|
||||
console.log('Total URLs:', response.data.length);
|
||||
|
||||
if (tracker) {
|
||||
tracker.trackUsage('search', totalTokens);
|
||||
tracker.trackUsage('search', totalTokens, TOKEN_CATEGORIES.PROMPT);
|
||||
}
|
||||
|
||||
resolve({ response, tokens: totalTokens });
|
||||
|
||||
Reference in New Issue
Block a user