@midscene/shared 1.18.2 → 1.18.3-beta-20261123111911.0
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.
- package/dist/es/env/model-config-manager.mjs +4 -3
- package/dist/es/env/parse-model-config.mjs +1 -1
- package/dist/lib/env/model-config-manager.js +4 -3
- package/dist/lib/env/parse-model-config.js +1 -1
- package/dist/types/env/model-config-manager.d.ts +1 -1
- package/dist/types/env/model-config-manager.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/env/model-config-manager.ts +17 -8
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { parseJson } from "./helper.mjs";
|
|
1
2
|
import { decideModelConfigFromIntentConfig } from "./parse-model-config.mjs";
|
|
3
|
+
import { MIDSCENE_MODEL_INIT_CONFIG_JSON, MIDSCENE_OPENAI_INIT_CONFIG_JSON } from "./types.mjs";
|
|
2
4
|
function _define_property(obj, key, value) {
|
|
3
5
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
4
6
|
value: value,
|
|
@@ -67,9 +69,8 @@ class ModelConfigManager {
|
|
|
67
69
|
return this.modelConfigMap[intent];
|
|
68
70
|
}
|
|
69
71
|
getUploadTestServerUrl() {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
return serverUrl;
|
|
72
|
+
const config = this.modelConfig ?? this.globalConfigManager?.getAllEnvConfig();
|
|
73
|
+
return parseJson(MIDSCENE_MODEL_INIT_CONFIG_JSON, String(config?.[MIDSCENE_MODEL_INIT_CONFIG_JSON] ?? '') || String(config?.[MIDSCENE_OPENAI_INIT_CONFIG_JSON] ?? ''))?.REPORT_SERVER_URL;
|
|
73
74
|
}
|
|
74
75
|
registerGlobalConfigManager(globalConfigManager) {
|
|
75
76
|
this.globalConfigManager = globalConfigManager;
|
|
@@ -5,7 +5,7 @@ import { assert } from "../utils.mjs";
|
|
|
5
5
|
import { maskConfig, parseJson } from "./helper.mjs";
|
|
6
6
|
import { initDebugConfig } from "./init-debug.mjs";
|
|
7
7
|
const MODEL_CONFIG_DOC_URL = 'https://www.midscenejs.com/model-api-setup.html';
|
|
8
|
-
const getCurrentVersion = ()=>"1.18.
|
|
8
|
+
const getCurrentVersion = ()=>"1.18.3-beta-20261123111911.0";
|
|
9
9
|
const getInvalidModelFamilyMessage = (modelFamily)=>`Invalid MIDSCENE_MODEL_FAMILY value: ${modelFamily}. Current version v${getCurrentVersion()} accepts the following model families: ${MODEL_FAMILY_VALUES.join(', ')}. You can also visit ${MODEL_CONFIG_DOC_URL} for the latest configuration information.`;
|
|
10
10
|
const KEYS_MAP = {
|
|
11
11
|
locate: LOCATE_MODEL_CONFIG_KEYS,
|
|
@@ -26,7 +26,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
ModelConfigManager: ()=>ModelConfigManager
|
|
28
28
|
});
|
|
29
|
+
const external_helper_js_namespaceObject = require("./helper.js");
|
|
29
30
|
const external_parse_model_config_js_namespaceObject = require("./parse-model-config.js");
|
|
31
|
+
const external_types_js_namespaceObject = require("./types.js");
|
|
30
32
|
function _define_property(obj, key, value) {
|
|
31
33
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
32
34
|
value: value,
|
|
@@ -95,9 +97,8 @@ class ModelConfigManager {
|
|
|
95
97
|
return this.modelConfigMap[intent];
|
|
96
98
|
}
|
|
97
99
|
getUploadTestServerUrl() {
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
return serverUrl;
|
|
100
|
+
const config = this.modelConfig ?? this.globalConfigManager?.getAllEnvConfig();
|
|
101
|
+
return (0, external_helper_js_namespaceObject.parseJson)(external_types_js_namespaceObject.MIDSCENE_MODEL_INIT_CONFIG_JSON, String(config?.[external_types_js_namespaceObject.MIDSCENE_MODEL_INIT_CONFIG_JSON] ?? '') || String(config?.[external_types_js_namespaceObject.MIDSCENE_OPENAI_INIT_CONFIG_JSON] ?? ''))?.REPORT_SERVER_URL;
|
|
101
102
|
}
|
|
102
103
|
registerGlobalConfigManager(globalConfigManager) {
|
|
103
104
|
this.globalConfigManager = globalConfigManager;
|
|
@@ -37,7 +37,7 @@ const external_utils_js_namespaceObject = require("../utils.js");
|
|
|
37
37
|
const external_helper_js_namespaceObject = require("./helper.js");
|
|
38
38
|
const external_init_debug_js_namespaceObject = require("./init-debug.js");
|
|
39
39
|
const MODEL_CONFIG_DOC_URL = 'https://www.midscenejs.com/model-api-setup.html';
|
|
40
|
-
const getCurrentVersion = ()=>"1.18.
|
|
40
|
+
const getCurrentVersion = ()=>"1.18.3-beta-20261123111911.0";
|
|
41
41
|
const getInvalidModelFamilyMessage = (modelFamily)=>`Invalid MIDSCENE_MODEL_FAMILY value: ${modelFamily}. Current version v${getCurrentVersion()} accepts the following model families: ${external_types_js_namespaceObject.MODEL_FAMILY_VALUES.join(', ')}. You can also visit ${MODEL_CONFIG_DOC_URL} for the latest configuration information.`;
|
|
42
42
|
const KEYS_MAP = {
|
|
43
43
|
locate: external_constants_js_namespaceObject.LOCATE_MODEL_CONFIG_KEYS,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GlobalConfigManager } from './global-config-manager';
|
|
2
|
-
import type
|
|
2
|
+
import { type CreateOpenAIClientFn, type IModelConfig, type TIntent, type TModelConfig } from './types';
|
|
3
3
|
export declare class ModelConfigManager {
|
|
4
4
|
private modelConfigMap;
|
|
5
5
|
private isInitialized;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-config-manager.d.ts","sourceRoot":"","sources":["../../../src/env/model-config-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"model-config-manager.d.ts","sourceRoot":"","sources":["../../../src/env/model-config-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAInE,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,YAAY,EAGjB,KAAK,OAAO,EACZ,KAAK,YAAY,EAClB,MAAM,SAAS,CAAC;AAEjB,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,cAAc,CAAwD;IAE9E,OAAO,CAAC,aAAa,CAAS;IAI9B,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO,CAAC,mBAAmB,CAA8C;IAEzE,OAAO,CAAC,WAAW,CAAC,CAAe;IACnC,OAAO,CAAC,oBAAoB,CAAC,CAAuB;gBAGlD,WAAW,CAAC,EAAE,YAAY,EAC1B,oBAAoB,CAAC,EAAE,oBAAoB;IAM7C,OAAO,CAAC,UAAU;IAmElB,OAAO,CAAC,oBAAoB;IAe5B;;OAEG;IACH,mBAAmB;IASnB;;;OAGG;IACH,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,YAAY;IAa7C,sBAAsB,IAAI,MAAM,GAAG,SAAS;IAY5C,2BAA2B,CAAC,mBAAmB,EAAE,mBAAmB;IAIpE,sBAAsB;CASvB"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { GlobalConfigManager } from './global-config-manager';
|
|
2
|
+
import { parseJson } from './helper';
|
|
2
3
|
import { decideModelConfigFromIntentConfig } from './parse-model-config';
|
|
3
4
|
|
|
4
|
-
import
|
|
5
|
-
CreateOpenAIClientFn,
|
|
6
|
-
IModelConfig,
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import {
|
|
6
|
+
type CreateOpenAIClientFn,
|
|
7
|
+
type IModelConfig,
|
|
8
|
+
MIDSCENE_MODEL_INIT_CONFIG_JSON,
|
|
9
|
+
MIDSCENE_OPENAI_INIT_CONFIG_JSON,
|
|
10
|
+
type TIntent,
|
|
11
|
+
type TModelConfig,
|
|
9
12
|
} from './types';
|
|
10
13
|
|
|
11
14
|
export class ModelConfigManager {
|
|
@@ -142,9 +145,15 @@ export class ModelConfigManager {
|
|
|
142
145
|
}
|
|
143
146
|
|
|
144
147
|
getUploadTestServerUrl(): string | undefined {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
+
// Read report configuration independently of provider credentials and
|
|
149
|
+
// per-intent model settings. Explicit Agent config remains isolated.
|
|
150
|
+
const config =
|
|
151
|
+
this.modelConfig ?? this.globalConfigManager?.getAllEnvConfig();
|
|
152
|
+
return parseJson(
|
|
153
|
+
MIDSCENE_MODEL_INIT_CONFIG_JSON,
|
|
154
|
+
String(config?.[MIDSCENE_MODEL_INIT_CONFIG_JSON] ?? '') ||
|
|
155
|
+
String(config?.[MIDSCENE_OPENAI_INIT_CONFIG_JSON] ?? ''),
|
|
156
|
+
)?.REPORT_SERVER_URL as string | undefined;
|
|
148
157
|
}
|
|
149
158
|
|
|
150
159
|
registerGlobalConfigManager(globalConfigManager: GlobalConfigManager) {
|