Skip to content

Commit 37048f8

Browse files
committed
fix: tidy up
1 parent f99ea83 commit 37048f8

File tree

3 files changed

+21
-23
lines changed

3 files changed

+21
-23
lines changed

aperag/service/agent_chat_service.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -174,25 +174,18 @@ async def handle_websocket_agent_chat(self, websocket: WebSocket, user: str, bot
174174

175175
# Get default collections once for performance
176176
if bot_config.agent.collections:
177-
user_collections = await self.db_ops.list_all_accessible_collections_for_user(user)
178-
user_collections_ids = [collection['id'] for collection in user_collections]
179-
# Create a dictionary for easy lookup
180-
user_collections_dict = {collection['id']: collection for collection in user_collections}
181-
182177
agent_collection_ids = [collection.id for collection in bot_config.agent.collections]
183-
for collection_id in agent_collection_ids:
184-
if collection_id not in user_collections_ids:
185-
raise ResourceNotFoundException("Collection", collection_id)
186-
agent_collection = user_collections_dict[collection_id]
178+
agent_collections = await self.db_ops.query_collections_by_ids(user, agent_collection_ids)
179+
for agent_collection in agent_collections:
187180
default_collections.append(view_models.Collection(
188-
id=agent_collection['id'],
189-
title=agent_collection['title'],
190-
description=agent_collection['description'],
191-
type=agent_collection['type'],
192-
status=agent_collection['status'],
193-
config=parseCollectionConfig(agent_collection['config']),
194-
created=agent_collection['gmt_created'].isoformat(),
195-
updated=agent_collection['gmt_updated'].isoformat(),
181+
id=agent_collection.id,
182+
title=agent_collection.title,
183+
description=agent_collection.description,
184+
type=agent_collection.type,
185+
status=agent_collection.status,
186+
config=parseCollectionConfig(agent_collection.config),
187+
created=agent_collection.gmt_created.isoformat(),
188+
updated=agent_collection.gmt_updated.isoformat(),
196189
))
197190

198191
while True:

envs/env.template

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@ POSTGRES_PASSWORD=postgres
77

88
# Database Connection Pool Settings
99
# Adjust these values based on your server resources and expected load
10-
DB_POOL_SIZE=20 # Base connection pool size
11-
DB_MAX_OVERFLOW=40 # Maximum overflow connections (total = pool_size + max_overflow)
12-
DB_POOL_TIMEOUT=60 # Connection timeout in seconds
13-
DB_POOL_RECYCLE=3600 # Recycle connections after 1 hour (in seconds)
14-
DB_POOL_PRE_PING=True # Validate connections before use
10+
# Base connection pool size
11+
DB_POOL_SIZE=20
12+
# Maximum overflow connections (total = pool_size + max_overflow)
13+
DB_MAX_OVERFLOW=40
14+
# Connection timeout in seconds
15+
DB_POOL_TIMEOUT=60
16+
# Recycle connections after 1 hour (in seconds)
17+
DB_POOL_RECYCLE=3600
18+
# Validate connections before use
19+
DB_POOL_PRE_PING=True
1520

1621
# Redis
1722
REDIS_HOST=127.0.0.1

web/src/app/workspace/collections/[collectionId]/documents/upload/document-upload.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ export const DocumentUpload = () => {
378378
<>
379379
<FileUpload
380380
maxFiles={1000}
381-
maxSize={10 * 1024 * 1024}
381+
maxSize={100 * 1024 * 1024}
382382
className="w-full gap-4"
383383
accept=".pdf,.doc,.docx,.txt,.md,.ppt,.pptx,.xls,.xlsx"
384384
value={documents.map((f) => f.file)}

0 commit comments

Comments
 (0)