Skip to content

Commit f654bfe

Browse files
committed
more fixin
1 parent ac57aba commit f654bfe

File tree

3 files changed

+4
-14
lines changed

3 files changed

+4
-14
lines changed

e2e/chat.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ testMatrix.forEach((testConfig) => {
6161
await expect(page.getByTestId('assistant-message')).toContainText('You are calling mock endpoint for streaming mock data')
6262
})
6363

64-
test('Multiple messages work', async ({ page }) => {
64+
test.only('Multiple messages work', async ({ page }) => {
6565
await acceptDisclaimer(page)
6666
await useMockModel(page)
6767

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import useCurrentUser from '../../../hooks/useCurrentUser'
1111
import { useCreatePromptMutation, useDeletePromptMutation } from '../../../hooks/usePromptMutation'
1212
import usePrompts from '../../../hooks/usePrompts'
1313
import type { Responsebility, User } from '../../../types'
14-
import { Conversation } from '../../ChatV2/Conversation'
1514
import SystemMessage from '../../ChatV2/SystemMessage'
1615
import Rag from '../../Rag/Rag'
1716
import { formatDate, getCurTypeLabel } from '../util'
@@ -25,7 +24,6 @@ import apiClient from '../../../util/apiClient'
2524
import { ActionUserSearch } from '../../Admin/UserSearch'
2625
import { useCourseRagIndices } from '../../../hooks/useRagIndices'
2726
import RagSelector, { RagSelectorDescription } from '../../ChatV2/RagSelector'
28-
import type { ChatMessage } from '../../../../shared/chat'
2927

3028
const Course = () => {
3129
const [showTeachers, setShowTeachers] = useState(false)
@@ -326,7 +324,6 @@ const Prompts = ({ courseId, chatInstanceId }: { courseId: string; chatInstanceI
326324
const { ragIndices } = useCourseRagIndices(courseId)
327325
const [name, setName] = useState('')
328326
const [system, setSystem] = useState('')
329-
const [messages, setMessages] = useState<ChatMessage[]>([])
330327
const [hidden, setHidden] = useState(false)
331328
const [mandatory, setMandatory] = useState(false)
332329
const [ragIndexId, setRagIndexId] = useState<number | undefined>(undefined)
@@ -335,7 +332,6 @@ const Prompts = ({ courseId, chatInstanceId }: { courseId: string; chatInstanceI
335332
const deleteMutation = useDeletePromptMutation()
336333

337334
const handleReset = () => {
338-
setMessages([])
339335
setName('')
340336
setSystem('')
341337
setHidden(false)
@@ -353,7 +349,7 @@ const Prompts = ({ courseId, chatInstanceId }: { courseId: string; chatInstanceI
353349
type: 'CHAT_INSTANCE',
354350
name,
355351
systemMessage: system,
356-
messages,
352+
messages: [],
357353
hidden,
358354
mandatory,
359355
ragIndexId,
@@ -401,8 +397,6 @@ const Prompts = ({ courseId, chatInstanceId }: { courseId: string; chatInstanceI
401397

402398
<SystemMessage system={system} setSystem={setSystem} disabled={false} creation />
403399

404-
<Conversation messages={messages} completion="" toolCalls={{}} isStreaming={false} setActiveToolResult={(_d) => {}} />
405-
406400
<Box sx={{ py: 2, display: 'flex', alignItems: 'start' }}>
407401
{!mandatoryPromptId ? (
408402
<FormControlLabel

src/server/routes/ai/v3.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,12 @@ router.post('/stream', upload.single('file'), async (r, res) => {
109109

110110
if (generationInfo.promptInfo.type === 'saved') {
111111
prompt = await Prompt.findByPk(generationInfo.promptInfo.id, {
112+
...(course ? { where: { chatInstanceId: course.id } } : {}),
112113
include: [
113-
{
114-
model: ChatInstance,
115-
attributes: ['id'],
116-
as: 'chatInstance',
117-
where: courseId ? { courseId } : {},
118-
},
119114
{
120115
model: RagIndex,
121116
as: 'ragIndex',
117+
required: false,
122118
},
123119
],
124120
})

0 commit comments

Comments
 (0)