Update error toast when user tries to drop open file into chat window
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 84/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Mở application/single_app/static/js/chat/chat-input-actions.js và theo dõi luồng tải lên bằng thao tác kéo và thả, đặc biệt là uploadFileToConversation và phần xử lý lỗi của nó. So sánh với hành vi tải lên bằng kẹp giấy, sau đó xác minh rằng khi thả một tệp không thể đọc hoặc bị khóa từ bên ngoài, một toast cụ thể và có thể thực hiện hành động sẽ được hiển thị, trong khi các lần tải lên thông thường vẫn hoàn tất thành công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
When a user tries to drop a file that's open in another app into the chat window, a vague error toast pops up in the upper right that doesn't provide enough information.
Trying to upload the same file via the paperclip icon provides much more helpful error:
Suggested fix - make changes similar to the below to application/single_app/static/js/chat/chat-input-actions.js to give the user a clearer message about what went wrong.)
More helpful error message:
New async function
const fileName = String(file?.name || "selected file").trim() || "selected file";
try {
await file.slice(0, Math.min(file.size, 1)).arrayBuffer();
} catch (error) {
throw new Error(
`The browser could not read "${fileName}". Close the file in other apps then try again.`
);
}
}
Updated uploadFileToConversation function:
export async function uploadFileToConversation(file) {
let uploadingIndicatorEl = null;
try {
await ensureUploadFileIsReadable(file);
const groupUploadContext = await resolveGroupUploadContext();
uploadingIndicatorEl = showFileUploadingMessage();
// Update the file button to show "Uploading..." state
const fileBtn = document.getElementById("choose-file-btn");
if (fileBtn) {
const fileBtnText = fileBtn.querySelector(".file-btn-text");
if (fileBtnText) {
fileBtnText.textContent = "Uploading...";
}
}
const formData = new FormData();
formData.append("file", file);
formData.append("conversation_id", currentConversationId);
if (groupUploadContext) {
formData.append("group_upload_target_id", groupUploadContext.selectedGroupId);
groupUploadContext.groupIds.forEach((groupId) => {
formData.append("upload_scope_group_ids", groupId);
});
}
let response;
try {
response = await fetch("/upload", {
method: "POST",
body: formData,
});
} catch (error) {
if (error instanceof TypeError) {
const fileName = String(file?.name || "selected file").trim() || "selected file";
throw new Error(
`The browser could not upload "${fileName}". The file may be open in another app, unavailable from cloud storage, or the network connection may have been interrupted. Ensure the file is closed and then try again.`
);
}
throw error;
}
hideFileUploadingMessage(uploadingIndicatorEl);
uploadingIndicatorEl = null;
const data = await response.json();
if (!response.ok) {
console.error("Upload failed:", data.error || "Unknown error");
throw new Error(data.error || "Upload failed");
}
if (data.conversation_id) {
const uploadedConversationId = data.conversation_id;
currentConversationId = uploadedConversationId;
window.currentConversationId = uploadedConversationId;
// If a title was returned and it's different from "New Conversation",
// update the conversation title in the UI
if (data.title && data.title !== "New Conversation") {
const currentConversationTitleEl = document.getElementById("current-conversation-title");
if (currentConversationTitleEl) {
currentConversationTitleEl.textContent = data.title;
}
}
const isCollaborationUpload = Boolean(
data.is_collaboration_upload
|| window.chatCollaboration?.isCollaborationConversation?.(uploadedConversationId)
);
const loadMessagesPromise = isCollaborationUpload && window.chatCollaboration?.activateConversation
? window.chatCollaboration.activateConversation(uploadedConversationId)
: loadMessages(uploadedConversationId);
if (data.workspace_document_id) {
registerConversationTaskDocument({
...(data.workspace_document || {}),
id: data.workspace_document_id,
conversation_id: uploadedConversationId,
scope: data.workspace_scope,
status: data.workspace_document?.status || 'Queued for processing',
percentage_complete: data.workspace_document?.percentage_complete || 0,
ready: false,
});
activateUserWorkspaceContextForChatUpload();
Promise.resolve(loadMessagesPromise).finally(() => {
watchChatWorkspaceUploadDocument(data.workspace_document_id, {
autoSelect: true,
workspaceScope: data.workspace_scope,
groupId: data.workspace_document?.group_id || data.group_upload_target?.id || null,
});
});
}
loadConversations();
} else {
console.error("No conversation_id returned from server.");
showToast("Error: No conversation ID returned from server.", "danger");
}
resetFileButton();
} catch (error) {
console.error("Error:", error);
if (!error.isUploadSelectionCancelled) {
showToast("Error uploading file: " + error.message, "danger");
}
resetFileButton();
if (uploadingIndicatorEl) {
hideFileUploadingMessage(uploadingIndicatorEl);
}
}
}
- Ngôn ngữ chính
- Python
- Star
- 157
- Fork
- 117
- Merge trung bình
- 3 giờ 6 phút
- Pull request đã merge (30 ngày)
- 219
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/simplechat
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
microsoft/simplechat#1370 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Fix mixed-source chat excerpt truncation, default system prompt suppression, bracketed citations, and Semantic Ranker quota fallbackCó thể đã có người làm @paullizer đã nhận hôm nay. Đang mởbug P1
microsoft/simplechat#1855 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add support for extracting comments from Word documents (.docx, .docm, .doc, .dotx)Có thể đã có người làm @paullizer đã nhận 2 ngày trước. Đang mởenhancement P2
microsoft/simplechat#1850 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
V2: Preserve explicit reasoning None across existing tool pathsCó thể đã có người làm @paullizer đã nhận 2 ngày trước. Đang mởbug P1
microsoft/simplechat#1846 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
V2: Make Azure OpenAI v1 routing and API-version guidance consistentCó thể đã có người làm @paullizer đã nhận 2 ngày trước. Đang mởbug P1
microsoft/simplechat#1845 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microsoft/simplechat
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Graphify-Labs/graphify#4860 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
:bug: Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
scikit-image/scikit-image#8377 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Ingredient import validation accepts negative nutrient values and NaNCó thể đã có người làm @LukeSekai đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
wger-project/wger#2564 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
apache/ponymail-foal#351 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 4 ngày