mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-04-03 14:33:15 -04:00
Enforce text length limits in editor paste handling, adjust API request size limit, and crop excessive content in LLM profile extraction
This commit is contained in:
@@ -669,7 +669,7 @@ Object.entries(handlers).forEach(([path, handler]) => {
|
||||
|
||||
const apiRoute = [
|
||||
url,
|
||||
express.json(),
|
||||
express.json({limit: '1mb'}),
|
||||
allowCorsUnrestricted,
|
||||
cache,
|
||||
typedEndpoint(path as any, handler as any),
|
||||
|
||||
@@ -274,8 +274,8 @@ TEXT TO ANALYZE:
|
||||
`
|
||||
const text = EXTRACTION_PROMPT + content
|
||||
if (text.length > MAX_CONTEXT_LENGTH) {
|
||||
log('Content exceeds maximum length', {length: text.length})
|
||||
throw APIErrors.badRequest('Content exceeds maximum length')
|
||||
log('Content exceeds maximum length, will be cropped', {length: text.length})
|
||||
// throw APIErrors.badRequest('Content exceeds maximum length')
|
||||
}
|
||||
debug({text})
|
||||
|
||||
@@ -404,6 +404,8 @@ export const llmExtractProfileEndpoint: APIHandler<'llm-extract-profile'> = asyn
|
||||
extracted.bio = bio
|
||||
}
|
||||
|
||||
debug(JSON.stringify(bio))
|
||||
|
||||
log('Profile extracted successfully', {extracted})
|
||||
|
||||
return extracted
|
||||
|
||||
Reference in New Issue
Block a user