Spaces:
Sleeping
Sleeping
quachtiensinh27 commited on
Commit ·
246d7fe
1
Parent(s): 0729fd9
refactor: Clean up debug logs and add Swagger docs for conversationId
Browse files- Removed debug console.log statements from ta.service.js
- Removed redundant FormData append for conversationId (only use query param)
- Added @ApiQuery decorators for proper Swagger documentation
- Fixed URL construction to only use query parameter
- src/services/ta.service.js +1 -13
src/services/ta.service.js
CHANGED
|
@@ -118,23 +118,12 @@ const taService = {
|
|
| 118 |
* AI: Gọi Agent với File (PDF/Ảnh)
|
| 119 |
*/
|
| 120 |
callAgentWithFile: async (spaceId, query, senderId, file, conversationId) => {
|
| 121 |
-
console.log('[TA Service] callAgentWithFile:', {
|
| 122 |
-
spaceId,
|
| 123 |
-
senderId,
|
| 124 |
-
fileName: file?.name,
|
| 125 |
-
fileSize: file?.size,
|
| 126 |
-
conversationId
|
| 127 |
-
});
|
| 128 |
-
|
| 129 |
const formData = new FormData();
|
| 130 |
formData.append('file', file);
|
| 131 |
formData.append('query', query);
|
| 132 |
formData.append('senderId', senderId);
|
| 133 |
-
if (conversationId) {
|
| 134 |
-
formData.append('conversationId', conversationId);
|
| 135 |
-
}
|
| 136 |
|
| 137 |
-
|
| 138 |
if (conversationId) {
|
| 139 |
url += `&conversationId=${encodeURIComponent(conversationId)}`;
|
| 140 |
}
|
|
@@ -146,7 +135,6 @@ const taService = {
|
|
| 146 |
},
|
| 147 |
timeout: 180000
|
| 148 |
});
|
| 149 |
-
console.log('[TA Service] callAgentWithFile success:', response.data);
|
| 150 |
return response.data;
|
| 151 |
} catch (error) {
|
| 152 |
console.error('[TA Service] callAgentWithFile error:', {
|
|
|
|
| 118 |
* AI: Gọi Agent với File (PDF/Ảnh)
|
| 119 |
*/
|
| 120 |
callAgentWithFile: async (spaceId, query, senderId, file, conversationId) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
const formData = new FormData();
|
| 122 |
formData.append('file', file);
|
| 123 |
formData.append('query', query);
|
| 124 |
formData.append('senderId', senderId);
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
+
let url = `/ta/agent/chat-with-file?spaceId=${spaceId}&query=${encodeURIComponent(query)}&senderId=${encodeURIComponent(senderId)}`;
|
| 127 |
if (conversationId) {
|
| 128 |
url += `&conversationId=${encodeURIComponent(conversationId)}`;
|
| 129 |
}
|
|
|
|
| 135 |
},
|
| 136 |
timeout: 180000
|
| 137 |
});
|
|
|
|
| 138 |
return response.data;
|
| 139 |
} catch (error) {
|
| 140 |
console.error('[TA Service] callAgentWithFile error:', {
|