Skip to content

Commit

Permalink
add set sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
ksyeo1010 committed Oct 20, 2023
1 parent 7d6f7ad commit a751074
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export class RhinoService implements OnDestroy {

try {
if (!this.rhino) {
RhinoWorker.setSdk('angular');
this.rhino = await RhinoWorker.create(
accessKey,
context,
Expand Down
1 change: 1 addition & 0 deletions binding/react/src/use_rhino.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export function useRhino(): {

try {
if (!rhinoRef.current) {
RhinoWorker.setSdk('react');
rhinoRef.current = await RhinoWorker.create(
accessKey,
context,
Expand Down
1 change: 1 addition & 0 deletions binding/vue/src/rhino.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export function useRhino(): RhinoVue {

try {
if (!rhinoRef.value) {
RhinoWorker.setSdk('vue');
rhinoRef.value = await RhinoWorker.create(
accessKey,
context,
Expand Down
6 changes: 6 additions & 0 deletions binding/web/src/rhino_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class RhinoWorker {

private static _wasm: string;
private static _wasmSimd: string;
private static _sdk: string = "web";

private constructor(
worker: Worker,
Expand Down Expand Up @@ -106,6 +107,10 @@ export class RhinoWorker {
}
}

public static setSdk(sdk: string): void {
RhinoWorker._sdk = sdk;
}

/**
* Creates a worker instance of the Rhino Speech-to-Intent engine.
* The model size is large, hence it will try to use the existing one if it exists,
Expand Down Expand Up @@ -223,6 +228,7 @@ export class RhinoWorker {
options: rest,
wasm: this._wasm,
wasmSimd: this._wasmSimd,
sdk: this._sdk,
});

return returnPromise;
Expand Down
1 change: 1 addition & 0 deletions binding/web/src/rhino_worker_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ self.onmessage = async function (
try {
Rhino.setWasm(event.data.wasm);
Rhino.setWasmSimd(event.data.wasmSimd);
Rhino.setSdk(event.data.sdk);
rhino = await Rhino._init(
event.data.accessKey,
event.data.contextPath,
Expand Down
1 change: 1 addition & 0 deletions binding/web/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export type RhinoWorkerInitRequest = {
sensitivity: number;
wasm: string;
wasmSimd: string;
sdk: string;
modelPath: string;
options: RhinoOptions;
};
Expand Down

0 comments on commit a751074

Please sign in to comment.