mirror of
https://github.com/sune-org/ORP.git
synced 2026-01-13 16:17:59 +00:00
Refactor: Handle multiple system messages for Claude
This commit is contained in:
6
index.js
6
index.js
@@ -221,8 +221,10 @@ export class MyDurableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async streamClaude({ apiKey, body }) {
|
async streamClaude({ apiKey, body }) {
|
||||||
const systemMsg = body.messages.find(m => m.role === 'system');
|
const system = body.messages
|
||||||
const system = this.extractTextFromMessage(systemMsg) || body.system;
|
.filter(m => m.role === 'system')
|
||||||
|
.map(m => this.extractTextFromMessage(m))
|
||||||
|
.join('\n\n') || body.system;
|
||||||
const payload = {
|
const payload = {
|
||||||
model: body.model,
|
model: body.model,
|
||||||
messages: body.messages.filter(m => m.role !== 'system').map(m => ({
|
messages: body.messages.filter(m => m.role !== 'system').map(m => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user