From d519534c7d0848effaa89e9d7909fa7f961c5064 Mon Sep 17 00:00:00 2001 From: geoffsee <> Date: Tue, 27 May 2025 13:39:46 -0400 Subject: [PATCH] Refactor store exports and cleanup unused code. Removed the centralized store export file to streamline dependencies and replaced indirect imports with direct ones for better maintainability. Additionally, eliminated unused views in `ClientChatStore` and commented out redundant code in the assistant SDK. --- src/stores/ClientChatStore.ts | 8 ++------ src/stores/index.ts | 15 --------------- workers/site/sdk/assistant-sdk.ts | 22 +++++++++++----------- 3 files changed, 13 insertions(+), 32 deletions(-) delete mode 100644 src/stores/index.ts diff --git a/src/stores/ClientChatStore.ts b/src/stores/ClientChatStore.ts index e61dd09..16ea043 100644 --- a/src/stores/ClientChatStore.ts +++ b/src/stores/ClientChatStore.ts @@ -2,7 +2,7 @@ import { applySnapshot, flow, Instance, types } from "mobx-state-tree"; import Message from "../models/Message"; import Attachment from "../models/Attachment"; import IntermediateStep from "../models/IntermediateStep"; -import { UserOptionsStore } from "./index"; +import UserOptionsStore from "./UserOptionsStore"; const ClientChatStore = types .model("ClientChatStore", { @@ -15,11 +15,6 @@ const ClientChatStore = types tools: types.optional(types.array(types.string), []), intermediateSteps: types.array(IntermediateStep), }) - .views((self) => ({ - get getModel() { - return self.model; - }, - })) .actions((self) => ({ cleanup() { if (self.eventSource) { @@ -321,6 +316,7 @@ const ClientChatStore = types })); export type IMessage = Instance; + export type IClientChatStore = Instance; export default ClientChatStore.create(); diff --git a/src/stores/index.ts b/src/stores/index.ts deleted file mode 100644 index f02c5ff..0000000 --- a/src/stores/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import AppMenuStore from "./AppMenuStore"; -import ClientChatStore from "./ClientChatStore"; -import ClientFeedbackStore from "./ClientFeedbackStore"; -import ClientTransactionStore from "./ClientTransactionStore"; -import FileUploadStore from "./FileUploadStore"; -import UserOptionsStore from "./UserOptionsStore"; - -export { - AppMenuStore, - ClientChatStore, - ClientFeedbackStore, - ClientTransactionStore, - FileUploadStore, - UserOptionsStore, -}; diff --git a/workers/site/sdk/assistant-sdk.ts b/workers/site/sdk/assistant-sdk.ts index d9885b9..010e661 100644 --- a/workers/site/sdk/assistant-sdk.ts +++ b/workers/site/sdk/assistant-sdk.ts @@ -23,17 +23,17 @@ export class AssistantSdk { const now = new Date(); const formattedMinutes = String(now.getMinutes()).padStart(2, "0"); const currentTime = `${now.getHours()}:${formattedMinutes} ${now.getSeconds()}s`; - const toolsInfo = - tools - .map((tool) => { - switch (tool) { - // case "user-attachments": return "### Attachments\nUser supplied attachments are normalized to text and will have this header (# Attachment:...) in the message."; - // case "web-search": return "### Web Search\nResults are optionally available in 'Live Search'."; - default: - return `- ${tool}`; - } - }) - .join("\n\n") || "- No additional tools selected."; + // const toolsInfo = + // tools + // .map((tool) => { + // switch (tool) { + // // case "user-attachments": return "### Attachments\nUser supplied attachments are normalized to text and will have this header (# Attachment:...) in the message."; + // // case "web-search": return "### Web Search\nResults are optionally available in 'Live Search'."; + // default: + // return `- ${tool}`; + // } + // }) + // .join("\n\n") || "- No additional tools selected."; return `# Assistant Knowledge ## Current Context