Skip to content

Commit a8d082d

Browse files
committed
feat: document upload working flow
1 parent 3c523dc commit a8d082d

File tree

4 files changed

+22
-13
lines changed

4 files changed

+22
-13
lines changed

dashboard/views.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,10 @@ def process_document(self, document: Document, stored_path: str):
226226
document: Document model instance
227227
stored_path: Path where the file is stored in S3/storage
228228
"""
229-
from documents.tasks import process_document_task
229+
from documents.tasks import extract_document
230230

231231
# Schedule document processing task using the document's ID
232-
process_document_task.delay(document_id=document.id, stored_path=stored_path)
232+
extract_document.delay(document_id=document.id, stored_path=stored_path)
233233

234234
# Update document with scheduled status
235235
document.chunking_status = DocumentChunkingStatus.SCHEDULED
@@ -255,6 +255,8 @@ def post(self, request, *args, **kwargs):
255255
)
256256
continue
257257

258+
# TODO: get file size and check if it is too large
259+
258260
# Create document instance
259261
try:
260262
document = Document.objects.create(

templates/dashboard/dashboard.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<a href="{% url 'dashboard:knowledge-bases' %}">knowledge bases</a>
1313
</li>
1414
<li>
15-
<a href="">documents</a>
15+
<a href=""></a>
1616
</li>
1717
</div>
1818
</div>

templates/dashboard/kb/detail.html

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,32 @@ <h2>{{ knowledge_base.name }}</h2>
1313
</div>
1414
</div>
1515

16-
<div class="uk-margin">
16+
<div class="uk-margin-small-top">
1717
<p class="uk-text-muted">{{ knowledge_base.description }}</p>
1818
</div>
1919

2020
<!-- Documents List -->
21-
<div class="uk-margin-large-top">
21+
<div class="uk-margin-small-top">
2222
<h3>Documents</h3>
2323

2424
{% if documents %}
2525
<div class="uk-grid uk-child-width-1-3@m" uk-grid>
2626
{% for doc in documents %}
2727
<div>
2828
<div class="uk-card uk-card-default uk-card-body uk-card-small">
29-
<h4 class="uk-card-title">{{ doc.name }}</h4>
29+
<h4 class="uk-card-title">
30+
<a href="{% url 'dashboard:knowledge-base-detail' doc.id %}">
31+
{{ doc.name }}
32+
</a>
33+
</h4>
3034
<div class="uk-text-meta">
3135
Size: {{ doc.file_size|filesizeformat }}<br>
3236
Type: {{ doc.content_type }}<br>
33-
Chunks: {{ doc.total_chunks }}
37+
Chunks: {{ doc.total_chunks }}<br>
38+
Status: {{ doc.chunking_status }}
3439
</div>
3540
<div class="uk-margin-small-top">
36-
<span class="uk-text-meta">Added {{ doc.created_at|timesince }} ago</span>
41+
<span class="uk-text-meta">{{ doc.created_at|timesince }} ago</span>
3742
</div>
3843
</div>
3944
</div>

templates/dashboard/kb/list.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ <h2>knowledge bases</h2>
2525
<div class="uk-grid uk-child-width-1-3@m" uk-grid>
2626
{% for kb in knowledge_bases %}
2727
<div>
28-
<div class="uk-card uk-card-default uk-card-body">
29-
<h3 class="uk-card-title">{{ kb.name }}</h3>
28+
<div class="uk-card uk-card-default uk-card-body uk-card-small">
29+
<h3 class="uk-card-title">
30+
<a href="{% url 'dashboard:knowledge-base-detail' kb.id %}">
31+
{{ kb.name }}
32+
</a>
33+
</h3>
3034
<p>{{ kb.description|truncatewords:30 }}</p>
31-
<a href="{% url 'dashboard:knowledge-base-detail' kb.id %}"
32-
class="uk-margin-bottom uk-button uk-button-primary uk-button-small">View</a>
3335
<div class="uk-text-meta">
34-
Created on {{ kb.created_at|date:"M d, Y" }}
36+
{{ kb.created_at|date:"M d, Y" }}
3537
</div>
3638
</div>
3739
</div>

0 commit comments

Comments
 (0)