OpenClaw AI
feat(ocr): implement screen recognition prototype with Tesseract.js and Electron IPC
7b7e57d Download apps/server/src/common/interceptors/transform.interceptor.ts from qf46578/omnics: direct link, hf CLI and curl.
- Browser
- Download file 721 Bytes
-
https://huggingface.co/spaces/qf46578/omnics/resolve/main/apps/server/src/common/interceptors/transform.interceptor.ts
- Command line
-
hf download hf://spaces/qf46578/omnics/apps/server/src/common/interceptors/transform.interceptor.ts
-
curl -L -o transform.interceptor.ts https://huggingface.co/spaces/qf46578/omnics/resolve/main/apps/server/src/common/interceptors/transform.interceptor.ts
721 Bytes
| import { | |
| Injectable, | |
| NestInterceptor, | |
| ExecutionContext, | |
| CallHandler, | |
| } from '@nestjs/common'; | |
| import { Observable } from 'rxjs'; | |
| import { map } from 'rxjs/operators'; | |
| export interface Response<T> { | |
| data: T; | |
| statusCode: number; | |
| message: string; | |
| } | |
| () | |
| export class TransformInterceptor<T> | |
| implements NestInterceptor<T, Response<T>> { | |
| intercept( | |
| context: ExecutionContext, | |
| next: CallHandler, | |
| ): Observable<Response<T>> { | |
| return next.handle().pipe( | |
| map((data) => ({ | |
| data, | |
| statusCode: context.switchToHttp().getResponse().statusCode, | |
| message: 'success', | |
| })), | |
| ); | |
| } | |
| } | |