diff --git a/application/api/user/routes.py b/application/api/user/routes.py
index b6bd5fea..fa0ff382 100644
--- a/application/api/user/routes.py
+++ b/application/api/user/routes.py
@@ -248,13 +248,12 @@ class DeleteOldIndexes(Resource):
jsonify({"success": False, "message": "Missing required fields"}), 400
)
- try:
- doc = sources_collection.find_one(
+ doc = sources_collection.find_one(
{"_id": ObjectId(source_id), "user": "local"}
- )
- if not doc:
+ )
+ if not doc:
return make_response(jsonify({"status": "not found"}), 404)
-
+ try:
if settings.VECTOR_STORE == "faiss":
shutil.rmtree(os.path.join(current_dir, "indexes", str(doc["_id"])))
else:
@@ -263,12 +262,12 @@ class DeleteOldIndexes(Resource):
)
vectorstore.delete_index()
- sources_collection.delete_one({"_id": ObjectId(source_id)})
except FileNotFoundError:
pass
except Exception as err:
return make_response(jsonify({"success": False, "error": str(err)}), 400)
-
+
+ sources_collection.delete_one({"_id": ObjectId(source_id)})
return make_response(jsonify({"success": True}), 200)
diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx
index ed69064a..7f06d6b1 100644
--- a/frontend/src/conversation/Conversation.tsx
+++ b/frontend/src/conversation/Conversation.tsx
@@ -15,7 +15,6 @@ import { useDarkTheme, useMediaQuery } from '../hooks';
import { ShareConversationModal } from '../modals/ShareConversationModal';
import { selectConversationId } from '../preferences/preferenceSlice';
import { AppDispatch } from '../store';
-import conversationService from '../api/services/conversationService';
import ConversationBubble from './ConversationBubble';
import { handleSendFeedback } from './conversationHandlers';
import { FEEDBACK, Query } from './conversationModels';
@@ -323,8 +322,8 @@ export default function Conversation() {
)}
-
-
+
+
@@ -337,10 +337,7 @@ const ConversationBubble = forwardRef<
) : (
-
+
{children}
);
diff --git a/frontend/src/conversation/conversationSlice.ts b/frontend/src/conversation/conversationSlice.ts
index 5e1f9b27..9298e7a5 100644
--- a/frontend/src/conversation/conversationSlice.ts
+++ b/frontend/src/conversation/conversationSlice.ts
@@ -157,8 +157,7 @@ export const fetchAnswer = createAsyncThunk<
result: '',
sources: [],
};
-},
-);
+});
export const conversationSlice = createSlice({
name: 'conversation',
diff --git a/frontend/src/settings/Documents.tsx b/frontend/src/settings/Documents.tsx
index 8e563f65..cea14f0a 100644
--- a/frontend/src/settings/Documents.tsx
+++ b/frontend/src/settings/Documents.tsx
@@ -15,6 +15,7 @@ import { Doc, DocumentsProps, ActiveState } from '../models/misc'; // Ensure Act
import { getDocs, getDocsWithPagination } from '../preferences/preferenceApi';
import { setSourceDocs } from '../preferences/preferenceSlice';
import { setPaginatedDocuments } from '../preferences/preferenceSlice';
+import { truncate } from '../utils/stringUtils';
// Utility function to format numbers
const formatTokens = (tokens: number): string => {
@@ -134,7 +135,6 @@ const Documents: React.FC = ({
};
useEffect(() => {
- // console.log('modalState', modalState);
if (modalState === 'INACTIVE') {
refreshDocs(sortField, currentPage, rowsPerPage);
}
@@ -184,13 +184,13 @@ const Documents: React.FC = ({
-
+
- |
+ |
{t('settings.documents.name')}
|
-
+ |
{t('settings.documents.date')}
![]() = ({
/>
|
-
+ |
{t('settings.documents.tokenUsage')}
![]() = ({
*/}
|
+ className="px-6 py-2 text-start font-medium text-gray-700 dark:text-gray-50 uppercase"
+ >
+ {' '}
+ |
{!currentDocuments?.length && (
|
{t('settings.documents.noData')}
|
@@ -239,13 +244,16 @@ const Documents: React.FC = ({
{Array.isArray(currentDocuments) &&
currentDocuments.map((document, index) => (
- |
- {document.name}
+ |
+ {truncate(document.name, 50)}
|
-
+ |
{document.date}
|
-
+ |
{document.tokens
? formatTokens(+document.tokens)
: ''}
diff --git a/frontend/src/utils/stringUtils.ts b/frontend/src/utils/stringUtils.ts
new file mode 100644
index 00000000..e87a7af3
--- /dev/null
+++ b/frontend/src/utils/stringUtils.ts
@@ -0,0 +1,4 @@
+export function truncate(str: string, n: number) {
+ // slices long strings and ends with ...
+ return str.length > n ? str.slice(0, n - 1) + '...' : str;
+}
|