증상:
- STT 426ms로 빠른데 LLM refine 단계가 39초 소요 후 빈 문자열 반환
- _completeSession('') → finalText.length === 0이라 paste 호출 자체 건너뜀
- 사용자에게는 '느리고 paste 안 됨'으로 보임
원인:
- 사용자가 ollama pull qwen3:4b 한 직후 첫 호출 (모델 cold start 일부 있음)
- qwen3는 reasoning model이라 응답에 <think>...</think> 블록을 길게 출력
- system prompt에 '/no_think' 토큰 없음 → reasoning mode ON
- generate()는 data.response.trim() 그대로 반환 → think 블록 + 빈 본문이면
trim 후 빈 문자열
- 빈 문자열에 대한 fallback이 없어서 그대로 _completeSession('')
수정:
- SYSTEM_PROMPTS 모두에 '/no_think' 헤더 추가
- qwen3 reasoning 비활성화 → 응답 속도 대폭 단축
- 다른 모델(llama, mistral, gemma)은 토큰 무시 → 호환성 OK
- stripReasoningBlocks() 추가
- <think>...</think> + <thinking>...</thinking> 블록 제거 (gi flag)
- /no_think를 무시하는 모델 + 응답에 think tag가 섞여 들어오는 케이스 안전망
- processText() 결과:
- stripReasoningBlocks(result.text)
- 빈 문자열이면 원본 transcript fallback + warn 로그
|
||
|---|---|---|
| .. | ||
| desktop | ||
| mobile | ||
| web | ||