vorqard-ai-sdk 1.0.1 → 1.0.2
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/package.json +1 -1
- package/src/index.js +2 -0
- package/src/screens/AIHealthChatScreen.js +12 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export const VorqardAIAssistant = ({
|
|
|
13
13
|
voiceBackendUrl,
|
|
14
14
|
userToken,
|
|
15
15
|
patientName = 'there',
|
|
16
|
+
initialPrompt,
|
|
16
17
|
userLocation,
|
|
17
18
|
onClose,
|
|
18
19
|
aiLogo,
|
|
@@ -33,6 +34,7 @@ export const VorqardAIAssistant = ({
|
|
|
33
34
|
<AIHealthChatScreen
|
|
34
35
|
voiceBackendUrl={voiceBackendUrl}
|
|
35
36
|
patientName={patientName}
|
|
37
|
+
initialPrompt={initialPrompt}
|
|
36
38
|
userLocation={userLocation}
|
|
37
39
|
onClose={onClose}
|
|
38
40
|
aiLogo={aiLogo}
|
|
@@ -78,6 +78,7 @@ const AI_ACTIONS = [
|
|
|
78
78
|
export const AIHealthChatScreen = ({
|
|
79
79
|
voiceBackendUrl,
|
|
80
80
|
patientName = 'there',
|
|
81
|
+
initialPrompt,
|
|
81
82
|
userLocation,
|
|
82
83
|
onClose,
|
|
83
84
|
aiLogo,
|
|
@@ -107,11 +108,21 @@ export const AIHealthChatScreen = ({
|
|
|
107
108
|
|
|
108
109
|
const [chatMode, setChatMode] = useState(false); // false = hub view, true = chat view
|
|
109
110
|
const [isVoiceMode, setIsVoiceMode] = useState(false); // true = live voice input panel active
|
|
111
|
+
const [hasSentInitial, setHasSentInitial] = useState(false);
|
|
110
112
|
|
|
111
113
|
useEffect(() => {
|
|
112
114
|
loadChatContext();
|
|
113
115
|
if (messages.length > 0) setChatMode(true);
|
|
114
|
-
|
|
116
|
+
|
|
117
|
+
// Auto-trigger an initial prompt if passed down
|
|
118
|
+
if (initialPrompt && !hasSentInitial) {
|
|
119
|
+
setHasSentInitial(true);
|
|
120
|
+
setChatMode(true);
|
|
121
|
+
setTimeout(() => {
|
|
122
|
+
sendMessage(initialPrompt);
|
|
123
|
+
}, 300);
|
|
124
|
+
}
|
|
125
|
+
}, [initialPrompt]);
|
|
115
126
|
|
|
116
127
|
// When user sends a message, switch to chat mode
|
|
117
128
|
const handleSend = (text) => {
|