fix: 修复服务器时间格式和保留监控字段
- 将服务器时间格式从本地字符串改为 ISO 字符串以确保一致性 - 在客户端正确格式化从服务器接收的 ISO 时间字符串 - 在 CodexConverter 中保留监控相关字段(_monitorRequestId 和 _requestBaseUrl)以支持请求追踪
This commit is contained in:
parent
8fb4d59b23
commit
0631d0db05
4 changed files with 22 additions and 12 deletions
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
||||||
2.10.9.2
|
2.10.9.3
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,14 @@ export class CodexConverter extends BaseConverter {
|
||||||
toOpenAIResponsesToCodexRequest(responsesRequest) {
|
toOpenAIResponsesToCodexRequest(responsesRequest) {
|
||||||
let codexRequest = { ...responsesRequest };
|
let codexRequest = { ...responsesRequest };
|
||||||
|
|
||||||
|
// 保留监控相关字段
|
||||||
|
if (responsesRequest._monitorRequestId) {
|
||||||
|
codexRequest._monitorRequestId = responsesRequest._monitorRequestId;
|
||||||
|
}
|
||||||
|
if (responsesRequest._requestBaseUrl) {
|
||||||
|
codexRequest._requestBaseUrl = responsesRequest._requestBaseUrl;
|
||||||
|
}
|
||||||
|
|
||||||
// 处理 input 字段,如果它是字符串,则转换为消息数组
|
// 处理 input 字段,如果它是字符串,则转换为消息数组
|
||||||
if (codexRequest.input && typeof codexRequest.input === 'string') {
|
if (codexRequest.input && typeof codexRequest.input === 'string') {
|
||||||
const inputText = codexRequest.input;
|
const inputText = codexRequest.input;
|
||||||
|
|
@ -164,6 +172,14 @@ export class CodexConverter extends BaseConverter {
|
||||||
include: ['reasoning.encrypted_content']
|
include: ['reasoning.encrypted_content']
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 保留监控相关字段
|
||||||
|
if (data._monitorRequestId) {
|
||||||
|
codexRequest._monitorRequestId = data._monitorRequestId;
|
||||||
|
}
|
||||||
|
if (data._requestBaseUrl) {
|
||||||
|
codexRequest._requestBaseUrl = data._requestBaseUrl;
|
||||||
|
}
|
||||||
|
|
||||||
codexRequest.service_tier = data.service_tier || 'default';
|
codexRequest.service_tier = data.service_tier || 'default';
|
||||||
if (codexRequest.service_tier !== 'priority') {
|
if (codexRequest.service_tier !== 'priority') {
|
||||||
delete codexRequest.service_tier;
|
delete codexRequest.service_tier;
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ export async function handleGetSystem(req, res) {
|
||||||
res.end(JSON.stringify({
|
res.end(JSON.stringify({
|
||||||
appVersion: appVersion,
|
appVersion: appVersion,
|
||||||
nodeVersion: process.version,
|
nodeVersion: process.version,
|
||||||
serverTime: new Date().toLocaleString(),
|
serverTime: new Date().toISOString(),
|
||||||
memoryUsage: `${Math.round(memUsage.heapUsed / 1024 / 1024)} MB / ${Math.round(memUsage.heapTotal / 1024 / 1024)} MB`,
|
memoryUsage: `${Math.round(memUsage.heapUsed / 1024 / 1024)} MB / ${Math.round(memUsage.heapTotal / 1024 / 1024)} MB`,
|
||||||
cpuUsage: cpuUsage,
|
cpuUsage: cpuUsage,
|
||||||
uptime: process.uptime()
|
uptime: process.uptime()
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,9 @@ async function loadSystemInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始显示
|
// 初始显示
|
||||||
if (serverTimeEl) serverTimeEl.textContent = data.serverTime || '--';
|
if (serverTimeEl) {
|
||||||
|
serverTimeEl.textContent = data.serverTime ? new Date(data.serverTime).toLocaleString(getCurrentLanguage()) : '--';
|
||||||
|
}
|
||||||
if (uptimeEl) uptimeEl.textContent = data.uptime ? formatUptime(data.uptime) : '--';
|
if (uptimeEl) uptimeEl.textContent = data.uptime ? formatUptime(data.uptime) : '--';
|
||||||
|
|
||||||
// 加载服务模式信息
|
// 加载服务模式信息
|
||||||
|
|
@ -165,15 +167,7 @@ function updateTimeDisplay() {
|
||||||
// 更新服务器时间
|
// 更新服务器时间
|
||||||
if (serverTimeEl) {
|
if (serverTimeEl) {
|
||||||
const currentServerTime = new Date(initialServerTime.getTime() + elapsedSeconds * 1000);
|
const currentServerTime = new Date(initialServerTime.getTime() + elapsedSeconds * 1000);
|
||||||
serverTimeEl.textContent = currentServerTime.toLocaleString(getCurrentLanguage(), {
|
serverTimeEl.textContent = currentServerTime.toLocaleString(getCurrentLanguage());
|
||||||
year: 'numeric',
|
|
||||||
month: '2-digit',
|
|
||||||
day: '2-digit',
|
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
second: '2-digit',
|
|
||||||
hour12: false
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新运行时间
|
// 更新运行时间
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue