-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathliveblocks.config.ts
More file actions
70 lines (60 loc) · 1.83 KB
/
Copy pathliveblocks.config.ts
File metadata and controls
70 lines (60 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Define Liveblocks types for your application
// https://liveblocks.io/docs/api-reference/liveblocks-react#Typing-your-data
import { LiveObject, LiveMap } from "@liveblocks/client";
type AIRequestData = {
requestId: string;
result: string;
timestamp: string;
};
type AIRequest = {
type: 'generate' | 'chat' | 'summarize' | 'translate';
prompt?: string;
question?: string;
targetLang?: string;
status: 'pending' | 'completed' | 'error';
timestamp: string;
completedAt?: string;
result: string | null;
};
declare global {
interface Liveblocks {
// Each user's Presence, for useMyPresence, useOthers, etc.
Presence: {
// Example, real-time cursor coordinates
cursor: { x: number; y: number } | null;
};
// The Storage tree for the room, for useMutation, useStorage, etc.
Storage: {
// AI requests storage
aiRequests: LiveMap<string, LiveObject<AIRequest>>;
};
// Custom user info set when authenticating with a secret key
UserMeta: {
id: string;
info: {
name: string;
avatar: string;
email: string;
};
};
// Custom events, for useBroadcastEvent, useEventListener
RoomEvent:
| { type: "AI_GENERATE_COMPLETED"; data: AIRequestData; }
| { type: "AI_CHAT_COMPLETED"; data: AIRequestData; }
| { type: "AI_SUMMARIZE_COMPLETED"; data: AIRequestData; }
| { type: "AI_TRANSLATE_COMPLETED"; data: AIRequestData; };
// Custom metadata set on threads, for useThreads, useCreateThread, etc.
ThreadMetadata: {
// Example, attaching coordinates to a thread
// x: number;
// y: number;
};
// Custom room info set with resolveRoomsInfo, for useRoomInfo
RoomInfo: {
// Example, rooms with a title and url
// title: string;
// url: string;
};
}
}
export {};