diff --git a/src/containers/Assistants/AssistantOptions/AssistantOptions.tsx b/src/containers/Assistants/AssistantOptions/AssistantOptions.tsx index 8b9788b66..92b575fbb 100644 --- a/src/containers/Assistants/AssistantOptions/AssistantOptions.tsx +++ b/src/containers/Assistants/AssistantOptions/AssistantOptions.tsx @@ -41,8 +41,10 @@ export const AssistantOptions = ({ currentId, options, setOptions }: AssistantOp const { refetch, data } = useQuery(GET_ASSISTANT_FILES, { variables: { assistantId: currentId }, onCompleted: ({ assistant }) => { - const attachedFiles = assistant.assistant.vectorStore.files; - setFiles([...files, ...attachedFiles.map((item: any) => ({ ...item, attached: true }))]); + if (assistant.assistant.vectorStore) { + const attachedFiles = assistant.assistant.vectorStore.files; + setFiles([...files, ...attachedFiles.map((item: any) => ({ ...item, attached: true }))]); + } }, });