@dudko.dev/agent-web 0.0.39 → 0.0.40

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/index.cjs CHANGED
@@ -6738,12 +6738,16 @@ var decisionModelFromAiSdk = (model, options = {}) => {
6738
6738
  decide: async (question, call) => {
6739
6739
  const result = await (0, import_ai12.experimental_decide)({
6740
6740
  model,
6741
- state: question.context ?? "",
6741
+ // The API refuses an empty state (Google's answers 400 "Missing text in content"), and a
6742
+ // question asked without a context is its own subject.
6743
+ state: question.context?.trim() ? question.context : question.prompt,
6742
6744
  questions: {
6743
6745
  [QUESTION_KEY]: {
6744
6746
  type: "choice",
6745
6747
  instructions: question.prompt,
6746
- criteria: Object.fromEntries(question.options.map((o) => [o.id, o.description ?? ""]))
6748
+ criteria: Object.fromEntries(
6749
+ question.options.map((o) => [o.id, o.description?.trim() ? o.description : o.id])
6750
+ )
6747
6751
  }
6748
6752
  },
6749
6753
  maxRetries: options.maxRetries ?? 0,