Skip to content

Commit

Permalink
feat(ts): split TranscribeFileNativeOptions
Browse files Browse the repository at this point in the history
fixes #100
  • Loading branch information
jhen0409 committed Aug 21, 2023
1 parent 296d30b commit ce1dbcb
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 22 deletions.
29 changes: 14 additions & 15 deletions docs/API/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ whisper.rn

#### Defined in

[index.ts:276](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/index.ts#L276)
[index.ts:289](https://github.com/mybigday/whisper.rn/blob/296d30b/src/index.ts#L289)

___

Expand All @@ -59,7 +59,7 @@ ___

#### Defined in

[index.ts:33](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/index.ts#L33)
[index.ts:34](https://github.com/mybigday/whisper.rn/blob/296d30b/src/index.ts#L34)

___

Expand All @@ -79,7 +79,6 @@ ___
| `maxLen?` | `number` | Maximum segment length in characters |
| `maxThreads?` | `number` | Number of threads to use during computation (Default: 2 for 4-core devices, 4 for more cores) |
| `offset?` | `number` | Time offset in milliseconds |
| `onProgress?` | `boolean` | Register onProgress event for transcribe file |
| `prompt?` | `string` | Initial Prompt |
| `speedUp?` | `boolean` | Speed up audio by x2 (reduced accuracy) |
| `temperature?` | `number` | Tnitial decoding temperature |
Expand All @@ -90,7 +89,7 @@ ___

#### Defined in

[NativeRNWhisper.ts:4](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/NativeRNWhisper.ts#L4)
[NativeRNWhisper.ts:5](https://github.com/mybigday/whisper.rn/blob/296d30b/src/NativeRNWhisper.ts#L5)

___

Expand All @@ -108,7 +107,7 @@ ___

#### Defined in

[index.ts:40](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/index.ts#L40)
[index.ts:41](https://github.com/mybigday/whisper.rn/blob/296d30b/src/index.ts#L41)

___

Expand All @@ -133,7 +132,7 @@ ___

#### Defined in

[index.ts:62](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/index.ts#L62)
[index.ts:63](https://github.com/mybigday/whisper.rn/blob/296d30b/src/index.ts#L63)

___

Expand All @@ -151,7 +150,7 @@ ___

#### Defined in

[index.ts:95](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/index.ts#L95)
[index.ts:96](https://github.com/mybigday/whisper.rn/blob/296d30b/src/index.ts#L96)

___

Expand All @@ -175,7 +174,7 @@ ___

#### Defined in

[index.ts:82](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/index.ts#L82)
[index.ts:83](https://github.com/mybigday/whisper.rn/blob/296d30b/src/index.ts#L83)

___

Expand All @@ -185,7 +184,7 @@ ___

#### Defined in

[index.ts:47](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/index.ts#L47)
[index.ts:48](https://github.com/mybigday/whisper.rn/blob/296d30b/src/index.ts#L48)

___

Expand All @@ -203,7 +202,7 @@ ___

#### Defined in

[NativeRNWhisper.ts:38](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/NativeRNWhisper.ts#L38)
[NativeRNWhisper.ts:42](https://github.com/mybigday/whisper.rn/blob/296d30b/src/NativeRNWhisper.ts#L42)

## Variables

Expand All @@ -215,7 +214,7 @@ Is allow fallback to CPU if load CoreML model failed

#### Defined in

[index.ts:361](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/index.ts#L361)
[index.ts:374](https://github.com/mybigday/whisper.rn/blob/296d30b/src/index.ts#L374)

___

Expand All @@ -227,7 +226,7 @@ Is use CoreML models on iOS

#### Defined in

[index.ts:358](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/index.ts#L358)
[index.ts:371](https://github.com/mybigday/whisper.rn/blob/296d30b/src/index.ts#L371)

___

Expand All @@ -239,7 +238,7 @@ Current version of whisper.cpp

#### Defined in

[index.ts:353](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/index.ts#L353)
[index.ts:366](https://github.com/mybigday/whisper.rn/blob/296d30b/src/index.ts#L366)

## Functions

Expand All @@ -259,7 +258,7 @@ Current version of whisper.cpp

#### Defined in

[index.ts:298](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/index.ts#L298)
[index.ts:311](https://github.com/mybigday/whisper.rn/blob/296d30b/src/index.ts#L311)

___

Expand All @@ -273,4 +272,4 @@ ___

#### Defined in

[index.ts:348](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/index.ts#L348)
[index.ts:361](https://github.com/mybigday/whisper.rn/blob/296d30b/src/index.ts#L361)
10 changes: 5 additions & 5 deletions docs/API/classes/WhisperContext.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#### Defined in

[index.ts:104](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/index.ts#L104)
[index.ts:105](https://github.com/mybigday/whisper.rn/blob/296d30b/src/index.ts#L105)

## Properties

Expand All @@ -42,7 +42,7 @@

#### Defined in

[index.ts:102](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/index.ts#L102)
[index.ts:103](https://github.com/mybigday/whisper.rn/blob/296d30b/src/index.ts#L103)

## Methods

Expand All @@ -56,7 +56,7 @@

#### Defined in

[index.ts:271](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/index.ts#L271)
[index.ts:284](https://github.com/mybigday/whisper.rn/blob/296d30b/src/index.ts#L284)

___

Expand Down Expand Up @@ -84,7 +84,7 @@ Transcribe audio file

#### Defined in

[index.ts:109](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/index.ts#L109)
[index.ts:110](https://github.com/mybigday/whisper.rn/blob/296d30b/src/index.ts#L110)

___

Expand All @@ -106,4 +106,4 @@ Transcribe the microphone audio stream, the microphone user permission is requir

#### Defined in

[index.ts:165](https://github.com/mybigday/whisper.rn/blob/22cc9a8/src/index.ts#L165)
[index.ts:178](https://github.com/mybigday/whisper.rn/blob/296d30b/src/index.ts#L178)
6 changes: 5 additions & 1 deletion src/NativeRNWhisper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport'
import { TurboModuleRegistry } from 'react-native'

// Common transcribe options
export type TranscribeOptions = {
/** Spoken language (Default: 'auto' for auto-detect) */
language?: string,
Expand Down Expand Up @@ -31,6 +32,9 @@ export type TranscribeOptions = {
speedUp?: boolean,
/** Initial Prompt */
prompt?: string,
}

export type TranscribeFileNativeOptions = TranscribeOptions & {
/** Register onProgress event for transcribe file */
onProgress?: boolean
}
Expand Down Expand Up @@ -69,7 +73,7 @@ export interface Spec extends TurboModule {
contextId: number,
jobId: number,
path: string,
options: TranscribeOptions,
options: TranscribeFileNativeOptions,
): Promise<TranscribeResult>;
startRealtimeTranscribe(
contextId: number,
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const EVENT_ON_TRANSCRIBE_PROGRESS = '@RNWhisper_onTranscribeProgress'
const EVENT_ON_REALTIME_TRANSCRIBE = '@RNWhisper_onRealtimeTranscribe'
const EVENT_ON_REALTIME_TRANSCRIBE_END = '@RNWhisper_onRealtimeTranscribeEnd'

// Fn -> Boolean in TranscribeFileNativeOptions
export type TranscribeFileOptions = TranscribeOptions & {
/**
* Progress callback, the progress is between 0 and 100
Expand All @@ -43,7 +44,7 @@ export type TranscribeProgressNativeEvent = {
progress: number
}

// NOTE: codegen missing TSIntersectionType support so we dont put it into the native spec
// Codegen missing TSIntersectionType support so we dont put it into the native spec
export type TranscribeRealtimeOptions = TranscribeOptions & {
/**
* Realtime record max duration in seconds.
Expand Down

0 comments on commit ce1dbcb

Please sign in to comment.