Verbose message logging only when debug = true
This commit is contained in:
@@ -250,13 +250,15 @@ app.post('/v1/messages', async (req, res) => {
|
|||||||
console.log(`[API] Request for model: ${request.model}, stream: ${!!stream}`);
|
console.log(`[API] Request for model: ${request.model}, stream: ${!!stream}`);
|
||||||
|
|
||||||
// Debug: Log message structure to diagnose tool_use/tool_result ordering
|
// Debug: Log message structure to diagnose tool_use/tool_result ordering
|
||||||
console.log('[API] Message structure:');
|
if (process.env.DEBUG) {
|
||||||
messages.forEach((msg, i) => {
|
console.log('[API] Message structure:');
|
||||||
const contentTypes = Array.isArray(msg.content)
|
messages.forEach((msg, i) => {
|
||||||
? msg.content.map(c => c.type || 'text').join(', ')
|
const contentTypes = Array.isArray(msg.content)
|
||||||
: (typeof msg.content === 'string' ? 'text' : 'unknown');
|
? msg.content.map(c => c.type || 'text').join(', ')
|
||||||
console.log(` [${i}] ${msg.role}: ${contentTypes}`);
|
: (typeof msg.content === 'string' ? 'text' : 'unknown');
|
||||||
});
|
console.log(` [${i}] ${msg.role}: ${contentTypes}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (stream) {
|
if (stream) {
|
||||||
// Handle streaming response
|
// Handle streaming response
|
||||||
|
|||||||
Reference in New Issue
Block a user