chore: 添加日志输出以调试图片发送流程
This commit is contained in:
@@ -390,7 +390,9 @@ export async function sendGroupImageMessage(
|
|||||||
content?: string
|
content?: string
|
||||||
): Promise<{ id: string; timestamp: string }> {
|
): Promise<{ id: string; timestamp: string }> {
|
||||||
// 先上传图片获取 file_info
|
// 先上传图片获取 file_info
|
||||||
|
console.log(`[qqbot-api] sendGroupImageMessage: uploading image from URL: ${imageUrl}`);
|
||||||
const uploadResult = await uploadGroupMedia(accessToken, groupOpenid, MediaFileType.IMAGE, imageUrl, false);
|
const uploadResult = await uploadGroupMedia(accessToken, groupOpenid, MediaFileType.IMAGE, imageUrl, false);
|
||||||
|
console.log(`[qqbot-api] sendGroupImageMessage: upload success, file_info: ${uploadResult.file_info?.slice(0, 50)}...`);
|
||||||
// 再发送富媒体消息
|
// 再发送富媒体消息
|
||||||
return sendGroupMediaMessage(accessToken, groupOpenid, uploadResult.file_info, msgId, content);
|
return sendGroupMediaMessage(accessToken, groupOpenid, uploadResult.file_info, msgId, content);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -541,6 +541,7 @@ export async function startGateway(ctx: GatewayContext): Promise<void> {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// 先发送图片(如果有)
|
// 先发送图片(如果有)
|
||||||
|
log?.info(`[qqbot:${account.accountId}] imageUrls to send: ${JSON.stringify(imageUrls)}, imageServerBaseUrl: ${imageServerBaseUrl}`);
|
||||||
for (const imageUrl of imageUrls) {
|
for (const imageUrl of imageUrls) {
|
||||||
try {
|
try {
|
||||||
await sendWithTokenRetry(async (token) => {
|
await sendWithTokenRetry(async (token) => {
|
||||||
|
|||||||
@@ -335,7 +335,9 @@ export function saveImage(
|
|||||||
|
|
||||||
// 返回访问 URL
|
// 返回访问 URL
|
||||||
const baseUrl = currentConfig.baseUrl || `http://localhost:${currentConfig.port}`;
|
const baseUrl = currentConfig.baseUrl || `http://localhost:${currentConfig.port}`;
|
||||||
return `${baseUrl}/images/${imageId}.${ext}`;
|
const resultUrl = `${baseUrl}/images/${imageId}.${ext}`;
|
||||||
|
console.log(`[image-server] saveImage: generated URL: ${resultUrl} (baseUrl: ${baseUrl})`);
|
||||||
|
return resultUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user