Update
This commit is contained in:
@@ -84,7 +84,8 @@ async function handleGenerate({ text, lang, tone, angle }, tabId) {
|
|||||||
action: 'SHOW_RESULT',
|
action: 'SHOW_RESULT',
|
||||||
comment: data.comment || data.text || JSON.stringify(data),
|
comment: data.comment || data.text || JSON.stringify(data),
|
||||||
model: data.model || '',
|
model: data.model || '',
|
||||||
commentTransVi: data.commentTransVi || ''
|
commentTransVi: data.commentTransVi || '',
|
||||||
|
commentTransModel: data.commentTransModel || '',
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
await chrome.tabs.sendMessage(tabId, { action: 'SHOW_ERROR', error: err.message }).catch(() => {});
|
await chrome.tabs.sendMessage(tabId, { action: 'SHOW_ERROR', error: err.message }).catch(() => {});
|
||||||
|
|||||||
@@ -102,7 +102,7 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (req.action === 'SHOW_RESULT') {
|
if (req.action === 'SHOW_RESULT') {
|
||||||
showResult(req.comment, req.model, req.commentTransVi);
|
showResult(req.comment, req.model, req.commentTransVi, req.commentTransModel);
|
||||||
sendResponse({ ok: true });
|
sendResponse({ ok: true });
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -584,7 +584,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===== SHOW RESULT / ERROR =====
|
// ===== SHOW RESULT / ERROR =====
|
||||||
function showResult(comment, model='', transVi='') {
|
function showResult(comment, model='', transVi='', transByModal = '') {
|
||||||
if (!sidebarHost) return;
|
if (!sidebarHost) return;
|
||||||
const s = sidebarHost.shadowRoot;
|
const s = sidebarHost.shadowRoot;
|
||||||
const statusEl = s.querySelector('#ai-status');
|
const statusEl = s.querySelector('#ai-status');
|
||||||
@@ -609,7 +609,7 @@
|
|||||||
transViEl.textContent = '';
|
transViEl.textContent = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (copyHint) { copyHint.style.display = 'block'; copyHint.textContent = model || '📋 Copy kết quả và dán vào ô reply!'; }
|
if (copyHint) { copyHint.style.display = 'block'; copyHint.textContent = `W:${model} - T:${transByModal}` || '📋 Copy kết quả và dán vào ô reply!'; }
|
||||||
if (runBtn) runBtn.disabled = false;
|
if (runBtn) runBtn.disabled = false;
|
||||||
if (drawer) drawer.classList.add('open');
|
if (drawer) drawer.classList.add('open');
|
||||||
if (typingOpts) typingOpts.classList.add('visible');
|
if (typingOpts) typingOpts.classList.add('visible');
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
// src/modules/social/facebook-api.service.ts
|
// src/modules/social/facebook-api.service.ts
|
||||||
import {HttpException, HttpStatus, Injectable, Logger} from '@nestjs/common';
|
import {HttpException, HttpStatus, Injectable, Logger} from '@nestjs/common';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import * as Http from "node:http";
|
||||||
|
import {NotifyService} from "../notify.service";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FacebookApi {
|
export class FacebookApi {
|
||||||
@@ -9,6 +11,11 @@ export class FacebookApi {
|
|||||||
private readonly pageAccessToken = process.env.FB_PAGE_ACCESS_TOKEN;
|
private readonly pageAccessToken = process.env.FB_PAGE_ACCESS_TOKEN;
|
||||||
private readonly pageId = process.env.FB_PAGE_ID;
|
private readonly pageId = process.env.FB_PAGE_ID;
|
||||||
|
|
||||||
|
constructor(private notifyService: NotifyService) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async postToPage(content: string, imageUrl?: string, throwEx = true) {
|
async postToPage(content: string, imageUrl?: string, throwEx = true) {
|
||||||
// console.log('postToPage==>', content, imageUrl);
|
// console.log('postToPage==>', content, imageUrl);
|
||||||
try {
|
try {
|
||||||
@@ -47,6 +54,7 @@ export class FacebookApi {
|
|||||||
fbErrormessage += '\n\n' + fbError.message;
|
fbErrormessage += '\n\n' + fbError.message;
|
||||||
this.logger.error('Subcode:', fbError.error_subcode);
|
this.logger.error('Subcode:', fbError.error_subcode);
|
||||||
this.logger.error('FB Trace ID:', fbError.fbtrace_id);
|
this.logger.error('FB Trace ID:', fbError.fbtrace_id);
|
||||||
|
await this.notifyService.sendUrgentMessageToTele(fbErrormessage);
|
||||||
} else {
|
} else {
|
||||||
// Lỗi do mạng hoặc cấu hình Axios sai
|
// Lỗi do mạng hoặc cấu hình Axios sai
|
||||||
this.logger.error('Lỗi hệ thống/mạng:', error.message);
|
this.logger.error('Lỗi hệ thống/mạng:', error.message);
|
||||||
|
|||||||
Reference in New Issue
Block a user