Make Groq happier
| @@ -97,8 +97,6 @@ router.post('/caption-image', jsonParser, async (request, response) => { | ||
| 97 | 97 | excludeKeysByYaml(body, request.body.custom_exclude_body); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - console.debug('Multimodal captioning request', body); | |
| 101 | - | |
| 102 | 100 | let apiUrl = ''; |
| 103 | 101 | |
| 104 | 102 | if (request.body.api === 'openrouter') { |
| @@ -124,6 +122,9 @@ router.post('/caption-image', jsonParser, async (request, response) => { | ||
| 124 | 122 | |
| 125 | 123 | if (request.body.api === 'groq') { |
| 126 | 124 | apiUrl = 'https://api.groq.com/openai/v1/chat/completions'; |
| 125 | + if (body.messages?.[0]?.role === 'system') { | |
| 126 | + body.messages[0].role = 'user'; | |
| 127 | + } | |
| 127 | 128 | } |
| 128 | 129 | |
| 129 | 130 | if (request.body.api === 'mistral') { |
| @@ -153,6 +154,7 @@ router.post('/caption-image', jsonParser, async (request, response) => { | ||
| 153 | 154 | } |
| 154 | 155 | |
| 155 | 156 | setAdditionalHeaders(request, { headers }, apiUrl); |
| 157 | + console.debug('Multimodal captioning request', body); | |
| 156 | 158 | |
| 157 | 159 | const result = await fetch(apiUrl, { |
| 158 | 160 | method: 'POST', |