Spaces:
Build error
Build error
Mohammad Shahid commited on
Commit ·
ea5ca39
1
Parent(s): f0a0636
- .gitmodules +1 -0
- README.md +1 -1
- integrity-check.cjs +0 -5
- src/shared-stubs/index.ts +0 -0
- src/shared-stubs/lib/errors.ts +0 -0
- src/shared-stubs/services/secrets.ts +0 -0
- src/shared/3rd-party/cloud-flare.ts +0 -6
- src/shared/3rd-party/internal-serp.ts +0 -9
- src/shared/3rd-party/jina-embeddings.ts +0 -6
- src/shared/3rd-party/serper-search.ts +0 -53
- src/shared/db/api-roll.ts +0 -16
- src/shared/db/jina-embeddings-token-account.ts +0 -24
- src/shared/services/async-context.ts +0 -16
- src/shared/services/common-llm.ts +0 -15
- src/shared/services/firebase-storage-bucket.ts +0 -26
- src/shared/services/proxy-provider.ts +0 -11
- src/shared/utils/audition.ts +0 -7
- src/shared/utils/openai.ts +0 -5
- tsconfig.json +1 -3
.gitmodules
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 🐳
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: blue
|
| 6 |
sdk: docker
|
| 7 |
-
app_port:
|
| 8 |
license: mit
|
| 9 |
short_description: Generate any application mdx with web reader
|
| 10 |
---
|
|
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: blue
|
| 6 |
sdk: docker
|
| 7 |
+
app_port: 8080
|
| 8 |
license: mit
|
| 9 |
short_description: Generate any application mdx with web reader
|
| 10 |
---
|
integrity-check.cjs
CHANGED
|
@@ -6,11 +6,6 @@ const path = require('path');
|
|
| 6 |
const file = path.resolve(__dirname, 'licensed/GeoLite2-City.mmdb');
|
| 7 |
|
| 8 |
if (!fs.existsSync(file)) {
|
| 9 |
-
// Skip integrity check for HF or development environments
|
| 10 |
-
if (process.env.NODE_ENV === 'development' || process.env.HF_SPACE_ID) {
|
| 11 |
-
console.warn(`Warning: ${file} does not exist. Continuing without geolocation support.`);
|
| 12 |
-
process.exit(0);
|
| 13 |
-
}
|
| 14 |
console.error(`Integrity check failed: ${file} does not exist.`);
|
| 15 |
process.exit(1);
|
| 16 |
}
|
|
|
|
| 6 |
const file = path.resolve(__dirname, 'licensed/GeoLite2-City.mmdb');
|
| 7 |
|
| 8 |
if (!fs.existsSync(file)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
console.error(`Integrity check failed: ${file} does not exist.`);
|
| 10 |
process.exit(1);
|
| 11 |
}
|
src/shared-stubs/index.ts
ADDED
|
File without changes
|
src/shared-stubs/lib/errors.ts
ADDED
|
File without changes
|
src/shared-stubs/services/secrets.ts
ADDED
|
File without changes
|
src/shared/3rd-party/cloud-flare.ts
CHANGED
|
@@ -1,6 +0,0 @@
|
|
| 1 |
-
// HF-compatible stub for CloudFlare
|
| 2 |
-
export class CloudFlareHTTP {
|
| 3 |
-
static async request(options: any): Promise<any> {
|
| 4 |
-
return { data: null };
|
| 5 |
-
}
|
| 6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/shared/3rd-party/internal-serp.ts
CHANGED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
// HF-compatible stub for Internal SERP API
|
| 2 |
-
export class JinaSerpApiHTTP {
|
| 3 |
-
static async search(params: any): Promise<any> {
|
| 4 |
-
return {
|
| 5 |
-
results: [],
|
| 6 |
-
total: 0
|
| 7 |
-
};
|
| 8 |
-
}
|
| 9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/shared/3rd-party/jina-embeddings.ts
CHANGED
|
@@ -1,6 +0,0 @@
|
|
| 1 |
-
// HF-compatible stub for Jina Embeddings
|
| 2 |
-
export class JinaEmbeddingsDashboardHTTP {
|
| 3 |
-
static async request(options: any): Promise<any> {
|
| 4 |
-
return { data: [] };
|
| 5 |
-
}
|
| 6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/shared/3rd-party/serper-search.ts
CHANGED
|
@@ -1,53 +0,0 @@
|
|
| 1 |
-
// HF-compatible stubs for Serper Search
|
| 2 |
-
export interface SerperSearchQueryParams {
|
| 3 |
-
q: string;
|
| 4 |
-
gl?: string;
|
| 5 |
-
hl?: string;
|
| 6 |
-
num?: number;
|
| 7 |
-
page?: number;
|
| 8 |
-
}
|
| 9 |
-
|
| 10 |
-
export interface SerperWebSearchResponse {
|
| 11 |
-
searchParameters: any;
|
| 12 |
-
organic: Array<{
|
| 13 |
-
title: string;
|
| 14 |
-
link: string;
|
| 15 |
-
snippet: string;
|
| 16 |
-
}>;
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
export interface SerperImageSearchResponse {
|
| 20 |
-
images: Array<{
|
| 21 |
-
title: string;
|
| 22 |
-
imageUrl: string;
|
| 23 |
-
imageWidth: number;
|
| 24 |
-
imageHeight: number;
|
| 25 |
-
}>;
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
export interface SerperNewsSearchResponse {
|
| 29 |
-
news: Array<{
|
| 30 |
-
title: string;
|
| 31 |
-
link: string;
|
| 32 |
-
snippet: string;
|
| 33 |
-
date: string;
|
| 34 |
-
}>;
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
export class SerperGoogleHTTP {
|
| 38 |
-
static async search(params: SerperSearchQueryParams): Promise<SerperWebSearchResponse> {
|
| 39 |
-
return {
|
| 40 |
-
searchParameters: params,
|
| 41 |
-
organic: []
|
| 42 |
-
};
|
| 43 |
-
}
|
| 44 |
-
}
|
| 45 |
-
|
| 46 |
-
export class SerperBingHTTP {
|
| 47 |
-
static async search(params: SerperSearchQueryParams): Promise<SerperWebSearchResponse> {
|
| 48 |
-
return {
|
| 49 |
-
searchParameters: params,
|
| 50 |
-
organic: []
|
| 51 |
-
};
|
| 52 |
-
}
|
| 53 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/shared/db/api-roll.ts
CHANGED
|
@@ -1,16 +0,0 @@
|
|
| 1 |
-
// HF-compatible stub for API Roll
|
| 2 |
-
export enum API_CALL_STATUS {
|
| 3 |
-
SUCCESS = 'success',
|
| 4 |
-
FAILED = 'failed',
|
| 5 |
-
PENDING = 'pending'
|
| 6 |
-
}
|
| 7 |
-
|
| 8 |
-
export class ApiCallRecord {
|
| 9 |
-
static async create(data: any): Promise<any> {
|
| 10 |
-
return { id: 'stub-id', ...data };
|
| 11 |
-
}
|
| 12 |
-
|
| 13 |
-
static async updateStatus(id: string, status: API_CALL_STATUS): Promise<void> {
|
| 14 |
-
// Stub implementation
|
| 15 |
-
}
|
| 16 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/shared/db/jina-embeddings-token-account.ts
CHANGED
|
@@ -1,24 +0,0 @@
|
|
| 1 |
-
// HF-compatible stub for Jina Embeddings Token Account
|
| 2 |
-
export interface JinaEmbeddingsTokenAccount {
|
| 3 |
-
id: string;
|
| 4 |
-
token: string;
|
| 5 |
-
userId: string;
|
| 6 |
-
createdAt: Date;
|
| 7 |
-
updatedAt: Date;
|
| 8 |
-
}
|
| 9 |
-
|
| 10 |
-
export class JinaEmbeddingsTokenAccountService {
|
| 11 |
-
static async findByUserId(userId: string): Promise<JinaEmbeddingsTokenAccount | null> {
|
| 12 |
-
return null;
|
| 13 |
-
}
|
| 14 |
-
|
| 15 |
-
static async create(data: Partial<JinaEmbeddingsTokenAccount>): Promise<JinaEmbeddingsTokenAccount> {
|
| 16 |
-
return {
|
| 17 |
-
id: 'stub-id',
|
| 18 |
-
token: 'stub-token',
|
| 19 |
-
userId: data.userId || 'stub-user',
|
| 20 |
-
createdAt: new Date(),
|
| 21 |
-
updatedAt: new Date()
|
| 22 |
-
} as JinaEmbeddingsTokenAccount;
|
| 23 |
-
}
|
| 24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/shared/services/async-context.ts
CHANGED
|
@@ -1,16 +0,0 @@
|
|
| 1 |
-
// HF-compatible stub for Async Context
|
| 2 |
-
export class AsyncContext {
|
| 3 |
-
get<T>(key: string): T | undefined {
|
| 4 |
-
// Stub implementation
|
| 5 |
-
return undefined;
|
| 6 |
-
}
|
| 7 |
-
|
| 8 |
-
set<T>(key: string, value: T): void {
|
| 9 |
-
// Stub implementation
|
| 10 |
-
}
|
| 11 |
-
|
| 12 |
-
run<T>(fn: () => T): T {
|
| 13 |
-
// Stub implementation
|
| 14 |
-
return fn();
|
| 15 |
-
}
|
| 16 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/shared/services/common-llm.ts
CHANGED
|
@@ -1,15 +0,0 @@
|
|
| 1 |
-
// HF-compatible stub for LLM Manager
|
| 2 |
-
export class LLMManager {
|
| 3 |
-
static async generate(options: any): Promise<string> {
|
| 4 |
-
// Stub implementation - returns empty for HF compatibility
|
| 5 |
-
return '';
|
| 6 |
-
}
|
| 7 |
-
|
| 8 |
-
static async generateStream(options: any): Promise<AsyncIterable<string>> {
|
| 9 |
-
// Stub implementation
|
| 10 |
-
async function* emptyGenerator() {
|
| 11 |
-
yield '';
|
| 12 |
-
}
|
| 13 |
-
return emptyGenerator();
|
| 14 |
-
}
|
| 15 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/shared/services/firebase-storage-bucket.ts
CHANGED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
// HF-compatible stub for Firebase Storage
|
| 2 |
-
export class FirebaseStorageBucketControl {
|
| 3 |
-
static async upload(data: any, path: string): Promise<string> {
|
| 4 |
-
// Stub implementation - returns empty URL for HF compatibility
|
| 5 |
-
return '';
|
| 6 |
-
}
|
| 7 |
-
|
| 8 |
-
static async download(path: string): Promise<ArrayBuffer | null> {
|
| 9 |
-
// Stub implementation
|
| 10 |
-
return null;
|
| 11 |
-
}
|
| 12 |
-
|
| 13 |
-
static async delete(path: string): Promise<void> {
|
| 14 |
-
// Stub implementation
|
| 15 |
-
}
|
| 16 |
-
|
| 17 |
-
async saveFile(fid: string, data: any, options?: any): Promise<string> {
|
| 18 |
-
// Stub implementation - just return the fid as URL
|
| 19 |
-
return `stub://file/${fid}`;
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
-
async signDownloadUrl(fid: string, expiresAt?: number): Promise<string> {
|
| 23 |
-
// Stub implementation - return a dummy URL
|
| 24 |
-
return `stub://download/${fid}`;
|
| 25 |
-
}
|
| 26 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/shared/services/proxy-provider.ts
CHANGED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
// HF-compatible stub for Proxy Provider
|
| 2 |
-
export class ProxyProviderService {
|
| 3 |
-
static async getProxy(): Promise<string | null> {
|
| 4 |
-
// Stub implementation - returns no proxy for HF compatibility
|
| 5 |
-
return null;
|
| 6 |
-
}
|
| 7 |
-
|
| 8 |
-
static async releaseProxy(proxy: string): Promise<void> {
|
| 9 |
-
// Stub implementation
|
| 10 |
-
}
|
| 11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/shared/utils/audition.ts
CHANGED
|
@@ -1,7 +0,0 @@
|
|
| 1 |
-
// HF-compatible stub for audition middleware
|
| 2 |
-
export function getAuditionMiddleware() {
|
| 3 |
-
return (req: any, res: any, next: any) => {
|
| 4 |
-
// Stub implementation - just pass through
|
| 5 |
-
next();
|
| 6 |
-
};
|
| 7 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/shared/utils/openai.ts
CHANGED
|
@@ -1,5 +0,0 @@
|
|
| 1 |
-
// HF-compatible stub for OpenAI utils
|
| 2 |
-
export function countGPTToken(text: string): number {
|
| 3 |
-
// Simple stub - estimate tokens as words / 0.75
|
| 4 |
-
return Math.ceil(text.split(/\s+/).length / 0.75);
|
| 5 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tsconfig.json
CHANGED
|
@@ -1,8 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"compilerOptions": {
|
| 3 |
"module": "node16",
|
| 4 |
-
"moduleResolution": "node16",
|
| 5 |
-
"types": ["node"],
|
| 6 |
|
| 7 |
"noImplicitReturns": true,
|
| 8 |
"noUnusedLocals": true,
|
|
@@ -11,7 +9,7 @@
|
|
| 11 |
"strict": true,
|
| 12 |
"allowJs": true,
|
| 13 |
"target": "es2022",
|
| 14 |
-
"lib": ["es2022"
|
| 15 |
"skipLibCheck": true,
|
| 16 |
"useDefineForClassFields": false,
|
| 17 |
"experimentalDecorators": true,
|
|
|
|
| 1 |
{
|
| 2 |
"compilerOptions": {
|
| 3 |
"module": "node16",
|
|
|
|
|
|
|
| 4 |
|
| 5 |
"noImplicitReturns": true,
|
| 6 |
"noUnusedLocals": true,
|
|
|
|
| 9 |
"strict": true,
|
| 10 |
"allowJs": true,
|
| 11 |
"target": "es2022",
|
| 12 |
+
"lib": ["es2022"],
|
| 13 |
"skipLibCheck": true,
|
| 14 |
"useDefineForClassFields": false,
|
| 15 |
"experimentalDecorators": true,
|