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