pi-model-control 0.1.1 → 0.1.3
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/extensions/shared.ts +11 -10
- package/package.json +1 -1
package/extensions/shared.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
const NULL_LEVELS = "none";
|
|
2
2
|
|
|
3
|
-
export const DISPLAY_LEVELS = [
|
|
3
|
+
export const DISPLAY_LEVELS = [NULL_LEVELS, "minimal", "low", "medium", "high", "max"];
|
|
4
4
|
|
|
5
5
|
export function getSupportedLevels(m: any): string[] {
|
|
6
|
-
if (!m.reasoning) return [
|
|
6
|
+
if (!m.reasoning) return [NULL_LEVELS];
|
|
7
|
+
|
|
8
|
+
const map = m.thinkingLevelMap;
|
|
9
|
+
if (!map) return [NULL_LEVELS];
|
|
10
|
+
|
|
7
11
|
return DISPLAY_LEVELS.filter((level) => {
|
|
8
|
-
const piLevel = level ===
|
|
9
|
-
|
|
10
|
-
if (mapped === null) return false;
|
|
11
|
-
if (level === "max") return mapped !== undefined;
|
|
12
|
-
return true;
|
|
12
|
+
const piLevel = level === NULL_LEVELS ? "off" : level;
|
|
13
|
+
return Object.prototype.hasOwnProperty.call(map, piLevel) && map[piLevel] !== null;
|
|
13
14
|
});
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export function displayToPi(display: string): string {
|
|
17
|
-
return display ===
|
|
18
|
+
return display === NULL_LEVELS ? "off" : display;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export function piToDisplay(pi: string): string {
|
|
21
|
-
return pi === "off" ?
|
|
22
|
+
return pi === "off" ? NULL_LEVELS : pi;
|
|
22
23
|
}
|