@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.mjs
CHANGED
|
@@ -154,9 +154,19 @@ function parseSlashCommand(content) {
|
|
|
154
154
|
body: match[2] ?? ""
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function getSlashCommandValidationHint(content) {
|
|
158
158
|
const parsed = parseSlashCommand(content);
|
|
159
|
-
|
|
159
|
+
if (parsed?.command !== "/draft-knowledge") return null;
|
|
160
|
+
const lines = parsed.body.split(/\r?\n/);
|
|
161
|
+
const title = lines[0]?.trim() ?? "";
|
|
162
|
+
const markdownContent = lines.slice(1).join("\n").trim();
|
|
163
|
+
if (!title) {
|
|
164
|
+
return "Add a title after /draft-knowledge, then add markdown content on the next line.";
|
|
165
|
+
}
|
|
166
|
+
if (!markdownContent) {
|
|
167
|
+
return "Add markdown content on a new line below the title.";
|
|
168
|
+
}
|
|
169
|
+
return null;
|
|
160
170
|
}
|
|
161
171
|
|
|
162
172
|
// src/utils/errorMessages.ts
|
|
@@ -2628,8 +2638,9 @@ var ChatInputV2 = forwardRef(
|
|
|
2628
2638
|
}, [isRecording, transcribedText]);
|
|
2629
2639
|
const handleSend = useCallback(() => {
|
|
2630
2640
|
if (!value.trim() || disabled) return;
|
|
2631
|
-
|
|
2632
|
-
|
|
2641
|
+
const commandHint = getSlashCommandValidationHint(value);
|
|
2642
|
+
if (commandHint) {
|
|
2643
|
+
setInlineHint(commandHint);
|
|
2633
2644
|
return;
|
|
2634
2645
|
}
|
|
2635
2646
|
voiceDraftSyncActiveRef.current = false;
|