@ynhcj/xiaoyi-channel 1.1.28 → 1.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import https from 'https';
|
|
5
5
|
import { URL } from 'url';
|
|
6
6
|
import { getConfig } from './config.js';
|
|
7
|
-
import {
|
|
7
|
+
import { DEFAULT_HTTPS_PORT, HTTP_STATUS_BAD_REQUEST, API_URL_SUFFIX } from './constants.js';
|
|
8
8
|
function buildHeadersForCelia(config, sessionId) {
|
|
9
9
|
if (!config.uid || !config.apiKey || !config.skillId || !config.requestFrom) {
|
|
10
10
|
throw new Error('[SENTINEL HOOK] Missing required configuration: uid, apiKey, skillId, or requestFrom is not defined');
|
|
@@ -22,7 +22,7 @@ function buildRequestOptions(url, headers, timeout) {
|
|
|
22
22
|
const urlObj = new URL(url);
|
|
23
23
|
return {
|
|
24
24
|
hostname: urlObj.hostname,
|
|
25
|
-
port: urlObj.port ||
|
|
25
|
+
port: urlObj.port || DEFAULT_HTTPS_PORT,
|
|
26
26
|
path: urlObj.pathname,
|
|
27
27
|
method: "POST",
|
|
28
28
|
headers: headers,
|
|
@@ -6,7 +6,7 @@ import path from 'path';
|
|
|
6
6
|
import https from 'https';
|
|
7
7
|
import { URL } from 'url';
|
|
8
8
|
import { getConfig } from './config.js';
|
|
9
|
-
import {
|
|
9
|
+
import { DEFAULT_HTTPS_PORT, MAX_TIMES, CONNECT_TIMEOUT, READ_TIMEOUT, EXPIRE_TIME, OSMS_PREPARE_URL, OSMS_COMPLETE_URL, TEMPORARY_MATERIAL_PACKAGE, FILE_OWNER_UID, FILE_OWNER_TEAM_ID } from './constants.js';
|
|
10
10
|
function buildOsmsHeaders(config, traceId) {
|
|
11
11
|
return {
|
|
12
12
|
'content-type': 'application/json',
|
|
@@ -22,7 +22,7 @@ function httpRequest(url, method, headers, body, timeout) {
|
|
|
22
22
|
const urlObj = new URL(url);
|
|
23
23
|
const options = {
|
|
24
24
|
hostname: urlObj.hostname,
|
|
25
|
-
port: urlObj.port ||
|
|
25
|
+
port: urlObj.port || DEFAULT_HTTPS_PORT,
|
|
26
26
|
path: urlObj.pathname + urlObj.search,
|
|
27
27
|
method: method,
|
|
28
28
|
headers: headers,
|
|
@@ -75,6 +75,23 @@ export function createModifyAlarmTool(ctx) {
|
|
|
75
75
|
required: ["entityId"],
|
|
76
76
|
},
|
|
77
77
|
async execute(toolCallId, params) {
|
|
78
|
+
// Coerce numeric string params to actual numbers
|
|
79
|
+
// The model may produce "1" instead of 1, which would fail typeof checks
|
|
80
|
+
const numericParams = [
|
|
81
|
+
"alarmState",
|
|
82
|
+
"alarmSnoozeDuration",
|
|
83
|
+
"alarmSnoozeTotal",
|
|
84
|
+
"alarmRingDuration",
|
|
85
|
+
"daysOfWakeType",
|
|
86
|
+
];
|
|
87
|
+
for (const key of numericParams) {
|
|
88
|
+
if (typeof params[key] === "string") {
|
|
89
|
+
const num = Number(params[key]);
|
|
90
|
+
if (!isNaN(num)) {
|
|
91
|
+
params[key] = num;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
78
95
|
// ===== Validate required parameter: entityId =====
|
|
79
96
|
if (!params.entityId || typeof params.entityId !== "string") {
|
|
80
97
|
throw new Error("Missing required parameter: entityId must be a string obtained from search_alarm or create_alarm");
|