fix: Adjust chunk size in parse_one_chapter to 1500 and add enable_thinking parameter to LLMService methods
This commit is contained in:
@@ -361,7 +361,7 @@ async def parse_one_chapter(project_id: int, chapter_id: int, user: User, db) ->
|
|||||||
|
|
||||||
crud.delete_audiobook_segments_for_chapter(db, project_id, chapter.chapter_index)
|
crud.delete_audiobook_segments_for_chapter(db, project_id, chapter.chapter_index)
|
||||||
|
|
||||||
chunks = _chunk_chapter(chapter.source_text, max_chars=4000)
|
chunks = _chunk_chapter(chapter.source_text, max_chars=1500)
|
||||||
ps.append_line(key, f"共 {len(chunks)} 块\n")
|
ps.append_line(key, f"共 {len(chunks)} 块\n")
|
||||||
|
|
||||||
seg_counter = 0
|
seg_counter = 0
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ class LLMService:
|
|||||||
"temperature": 0.3,
|
"temperature": 0.3,
|
||||||
"max_tokens": max_tokens,
|
"max_tokens": max_tokens,
|
||||||
"stream": True,
|
"stream": True,
|
||||||
|
"enable_thinking": False,
|
||||||
}
|
}
|
||||||
full_text = ""
|
full_text = ""
|
||||||
timeout = httpx.Timeout(connect=10.0, read=90.0, write=10.0, pool=5.0)
|
timeout = httpx.Timeout(connect=10.0, read=90.0, write=10.0, pool=5.0)
|
||||||
@@ -87,6 +88,8 @@ class LLMService:
|
|||||||
{"role": "user", "content": user_message},
|
{"role": "user", "content": user_message},
|
||||||
],
|
],
|
||||||
"temperature": 0.3,
|
"temperature": 0.3,
|
||||||
|
"max_tokens": 8192,
|
||||||
|
"enable_thinking": False,
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout = httpx.Timeout(connect=10.0, read=90.0, write=10.0, pool=5.0)
|
timeout = httpx.Timeout(connect=10.0, read=90.0, write=10.0, pool=5.0)
|
||||||
|
|||||||
Reference in New Issue
Block a user