@paymanai/payman-ask-sdk 4.0.3 → 4.0.4
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 +15 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -180,9 +180,19 @@ function parseSlashCommand(content) {
|
|
|
180
180
|
body: match[2] ?? ""
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function getSlashCommandValidationHint(content) {
|
|
184
184
|
const parsed = parseSlashCommand(content);
|
|
185
|
-
|
|
185
|
+
if (parsed?.command !== "/draft-knowledge") return null;
|
|
186
|
+
const lines = parsed.body.split(/\r?\n/);
|
|
187
|
+
const title = lines[0]?.trim() ?? "";
|
|
188
|
+
const markdownContent = lines.slice(1).join("\n").trim();
|
|
189
|
+
if (!title) {
|
|
190
|
+
return "Add a title after /draft-knowledge, then add markdown content on the next line.";
|
|
191
|
+
}
|
|
192
|
+
if (!markdownContent) {
|
|
193
|
+
return "Add markdown content on a new line below the title.";
|
|
194
|
+
}
|
|
195
|
+
return null;
|
|
186
196
|
}
|
|
187
197
|
|
|
188
198
|
// src/utils/errorMessages.ts
|
|
@@ -2654,8 +2664,9 @@ var ChatInputV2 = react.forwardRef(
|
|
|
2654
2664
|
}, [isRecording, transcribedText]);
|
|
2655
2665
|
const handleSend = react.useCallback(() => {
|
|
2656
2666
|
if (!value.trim() || disabled) return;
|
|
2657
|
-
|
|
2658
|
-
|
|
2667
|
+
const commandHint = getSlashCommandValidationHint(value);
|
|
2668
|
+
if (commandHint) {
|
|
2669
|
+
setInlineHint(commandHint);
|
|
2659
2670
|
return;
|
|
2660
2671
|
}
|
|
2661
2672
|
voiceDraftSyncActiveRef.current = false;
|