diff --git a/frontend/src/modals/CreateAPIKeyModal.tsx b/frontend/src/modals/CreateAPIKeyModal.tsx index e59fd37e..71d86330 100644 --- a/frontend/src/modals/CreateAPIKeyModal.tsx +++ b/frontend/src/modals/CreateAPIKeyModal.tsx @@ -50,9 +50,9 @@ export default function CreateAPIKeyModal({ }; } return { - name: doc.name as string, - id: doc.docLink as string, - type: 'default', + name: doc.name, + id: doc.id ?? 'default', + type: doc.type ?? 'default', }; }) : []; diff --git a/frontend/src/models/misc.ts b/frontend/src/models/misc.ts index 71ecc084..bf77fd0b 100644 --- a/frontend/src/models/misc.ts +++ b/frontend/src/models/misc.ts @@ -5,16 +5,12 @@ export type User = { }; export type Doc = { id?: string; - location: string; name: string; - language: string; - version: string; - description: string; - fullName: string; date: string; - docLink: string; model: string; tokens?: string; + type?: string; + retriever?: string; }; export type PromptProps = { diff --git a/frontend/src/preferences/SelectDocsModal.tsx b/frontend/src/preferences/SelectDocsModal.tsx index edb2714b..f2aa4754 100644 --- a/frontend/src/preferences/SelectDocsModal.tsx +++ b/frontend/src/preferences/SelectDocsModal.tsx @@ -8,7 +8,8 @@ import { selectSourceDocs, selectSelectedDocs, } from './preferenceSlice'; -import { getDocs, Doc } from './preferenceApi'; +import { Doc } from '../models/misc'; +import { getDocs } from './preferenceApi'; export default function APIKeyModal({ modalState, @@ -75,9 +76,7 @@ export default function APIKeyModal({ {!localSelectedDocs ? (

Select

) : ( -

- {localSelectedDocs.name} {localSelectedDocs.version} -

+

{localSelectedDocs.name}

)} {isDocsListOpen && ( diff --git a/frontend/src/preferences/preferenceApi.ts b/frontend/src/preferences/preferenceApi.ts index 96f87e1d..90dbff7a 100644 --- a/frontend/src/preferences/preferenceApi.ts +++ b/frontend/src/preferences/preferenceApi.ts @@ -1,15 +1,6 @@ import conversationService from '../api/services/conversationService'; import userService from '../api/services/userService'; - -// not all properties in Doc are going to be present. Make some optional -export type Doc = { - id: string | null; - name: string; - type: string; - date: string; - model: string; - retriever: string; -}; +import { Doc } from '../models/misc'; //Fetches all JSON objects from the source. We only use the objects with the "model" property in SelectDocsModal.tsx. Hopefully can clean up the source file later. export async function getDocs(): Promise {