@yushaw/sanqian-chat 0.3.4 → 0.3.6

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.
@@ -7730,10 +7730,9 @@ var basePalettes = {
7730
7730
  surface: "#F5F5F4"
7731
7731
  },
7732
7732
  dark: {
7733
- bg: "#1F1F1F",
7734
- // Same as Notes --color-card-solid
7735
- card: "#1F1F1F",
7736
- surface: "#262626"
7733
+ bg: "#080808",
7734
+ card: "#101010",
7735
+ surface: "#141414"
7737
7736
  }
7738
7737
  };
7739
7738
  function getBaseColors(isDark) {
@@ -9106,6 +9105,16 @@ var ChatInput = (0, import_react23.memo)(
9106
9105
  // src/renderer/components/HitlCard.tsx
9107
9106
  var import_react24 = require("react");
9108
9107
  var import_jsx_runtime12 = require("react/jsx-runtime");
9108
+ function parseOption(option) {
9109
+ if (typeof option === "string") return { label: option };
9110
+ if (option && typeof option === "object") {
9111
+ const obj = option;
9112
+ const label = (typeof obj.label === "string" ? obj.label : void 0) ?? (typeof obj.name === "string" ? obj.name : void 0) ?? JSON.stringify(option);
9113
+ const description = typeof obj.description === "string" ? obj.description : void 0;
9114
+ return { label, description };
9115
+ }
9116
+ return { label: String(option) };
9117
+ }
9109
9118
  var defaultStrings = {
9110
9119
  approve: "Approve",
9111
9120
  reject: "Reject",
@@ -9231,7 +9240,7 @@ var HitlCard = (0, import_react24.memo)(function HitlCard2({
9231
9240
  return;
9232
9241
  }
9233
9242
  if (hasOptions) {
9234
- const selectedAnswers = selectedIndices.map((i) => interrupt.options[i]).join(", ");
9243
+ const selectedAnswers = selectedIndices.map((i) => parseOption(interrupt.options[i]).label).join(", ");
9235
9244
  onSubmit?.({
9236
9245
  answer: selectedAnswers,
9237
9246
  selected_indices: selectedIndices
@@ -9268,6 +9277,7 @@ var HitlCard = (0, import_react24.memo)(function HitlCard2({
9268
9277
  width: "1.125rem",
9269
9278
  height: "1.125rem",
9270
9279
  margin: 0,
9280
+ marginTop: "0.125rem",
9271
9281
  flexShrink: 0
9272
9282
  };
9273
9283
  const cardStyle = {
@@ -9371,11 +9381,12 @@ var HitlCard = (0, import_react24.memo)(function HitlCard2({
9371
9381
  ] }),
9372
9382
  isUserInput && interrupt.options && interrupt.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "space-y-1.5", children: interrupt.options.map((option, index) => {
9373
9383
  const isSelected = selectedIndices.includes(index);
9384
+ const { label: optLabel, description: optDesc } = parseOption(option);
9374
9385
  const optionStyle = isSelected ? isDarkMode ? { borderColor: "rgba(96, 165, 250, 0.75)", background: "rgba(59, 130, 246, 0.24)" } : { borderColor: "rgba(37, 99, 235, 0.36)", background: "rgba(239, 246, 255, 0.98)" } : isDarkMode ? { borderColor: "rgba(113, 113, 122, 0.6)", background: "rgba(9, 9, 11, 0.84)" } : { borderColor: "rgba(113, 113, 122, 0.34)", background: "rgba(250, 250, 250, 0.96)" };
9375
9386
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
9376
9387
  "label",
9377
9388
  {
9378
- className: `flex cursor-pointer items-center gap-2 rounded p-2 transition-colors ${isSelected ? isDarkMode ? "border-blue-500/50 bg-blue-500/20" : "border-blue-200 bg-blue-50" : `${inputBg} border-transparent hover:border-zinc-300`} border`,
9389
+ className: `flex cursor-pointer items-start gap-2 rounded p-2 transition-colors ${isSelected ? isDarkMode ? "border-blue-500/50 bg-blue-500/20" : "border-blue-200 bg-blue-50" : `${inputBg} border-transparent hover:border-zinc-300`} border`,
9379
9390
  style: optionStyle,
9380
9391
  children: [
9381
9392
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
@@ -9388,7 +9399,10 @@ var HitlCard = (0, import_react24.memo)(function HitlCard2({
9388
9399
  style: optionControlStyle
9389
9400
  }
9390
9401
  ),
9391
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: `text-sm ${textPrimary} break-words ${isSelected ? "font-semibold" : "font-medium"}`, children: option })
9402
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "min-w-0 break-words", children: [
9403
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: `text-sm ${textPrimary} ${isSelected ? "font-semibold" : "font-medium"}`, children: optLabel }),
9404
+ optDesc && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: `block text-xs ${textSecondary} mt-0.5 leading-snug`, children: optDesc })
9405
+ ] })
9392
9406
  ]
9393
9407
  },
9394
9408
  index
@@ -7642,10 +7642,9 @@ var basePalettes = {
7642
7642
  surface: "#F5F5F4"
7643
7643
  },
7644
7644
  dark: {
7645
- bg: "#1F1F1F",
7646
- // Same as Notes --color-card-solid
7647
- card: "#1F1F1F",
7648
- surface: "#262626"
7645
+ bg: "#080808",
7646
+ card: "#101010",
7647
+ surface: "#141414"
7649
7648
  }
7650
7649
  };
7651
7650
  function getBaseColors(isDark) {
@@ -9034,6 +9033,16 @@ var ChatInput = memo7(
9034
9033
  // src/renderer/components/HitlCard.tsx
9035
9034
  import { memo as memo8, useState as useState15, useEffect as useEffect18, useRef as useRef10 } from "react";
9036
9035
  import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
9036
+ function parseOption(option) {
9037
+ if (typeof option === "string") return { label: option };
9038
+ if (option && typeof option === "object") {
9039
+ const obj = option;
9040
+ const label = (typeof obj.label === "string" ? obj.label : void 0) ?? (typeof obj.name === "string" ? obj.name : void 0) ?? JSON.stringify(option);
9041
+ const description = typeof obj.description === "string" ? obj.description : void 0;
9042
+ return { label, description };
9043
+ }
9044
+ return { label: String(option) };
9045
+ }
9037
9046
  var defaultStrings = {
9038
9047
  approve: "Approve",
9039
9048
  reject: "Reject",
@@ -9159,7 +9168,7 @@ var HitlCard = memo8(function HitlCard2({
9159
9168
  return;
9160
9169
  }
9161
9170
  if (hasOptions) {
9162
- const selectedAnswers = selectedIndices.map((i) => interrupt.options[i]).join(", ");
9171
+ const selectedAnswers = selectedIndices.map((i) => parseOption(interrupt.options[i]).label).join(", ");
9163
9172
  onSubmit?.({
9164
9173
  answer: selectedAnswers,
9165
9174
  selected_indices: selectedIndices
@@ -9196,6 +9205,7 @@ var HitlCard = memo8(function HitlCard2({
9196
9205
  width: "1.125rem",
9197
9206
  height: "1.125rem",
9198
9207
  margin: 0,
9208
+ marginTop: "0.125rem",
9199
9209
  flexShrink: 0
9200
9210
  };
9201
9211
  const cardStyle = {
@@ -9299,11 +9309,12 @@ var HitlCard = memo8(function HitlCard2({
9299
9309
  ] }),
9300
9310
  isUserInput && interrupt.options && interrupt.options.length > 0 && /* @__PURE__ */ jsx12("div", { className: "space-y-1.5", children: interrupt.options.map((option, index) => {
9301
9311
  const isSelected = selectedIndices.includes(index);
9312
+ const { label: optLabel, description: optDesc } = parseOption(option);
9302
9313
  const optionStyle = isSelected ? isDarkMode ? { borderColor: "rgba(96, 165, 250, 0.75)", background: "rgba(59, 130, 246, 0.24)" } : { borderColor: "rgba(37, 99, 235, 0.36)", background: "rgba(239, 246, 255, 0.98)" } : isDarkMode ? { borderColor: "rgba(113, 113, 122, 0.6)", background: "rgba(9, 9, 11, 0.84)" } : { borderColor: "rgba(113, 113, 122, 0.34)", background: "rgba(250, 250, 250, 0.96)" };
9303
9314
  return /* @__PURE__ */ jsxs6(
9304
9315
  "label",
9305
9316
  {
9306
- className: `flex cursor-pointer items-center gap-2 rounded p-2 transition-colors ${isSelected ? isDarkMode ? "border-blue-500/50 bg-blue-500/20" : "border-blue-200 bg-blue-50" : `${inputBg} border-transparent hover:border-zinc-300`} border`,
9317
+ className: `flex cursor-pointer items-start gap-2 rounded p-2 transition-colors ${isSelected ? isDarkMode ? "border-blue-500/50 bg-blue-500/20" : "border-blue-200 bg-blue-50" : `${inputBg} border-transparent hover:border-zinc-300`} border`,
9307
9318
  style: optionStyle,
9308
9319
  children: [
9309
9320
  /* @__PURE__ */ jsx12(
@@ -9316,7 +9327,10 @@ var HitlCard = memo8(function HitlCard2({
9316
9327
  style: optionControlStyle
9317
9328
  }
9318
9329
  ),
9319
- /* @__PURE__ */ jsx12("span", { className: `text-sm ${textPrimary} break-words ${isSelected ? "font-semibold" : "font-medium"}`, children: option })
9330
+ /* @__PURE__ */ jsxs6("span", { className: "min-w-0 break-words", children: [
9331
+ /* @__PURE__ */ jsx12("span", { className: `text-sm ${textPrimary} ${isSelected ? "font-semibold" : "font-medium"}`, children: optLabel }),
9332
+ optDesc && /* @__PURE__ */ jsx12("span", { className: `block text-xs ${textSecondary} mt-0.5 leading-snug`, children: optDesc })
9333
+ ] })
9320
9334
  ]
9321
9335
  },
9322
9336
  index
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yushaw/sanqian-chat",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "Floating chat window SDK for Sanqian AI Assistant",
5
5
  "main": "./dist/main/index.js",
6
6
  "types": "./dist/main/index.d.ts",