Skip to content

Commit 65ec6b2

Browse files
Update src/services/apis/openai-api.mjs
Co-authored-by: Copilot <[email protected]>
1 parent 79d378e commit 65ec6b2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/services/apis/openai-api.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,11 @@ export async function generateAnswersWithChatgptApiCompat(
130130
false,
131131
)
132132

133-
// Filter out system messages for reasoning models (only user and assistant are allowed)
133+
// Always filter out system messages; for reasoning models, only allow user and assistant
134+
const promptWithoutSystem = prompt.filter((msg) => msg.role !== 'system')
134135
const filteredPrompt = isReasoningModel
135-
? prompt.filter((msg) => msg.role === 'user' || msg.role === 'assistant')
136-
: prompt
136+
? promptWithoutSystem.filter((msg) => msg.role === 'user' || msg.role === 'assistant')
137+
: promptWithoutSystem
137138

138139
filteredPrompt.push({ role: 'user', content: question })
139140

0 commit comments

Comments
 (0)