mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 06:42:03 +00:00
fix: add scrolling to user messages and validate file uploads
- Limit user message height to 15vh with hidden scrollbar - Show notice for unsupported file types instead of silently failing - Extract file type check to prevent invalid MIME type lookups
This commit is contained in:
parent
47ce3e5c88
commit
562ab8d036
2 changed files with 16 additions and 3 deletions
|
|
@ -384,9 +384,15 @@
|
|||
}
|
||||
|
||||
.message-text-user {
|
||||
margin: var(--size-4-2);
|
||||
max-height: 15vh;
|
||||
overflow: scroll;
|
||||
padding-top: var(--size-4-2);
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.message-text-user::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.conversation-empty-state {
|
||||
margin: auto;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { Exception } from "Helpers/Exception";
|
||||
import { isSearchTriggerElement } from "../Enums/SearchTrigger";
|
||||
import { Attachment } from "Conversations/Attachment";
|
||||
import { arrayBufferToBase64 } from "obsidian";
|
||||
import { arrayBufferToBase64, Notice } from "obsidian";
|
||||
import { FileTypeToMimeType } from "Enums/FileTypeMimeTypeMapping";
|
||||
import * as path from "path-browserify";
|
||||
import { pathExtname } from "Helpers/Helpers";
|
||||
|
|
@ -37,9 +37,16 @@ export class InputService {
|
|||
if (files) {
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = files[i];
|
||||
const fileType = toFileType(pathExtname(file.name))
|
||||
|
||||
if (fileType === FileType.UNKNOWN) {
|
||||
new Notice(`Unsupported file '${file.name}'`);
|
||||
continue;
|
||||
}
|
||||
|
||||
attachments.push(new Attachment(
|
||||
file.name,
|
||||
FileTypeToMimeType[toFileType(pathExtname(file.name))],
|
||||
FileTypeToMimeType[fileType],
|
||||
arrayBufferToBase64(await file.arrayBuffer())
|
||||
));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue