@jeffreycao/copilot-api 2.6.22 → 2.6.23

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/pages/index.html +32 -21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@jeffreycao/copilot-api",
4
- "version": "2.6.22",
4
+ "version": "2.6.23",
5
5
  "description": "GitHub Copilot, OpenAI Codex, OpenCode Go, and third-party AI provider gateway with OpenAI and Anthropic API compatibility.",
6
6
  "keywords": [
7
7
  "github-copilot",
package/pages/index.html CHANGED
@@ -1514,34 +1514,45 @@
1514
1514
  * @returns {string} HTML string for the formatted list.
1515
1515
  */
1516
1516
  function formatObject(obj) {
1517
+ if (Array.isArray(obj)) {
1518
+ if (obj.length === 0) {
1519
+ return `<span style="color: var(--color-gray);">[]</span>`;
1520
+ }
1521
+
1522
+ return (
1523
+ '<div class="pl-4">' +
1524
+ obj
1525
+ .map(
1526
+ (value, index) =>
1527
+ `<div class="mt-1"><span class="capitalize font-semibold" style="color: var(--color-fg-lightest);">[${index}]:</span> ${formatObject(value)}</div>`,
1528
+ )
1529
+ .join("") +
1530
+ "</div>"
1531
+ );
1532
+ }
1533
+
1517
1534
  if (obj === null || typeof obj !== "object") {
1518
- return `<span style="color: var(--color-green);">${escapeHtml(JSON.stringify(obj))}</span>`;
1535
+ if (typeof obj === "boolean") {
1536
+ return `<span class="font-semibold" style="color: ${obj ? "var(--color-green)" : "var(--color-red)"}">${escapeHtml(String(obj))}</span>`;
1537
+ }
1538
+
1539
+ return `<span style="color: var(--color-blue);">${escapeHtml(JSON.stringify(obj))}</span>`;
1540
+ }
1541
+
1542
+ const entries = Object.entries(obj);
1543
+ if (entries.length === 0) {
1544
+ return `<span style="color: var(--color-gray);">{}</span>`;
1519
1545
  }
1520
1546
 
1521
1547
  return (
1522
1548
  '<div class="pl-4">' +
1523
- Object.entries(obj)
1549
+ entries
1524
1550
  .map(([key, value]) => {
1525
1551
  const formattedKey = escapeHtml(key.replace(/_/g, " "));
1526
- let displayValue;
1527
-
1528
- if (Array.isArray(value)) {
1529
- displayValue =
1530
- value.length > 0
1531
- ? `<span style='color: var(--color-gray)'>[...${value.length} items]</span>`
1532
- : `<span style='color: var(--color-gray)'>[]</span>`;
1533
- } else if (typeof value === "object" && value !== null) {
1534
- displayValue = formatObject(value);
1535
- } else if (typeof value === "boolean") {
1536
- displayValue = `<span class="font-semibold" style="color: ${value ? "var(--color-green)" : "var(--color-red)"}">${escapeHtml(String(value))}</span>`;
1537
- } else {
1538
- displayValue = `<span style="color: var(--color-blue);">${escapeHtml(JSON.stringify(value))}</span>`;
1539
- }
1540
-
1541
1552
  return `<div class="mt-1">
1542
- <span class="capitalize font-semibold" style="color: var(--color-fg-lightest);">${formattedKey}:</span>
1543
- ${typeof value === "object" && value !== null && !Array.isArray(value) ? displayValue : ` ${displayValue}`}
1544
- </div>`;
1553
+ <span class="capitalize font-semibold" style="color: var(--color-fg-lightest);">${formattedKey}:</span>
1554
+ ${formatObject(value)}
1555
+ </div>`;
1545
1556
  })
1546
1557
  .join("") +
1547
1558
  "</div>"
@@ -1554,7 +1565,7 @@
1554
1565
  * @returns {string} HTML string for the full data section.
1555
1566
  */
1556
1567
  function renderDetailedData(data) {
1557
- if (!data || Object.keys(data).length === 0) {
1568
+ if (data === null || typeof data === "undefined") {
1558
1569
  return "";
1559
1570
  }
1560
1571