Update error toast when user tries to drop open file into chat window
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 84/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- javascript
- Área
- frontend
Línea de trabajo
Abre application/single_app/static/js/chat/chat-input-actions.js y sigue la ruta de carga mediante arrastrar y soltar, especialmente uploadFileToConversation y su gestión de errores. Compárala con el comportamiento de carga mediante el clip y verifica que soltar un archivo ilegible o bloqueado externamente muestre un toast específico y accionable, mientras que las cargas normales sigan completándose correctamente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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);
}
}
}
- Lenguaje dominante
- Python
- Estrellas
- 157
- Forks
- 117
- Merge medio
- 4 h 3 min
- PR fusionados (30 d)
- 217
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/simplechat
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
microsoft/simplechat#1370 ·
Los mantenedores suelen responder en 1 día
-
Stale activeGroupOid after group removal interrupts chat in legacy and React V2Posiblemente ocupada @paullizer la tomó hace 1 día. Abiertobug P1
microsoft/simplechat#1816 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Simple Chat - NLRAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
microsoft/simplechat#1804 ·
Los mantenedores suelen responder en 1 día
-
Simple Chat - NLRAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
microsoft/simplechat#1803 ·
Los mantenedores suelen responder en 1 día
-
V2: triage multi-turn UI failures and make saved-memory orchestration validation reliablePosiblemente ocupada @paullizer la tomó hace 3 días. Abiertobug P1
microsoft/simplechat#1785 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/simplechat
Issues similares
-
Python Volcengine provider returns failures instead of raising themPosiblemente ocupada @Ricardo-M-L la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
agent-infra/sandbox#248 ·
-
Textractor leaves empty temporary files when remote retrieval failsPosiblemente ocupada @HuaTNA la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
test(bm_generation): pin the learning parameters and CPU sync shortcutPosiblemente ocupada @iloveeyjafjalla la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
qboson/kaiwu-pytorch-plugin#1341 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
elder-plinius/V3R1T4S#625 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
foxglove/mcap#1907 · 1 comentario ·
Los mantenedores suelen responder en 1 día