fix(ocr): address code review: add model fallback default, remove unused variable
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -261,7 +261,7 @@ def check_text_quality(text: str, text_source: TextSource) -> TextQualityResult:
|
|||||||
response_text: Optional[str] = None
|
response_text: Optional[str] = None
|
||||||
try:
|
try:
|
||||||
provider = get_ai_provider()
|
provider = get_ai_provider()
|
||||||
model = settings.ai_model or settings.openai_model
|
model = settings.ai_model or settings.openai_model or "gpt-4o-mini"
|
||||||
response_text = provider.chat_completion(
|
response_text = provider.chat_completion(
|
||||||
messages=[
|
messages=[
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -401,7 +401,6 @@ class TestCheckTextQualityAI:
|
|||||||
|
|
||||||
assert len(captured_prompts) == 1
|
assert len(captured_prompts) == 1
|
||||||
# The prompt should NOT contain more than _TEXT_SAMPLE_MAX_CHARS "a"s
|
# The prompt should NOT contain more than _TEXT_SAMPLE_MAX_CHARS "a"s
|
||||||
count_a = captured_prompts[0].count("a" * 100)
|
|
||||||
assert "a" * (_TEXT_SAMPLE_MAX_CHARS + 1) not in captured_prompts[0]
|
assert "a" * (_TEXT_SAMPLE_MAX_CHARS + 1) not in captured_prompts[0]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user