@meistrari/chat-nuxt 3.5.0 → 3.7.0
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/dist/module.d.mts +2 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -1
- package/dist/runtime/conversations/components/chat-conversation-list.d.vue.ts +1 -0
- package/dist/runtime/conversations/components/chat-conversation-list.vue +3 -2
- package/dist/runtime/conversations/components/chat-conversation-list.vue.d.ts +1 -0
- package/dist/runtime/conversations/composables/conversations.js +5 -0
- package/dist/runtime/embed/components/chat-embed-inner.d.vue.ts +2 -0
- package/dist/runtime/embed/components/chat-embed-inner.vue +41 -2
- package/dist/runtime/embed/components/chat-embed-inner.vue.d.ts +2 -0
- package/dist/runtime/embed/components/chat-embed.vue +2 -0
- package/dist/runtime/embed/components/meistrari-chat-embed.vue +3 -0
- package/dist/runtime/embed/components/mobile/chat-mobile-drawer.d.vue.ts +1 -0
- package/dist/runtime/embed/components/mobile/chat-mobile-drawer.vue +2 -1
- package/dist/runtime/embed/components/mobile/chat-mobile-drawer.vue.d.ts +1 -0
- package/dist/runtime/embed/components/mobile/chat-mobile-shell.d.vue.ts +1 -0
- package/dist/runtime/embed/components/mobile/chat-mobile-shell.vue +2 -0
- package/dist/runtime/embed/components/mobile/chat-mobile-shell.vue.d.ts +1 -0
- package/dist/runtime/embed/types.d.ts +2 -0
- package/dist/runtime/server/utils/chat-api-proxy.js +10 -1
- package/dist/runtime/shared/composables/feature-flags.d.ts +8 -1
- package/dist/runtime/shared/composables/feature-flags.js +10 -1
- package/dist/runtime/types/schemas/chat/usage.d.ts +2 -0
- package/dist/runtime/types/schemas/chat/usage.js +1 -0
- package/package.json +1 -1
package/dist/module.d.mts
CHANGED
|
@@ -6,6 +6,8 @@ type ChatNuxtConfigValidationMode = false | 'warn' | 'error';
|
|
|
6
6
|
interface ChatNuxtModuleOptions {
|
|
7
7
|
/** Dedicated Chat API base URL used by Nuxt server routes. */
|
|
8
8
|
chatApiUrl?: string;
|
|
9
|
+
/** Host app identifier reported to the chat-api (e.g. `'chat-app'`). */
|
|
10
|
+
source?: string;
|
|
9
11
|
/**
|
|
10
12
|
* Whether to fail fast (`'error'`), warn (`'warn'`), or skip (`false`) when
|
|
11
13
|
* required runtime config keys are unset.
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -149,6 +149,7 @@ function resolveWorkspaceSettingsResolverEntry(srcDir, fallbackResolverBase) {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
const _chatNuxtRequire = createRequire(import.meta.url);
|
|
152
|
+
const _chatNuxtPackageVersion = _chatNuxtRequire("../package.json").version;
|
|
152
153
|
const VUE_COMPONENT_EXTENSIONS = [".vue"];
|
|
153
154
|
const FEATURE_DIRS = ["conversations", "embed", "files", "messages", "rendering", "shared", "usage", "workspace"];
|
|
154
155
|
const FULL_NAME_COMPONENT_DIRS = ["conversations", "embed", "files", "messages", "usage"];
|
|
@@ -358,7 +359,9 @@ const module$1 = defineNuxtModule({
|
|
|
358
359
|
rc.public = rc.public || {};
|
|
359
360
|
const existingChatNuxtRuntimeConfig = rc.chatNuxt;
|
|
360
361
|
rc.chatNuxt = {
|
|
361
|
-
chatApiUrl: existingChatNuxtRuntimeConfig?.chatApiUrl || rc.chatApiUrl
|
|
362
|
+
chatApiUrl: existingChatNuxtRuntimeConfig?.chatApiUrl || rc.chatApiUrl,
|
|
363
|
+
source: options.source || existingChatNuxtRuntimeConfig?.source,
|
|
364
|
+
clientVersion: _chatNuxtPackageVersion
|
|
362
365
|
};
|
|
363
366
|
validateRuntimeConfig(rc, options.validateConfig ?? false);
|
|
364
367
|
nuxt.options.css = nuxt.options.css || [];
|
|
@@ -8,6 +8,7 @@ type __VLS_Props = {
|
|
|
8
8
|
resetConversation?: () => void | Promise<void>;
|
|
9
9
|
startConversation?: (groupId?: string | null) => void | Promise<void>;
|
|
10
10
|
loading?: boolean;
|
|
11
|
+
hideFolderHint?: boolean;
|
|
11
12
|
};
|
|
12
13
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
14
|
declare const _default: typeof __VLS_export;
|
|
@@ -7,7 +7,8 @@ const props = defineProps({
|
|
|
7
7
|
selectConversation: { type: Function, required: false },
|
|
8
8
|
resetConversation: { type: Function, required: false },
|
|
9
9
|
startConversation: { type: Function, required: false },
|
|
10
|
-
loading: { type: Boolean, required: false }
|
|
10
|
+
loading: { type: Boolean, required: false },
|
|
11
|
+
hideFolderHint: { type: Boolean, required: false }
|
|
11
12
|
});
|
|
12
13
|
const {
|
|
13
14
|
conversationSearch,
|
|
@@ -112,7 +113,7 @@ const {
|
|
|
112
113
|
<span h-10px w-84px rounded-full bg-neutral-100 />
|
|
113
114
|
</div>
|
|
114
115
|
</div>
|
|
115
|
-
<p px-4px text-14px text-neutral-500 leading-20px>
|
|
116
|
+
<p v-if="!hideFolderHint" px-4px text-14px text-neutral-500 leading-20px>
|
|
116
117
|
Suas pastas aparecem aqui. Crie uma para começar a agrupar conversas.
|
|
117
118
|
</p>
|
|
118
119
|
<ChatConversationNewGroupButton label="Criar pasta" variant="empty-state" />
|
|
@@ -8,6 +8,7 @@ type __VLS_Props = {
|
|
|
8
8
|
resetConversation?: () => void | Promise<void>;
|
|
9
9
|
startConversation?: (groupId?: string | null) => void | Promise<void>;
|
|
10
10
|
loading?: boolean;
|
|
11
|
+
hideFolderHint?: boolean;
|
|
11
12
|
};
|
|
12
13
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
14
|
declare const _default: typeof __VLS_export;
|
|
@@ -293,6 +293,7 @@ export function useConversations() {
|
|
|
293
293
|
};
|
|
294
294
|
const createConversation = async (input) => {
|
|
295
295
|
error.value = null;
|
|
296
|
+
const statusToast = useStatusToast();
|
|
296
297
|
const requestRuntimeScope = runtimeScope.value;
|
|
297
298
|
const metadataSnapshot = snapshotConversationMetadata(requestRuntimeScope);
|
|
298
299
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -333,6 +334,10 @@ export function useConversations() {
|
|
|
333
334
|
restoreConversationMetadata(requestRuntimeScope, metadataSnapshot);
|
|
334
335
|
const message = err instanceof Error ? err.message : "Erro ao criar conversa";
|
|
335
336
|
error.value = message;
|
|
337
|
+
statusToast.update({
|
|
338
|
+
text: "Erro ao criar conversa",
|
|
339
|
+
icon: "i-ph-warning"
|
|
340
|
+
});
|
|
336
341
|
return null;
|
|
337
342
|
}
|
|
338
343
|
};
|
|
@@ -7,6 +7,7 @@ type __VLS_Props = {
|
|
|
7
7
|
hideSidebar?: boolean;
|
|
8
8
|
sidebar?: ChatSidebarConfig;
|
|
9
9
|
hideSettings?: boolean;
|
|
10
|
+
hideFolderHint?: boolean;
|
|
10
11
|
user?: EmbedUser | null;
|
|
11
12
|
features?: Partial<ChatFeatureConfig>;
|
|
12
13
|
};
|
|
@@ -19,6 +20,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
19
20
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
20
21
|
"onUpdate:conversationId"?: ((value: string | null) => any) | undefined;
|
|
21
22
|
}>, {
|
|
23
|
+
hideFolderHint: boolean;
|
|
22
24
|
hideSettings: boolean;
|
|
23
25
|
hideSidebar: boolean;
|
|
24
26
|
initialConversationId: string | null;
|
|
@@ -30,6 +30,7 @@ const props = defineProps({
|
|
|
30
30
|
hideSidebar: { type: Boolean, required: false, default: true },
|
|
31
31
|
sidebar: { type: Object, required: false },
|
|
32
32
|
hideSettings: { type: Boolean, required: false, default: false },
|
|
33
|
+
hideFolderHint: { type: Boolean, required: false, default: false },
|
|
33
34
|
user: { type: [Object, null], required: false },
|
|
34
35
|
features: { type: Object, required: false }
|
|
35
36
|
});
|
|
@@ -397,6 +398,32 @@ const editTitle = ref("");
|
|
|
397
398
|
const justStartedEditing = ref(false);
|
|
398
399
|
const showDebugModal = ref(false);
|
|
399
400
|
const debugSessionId = computed(() => currentConversation.value?.threadSessionId ?? "Sess\xE3o ainda n\xE3o criada");
|
|
401
|
+
async function copyDebugInfo() {
|
|
402
|
+
const conversation = currentConversation.value;
|
|
403
|
+
const conversationId = conversation?.id ?? activeConversationId.value;
|
|
404
|
+
const sessionId = conversation?.threadSessionId ?? null;
|
|
405
|
+
const telaAgentId = conversation?.telaAgentId ?? null;
|
|
406
|
+
const createdAt = conversation?.createdAt ? new Date(conversation.createdAt) : null;
|
|
407
|
+
const datadogTimeRange = createdAt ? `&from_ts=${createdAt.getTime()}&to_ts=${Date.now()}&live=false` : "";
|
|
408
|
+
const datadogLogsUrl = (facet, value) => `https://us5.datadoghq.com/logs?query=${encodeURIComponent(`@${facet}:${value}`)}${datadogTimeRange}`;
|
|
409
|
+
const environment = useRuntimeConfig().public.environment;
|
|
410
|
+
const telaAppUrl = environment === "production" ? "https://app.tela.com" : "https://app.telastaging.com";
|
|
411
|
+
const debugInfo = {
|
|
412
|
+
conversationId: conversationId ?? null,
|
|
413
|
+
sessionId,
|
|
414
|
+
telaAgentId,
|
|
415
|
+
createdAt: createdAt?.toISOString() ?? null,
|
|
416
|
+
seeConversationInDatadog: conversationId ? datadogLogsUrl("conversationId", conversationId) : null,
|
|
417
|
+
seeSessionInDatadog: sessionId ? datadogLogsUrl("sessionId", sessionId) : null,
|
|
418
|
+
linkToTelaAgent: telaAgentId ? `${telaAppUrl}/agent/${telaAgentId}` : null
|
|
419
|
+
};
|
|
420
|
+
try {
|
|
421
|
+
await navigator.clipboard.writeText(JSON.stringify(debugInfo, null, 2));
|
|
422
|
+
statusToast.update({ text: "Dados de debug copiados", icon: "i-ph-check" });
|
|
423
|
+
} catch {
|
|
424
|
+
statusToast.update({ text: "Erro ao copiar dados de debug", icon: "i-ph-warning" });
|
|
425
|
+
}
|
|
426
|
+
}
|
|
400
427
|
function startEditing() {
|
|
401
428
|
editTitle.value = displayTitle.value;
|
|
402
429
|
isEditing.value = true;
|
|
@@ -522,6 +549,7 @@ async function handleDelete() {
|
|
|
522
549
|
:reset-conversation="handleNewConversation"
|
|
523
550
|
:start-conversation="handleNewConversation"
|
|
524
551
|
:loading="conversationsLoading"
|
|
552
|
+
:hide-folder-hint="hideFolderHint"
|
|
525
553
|
/>
|
|
526
554
|
</div>
|
|
527
555
|
|
|
@@ -573,6 +601,7 @@ async function handleDelete() {
|
|
|
573
601
|
:has-pending-message="hasPendingMessage"
|
|
574
602
|
:hide-settings="hideSettings"
|
|
575
603
|
:hide-sidebar="hideSidebar"
|
|
604
|
+
:hide-folder-hint="hideFolderHint"
|
|
576
605
|
:is-editing="isEditing"
|
|
577
606
|
:loading="loading"
|
|
578
607
|
:messages="messages"
|
|
@@ -885,7 +914,7 @@ async function handleDelete() {
|
|
|
885
914
|
<div flex="~ col" w-full my-24px gap-24px>
|
|
886
915
|
<div flex="~ col" gap-4px w-full>
|
|
887
916
|
<p text-14px font-580 text-gray-700 leading-18px>
|
|
888
|
-
|
|
917
|
+
Conversation Id
|
|
889
918
|
</p>
|
|
890
919
|
<div
|
|
891
920
|
px-12px py-10px
|
|
@@ -903,7 +932,7 @@ async function handleDelete() {
|
|
|
903
932
|
</div>
|
|
904
933
|
<div flex="~ col" gap-4px w-full>
|
|
905
934
|
<p text-14px font-580 text-gray-700 leading-18px>
|
|
906
|
-
|
|
935
|
+
Session Id
|
|
907
936
|
</p>
|
|
908
937
|
<div
|
|
909
938
|
px-12px py-10px
|
|
@@ -920,6 +949,16 @@ async function handleDelete() {
|
|
|
920
949
|
</div>
|
|
921
950
|
</div>
|
|
922
951
|
</div>
|
|
952
|
+
<template #footer>
|
|
953
|
+
<div flex justify-between items-center gap-12px w-full>
|
|
954
|
+
<p text-12px font-400 leading-16px text-tertiary>
|
|
955
|
+
Inclui os ids da conversa e os links de debug no Datadog e no Tela
|
|
956
|
+
</p>
|
|
957
|
+
<TelaButton variant="primary" icon="i-ph-copy" leading flex-shrink-0 @click="copyDebugInfo">
|
|
958
|
+
Copiar dados completos
|
|
959
|
+
</TelaButton>
|
|
960
|
+
</div>
|
|
961
|
+
</template>
|
|
923
962
|
</TelaModal>
|
|
924
963
|
</div>
|
|
925
964
|
|
|
@@ -7,6 +7,7 @@ type __VLS_Props = {
|
|
|
7
7
|
hideSidebar?: boolean;
|
|
8
8
|
sidebar?: ChatSidebarConfig;
|
|
9
9
|
hideSettings?: boolean;
|
|
10
|
+
hideFolderHint?: boolean;
|
|
10
11
|
user?: EmbedUser | null;
|
|
11
12
|
features?: Partial<ChatFeatureConfig>;
|
|
12
13
|
};
|
|
@@ -19,6 +20,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
19
20
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
20
21
|
"onUpdate:conversationId"?: ((value: string | null) => any) | undefined;
|
|
21
22
|
}>, {
|
|
23
|
+
hideFolderHint: boolean;
|
|
22
24
|
hideSettings: boolean;
|
|
23
25
|
hideSidebar: boolean;
|
|
24
26
|
initialConversationId: string | null;
|
|
@@ -15,6 +15,7 @@ const props = defineProps({
|
|
|
15
15
|
hideSidebar: { type: Boolean, required: false },
|
|
16
16
|
sidebar: { type: Object, required: false },
|
|
17
17
|
hideSettings: { type: Boolean, required: false },
|
|
18
|
+
hideFolderHint: { type: Boolean, required: false },
|
|
18
19
|
loadingMessages: { type: [Array, null], required: false },
|
|
19
20
|
loadingMessagesMode: { type: [String, null], required: false },
|
|
20
21
|
customComponents: { type: Object, required: false },
|
|
@@ -95,6 +96,7 @@ provideChatMessageTerminal((payload) => {
|
|
|
95
96
|
:hide-sidebar="hideSidebar"
|
|
96
97
|
:sidebar="sidebar"
|
|
97
98
|
:hide-settings="hideSettings"
|
|
99
|
+
:hide-folder-hint="hideFolderHint"
|
|
98
100
|
:user="normalizedTelaAgentId ? null : user"
|
|
99
101
|
:features="features"
|
|
100
102
|
@update:conversation-id="$emit('update:conversationId', $event)"
|
|
@@ -8,6 +8,7 @@ const props = defineProps({
|
|
|
8
8
|
hideSidebar: { type: Boolean, required: false },
|
|
9
9
|
sidebar: { type: Object, required: false },
|
|
10
10
|
hideSettings: { type: Boolean, required: false },
|
|
11
|
+
hideFolderHint: { type: Boolean, required: false },
|
|
11
12
|
loadingMessages: { type: [Array, null], required: false },
|
|
12
13
|
loadingMessagesMode: { type: [String, null], required: false },
|
|
13
14
|
customComponents: { type: Object, required: false },
|
|
@@ -37,6 +38,7 @@ const hideSettings = computed(() => props.hideSettings ?? false);
|
|
|
37
38
|
:hide-sidebar="hideSidebar"
|
|
38
39
|
:sidebar="sidebar"
|
|
39
40
|
:hide-settings="hideSettings"
|
|
41
|
+
:hide-folder-hint="hideFolderHint"
|
|
40
42
|
:features="features"
|
|
41
43
|
:loading-messages="loadingMessages"
|
|
42
44
|
:loading-messages-mode="loadingMessagesMode"
|
|
@@ -64,6 +66,7 @@ const hideSettings = computed(() => props.hideSettings ?? false);
|
|
|
64
66
|
:hide-sidebar="hideSidebar"
|
|
65
67
|
:sidebar="sidebar"
|
|
66
68
|
:hide-settings="hideSettings"
|
|
69
|
+
:hide-folder-hint="hideFolderHint"
|
|
67
70
|
:features="features"
|
|
68
71
|
:loading-messages="loadingMessages"
|
|
69
72
|
:loading-messages-mode="loadingMessagesMode"
|
|
@@ -13,6 +13,7 @@ const props = defineProps({
|
|
|
13
13
|
conversations: { type: null, required: true },
|
|
14
14
|
activeId: { type: [String, null], required: true },
|
|
15
15
|
loading: { type: Boolean, required: false },
|
|
16
|
+
hideFolderHint: { type: Boolean, required: false },
|
|
16
17
|
userName: { type: String, required: false },
|
|
17
18
|
userEmail: { type: String, required: false },
|
|
18
19
|
userImage: { type: String, required: false }
|
|
@@ -338,7 +339,7 @@ async function handleConversationDrop(event, groupId) {
|
|
|
338
339
|
<span h-10px w-84px rounded-full bg-neutral-100 />
|
|
339
340
|
</div>
|
|
340
341
|
</div>
|
|
341
|
-
<p px-4px text-14px text-neutral-500 leading-20px>
|
|
342
|
+
<p v-if="!hideFolderHint" px-4px text-14px text-neutral-500 leading-20px>
|
|
342
343
|
Suas pastas aparecem aqui. Crie uma para começar a agrupar conversas.
|
|
343
344
|
</p>
|
|
344
345
|
<ChatConversationNewGroupButton label="Criar pasta" variant="empty-state" />
|
|
@@ -32,6 +32,7 @@ const props = defineProps({
|
|
|
32
32
|
hasPendingMessage: { type: Boolean, required: false },
|
|
33
33
|
hideSettings: { type: Boolean, required: false },
|
|
34
34
|
hideSidebar: { type: Boolean, required: false },
|
|
35
|
+
hideFolderHint: { type: Boolean, required: false },
|
|
35
36
|
isEditing: { type: Boolean, required: true },
|
|
36
37
|
loading: { type: Boolean, required: false },
|
|
37
38
|
messages: { type: Array, required: true },
|
|
@@ -139,6 +140,7 @@ function startNewConversationFromOutdatedSettings() {
|
|
|
139
140
|
:conversations="conversations"
|
|
140
141
|
:active-id="activeConversationId"
|
|
141
142
|
:loading="conversationsLoading"
|
|
143
|
+
:hide-folder-hint="hideFolderHint"
|
|
142
144
|
:user-name="currentUser?.name ?? void 0"
|
|
143
145
|
:user-email="currentUser?.email ?? void 0"
|
|
144
146
|
:user-image="currentUser?.image ?? void 0"
|
|
@@ -44,6 +44,8 @@ export type ChatEmbedSharedProps = {
|
|
|
44
44
|
sidebar?: ChatSidebarConfig;
|
|
45
45
|
/** Hide workspace settings actions while keeping the chat header and content unchanged. */
|
|
46
46
|
hideSettings?: boolean;
|
|
47
|
+
/** Hide the folder onboarding hint while keeping folder creation actions available. */
|
|
48
|
+
hideFolderHint?: boolean;
|
|
47
49
|
/** Custom pending-response messages shown while the assistant is working. */
|
|
48
50
|
loadingMessages?: readonly string[] | null;
|
|
49
51
|
/** How custom loading messages rotate. Defaults to ordered behavior when omitted. */
|
|
@@ -58,8 +58,17 @@ function buildProxyHeaders(event) {
|
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
const headers = {
|
|
61
|
-
authorization: `Bearer ${token}
|
|
61
|
+
"authorization": `Bearer ${token}`,
|
|
62
|
+
"x-chat-client": "chat-nuxt"
|
|
62
63
|
};
|
|
64
|
+
const config = useRuntimeConfig(event);
|
|
65
|
+
if (config.chatNuxt?.clientVersion) {
|
|
66
|
+
headers["x-chat-client-version"] = config.chatNuxt.clientVersion;
|
|
67
|
+
}
|
|
68
|
+
const source = config.chatNuxt?.source || getRequestURL(event).host;
|
|
69
|
+
if (source) {
|
|
70
|
+
headers["x-chat-source"] = source;
|
|
71
|
+
}
|
|
63
72
|
for (const headerName of CHAT_COMPAT_HEADERS) {
|
|
64
73
|
const value = getHeader(event, headerName)?.trim();
|
|
65
74
|
if (value) {
|
|
@@ -8,7 +8,14 @@ type Workspace = {
|
|
|
8
8
|
id: string;
|
|
9
9
|
name?: string | null;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type PosthogLogsOptions = {
|
|
12
|
+
captureConsoleLogs?: boolean;
|
|
13
|
+
/** Shown as `service.name` in the PostHog Logs UI. Defaults to `unknown_service`. */
|
|
14
|
+
serviceName?: string;
|
|
15
|
+
/** Shown as `deployment.environment` in the PostHog Logs UI. */
|
|
16
|
+
environment?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function initPosthog(publicKey: string, host: string, defaults: string, logs?: PosthogLogsOptions): Promise<void>;
|
|
12
19
|
export declare function identifyPosthogUser(user: AuthUser): void;
|
|
13
20
|
export declare function resetPosthogIdentity(): void;
|
|
14
21
|
export declare function setPosthogWorkspace(workspace: Workspace): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const posthogClient = shallowRef(null);
|
|
2
2
|
const flagsVersion = ref(0);
|
|
3
3
|
let identifiedUserFingerprint = null;
|
|
4
|
-
export async function initPosthog(publicKey, host, defaults) {
|
|
4
|
+
export async function initPosthog(publicKey, host, defaults, logs) {
|
|
5
5
|
if (posthogClient.value)
|
|
6
6
|
return;
|
|
7
7
|
try {
|
|
@@ -10,6 +10,15 @@ export async function initPosthog(publicKey, host, defaults) {
|
|
|
10
10
|
api_host: host,
|
|
11
11
|
defaults,
|
|
12
12
|
person_profiles: "identified_only",
|
|
13
|
+
// serviceName/environment are supported at runtime but missing
|
|
14
|
+
// from PostHogConfig['logs'] in the pinned posthog-js version.
|
|
15
|
+
...logs?.captureConsoleLogs ? {
|
|
16
|
+
logs: {
|
|
17
|
+
captureConsoleLogs: true,
|
|
18
|
+
serviceName: logs.serviceName,
|
|
19
|
+
environment: logs.environment
|
|
20
|
+
}
|
|
21
|
+
} : {},
|
|
13
22
|
loaded: (c) => {
|
|
14
23
|
if (import.meta.dev)
|
|
15
24
|
c.debug();
|
|
@@ -183,6 +183,7 @@ export declare const workspaceUsageResponseSchema: z.ZodObject<{
|
|
|
183
183
|
export type WorkspaceUsageResponse = z.infer<typeof workspaceUsageResponseSchema>;
|
|
184
184
|
export declare const dailyUsageRowSchema: z.ZodObject<{
|
|
185
185
|
workspaceId: z.ZodString;
|
|
186
|
+
source: z.ZodNullable<z.ZodString>;
|
|
186
187
|
totalTokens: z.ZodNumber;
|
|
187
188
|
totalCost: z.ZodNumber;
|
|
188
189
|
promptTokens: z.ZodNumber;
|
|
@@ -196,6 +197,7 @@ export type DailyUsageRow = z.infer<typeof dailyUsageRowSchema>;
|
|
|
196
197
|
export declare const dailyUsageResponseSchema: z.ZodObject<{
|
|
197
198
|
rows: z.ZodArray<z.ZodObject<{
|
|
198
199
|
workspaceId: z.ZodString;
|
|
200
|
+
source: z.ZodNullable<z.ZodString>;
|
|
199
201
|
totalTokens: z.ZodNumber;
|
|
200
202
|
totalCost: z.ZodNumber;
|
|
201
203
|
promptTokens: z.ZodNumber;
|