From 26574709b02d1bd61bc818e1accbf4489079f669 Mon Sep 17 00:00:00 2001 From: omgate234 Date: Mon, 8 Sep 2025 18:04:40 +0530 Subject: [PATCH 01/13] feat: meeting recorder content and canvas --- .../meeting-recorder/AttachBottom.vue | 28 ++ .../meeting-recorder/AttachLeft.vue | 26 ++ .../meeting-recorder/AttachTop.vue | 27 ++ .../meeting-recorder/Button.vue | 81 ++++ .../meeting-recorder/Cross.vue | 42 ++ .../canvas-handlers/meeting-recorder/Live.vue | 24 ++ .../meeting-recorder/LiveAnalysisModal.vue | 352 ++++++++++++++++ .../meeting-recorder/MeetingAnalysisModal.vue | 377 ++++++++++++++++++ .../MeetingRecorderCanvas.vue | 129 ++++++ .../meeting-recorder/Pinned.vue | 31 ++ .../meeting-recorder/Robot.vue | 26 ++ .../meeting-recorder/UnPinned.vue | 31 ++ src/components/chat/ChatInterface.vue | 109 ++++- src/components/hooks/useChatInterface.js | 38 +- src/components/hooks/useVideoDBAgent.js | 30 ++ .../message-handlers/MeetingRecorder.vue | 340 ++++++++++++++++ 16 files changed, 1670 insertions(+), 21 deletions(-) create mode 100644 src/components/canvas-handlers/meeting-recorder/AttachBottom.vue create mode 100644 src/components/canvas-handlers/meeting-recorder/AttachLeft.vue create mode 100644 src/components/canvas-handlers/meeting-recorder/AttachTop.vue create mode 100644 src/components/canvas-handlers/meeting-recorder/Button.vue create mode 100644 src/components/canvas-handlers/meeting-recorder/Cross.vue create mode 100644 src/components/canvas-handlers/meeting-recorder/Live.vue create mode 100644 src/components/canvas-handlers/meeting-recorder/LiveAnalysisModal.vue create mode 100644 src/components/canvas-handlers/meeting-recorder/MeetingAnalysisModal.vue create mode 100644 src/components/canvas-handlers/meeting-recorder/MeetingRecorderCanvas.vue create mode 100644 src/components/canvas-handlers/meeting-recorder/Pinned.vue create mode 100644 src/components/canvas-handlers/meeting-recorder/Robot.vue create mode 100644 src/components/canvas-handlers/meeting-recorder/UnPinned.vue create mode 100644 src/components/message-handlers/MeetingRecorder.vue diff --git a/src/components/canvas-handlers/meeting-recorder/AttachBottom.vue b/src/components/canvas-handlers/meeting-recorder/AttachBottom.vue new file mode 100644 index 0000000..8e4a96e --- /dev/null +++ b/src/components/canvas-handlers/meeting-recorder/AttachBottom.vue @@ -0,0 +1,28 @@ + + + diff --git a/src/components/canvas-handlers/meeting-recorder/AttachLeft.vue b/src/components/canvas-handlers/meeting-recorder/AttachLeft.vue new file mode 100644 index 0000000..4824569 --- /dev/null +++ b/src/components/canvas-handlers/meeting-recorder/AttachLeft.vue @@ -0,0 +1,26 @@ + + diff --git a/src/components/canvas-handlers/meeting-recorder/AttachTop.vue b/src/components/canvas-handlers/meeting-recorder/AttachTop.vue new file mode 100644 index 0000000..d48ebcf --- /dev/null +++ b/src/components/canvas-handlers/meeting-recorder/AttachTop.vue @@ -0,0 +1,27 @@ + + + diff --git a/src/components/canvas-handlers/meeting-recorder/Button.vue b/src/components/canvas-handlers/meeting-recorder/Button.vue new file mode 100644 index 0000000..f52c5c8 --- /dev/null +++ b/src/components/canvas-handlers/meeting-recorder/Button.vue @@ -0,0 +1,81 @@ + + + + + diff --git a/src/components/canvas-handlers/meeting-recorder/Cross.vue b/src/components/canvas-handlers/meeting-recorder/Cross.vue new file mode 100644 index 0000000..bbae0e8 --- /dev/null +++ b/src/components/canvas-handlers/meeting-recorder/Cross.vue @@ -0,0 +1,42 @@ + + + + + diff --git a/src/components/canvas-handlers/meeting-recorder/Live.vue b/src/components/canvas-handlers/meeting-recorder/Live.vue new file mode 100644 index 0000000..0a20fc6 --- /dev/null +++ b/src/components/canvas-handlers/meeting-recorder/Live.vue @@ -0,0 +1,24 @@ + + + + diff --git a/src/components/canvas-handlers/meeting-recorder/LiveAnalysisModal.vue b/src/components/canvas-handlers/meeting-recorder/LiveAnalysisModal.vue new file mode 100644 index 0000000..13ca35e --- /dev/null +++ b/src/components/canvas-handlers/meeting-recorder/LiveAnalysisModal.vue @@ -0,0 +1,352 @@ + + + + + + diff --git a/src/components/canvas-handlers/meeting-recorder/MeetingAnalysisModal.vue b/src/components/canvas-handlers/meeting-recorder/MeetingAnalysisModal.vue new file mode 100644 index 0000000..1cd1bb4 --- /dev/null +++ b/src/components/canvas-handlers/meeting-recorder/MeetingAnalysisModal.vue @@ -0,0 +1,377 @@ + + + + diff --git a/src/components/canvas-handlers/meeting-recorder/MeetingRecorderCanvas.vue b/src/components/canvas-handlers/meeting-recorder/MeetingRecorderCanvas.vue new file mode 100644 index 0000000..00d3216 --- /dev/null +++ b/src/components/canvas-handlers/meeting-recorder/MeetingRecorderCanvas.vue @@ -0,0 +1,129 @@ + + + + + diff --git a/src/components/canvas-handlers/meeting-recorder/Pinned.vue b/src/components/canvas-handlers/meeting-recorder/Pinned.vue new file mode 100644 index 0000000..011fb88 --- /dev/null +++ b/src/components/canvas-handlers/meeting-recorder/Pinned.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/src/components/canvas-handlers/meeting-recorder/Robot.vue b/src/components/canvas-handlers/meeting-recorder/Robot.vue new file mode 100644 index 0000000..cb0a242 --- /dev/null +++ b/src/components/canvas-handlers/meeting-recorder/Robot.vue @@ -0,0 +1,26 @@ + + + diff --git a/src/components/canvas-handlers/meeting-recorder/UnPinned.vue b/src/components/canvas-handlers/meeting-recorder/UnPinned.vue new file mode 100644 index 0000000..3c96580 --- /dev/null +++ b/src/components/canvas-handlers/meeting-recorder/UnPinned.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/src/components/chat/ChatInterface.vue b/src/components/chat/ChatInterface.vue index c90a130..be839af 100644 --- a/src/components/chat/ChatInterface.vue +++ b/src/components/chat/ChatInterface.vue @@ -46,13 +46,15 @@ /> -
+
diff --git a/src/components/icons/DotVertical.vue b/src/components/icons/DotVertical.vue new file mode 100644 index 0000000..c15cd46 --- /dev/null +++ b/src/components/icons/DotVertical.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/src/components/icons/Edit.vue b/src/components/icons/Edit.vue new file mode 100644 index 0000000..798acd2 --- /dev/null +++ b/src/components/icons/Edit.vue @@ -0,0 +1,36 @@ + + + + + From aff6daf812affc2e157c8cf4a2d22ccfdeef766a Mon Sep 17 00:00:00 2001 From: omgate234 Date: Tue, 9 Sep 2025 19:08:14 +0530 Subject: [PATCH 05/13] chore: cleanup logs --- .../MeetingRecorderCanvas.vue | 25 +------------------ .../message-handlers/MeetingRecorder.vue | 15 +++-------- 2 files changed, 5 insertions(+), 35 deletions(-) diff --git a/src/components/canvas-handlers/meeting-recorder/MeetingRecorderCanvas.vue b/src/components/canvas-handlers/meeting-recorder/MeetingRecorderCanvas.vue index fa8d294..958f657 100644 --- a/src/components/canvas-handlers/meeting-recorder/MeetingRecorderCanvas.vue +++ b/src/components/canvas-handlers/meeting-recorder/MeetingRecorderCanvas.vue @@ -41,7 +41,7 @@ diff --git a/src/components/hooks/useVideoDBAgent.js b/src/components/hooks/useVideoDBAgent.js index d08bb3f..72644e5 100644 --- a/src/components/hooks/useVideoDBAgent.js +++ b/src/components/hooks/useVideoDBAgent.js @@ -137,18 +137,18 @@ export function useVideoDBAgent(config) { return res; }; - const appendMessageMetadata = async (msgId, metadata) => { + const saveMeetingContext = async (msgId, context) => { const res = {}; try { const response = await fetch( - `${httpUrl}/session/message/${msgId}/metadata`, + `${httpUrl}/session/message/${msgId}/meeting_context`, { method: "POST", headers: { Accept: "application/json", "Content-Type": "application/json", }, - body: JSON.stringify(metadata), + body: JSON.stringify(context), }, ); @@ -166,6 +166,29 @@ export function useVideoDBAgent(config) { return res; }; + const fetchMeetingContext = async (uiId) => { + const res = {}; + try { + const response = await fetch( + `${httpUrl}/session/meeting_context/${uiId}`, + ); + if (response.status === 404) { + res.status = "not_found"; + return res; + } + if (!response.ok) { + throw new Error("Network response was not ok"); + } + const data = await response.json(); + res.status = "success"; + res.data = data; + } catch (error) { + res.status = "error"; + res.error = error; + } + return res; + }; + const refetchCollectionVideos = async () => { fetchCollectionVideos(session.collectionId).then((res) => { activeCollectionVideos.value = res.data; @@ -667,6 +690,7 @@ export function useVideoDBAgent(config) { uploadMedia, generateImageUrl, generateAudioUrl, - appendMessageMetadata, + saveMeetingContext, + fetchMeetingContext, }; } diff --git a/src/components/message-handlers/MeetingRecorder.vue b/src/components/message-handlers/MeetingRecorder.vue index 6fad0d6..4ec2f4c 100644 --- a/src/components/message-handlers/MeetingRecorder.vue +++ b/src/components/message-handlers/MeetingRecorder.vue @@ -264,17 +264,32 @@ function toggleTopic(t) { } const canSave = computed( - () => objective.value.trim().length > 0 && selectedMainGoals.value.size > 0, + () => + selectedMainGoals.value.size > 0 || + objective.value.trim().length > 0 || + selectedTopics.value.size > 0 || + discussionTopicText.value.trim().length > 0, ); /* chat ctx */ -const { appendMessageMetadata, openCanvas, conversations, canvasState } = +const { saveMeetingContext, fetchMeetingContext, openCanvas, canvasState } = useVideoDBChat(); -const message = computed(() => conversations?.[props.convId]?.[props.msgId]); -onMounted(() => { - if (message.value?.metadata?.meeting_context) { - openCanvas && openCanvas("meeting_recorder", props.content); +onMounted(async () => { + openCanvas && openCanvas("meeting_recorder", props.content); + if (props.content?.ui_id) { + const res = await fetchMeetingContext(props.content.ui_id); + if (res.status === "success" && res.data) { + const ctx = res.data?.meeting_context; + if (!ctx) return; + if (Array.isArray(ctx.main_goals)) + selectedMainGoals.value = new Set(ctx.main_goals); + if (typeof ctx.objective === "string") objective.value = ctx.objective; + if (Array.isArray(ctx.topics)) selectedTopics.value = new Set(ctx.topics); + if (typeof ctx.discussion_topic_text === "string") + discussionTopicText.value = ctx.discussion_topic_text; + isOpen.value = false; + } } }); @@ -289,39 +304,19 @@ watch( { deep: true, immediate: true }, ); -watch( - () => message.value?.metadata, - (m) => { - const ctx = m?.meeting_context; - if (!ctx) return; - if (Array.isArray(ctx.main_goals)) - selectedMainGoals.value = new Set(ctx.main_goals); - if (typeof ctx.objective === "string") objective.value = ctx.objective; - if (Array.isArray(ctx.topics)) selectedTopics.value = new Set(ctx.topics); - if (typeof ctx.discussion_topic_text === "string") - discussionTopicText.value = ctx.discussion_topic_text; - - // Close the drawer when metadata is present (already filled previously) - isOpen.value = false; - }, - { deep: true, immediate: true }, -); - async function handleSave() { if (!canSave.value) return; - const metadata = { - meeting_context: { - main_goals: Array.from(selectedMainGoals.value), - objective: objective.value.trim(), - topics: Array.from(selectedTopics.value), - discussion_topic_text: discussionTopicText.value.trim(), - ui_id: props.content.ui_id, - }, + const meetingContext = { + main_goals: Array.from(selectedMainGoals.value), + objective: objective.value.trim(), + topics: Array.from(selectedTopics.value), + discussion_topic_text: discussionTopicText.value.trim(), + ui_id: props.content.ui_id, }; const targetMsgId = props.content?.msg_id || props.msgId; - appendMessageMetadata && appendMessageMetadata(targetMsgId, metadata); + saveMeetingContext(targetMsgId, meetingContext); openCanvas && openCanvas("meeting_recorder", props.content); // 2) Auto-close the drawer From 82609541db81b51748782f64956c6bcc17aa263d Mon Sep 17 00:00:00 2001 From: Rohit Garg Date: Wed, 10 Sep 2025 19:36:28 +0530 Subject: [PATCH 08/13] bump videodb-player --- package-lock.json | 12 ++++++------ package.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6f4723f..da633bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "@videodb/chat-vue", - "version": "0.0.36", + "version": "0.0.40", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@videodb/chat-vue", - "version": "0.0.36", + "version": "0.0.40", "license": "Apache-2.0", "dependencies": { - "@videodb/player-vue": "~0.0.4", + "@videodb/player-vue": "^0.0.5", "dayjs": "^1.11.13", "katex": "^0.16.11", "marked": "^4.2.5", @@ -418,9 +418,9 @@ "license": "ISC" }, "node_modules/@videodb/player-vue": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/@videodb/player-vue/-/player-vue-0.0.4.tgz", - "integrity": "sha512-q5B1Yv2vD3g35xn4ozX7aqGVjdF/occMcWfifA+SgnOQEaBNYZi8iRfTPKIomEgGohT23Ugj42GlpsA4Ft6ysA==", + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/@videodb/player-vue/-/player-vue-0.0.5.tgz", + "integrity": "sha512-vKXJMIoXH9WkduFOo1UJJ9dqt5/YJUV1mx8mjn2YfOP0FB1gfcDfRYE2pC9fJyOEe3vvagVLyTyCdlmmamOoJA==", "license": "Apache-2.0", "dependencies": { "lodash.debounce": "^4.0.8", diff --git a/package.json b/package.json index 44a4a05..1e9e558 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "vue-tsc": "^2.0.29" }, "dependencies": { - "@videodb/player-vue": "~0.0.4", + "@videodb/player-vue": "^0.0.5", "dayjs": "^1.11.13", "katex": "^0.16.11", "marked": "^4.2.5", From 4a6d0d5a53533c69386c6309b073bd0bd346dddc Mon Sep 17 00:00:00 2001 From: omgate234 Date: Thu, 18 Sep 2025 12:25:51 +0530 Subject: [PATCH 09/13] feat: share session feature --- package-lock.json | 16 +- package.json | 1 - src/components/chat/ChatInput.vue | 5 +- src/components/chat/ChatInterface.vue | 34 +++- src/components/chat/elements/Sidebar.vue | 15 ++ src/components/hooks/useVideoDBAgent.js | 32 +++- src/components/icons/Share.vue | 42 ++++ src/components/modals/ShareModal.vue | 233 +++++++++++++++++++++++ src/components/utils/index.js | 64 +++---- 9 files changed, 388 insertions(+), 54 deletions(-) create mode 100644 src/components/icons/Share.vue create mode 100644 src/components/modals/ShareModal.vue diff --git a/package-lock.json b/package-lock.json index 2124a7f..1c92b8a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@videodb/chat-vue", - "version": "0.0.40", + "version": "0.0.41", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@videodb/chat-vue", - "version": "0.0.40", + "version": "0.0.41", "license": "Apache-2.0", "dependencies": { "@videodb/player-vue": "~0.0.6", @@ -17,7 +17,6 @@ "prismjs": "^1.29.0", "socket.io-client": "^4.7.5", "swiper": "^11.1.10", - "uuid": "^10.0.0", "vue3-popper": "^1.5.0" }, "devDependencies": { @@ -4404,17 +4403,6 @@ "dev": true, "license": "MIT" }, - "node_modules/uuid": { - "version": "10.0.0", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "license": "MIT", - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/video.js": { "version": "8.19.1", "resolved": "https://registry.npmjs.org/video.js/-/video.js-8.19.1.tgz", diff --git a/package.json b/package.json index c1fd826..02c5e90 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,6 @@ "prismjs": "^1.29.0", "socket.io-client": "^4.7.5", "swiper": "^11.1.10", - "uuid": "^10.0.0", "vue3-popper": "^1.5.0" } } diff --git a/src/components/chat/ChatInput.vue b/src/components/chat/ChatInput.vue index 5f62847..6dcd8ec 100644 --- a/src/components/chat/ChatInput.vue +++ b/src/components/chat/ChatInput.vue @@ -119,7 +119,6 @@ diff --git a/src/components/modals/ShareModal.vue b/src/components/modals/ShareModal.vue new file mode 100644 index 0000000..ff76abd --- /dev/null +++ b/src/components/modals/ShareModal.vue @@ -0,0 +1,233 @@ + + + + + diff --git a/src/components/utils/index.js b/src/components/utils/index.js index 86507cb..e0238e9 100644 --- a/src/components/utils/index.js +++ b/src/components/utils/index.js @@ -1,74 +1,72 @@ -import { v1 } from 'uuid' - export function secondsToHHMMSS(val) { - if (!val) return '00:00:00' - let time = '' - time = new Date(val * 1000).toISOString().substring(11, 19) - if (time.substring(0, 2) === '00') { - return time.substring(3, time.length) + if (!val) return "00:00:00"; + let time = ""; + time = new Date(val * 1000).toISOString().substring(11, 19); + if (time.substring(0, 2) === "00") { + return time.substring(3, time.length); } - return time + return time; } export function randomHsl(num, total) { - return 'hsla(' + ((num + 1) / (total + 1)) * 360 + ', 100%, 50%, 1)' + return "hsla(" + ((num + 1) / (total + 1)) * 360 + ", 100%, 50%, 1)"; } export function separateBulletPoints(markdownString) { // Split the markdown string into individual lines - const lines = markdownString.split('\n') + const lines = markdownString.split("\n"); // Remove empty lines and trim leading/trailing whitespace from each line const cleanedLines = lines - .filter((line) => line.trim() !== '') - .map((line) => line.trim()) + .filter((line) => line.trim() !== "") + .map((line) => line.trim()); // Iterate over the cleaned lines and extract the bullet points - const bulletPoints = [] - let currentBulletPoint = '' + const bulletPoints = []; + let currentBulletPoint = ""; cleanedLines.forEach((line) => { - if (line.startsWith('-')) { + if (line.startsWith("-")) { // Add the current bullet point to the array - if (currentBulletPoint !== '') { - bulletPoints.push(currentBulletPoint.trim()) + if (currentBulletPoint !== "") { + bulletPoints.push(currentBulletPoint.trim()); } // Start a new bullet point - currentBulletPoint = line.substring(1).trim() + currentBulletPoint = line.substring(1).trim(); } else { // Append the line to the current bullet point - currentBulletPoint += ' ' + line.trim() + currentBulletPoint += " " + line.trim(); } - }) + }); // Add the last bullet point to the array - if (currentBulletPoint !== '') { - bulletPoints.push(currentBulletPoint.trim()) + if (currentBulletPoint !== "") { + bulletPoints.push(currentBulletPoint.trim()); } - return bulletPoints + return bulletPoints; } -const NOT_ALLOWED_CHARS = ['\\$', '#', '\\[', '\\]', '\\.', '/'] // Escape special characters with backslashes +const NOT_ALLOWED_CHARS = ["\\$", "#", "\\[", "\\]", "\\.", "/"]; // Escape special characters with backslashes export function generateSlug(title) { - if (title.split(' ').length > 1) { + if (title.split(" ").length > 1) { const nTitle = title - .split(' ') + .split(" ") .slice(0, 10) .filter((w) => /^[a-zA-Z0-9]+$/.test(w)) - .join('-') - title = nTitle + .join("-"); + title = nTitle; } for (const NOT_ALLOWED_CHAR of NOT_ALLOWED_CHARS) { - title = title.replace(new RegExp(NOT_ALLOWED_CHAR, 'g'), '-') + title = title.replace(new RegExp(NOT_ALLOWED_CHAR, "g"), "-"); } - const key = v1().replace(/-/g, '').substring(0, 8) - const slug = `${title}_${key}` - return slug + const key = crypto.randomUUID().replace(/-/g, "").substring(0, 8); + const slug = `${title}_${key}`; + return slug; } -export default {} +export default {}; From e876ebae553e575641e8d3e5caad09664cb8daa1 Mon Sep 17 00:00:00 2001 From: omgate234 Date: Thu, 18 Sep 2025 15:39:59 +0530 Subject: [PATCH 10/13] style: updated styling --- src/components/modals/ShareModal.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/modals/ShareModal.vue b/src/components/modals/ShareModal.vue index ff76abd..e48f932 100644 --- a/src/components/modals/ShareModal.vue +++ b/src/components/modals/ShareModal.vue @@ -5,7 +5,7 @@ @click="closeModal" >
@@ -35,7 +35,7 @@ class="vdb-c-flex vdb-c-items-center vdb-c-gap-8 vdb-c-rounded-lg vdb-c-bg-gray-50 vdb-c-p-12" >
Creating public link...
in
r
X Date: Fri, 19 Sep 2025 15:36:44 +0530 Subject: [PATCH 11/13] fix: fix link display --- src/components/chat/ChatInterface.vue | 1 + src/components/hooks/useVideoDBAgent.js | 8 ++++ src/components/modals/ShareModal.vue | 49 +++++++++++++++++++++++-- 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/src/components/chat/ChatInterface.vue b/src/components/chat/ChatInterface.vue index c6a90f8..a082cd3 100644 --- a/src/components/chat/ChatInterface.vue +++ b/src/components/chat/ChatInterface.vue @@ -334,6 +334,7 @@ diff --git a/src/components/hooks/useVideoDBAgent.js b/src/components/hooks/useVideoDBAgent.js index 4930cfd..2d6d130 100644 --- a/src/components/hooks/useVideoDBAgent.js +++ b/src/components/hooks/useVideoDBAgent.js @@ -208,6 +208,14 @@ export function useVideoDBAgent(config) { res.status = "success"; res.success = true; res.data = data; + + const idx = sessions.value.findIndex((s) => s.session_id === sessionId); + if (idx !== -1) { + sessions.value[idx] = { + ...sessions.value[idx], + is_public: isPublic, + }; + } } catch (error) { res.status = "error"; res.success = false; diff --git a/src/components/modals/ShareModal.vue b/src/components/modals/ShareModal.vue index e48f932..5256241 100644 --- a/src/components/modals/ShareModal.vue +++ b/src/components/modals/ShareModal.vue @@ -25,8 +25,7 @@

- A public link to your chat has been created. Manage previously shared - chats at any time via Settings. + A public link to your chat has been created.

@@ -149,6 +148,10 @@ const props = defineProps({ type: String, default: "", }, + isPublic: { + type: Boolean, + default: false, + }, onMakePublic: { type: Function, required: true, @@ -184,7 +187,7 @@ const copyLink = async () => { }; const shareOnLinkedIn = () => { - const url = `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(publicLink.value)}`; + const url = `https://www.linkedin.com/feed/?shareActive=true&text=${encodeURIComponent("Check out this chat session from VideoDB Director! \n" + publicLink.value)}`; window.open(url, "_blank"); }; @@ -198,11 +201,41 @@ const shareOnX = () => { window.open(url, "_blank"); }; +const initializeShare = async (sid) => { + if (!sid || !props.showDialog) return; + if (props.isPublic) { + publicLink.value = `${window.location.origin}/share/${sid}`; + isLoading.value = false; + error.value = ""; + return; + } + isLoading.value = true; + error.value = ""; + publicLink.value = ""; + try { + const result = await props.onMakePublic(sid); + if (result.success) { + publicLink.value = `${window.location.origin}/share/${sid}`; + } else { + error.value = result.error || "Failed to create public link"; + } + } catch (err) { + error.value = "Failed to create public link"; + console.error("Error making session public:", err); + } finally { + isLoading.value = false; + } +}; + // Watch for sessionId changes and make session public watch( () => props.sessionId, async (newSessionId) => { if (newSessionId && props.showDialog) { + if (props.isPublic) { + publicLink.value = `${window.location.origin}/share/${newSessionId}`; + return; + } isLoading.value = true; error.value = ""; publicLink.value = ""; @@ -224,6 +257,16 @@ watch( }, { immediate: true }, ); + +// Re-run initialization whenever the modal is opened +watch( + () => props.showDialog, + async (isOpen) => { + if (isOpen) { + await initializeShare(props.sessionId); + } + }, +);