Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"lint": "eslint 'src/**/*.{ts,vue}'",
"test": "vitest",
"test-ci": "vitest --run",
"prepublishOnly": "npm run build"
"prepublishOnly": "npm run build",
"prepare": "npm run build"
},
"peerDependencies": {
"vue": "^3.0.4"
Expand Down
40 changes: 27 additions & 13 deletions src/components/chat/ChatInterface.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"
@session-click="handleSessionClick"
@collection-click="handleCollectionClick"
@share-session="handleShareSession"
/>

<!-- Main Content -->
Expand Down Expand Up @@ -472,6 +471,10 @@ const props = defineProps({
type: Boolean,
default: true,
},
customCanvasHandlers: {
type: Array,
default: () => [],
},
});
const emit = defineEmits([]);

Expand Down Expand Up @@ -563,7 +566,7 @@ watch(chatAttachments, async (newAttachments) => {
throw Error("Upload failed");
}
} catch (e) {
console.log("something went wrong", e);
console.error("something went wrong", e);
attachment.upload_status = "error";
}
}
Expand All @@ -579,6 +582,14 @@ registerMessageHandler("meeting_recorder", MeetingRecorder);

registerCanvasHandler("meeting_recorder", MeetingRecorderCanvas);

if (Array.isArray(props.customCanvasHandlers)) {
for (const handler of props.customCanvasHandlers) {
if (handler && handler.type && handler.component) {
registerCanvasHandler(handler.type, handler.component);
}
}
}

const isStaticPage = ref(false);
const chatWindowRef = ref(null);
const headerRef = ref(null);
Expand Down Expand Up @@ -729,20 +740,28 @@ watch(
{ immediate: true },
);

const scrollToBottom = () => {
const scrollToLatestUserMessage = () => {
const chatWindow = chatWindowRef.value;
if (!chatWindow) return;

nextTick(() => {
chatWindow.scroll({
top: chatWindow.scrollHeight,
behavior: "smooth",
});
const userMessages = chatWindow.querySelectorAll('[data-msg-type="input"]');

if (userMessages.length > 0) {
const latestUserMessage = userMessages[userMessages.length - 1];

latestUserMessage.scrollIntoView({
behavior: "smooth",
block: "start",
inline: "nearest",
});
}
});
};

watch(chatLoading, (val) => {
if (val) {
scrollToBottom();
scrollToLatestUserMessage();
}
});

Expand Down Expand Up @@ -814,11 +833,6 @@ const handleUpdateSessionName = async ({ sessionId: _sessionId, name }) => {
}
};

const handleShareSession = (session) => {
sessionToShare.value = session;
showShareModal.value = true;
};

// --- Upload Dialog Handlers ---
const showUploadDialog = ref(false);
const handleUpload = async (uploadData) => {
Expand Down
3 changes: 2 additions & 1 deletion src/components/chat/ChatMessage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
:class="[
'vdb-c-flex vdb-c-h-auto vdb-c-w-full vdb-c-justify-start vdb-c-py-8 md:vdb-c-py-12',
{
'vdb-c-border-b vdb-c-border-kilvish-300 vdb-c-bg-white': isUser,
'user-message vdb-c-border-b vdb-c-border-kilvish-300 vdb-c-bg-white':
isUser,
},
]"
>
Expand Down
6 changes: 3 additions & 3 deletions src/components/chat/ChatMessageContainer.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<div
class="vdb-c-relative vdb-c-h-auto vdb-c-w-full"
>
<div class="vdb-c-relative vdb-c-h-auto vdb-c-w-full">
<div
v-for="(message, i) in messages"
:key="message.msg_id"
class="vdb-c-w-full"
:data-msg-id="message.msg_id"
:data-msg-type="message.msg_type"
>
<chat-message
:message="message"
Expand Down
2 changes: 0 additions & 2 deletions src/components/chat/elements/DefaultScreen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,6 @@ const props = defineProps({
},
});

console.log(props.isContentLoading, props.previewMedia);

const collectionName = computed(() => props.collectionData?.name);

defineEmits([
Expand Down
14 changes: 0 additions & 14 deletions src/components/chat/elements/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,6 @@
>Rename</span
>
</button>
<button
@click.stop="shareSession(session)"
class="vdb-c-mb-[2.5px] vdb-c-flex vdb-c-w-full vdb-c-items-center vdb-c-gap-8 vdb-c-rounded-lg vdb-c-px-12 vdb-c-py-8 hover:vdb-c-bg-roy"
>
<ShareIcon />
<span class="vdb-c-text-sm vdb-c-text-black"
>Share</span
>
</button>
<div
class="vdb-c-my-2 vdb-c-mb-[2.5px] vdb-c-h-px vdb-c-bg-[#EDEDED]"
></div>
Expand Down Expand Up @@ -525,7 +516,6 @@ const emit = defineEmits([
"create-collection",
"delete-collection",
"update-session-name",
"share-session",
]);

const closeSidebar = () => {
Expand Down Expand Up @@ -641,10 +631,6 @@ const copySessionId = async (sessionId) => {
console.error("Failed to copy session ID", error);
}
};

const shareSession = (session) => {
emit("share-session", session);
};
</script>

<style>
Expand Down
24 changes: 1 addition & 23 deletions src/components/hooks/useVideoDBAgent.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,31 +191,9 @@ export function useVideoDBAgent(config) {
const makeSessionPublic = async (sessionId, isPublic = true) => {
const res = {};
try {
const response = await fetch(`${httpUrl}/session/${sessionId}/public`, {
method: "PUT",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({ is_public: isPublic }),
});

if (!response.ok) {
throw new Error("Network response was not ok");
}

const data = await response.json();
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,
};
}
res.data = {};
} catch (error) {
res.status = "error";
res.success = false;
Expand Down