guideai-app 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GuideAI.d.ts +1 -8
- package/GuideAI.js +1 -0
- package/GuideAI.js.LICENSE.txt +16 -0
- package/GuideAI.js.map +1 -0
- package/components/Styles.d.ts +3 -0
- package/dist/GuideAI.js +1 -1
- package/dist/GuideAI.js.map +1 -1
- package/dist/messageStorageUtils.d.ts +26 -0
- package/dist/utils/storage.d.ts +5 -0
- package/hooks/useConversation.d.ts +11 -0
- package/hooks/useRecording.d.ts +12 -0
- package/index.d.ts +3 -0
- package/package.json +1 -1
- package/types/index.d.ts +20 -0
- package/utils/api-services.d.ts +5 -0
- package/utils/dom-interaction.d.ts +2 -0
- package/utils/react-hooks.d.ts +9 -0
- package/utils/storage.d.ts +14 -0
- package/utils/webrtc.d.ts +3 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface StoredMessage {
|
|
2
|
+
content: string;
|
|
3
|
+
sender: 'GUIDEAI' | 'HUMAN';
|
|
4
|
+
timestamp: number;
|
|
5
|
+
}
|
|
6
|
+
export interface StoredConversation {
|
|
7
|
+
conversationId: string;
|
|
8
|
+
messages: StoredMessage[];
|
|
9
|
+
timestamp: number;
|
|
10
|
+
organizationKey: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const CONVERSATION_STORAGE_KEY = "guideai_conversation";
|
|
13
|
+
export declare const CONVERSATION_EXPIRY_MINUTES = 30;
|
|
14
|
+
export declare const MAX_STORED_MESSAGES = 50;
|
|
15
|
+
export declare const isLocalStorageAvailable: () => boolean;
|
|
16
|
+
export declare const isConversationExpired: (conversation: StoredConversation) => boolean;
|
|
17
|
+
export declare const saveConversationToStorage: (conversation: StoredConversation) => void;
|
|
18
|
+
export declare const loadConversationFromStorage: () => StoredConversation | null;
|
|
19
|
+
export declare const clearConversationStorage: () => void;
|
|
20
|
+
export declare const addMessageToStorage: (message: StoredMessage, conversationId: string, organizationKey: string) => void;
|
|
21
|
+
export declare const checkForStoredConversation: (currentOrganizationKey: string) => {
|
|
22
|
+
shouldRestore: boolean;
|
|
23
|
+
conversationId: string | null;
|
|
24
|
+
messages: StoredMessage[] | null;
|
|
25
|
+
};
|
|
26
|
+
export declare const formatConversationContext: (messages: StoredMessage[], maxMessages?: number) => string;
|
package/dist/utils/storage.d.ts
CHANGED
|
@@ -4,6 +4,11 @@ export declare const STORAGE_KEYS: {
|
|
|
4
4
|
CONVERSATION_ID: string;
|
|
5
5
|
HAS_INTERACTED: string;
|
|
6
6
|
LAST_ACTIVITY: string;
|
|
7
|
+
MIC_PERMISSION_GRANTED: string;
|
|
8
|
+
CONVERSATION_ACTIVE: string;
|
|
9
|
+
EPHEMERAL_TOKEN: string;
|
|
10
|
+
TOKEN_TIMESTAMP: string;
|
|
7
11
|
};
|
|
8
12
|
export declare const saveToStorage: (key: string, value: any) => void;
|
|
9
13
|
export declare const getFromStorage: <T>(key: string, defaultValue: T) => T;
|
|
14
|
+
export declare const isTokenValid: () => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ConversationItem } from '../types';
|
|
2
|
+
export declare const useConversation: (organizationKey: string, onError: (error: string | Error, context?: string) => void) => {
|
|
3
|
+
conversationItems: ConversationItem[];
|
|
4
|
+
conversationIdRef: import("react").MutableRefObject<string | null>;
|
|
5
|
+
storeConversationItem: (eventData: any) => void;
|
|
6
|
+
updateConversationItem: (itemId: string, updateData: Partial<any>) => void;
|
|
7
|
+
logMessageToConversation: (content: string, sender: "GUIDEAI" | "HUMAN") => Promise<void>;
|
|
8
|
+
addConversationHistory: (sendMessageFn: (message: any) => void) => void;
|
|
9
|
+
isAddingHistoryContext: import("react").MutableRefObject<boolean>;
|
|
10
|
+
hasCreatedConversationRef: import("react").MutableRefObject<boolean>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RecordingStatus } from '../types';
|
|
2
|
+
export declare const useRecording: (organizationKey: string, onError: (error: string | Error, context?: string) => void, logMessageFn: (message: string, sender: "GUIDEAI" | "HUMAN") => Promise<void>, addConversationHistoryFn: (sendMessageFn: (message: any) => void) => void, storeConversationItemFn: (item: any) => void, updateConversationItem: (itemId: string, updateData: Partial<any>) => void, isAddingHistoryContextRef: React.MutableRefObject<boolean>) => {
|
|
3
|
+
status: RecordingStatus;
|
|
4
|
+
isSessionReady: boolean;
|
|
5
|
+
isConversationActive: boolean;
|
|
6
|
+
toggleRecording: () => Promise<void>;
|
|
7
|
+
toggleConversation: () => Promise<void>;
|
|
8
|
+
cleanupWebRTC: () => void;
|
|
9
|
+
audioElementRef: import("react").MutableRefObject<HTMLAudioElement | null>;
|
|
10
|
+
ephemeralToken: string | null;
|
|
11
|
+
setEphemeralToken: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
12
|
+
};
|
package/index.d.ts
ADDED
package/package.json
CHANGED
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ConversationItem {
|
|
2
|
+
event_id?: string;
|
|
3
|
+
type: string;
|
|
4
|
+
previous_item_id: string | null;
|
|
5
|
+
item: Record<string, any>;
|
|
6
|
+
timestamp: number;
|
|
7
|
+
}
|
|
8
|
+
export type RecordingStatus = 'idle' | 'recording' | 'processing' | 'playing' | 'initializing';
|
|
9
|
+
export interface GuideAIProps {
|
|
10
|
+
apiKey?: string;
|
|
11
|
+
organizationKey: string;
|
|
12
|
+
position?: {
|
|
13
|
+
top?: string;
|
|
14
|
+
right?: string;
|
|
15
|
+
bottom?: string;
|
|
16
|
+
left?: string;
|
|
17
|
+
marginLeft?: string;
|
|
18
|
+
};
|
|
19
|
+
onError?: (error: string | Error, context?: string) => void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const DEFAULT_PROMPT = "you are Guide AI.\n Your role is to answer any question directly and succinctly that a user has. NEVER DIRECTLY MENTION THE SCREENSHOT, but use its information as much as possible to target your responses.\n If nothing is asked, then your goal is to generally assist them.\n IMPORTANT: NEVER answer in more than 10 words. Always be concise and limit answers to 1 sentence maximum. Be simple and as short as possible.\n Your job is to help them get it done through asking more and more targeted specific questions.";
|
|
2
|
+
export declare const geminiFlash: (prompt: string) => Promise<any>;
|
|
3
|
+
export declare const createNewConversation: (organizationKey: string) => Promise<string | null>;
|
|
4
|
+
export declare const logMessage: (conversationId: string, content: string, sender: "GUIDEAI" | "HUMAN") => Promise<void>;
|
|
5
|
+
export declare const fetchEphemeralToken: (organizationKey: string) => Promise<string | null>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type UseStateHook = typeof React.useState;
|
|
3
|
+
export type UseEffectHook = typeof React.useEffect;
|
|
4
|
+
export type UseRefHook = typeof React.useRef;
|
|
5
|
+
export declare const getReactHooks: () => {
|
|
6
|
+
useState: UseStateHook;
|
|
7
|
+
useEffect: UseEffectHook;
|
|
8
|
+
useRef: UseRefHook;
|
|
9
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const STORAGE_PREFIX = "guideAI_";
|
|
2
|
+
export declare const STORAGE_KEYS: {
|
|
3
|
+
CONVERSATION_ITEMS: string;
|
|
4
|
+
CONVERSATION_ID: string;
|
|
5
|
+
HAS_INTERACTED: string;
|
|
6
|
+
LAST_ACTIVITY: string;
|
|
7
|
+
MIC_PERMISSION_GRANTED: string;
|
|
8
|
+
CONVERSATION_ACTIVE: string;
|
|
9
|
+
EPHEMERAL_TOKEN: string;
|
|
10
|
+
TOKEN_TIMESTAMP: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const saveToStorage: (key: string, value: any) => void;
|
|
13
|
+
export declare const getFromStorage: <T>(key: string, defaultValue: T) => T;
|
|
14
|
+
export declare const isTokenValid: () => boolean;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const initializeWebRTC: (audioStream: MediaStream, token: string, audioElementRef: React.RefObject<HTMLAudioElement>, peerConnectionRef: React.MutableRefObject<RTCPeerConnection | null>, dataChannelRef: React.MutableRefObject<RTCDataChannel | null>, onMessage: (message: any) => void, onOpen?: () => void) => Promise<boolean>;
|
|
3
|
+
export declare const sendMessage: (dataChannel: RTCDataChannel | null, message: any) => boolean;
|