Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
8878e23
feat: add functionality to upload documents in chat
Dakai Oct 5, 2024
9de7a9e
style(app): update styles in chat module
Dakai Oct 5, 2024
4f978d3
style: fix indentation in Chat component
Dakai Oct 5, 2024
05b16f5
style(chat.module.scss): improve styling for chat module components
Dakai Oct 5, 2024
83f9482
style: fix formatting issues in chat.tsx
Dakai Oct 5, 2024
10f6ef0
refactor(api): update file_url field in MultimodalContent interface
Dakai Oct 5, 2024
f9e4f02
feat: add UploadFile interface for handling file uploads
Dakai Oct 5, 2024
e33758e
style: improve code formatting in chat module styles
Dakai Oct 5, 2024
cc4b565
Merge remote-tracking branch 'upstream/main' into upload_doc
Dakai Oct 5, 2024
4acc742
remove testing purpose code
Dakai Oct 5, 2024
586c4a4
refactor: refactor token counting logic in countTokens function
Dakai Oct 6, 2024
83cf5f0
style: fix formatting in api.ts and chat.ts files
Dakai Oct 6, 2024
52885df
style: improve code formatting in chat.tsx file
Dakai Oct 6, 2024
1f2dea4
style(app/components/chat.tsx): improve code formatting for easier re…
Dakai Oct 6, 2024
e6ef10e
refactor(client): update file handling in file upload functions
Dakai Oct 6, 2024
32045e9
Merge branch 'ChatGPTNextWeb:main' into upload_doc
Dakai Oct 6, 2024
e86a390
fix: throw error instead of returning empty string when reading file …
Dakai Oct 6, 2024
40947a5
refactor: improve URL validation in readFileContent
Dakai Feb 6, 2025
f6ebb19
docs: add documentation for countTokens function
Dakai Feb 6, 2025
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
13 changes: 12 additions & 1 deletion app/client/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,22 @@ export const TTSModels = ["tts-1", "tts-1-hd"] as const;
export type ChatModel = ModelType;

export interface MultimodalContent {
type: "text" | "image_url";
type: "text" | "image_url" | "file_url";
text?: string;
image_url?: {
url: string;
};
file_url?: {
url: string;
name: string;
tokenCount?: number;
};
}

export interface UploadFile {
name: string;
url: string;
tokenCount?: number;
}

export interface RequestMessage {
Expand Down
118 changes: 116 additions & 2 deletions app/components/chat.module.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
@import "../styles/animation.scss";

.attach-images {
.attachments {
position: absolute;
left: 30px;
bottom: 32px;
display: flex;
flex-direction: row;
}

.attach-images {
//position: absolute;
//left: 30px;
//bottom: 32px;
display: flex;
}

.attach-image {
Expand Down Expand Up @@ -42,6 +50,86 @@
}
}

.attach-files {
//position: absolute;
//left: 30px;
//bottom: 32px;
display: flex;
flex-direction: column;
//row-gap: 11px;
max-height: 64px;
}

.attach-file {
cursor: default;
display: flex;
flex-direction: row;
column-gap: 4px;
justify-content: flex-start;
color: var(--black);
font-size: 14px;
border-radius: 5px;
margin-right: 10px;

%attach-file-name-common {
display:flex;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;

}
.attach-file-name-full {
@extend %attach-file-name-common;
max-width:calc(62vw);
}

.attach-file-name-half {
@extend %attach-file-name-common;
max-width:calc(45vw);
}

.attach-file-name-less {
@extend %attach-file-name-common;
max-width:calc(28vw);
}

.attach-file-name-min {
@extend %attach-file-name-common;
max-width:calc(12vw);
}
.attach-file-icon {
min-width: 16px;
max-width: 16px;
}

.attach-file-icon:hover {
opacity: 0;
}

.attach-image-mask {
width: 100%;
height: 100%;
opacity: 0;
transition: all ease 0.2s;
position: absolute;
}

.attach-image-mask:hover {
opacity: 1;
}
Comment thread
Dakai marked this conversation as resolved.

.delete-image {
width: 16px;
height: 20px;
cursor: pointer;
border-radius: 5px;
float: left;
background-color: var(--white);
}
Comment thread
Dakai marked this conversation as resolved.
}



.chat-input-actions {
display: flex;
flex-wrap: wrap;
Expand Down Expand Up @@ -471,6 +559,32 @@
border: rgba($color: #888, $alpha: 0.2) 1px solid;
}

.chat-message-item-files {
width: 100%;
display: flex;
flex-direction: column;
row-gap: 10px;
flex-wrap: wrap;
margin-top: 10px;
}

.chat-message-item-file {
display: flex;
flex-direction: row;
column-gap: 6px;

}
.chat-message-item-file-icon {
max-width: 16px;
}

.chat-message-item-file-name {
max-width:100%;
}





@media only screen and (max-width: 600px) {
$calc-image-width: calc(100vw/3*2/var(--image-count));
Expand Down Expand Up @@ -693,4 +807,4 @@
.shortcut-key span {
font-size: 12px;
color: var(--black);
}
}
Loading