Fix chat API params to match voice agent

- Change clientId from '001' to 'MA_001'
- Change deployment_id to '21' (Ferdinand)
- Send raw question without context wrapping
- Same params as julia-agent/julia-ai/src/agent.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Sergei 2026-01-18 22:51:39 -08:00
parent 173c0a8262
commit 9b152bdf9d

View File

@ -150,31 +150,21 @@ export default function ChatScreen() {
throw new Error('Please log in');
}
// Get beneficiary context
let beneficiary = currentBeneficiary;
if (!beneficiary?.id) {
const loaded = await loadBeneficiaries();
if (loaded.length > 0) {
beneficiary = loaded[0];
setCurrentBeneficiary(beneficiary);
}
}
// Use same API parameters as voice agent (Julia AI)
// IMPORTANT: clientId MUST be 'MA_001' and deployment_id MUST be '21' (Ferdinand)
// to match the voice agent configuration in julia-agent/julia-ai/src/agent.py
const beneficiaryName = beneficiary?.name || 'the patient';
const deploymentId = beneficiary?.id?.toString() || '';
// Call API
// Call API with same params as voice agent
const response = await fetch(API_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({
function: 'voice_ask',
clientId: '001',
clientId: 'MA_001',
user_name: userName,
token: token,
question: `You are Julia, a caring assistant helping monitor ${beneficiaryName}'s wellbeing. Answer: ${trimmedInput}`,
deployment_id: deploymentId,
context: '',
question: trimmedInput,
deployment_id: '21',
}).toString(),
});
@ -202,7 +192,7 @@ export default function ChatScreen() {
} finally {
setIsSending(false);
}
}, [input, isSending, currentBeneficiary, loadBeneficiaries, setCurrentBeneficiary]);
}, [input, isSending]);
// Render message bubble
const renderMessage = ({ item }: { item: Message }) => {