Voice commands now create activities directly via API
Some checks failed
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled

- Replace navigation to pre-filled forms with direct API activity creation
- Fetch children from family and use first child (can be enhanced for name matching)
- Show success/error messages with proper feedback
- Auto-close dialog after successful save
- Add test endpoint /api/v1/voice/test-classify for easy testing

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-02 08:08:31 +00:00
parent db0ff8067a
commit 4b8828fdad
4 changed files with 383 additions and 25 deletions

View File

@@ -10,6 +10,7 @@ import {
} from '@nestjs/common';
import { FileInterceptor } from '@nestjs/platform-express';
import { VoiceService } from './voice.service';
import { Public } from '../auth/decorators/public.decorator';
@Controller('api/v1/voice')
export class VoiceController {
@@ -150,4 +151,36 @@ export class VoiceController {
},
};
}
/**
* Test endpoint for voice classification (public, for development/testing only)
* IMPORTANT: Remove @Public() decorator in production
*/
@Public()
@Post('test-classify')
async testClassify(
@Body('text') text: string,
@Body('language') language?: string,
@Body('childName') childName?: string,
) {
if (!text) {
throw new BadRequestException('Text is required');
}
this.logger.log(`[TEST] Voice classification request: "${text}"`);
const result = await this.voiceService.extractActivityFromText(
text,
language || 'en',
childName,
);
this.logger.log(`[TEST] Classification result: ${JSON.stringify(result, null, 2)}`);
return {
success: true,
transcript: text,
classification: result,
};
}
}