@kieksme/csp-plugin-chat 0.3.0 → 0.4.0

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/README.md CHANGED
@@ -1,3 +1,3 @@
1
1
  # @kieksme/csp-plugin-chat
2
2
 
3
- Part of the Customer Service Portal. See the product README and docs/plugin-sdk.md for configuration and usage.
3
+ Part of the Customer Service Portal. See the product README and Docs/plugin-sdk.md for configuration and usage.
package/dist/browser.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  cspPlugin
3
- } from "./chunk-A54AKMRB.js";
3
+ } from "./chunk-3ZQPP6HM.js";
4
4
 
5
5
  // src/browser.tsx
6
6
  import { useEffect, useRef, useState } from "react";
@@ -31,12 +31,15 @@ function Chat(ctx) {
31
31
  const controller = new AbortController();
32
32
  abort.current = controller;
33
33
  try {
34
- const response = await fetch(ctx.config.apiUrl + "/api/v1/chat", {
35
- method: "POST",
36
- headers: { "Content-Type": "application/json" },
37
- body: JSON.stringify({ messages: bounded }),
38
- signal: controller.signal
39
- });
34
+ const response = await (ctx.request ?? fetch)(
35
+ ctx.config.apiUrl + "/api/v1/chat",
36
+ {
37
+ method: "POST",
38
+ headers: { "Content-Type": "application/json" },
39
+ body: JSON.stringify({ messages: bounded }),
40
+ signal: controller.signal
41
+ }
42
+ );
40
43
  if (!response.ok || !response.body)
41
44
  throw new Error(
42
45
  response.status === 429 ? "Zu viele Anfragen. Bitte warten Sie eine Minute." : "Chat derzeit nicht erreichbar."
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var cspPlugin = {
3
3
  id: "chat",
4
- sdkVersion: "^0.3.0",
4
+ sdkVersion: "^0.4.0",
5
5
  browser: "./browser",
6
6
  server: "./server"
7
7
  };
package/dist/server.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  cspPlugin
3
- } from "./chunk-A54AKMRB.js";
3
+ } from "./chunk-3ZQPP6HM.js";
4
4
 
5
5
  // src/server.ts
6
6
  import { z } from "zod";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kieksme/csp-plugin-chat",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -22,7 +22,7 @@
22
22
  "registry": "https://registry.npmjs.org"
23
23
  },
24
24
  "dependencies": {
25
- "@kieksme/csp-sdk": "^0.3.0",
25
+ "@kieksme/csp-sdk": "^0.4.0",
26
26
  "zod": "^3.25.76",
27
27
  "openai": "^6.3.0"
28
28
  },
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "cspPlugin": {
36
36
  "id": "chat",
37
- "sdkVersion": "^0.3.0",
37
+ "sdkVersion": "^0.4.0",
38
38
  "browser": "./browser",
39
39
  "server": "./server"
40
40
  },