Skip to content

Commit 8d8e3ae

Browse files
committed
fix: prompt editor rag selector broken
1 parent 09e5b79 commit 8d8e3ae

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

src/client/components/Courses/Course/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ const AssignedResponsibilityManagement = ({ responsibility, handleRemove }) => {
339339

340340
const Prompts = ({ courseId, chatInstanceId }: { courseId: string; chatInstanceId: string }) => {
341341
const { t } = useTranslation()
342-
const { ragIndices } = useCourseRagIndices(courseId)
342+
const { ragIndices } = useCourseRagIndices(chatInstanceId)
343343

344344
const { prompts, isLoading: promptsLoading } = usePrompts(courseId)
345345

src/client/components/Prompt/PromptEditor.tsx

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -115,23 +115,16 @@ export const PromptEditor = ({ prompt, ragIndices, type, chatInstanceId }: Promp
115115

116116
<FormControl fullWidth margin="normal">
117117
<InputLabel>{t('rag:sourceMaterials')}</InputLabel>
118-
{ragIndices && (
119-
<Select
120-
data-testid="rag-select"
121-
value={ragIndexId || ''}
122-
onChange={(e) => setRagIndexId(e.target.value ? Number(e.target.value) : undefined)}
123-
disabled={ragIndices === undefined || ragIndices.length === 0}
124-
>
125-
<MenuItem value="" data-testid="no-source-materials">
126-
<em>{t('prompt:noSourceMaterials')}</em>
118+
<Select data-testid="rag-select" value={ragIndexId || ''} onChange={(e) => setRagIndexId(e.target.value ? Number(e.target.value) : undefined)}>
119+
<MenuItem value="" data-testid="no-source-materials">
120+
<em>{t('prompt:noSourceMaterials')}</em>
121+
</MenuItem>
122+
{ragIndices?.map((index) => (
123+
<MenuItem key={index.id} value={index.id} data-testid={`source-material-${index.metadata.name}`}>
124+
{index.metadata.name}
127125
</MenuItem>
128-
{ragIndices?.map((index) => (
129-
<MenuItem key={index.id} value={index.id} data-testid={`source-material-${index.metadata.name}`}>
130-
{index.metadata.name}
131-
</MenuItem>
132-
))}
133-
</Select>
134-
)}
126+
))}
127+
</Select>
135128
</FormControl>
136129
<FormControl fullWidth margin="normal">
137130
<InputLabel>{t('common:model')}</InputLabel>

0 commit comments

Comments
 (0)