Spaces:
Paused
Paused
Download fronted/src/services/speakingAnalysisService.js from phuc7/linguaielts-api: direct link, hf CLI and curl.
- Browser
- Download file 869 Bytes
-
https://huggingface.co/spaces/phuc7/linguaielts-api/resolve/main/fronted/src/services/speakingAnalysisService.js
- Command line
-
hf download hf://spaces/phuc7/linguaielts-api/fronted/src/services/speakingAnalysisService.js
-
curl -L -o speakingAnalysisService.js https://huggingface.co/spaces/phuc7/linguaielts-api/resolve/main/fronted/src/services/speakingAnalysisService.js
869 Bytes
| import apiClient from '@/api/client.js' | |
| let _cacheKey = '' | |
| let _cachePromise = null | |
| /** | |
| * One OpenRouter-backed call (via backend) for grammar + vocabulary card data. | |
| * @param {{ transcript: string, questionText?: string }} params | |
| */ | |
| export async function fetchLanguageAnalysis({ transcript, questionText = '' }) { | |
| const key = `${transcript}::${questionText}` | |
| if (_cacheKey === key && _cachePromise) return _cachePromise | |
| _cacheKey = key | |
| _cachePromise = apiClient | |
| .post( | |
| '/speaking/analyze-language', | |
| { | |
| transcript, | |
| question_text: questionText, | |
| }, | |
| { timeout: 90_000 }, | |
| ) | |
| .then((res) => res.data) | |
| .catch((err) => { | |
| _cacheKey = '' | |
| _cachePromise = null | |
| throw err | |
| }) | |
| return _cachePromise | |
| } | |
| export function clearLanguageAnalysisCache() { | |
| _cacheKey = '' | |
| _cachePromise = null | |
| } | |