@zenning/openai 1.4.8 → 1.4.9

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.js CHANGED
@@ -2652,16 +2652,14 @@ var OpenAIResponsesLanguageModel = class {
2652
2652
  console.log("\u2705 Created URL source:", JSON.stringify(urlSource, null, 2));
2653
2653
  return urlSource;
2654
2654
  } else if (annotation.type === "file_citation") {
2655
- const documentSource = {
2656
- sourceType: "document",
2655
+ const urlSource = {
2656
+ sourceType: "url",
2657
2657
  id: (_f2 = (_e2 = (_d2 = this.config).generateId) == null ? void 0 : _e2.call(_d2)) != null ? _f2 : (0, import_provider_utils9.generateId)(),
2658
- mediaType: "text/plain",
2659
- title: annotation.quote || annotation.filename || "Document",
2660
- filename: annotation.filename,
2661
- quote: annotation.quote
2658
+ url: `file://${annotation.file_id}`,
2659
+ title: annotation.quote || annotation.filename || "Document"
2662
2660
  };
2663
- console.log("\u{1F4C4} Created document source:", JSON.stringify(documentSource, null, 2));
2664
- return documentSource;
2661
+ console.log("\u{1F4C4} Created URL source for file citation:", JSON.stringify(urlSource, null, 2));
2662
+ return urlSource;
2665
2663
  } else {
2666
2664
  console.log("\u26A0\uFE0F Unknown annotation type in doGenerate:", annotation.type);
2667
2665
  return {
@@ -2961,23 +2959,21 @@ var OpenAIResponsesLanguageModel = class {
2961
2959
  });
2962
2960
  console.log("\u2705 URL source enqueued successfully");
2963
2961
  } else if (value.annotation.type === "file_citation") {
2964
- console.log("\u{1F4C4} Processing FILE citation - this is where the error likely occurs");
2962
+ console.log("\u{1F4C4} Processing FILE citation - using URL format for v4 compatibility");
2965
2963
  console.log("\u{1F4C4} File citation raw data:", JSON.stringify(value.annotation, null, 2));
2966
- const documentSource = {
2967
- sourceType: "document",
2964
+ const urlSource = {
2965
+ sourceType: "url",
2968
2966
  id: (_l = (_k = (_j = self.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : (0, import_provider_utils9.generateId)(),
2969
- mediaType: "text/plain",
2970
- title: String(value.annotation.quote || value.annotation.filename || "Document"),
2971
- filename: value.annotation.filename ? String(value.annotation.filename) : void 0,
2972
- quote: value.annotation.quote ? String(value.annotation.quote) : void 0
2967
+ url: `file://${value.annotation.file_id}`,
2968
+ title: String(value.annotation.quote || value.annotation.filename || "Document")
2973
2969
  };
2974
- console.log("\u{1F4C4} Created document source:", JSON.stringify(documentSource, null, 2));
2975
- console.log("\u{1F50D} Annotation processing - step 3: Enqueuing document source");
2970
+ console.log("\u{1F4C4} Created URL source for file citation:", JSON.stringify(urlSource, null, 2));
2971
+ console.log("\u{1F50D} Annotation processing - step 3: Enqueuing URL source");
2976
2972
  controller.enqueue({
2977
2973
  type: "source",
2978
- source: documentSource
2974
+ source: urlSource
2979
2975
  });
2980
- console.log("\u2705 Document source enqueued successfully");
2976
+ console.log("\u2705 File citation URL source enqueued successfully");
2981
2977
  } else {
2982
2978
  console.log("\u26A0\uFE0F Unknown annotation type:", value.annotation.type);
2983
2979
  }