Remove file upload functionality and related components

The `FileUploadStore` and all file upload features were removed, simplifying the chat interface. This change eliminates unused code, including file handling logic, attachment management, and UI elements, streamlining the application.
This commit is contained in:
geoffsee
2025-05-27 14:15:12 -04:00
committed by Geoff Seemueller
parent c04e19611e
commit 47272ba350
13 changed files with 105 additions and 302 deletions

View File

@@ -1,6 +0,0 @@
import { types } from "mobx-state-tree";
export default types.model("Attachment", {
content: types.string,
url: types.string,
});

View File

@@ -1,6 +1,5 @@
import { applySnapshot, flow, Instance, types } from "mobx-state-tree";
import Message from "../models/Message";
import IntermediateStep from "../models/IntermediateStep";
import UserOptionsStore from "./UserOptionsStore";
const ClientChatStore = types
@@ -10,8 +9,6 @@ const ClientChatStore = types
isLoading: types.optional(types.boolean, false),
model: types.optional(types.string, "llama-3.3-70b-versatile"),
imageModel: types.optional(types.string, "black-forest-labs/flux-1.1-pro"),
tools: types.optional(types.array(types.string), []),
intermediateSteps: types.array(IntermediateStep),
})
.actions((self) => ({
cleanup() {
@@ -39,7 +36,6 @@ const ClientChatStore = types
const payload = {
messages: self.messages.slice(),
model: self.model,
tools: self.tools.slice(),
};
yield new Promise((resolve) => setTimeout(resolve, 500));
@@ -96,8 +92,6 @@ const ClientChatStore = types
self.appendToLastMessage(
parsedData.data.choices[0]?.delta?.content || "",
);
} else {
self.handleIntermediateSteps(parsedData);
}
} catch (error) {
console.error("Error processing stream:", error);
@@ -160,7 +154,6 @@ const ClientChatStore = types
const payload = {
messages: self.messages.slice(),
model: self.model,
tools: self.tools.slice(),
};
const response = yield fetch("/api/chat", {
@@ -211,8 +204,6 @@ const ClientChatStore = types
self.appendToLastMessage(
parsedData.data.choices[0]?.delta?.content || "",
);
} else {
self.handleIntermediateSteps(parsedData);
}
} catch (error) {
console.error("Error processing stream:", error);
@@ -240,31 +231,11 @@ const ClientChatStore = types
reset() {
applySnapshot(self, {});
},
addIntermediateStep(stepData) {
return;
},
handleIntermediateSteps(eventData: any) {
try {
self.appendToLastMessage(eventData?.data.trim() + "\n");
self.addIntermediateStep({
kind: eventData.type,
data: eventData.data,
});
} catch (e) {}
},
removeMessagesAfter(index: number) {
if (index >= 0 && index < self.messages.length) {
self.messages.splice(index + 1);
}
},
setTools(tools: string[]) {
self.tools.clear();
self.tools.push(...tools);
},
getTools() {
return self.tools.slice();
},
updateLastMessage(content: string) {
if (self.messages.length > 0) {
self.messages[self.messages.length - 1].content = content;