Skip to content

Commit

Permalink
Custom actions and narrative Maps (#9)
Browse files Browse the repository at this point in the history
* TIVO temp fix

* custom actions code
  • Loading branch information
AirSurfer09 authored Jul 29, 2024
1 parent 8bf7c90 commit 57bc9d8
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/cjs/convai-web-client.js

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions dist/typings/convai_client.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { GetResponseResponse } from '../Proto/service/service_pb';
import { ActionConfigParamsType, ConvaiGRPCClientConfigType } from './types';
export interface ConvaiClientParams {
apiKey: string;
characterId: string;
Expand Down Expand Up @@ -31,20 +32,22 @@ export declare class ConvaiClient {
private enableFacialData;
private faceModel;
private narrativeTemplateKeysMap;
private actionConfig;
convaiConfig: ConvaiGRPCClientConfigType;
constructor(params: ConvaiClientParams);
private validateBeforeRequest;
resetSession(): void;
setResponseCallback(fn: (response: GetResponseResponse) => void): void;
setErrorCallback(fn: (type: string, statusMessage: string) => void): void;
invokeTrigger(name: string, message?: string): void;
sendFeedback(interaction_id: string, character_id: string, session_id: string, thumbs_up: boolean, feedback_text: string): void;
setErrorCallback(fn: (type: string, statusMessage: string, status: string) => void): void;
sendTextChunk(text: string): void;
connectionState(text: string): void;
startAudioChunk(): void;
invokeTrigger(name: string, message?: string): void;
sendFeedback(interaction_id: string, character_id: string, session_id: string, thumbs_up: boolean, feedback_text: string): void;
endAudioChunk(): void;
toggleAudioVolume(): void;
getAudioVolume(): number;
stopCharacterAudio(): void;
onAudioPlay(fn: () => void): void;
onAudioStop(fn: () => void): void;
setActionConfig(actionConfig: ActionConfigParamsType): void;
}
9 changes: 7 additions & 2 deletions dist/typings/convai_grpc_client.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { grpc } from '@improbable-eng/grpc-web';
import { GetResponseResponse } from '../Proto/service/service_pb';
import { ActionConfigParamsType } from './types';
export declare class ConvaiGRPCClient {
private client;
client: grpc.Client<any, any>;
private feedbackClient;
private apiKey;
private languageCode;
Expand All @@ -14,12 +16,15 @@ export declare class ConvaiGRPCClient {
private enableFacialData;
private faceModel;
private narrativeTemplateKeysMap;
constructor(apiKey: string, characterId: string, speaker: string, speakerId: string, sessionId: string, responseCallback: (response: GetResponseResponse) => void, errorCallback: (type: string, statusMessage: string) => void, languageCode: string, disableAudioGeneration: boolean, enableFacialData: boolean, faceModel: 0 | 1 | 2 | 3, narrativeTemplateKeysMap: Map<string, string>);
private actionConfigParams;
constructor(apiKey: string, characterId: string, speaker: string, speakerId: string, sessionId: string, responseCallback: (response: GetResponseResponse) => void, errorCallback: (type: string, statusMessage: string, status: string) => void, languageCode: string, disableAudioGeneration: boolean, enableFacialData: boolean, faceModel: 0 | 1 | 2 | 3, narrativeTemplateKeysMap: Map<string, string>, actionConfig?: ActionConfigParamsType);
close(): void;
invokeTrigger(name: string, message?: string): void;
sendFeedback(interaction_id: string, character_id: string, session_id: string, thumbs_up: boolean, feedback_text: string): void;
sendText(text: string): void;
sendAudioChunk(chunk: ArrayBuffer): void;
finishSend(): void;
private setActionConfig;
private start;
}
export type ConvaiGRPCClientType = ConvaiGRPCClient;
6 changes: 6 additions & 0 deletions dist/typings/manageClients.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { ConvaiGRPCClient } from "./convai_grpc_client";
import { ConvaiGRPCClientConfigType } from "./types";
export declare const setGrpcConfig: (config: ConvaiGRPCClientConfigType) => void;
export declare const generateNewCurrentClient: (config?: ConvaiGRPCClientConfigType) => void;
export declare const getCurrentClient: (config?: ConvaiGRPCClientConfigType) => ConvaiGRPCClient;
export declare const manageClient: (config: ConvaiGRPCClientConfigType) => void;
25 changes: 25 additions & 0 deletions dist/typings/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ActionConfig } from "../Proto/service/service_pb";
type ConvaiGRPCClientConfigType = {
apiKey: string;
characterId: string;
speaker: string;
speakerId: string;
sessionId: string;
errorCallback: (type: string, statusMessage: string, status: string) => void;
responseCallback: (response: any) => void;
languageCode: string;
disableAudioGeneration: boolean;
enableFacialData: boolean;
faceModel: 0 | 1 | 2 | 3;
narrativeTemplateKeysMap: any;
actionConfig?: ActionConfigParamsType | null;
};
type ActionConfigParamsType = {
actions?: string[];
characters?: ActionConfig.Character[];
objects?: ActionConfig.Object[];
classification?: string;
contextLevel?: number;
currentAttentionObject?: string;
};
export { ConvaiGRPCClientConfigType, ActionConfigParamsType };
2 changes: 1 addition & 1 deletion dist/umd/convai-web-client.umd.js

Large diffs are not rendered by default.

0 comments on commit 57bc9d8

Please sign in to comment.