fix(app): remove legacy and scoped namespace alias

This commit is contained in:
2025-11-14 11:56:34 +02:00
parent 085851527e
commit 4ec2a608b1
681 changed files with 655 additions and 36825 deletions
+3 -20
View File
@@ -1,9 +1,8 @@
import { format, getUnixTime, isMatch, parse } from "date-fns";
import type { RedisOptions } from "ioredis";
import { TiktokenEncoding, get_encoding } from "tiktoken";
import { config } from "@/config";
import { DEFAULT_DATE_FORMAT } from "@/constants";
import { config } from "#crawler/config";
import { DEFAULT_DATE_FORMAT } from "#crawler/constants";
import {
AnySourceConfig,
CreateDateRangeOptions,
@@ -15,7 +14,7 @@ import {
PageRangeSchema,
PageRangeSpecSchema,
WordPressSourceConfig,
} from "@/schema";
} from "#crawler/schema";
/**
* Resolve a source configuration by its ID.
@@ -66,22 +65,6 @@ const parseDate = (value: string, format: string): Date => {
return parsed;
};
/**
* Count the number of tokens in the given text using the specified encoding.
* @param text - The input text
* @param encoding - The token encoding (default: "cl100k_base")
*/
export const countTokens = (text: string, encoding: TiktokenEncoding = "cl100k_base"): number => {
try {
const encoder = get_encoding(encoding);
const tokens = encoder.encode(text);
encoder.free();
return tokens.length;
} catch {
return text.length;
}
};
/**
* Create a page range from a string specification.
* @param spec - The page range specification (e.g., "1:10")