fix: content parts

This commit is contained in:
ikechan8370 2024-01-17 13:12:56 +08:00
parent 37d1d04de6
commit c551aeec1d
2 changed files with 9 additions and 9 deletions

View file

@ -120,7 +120,7 @@ export class ChatGLM4Client extends BaseClient {
}
}
let content = partialResponse?.content[0]
if (content.type === 'image' && content.status === 'finish') {
if (content?.type === 'image' && content?.status === 'finish') {
image = content.image[0].image_url
}
if (convoResponseEvent.status === 'finish') {

View file

@ -2,16 +2,16 @@ import { ChatGLM4Client } from '../ChatGLM4Client.js'
async function sendMsg () {
const client = new ChatGLM4Client({
refreshToken: '',
refreshToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTcwNTQ2NjMwMywianRpIjoiOTc2OGVlMzAtNDIxZS00Nzk2LWIxN2UtYjc0MDA3NmFhMGUyIiwidHlwZSI6InJlZnJlc2giLCJzdWIiOiJhNWRiZDcyOTMwYWY0ZWY0YjVjZDBiM2M2YzBkNzRmZiIsIm5iZiI6MTcwNTQ2NjMwMywiZXhwIjoxNzIxMDE4MzAzLCJ1aWQiOiI2NWE3M2ExNmVmNjQ2ZWIxODA2OGY3ODAiLCJ1cGxhdGZvcm0iOiJoNSIsInJvbGVzIjpbInVuYXV0aGVkX3VzZXIiXX0.vlxSwm7pXaFT6v9jNJ0IlTButLx8n4tIkKhF_d7Jvww',
debug: true
})
let res = await client.sendMessage('你好啊')
console.log(res)
}
// global.redis = null
// global.logger = {
// info: console.log,
// warn: console.warn,
// error: console.error
// }
// sendMsg()
global.redis = null
global.logger = {
info: console.log,
warn: console.warn,
error: console.error
}
sendMsg()