Add text chunking functionality to chat endpoint

- Introduced SentenceTextChunker and SentenceTextChunkerConfig for improved text processing in chat responses.
- Updated chat endpoint to conditionally use text chunking based on the new 'useTextChunk' parameter from the request.
- Enhanced logging to include 'useTextChunk' status and adjusted text delta handling to support chunked responses.
- Modified ProcessRequest_chat model to include 'useTextChunk' field for request handling.
- Added unit tests for SentenceTextChunker to ensure correct chunking behavior and edge case handling.
This commit is contained in:
Xin Wang
2026-06-17 14:18:24 +08:00
parent 084e13e03c
commit a6777a827b
4 changed files with 232 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ class ProcessRequest_chat(BaseModel):
timeStamp: str = Field(..., max_length=32)
text: str = Field(...)
needFormUpdate: bool = False
useTextChunk: bool = False
class ProcessResponse_chat(BaseModel):
sessionId: str = Field(..., max_length=64)