@kieksme/csp-plugin-chat 0.4.0 → 0.5.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/dist/browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
cspPlugin
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PQWU3SII.js";
|
|
4
4
|
|
|
5
5
|
// src/browser.tsx
|
|
6
6
|
import { useEffect, useRef, useState } from "react";
|
|
@@ -92,21 +92,36 @@ function Chat(ctx) {
|
|
|
92
92
|
abort.current = null;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
return /* @__PURE__ */ jsxs("div", { className: "chat-layout", children: [
|
|
96
|
-
/* @__PURE__ */ jsxs("div", { className: "chat-intro", children: [
|
|
95
|
+
return /* @__PURE__ */ jsxs("div", { className: "chat-layout grid grid-cols-[1fr_1.7fr] gap-13.75 compact:grid-cols-[1fr] compact:gap-3.75", children: [
|
|
96
|
+
/* @__PURE__ */ jsxs("div", { className: "chat-intro [&_p]:text-[0.875rem] [&_p]:text-muted [&_p]:leading-[1.8] compact:max-w-[500px]", children: [
|
|
97
97
|
/* @__PURE__ */ jsx("h3", { children: "Eine Frage reicht." }),
|
|
98
98
|
/* @__PURE__ */ jsx("p", { children: "Unser Assistent kennt die Hilfe-Inhalte, das Team und die aktuellen Meldungen. F\xFCr dringende St\xF6rungen bleibt die Hotline der direkte Weg." }),
|
|
99
|
-
/* @__PURE__ */ jsx("p", { className: "data-state", children: "\xD6ffentlicher Chat \xB7 Verlauf nur in dieser Sitzung" })
|
|
99
|
+
/* @__PURE__ */ jsx("p", { className: "data-state font-mono text-[0.625rem] text-muted m-[calc(var(--spacing)_*_3)_0_0] [&.warning]:text-warning", children: "\xD6ffentlicher Chat \xB7 Verlauf nur in dieser Sitzung" })
|
|
100
100
|
] }),
|
|
101
|
-
/* @__PURE__ */ jsxs("div", { className: "chat-panel", children: [
|
|
102
|
-
/* @__PURE__ */ jsxs(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
/* @__PURE__ */ jsxs("div", { className: "chat-panel bg-card border border-line p-6 rounded-card", children: [
|
|
102
|
+
/* @__PURE__ */ jsxs(
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
className: "chat-history grid gap-3.75 max-h-[400px] overflow-auto mb-4",
|
|
106
|
+
"aria-live": "polite",
|
|
107
|
+
"aria-busy": busy,
|
|
108
|
+
children: [
|
|
109
|
+
!messages.length && /* @__PURE__ */ jsx("p", { className: "message assistant text-[0.8125rem] leading-[1.8] whitespace-pre-wrap [overflow-wrap:anywhere] [&.user]:bg-soft [&.user]:pt-3 [&.user]:pb-3 [&.user]:pl-4 [&.user]:pr-4 [&.user]:rounded-card [&.assistant]:[border-left:2px_solid_var(--accent)] [&.assistant]:pt-[0] [&.assistant]:pb-[0] [&.assistant]:pl-4 [&.assistant]:pr-4", children: "Wie kann ich Ihnen helfen?" }),
|
|
110
|
+
messages.map((m, i) => /* @__PURE__ */ jsxs(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
className: "message text-[0.8125rem] leading-[1.8] whitespace-pre-wrap [overflow-wrap:anywhere] [&.user]:bg-soft [&.user]:pt-3 [&.user]:pb-3 [&.user]:pl-4 [&.user]:pr-4 [&.user]:rounded-card [&.assistant]:[border-left:2px_solid_var(--accent)] [&.assistant]:pt-[0] [&.assistant]:pb-[0] [&.assistant]:pl-4 [&.assistant]:pr-4 " + m.role,
|
|
114
|
+
children: [
|
|
115
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: m.role === "user" ? "Sie: " : "Assistent: " }),
|
|
116
|
+
m.content || "Antwort wird vorbereitet \u2026"
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
i
|
|
120
|
+
))
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
sources.length > 0 && /* @__PURE__ */ jsxs("div", { className: "sources text-[0.6875rem] text-muted mt-3.75 mb-3.75 ml-[0] mr-[0] [&_a]:mr-3", children: [
|
|
110
125
|
"Referenzquellen:",
|
|
111
126
|
" ",
|
|
112
127
|
sources.map(
|
|
@@ -119,31 +134,45 @@ function Chat(ctx) {
|
|
|
119
134
|
] }, s.id)
|
|
120
135
|
)
|
|
121
136
|
] }),
|
|
122
|
-
/* @__PURE__ */ jsxs(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
className: "
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
137
|
+
/* @__PURE__ */ jsxs(
|
|
138
|
+
"form",
|
|
139
|
+
{
|
|
140
|
+
className: "chat-form flex gap-2.5 items-end [&_textarea]:resize-y [&_textarea]:min-h-[50px] [&_textarea]:[flex:1] [&_textarea]:min-w-0 [&_button]:bg-accent [&_button]:text-accent-ink [&_button]:[border:0] [&_button]:w-[50px] [&_button]:h-[50px] [&_button]:rounded-card [&_button]:text-[1.25rem] [&_button:disabled]:opacity-[0.5]",
|
|
141
|
+
onSubmit: submit,
|
|
142
|
+
children: [
|
|
143
|
+
/* @__PURE__ */ jsx("label", { className: "sr-only", htmlFor: "chat-input", children: "Ihre Frage" }),
|
|
144
|
+
/* @__PURE__ */ jsx(
|
|
145
|
+
"textarea",
|
|
146
|
+
{
|
|
147
|
+
id: "chat-input",
|
|
148
|
+
className: "search bg-card border border-line rounded-card py-3.5 px-4.5 text-ink w-full",
|
|
149
|
+
value: input,
|
|
150
|
+
maxLength: 4e3,
|
|
151
|
+
onChange: (e) => setInput(e.target.value),
|
|
152
|
+
placeholder: "Ihre Frage an unser Team \u2026",
|
|
153
|
+
required: true
|
|
154
|
+
}
|
|
155
|
+
),
|
|
156
|
+
/* @__PURE__ */ jsx(
|
|
157
|
+
"button",
|
|
158
|
+
{
|
|
159
|
+
type: "submit",
|
|
160
|
+
disabled: busy || !input.trim(),
|
|
161
|
+
"aria-label": "Frage senden",
|
|
162
|
+
children: "\u2191"
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
),
|
|
168
|
+
error && /* @__PURE__ */ jsx(
|
|
169
|
+
"p",
|
|
170
|
+
{
|
|
171
|
+
className: "chat-error text-danger dark:text-warning text-[0.75rem]",
|
|
172
|
+
role: "alert",
|
|
173
|
+
children: error
|
|
174
|
+
}
|
|
175
|
+
)
|
|
147
176
|
] })
|
|
148
177
|
] });
|
|
149
178
|
}
|
package/dist/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kieksme/csp-plugin-chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.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.
|
|
25
|
+
"@kieksme/csp-sdk": "^0.5.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.
|
|
37
|
+
"sdkVersion": "^0.5.0",
|
|
38
38
|
"browser": "./browser",
|
|
39
39
|
"server": "./server"
|
|
40
40
|
},
|