django-spire 0.21.0__py3-none-any.whl → 0.22.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_spire/ai/chat/templates/django_spire/ai/chat/element/recent_chat_select_element.html +1 -1
- django_spire/ai/chat/templates/django_spire/ai/chat/widget/selection_widget.html +1 -1
- django_spire/consts.py +1 -1
- django_spire/core/static/django_spire/css/app-navigation.css +4 -4
- django_spire/core/static/django_spire/css/app-side-panel.css +0 -45
- django_spire/core/{tags → tag}/intelligence/tag_set_bot.py +5 -4
- django_spire/core/tag/mixins.py +23 -0
- django_spire/core/{tags → tag}/models.py +1 -1
- django_spire/core/tag/service/tag_service.py +72 -0
- django_spire/core/{tags → tag}/tests/test_intelligence.py +1 -1
- django_spire/core/tag/tests/test_tags.py +102 -0
- django_spire/core/tag/tools.py +66 -0
- django_spire/core/templates/django_spire/navigation/top_navigation.html +42 -38
- django_spire/core/templates/django_spire/page/full_page.html +69 -47
- django_spire/core/templates/django_spire/tag/element/tag.html +1 -0
- django_spire/core/templatetags/spire_core_tags.py +12 -0
- django_spire/knowledge/collection/models.py +2 -2
- django_spire/knowledge/collection/services/tag_service.py +16 -14
- django_spire/knowledge/entry/models.py +2 -2
- django_spire/knowledge/entry/querysets.py +5 -0
- django_spire/knowledge/entry/services/tag_service.py +5 -5
- django_spire/knowledge/intelligence/bots/entries_search_llm_bot.py +44 -0
- django_spire/knowledge/intelligence/intel/entry_intel.py +24 -4
- django_spire/knowledge/intelligence/workflows/knowledge_workflow.py +46 -25
- django_spire/knowledge/templates/django_spire/knowledge/collection/page/display_page.html +6 -4
- django_spire/knowledge/templates/django_spire/knowledge/entry/version/page/editor_page.html +3 -2
- django_spire/knowledge/templates/django_spire/knowledge/message/knowledge_message_intel.html +14 -6
- django_spire/knowledge/templates/django_spire/knowledge/sub_navigation/item/entry_sub_navigation_item.html +1 -0
- django_spire/settings.py +1 -1
- {django_spire-0.21.0.dist-info → django_spire-0.22.0.dist-info}/METADATA +2 -2
- {django_spire-0.21.0.dist-info → django_spire-0.22.0.dist-info}/RECORD +39 -41
- django_spire/core/tags/mixins.py +0 -61
- django_spire/core/tags/tests/test_tags.py +0 -102
- django_spire/core/tags/tools.py +0 -20
- django_spire/knowledge/intelligence/bots/entry_search_llm_bot.py +0 -45
- django_spire/knowledge/intelligence/decoders/collection_decoder.py +0 -19
- django_spire/knowledge/intelligence/decoders/entry_decoder.py +0 -22
- django_spire/knowledge/intelligence/intel/collection_intel.py +0 -8
- django_spire/knowledge/templates/django_spire/knowledge/entry/version/page/form_page.html +0 -26
- /django_spire/core/{tags → tag}/__init__.py +0 -0
- /django_spire/core/{tags → tag}/intelligence/__init__.py +0 -0
- /django_spire/core/{tags → tag}/querysets.py +0 -0
- /django_spire/core/{tags/tests → tag/service}/__init__.py +0 -0
- /django_spire/{knowledge/intelligence/decoders → core/tag/tests}/__init__.py +0 -0
- {django_spire-0.21.0.dist-info → django_spire-0.22.0.dist-info}/WHEEL +0 -0
- {django_spire-0.21.0.dist-info → django_spire-0.22.0.dist-info}/licenses/LICENSE.md +0 -0
- {django_spire-0.21.0.dist-info → django_spire-0.22.0.dist-info}/top_level.txt +0 -0
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
></i>
|
|
78
78
|
|
|
79
79
|
<template x-if="!can_rename_chat">
|
|
80
|
-
<div @click="$dispatch('load-chat', {chat_id: {{ recent_chat.id }}})" class="cursor-pointer flex-grow-1 text-truncate">
|
|
80
|
+
<div @click="$dispatch('load-chat', {chat_id: {{ recent_chat.id }}})" class="cursor-pointer flex-grow-1 text-truncate" data-closes-nav>
|
|
81
81
|
<span class="px-2 fs-7" x-text="chat_name"></span>
|
|
82
82
|
</div>
|
|
83
83
|
</template>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
<div class="col-12 px-0">
|
|
23
23
|
<div class="px-2 pb-3">
|
|
24
|
-
<button @click="$dispatch('load-chat', {chat_id: 0})" class="btn btn-app-primary-outlined p-1 w-100">
|
|
24
|
+
<button @click="$dispatch('load-chat', {chat_id: 0})" class="btn btn-app-primary-outlined p-1 w-100" data-closes-nav>
|
|
25
25
|
<i class="bi bi-plus-lg me-2"></i>New Chat
|
|
26
26
|
</button>
|
|
27
27
|
</div>
|
django_spire/consts.py
CHANGED
|
@@ -82,14 +82,14 @@
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
.side-navigation-fade-bottom {
|
|
85
|
-
background: linear-gradient(to top, var(--app-side-navigation-bg-color) 0%,
|
|
86
|
-
height:
|
|
85
|
+
background: linear-gradient(to top, var(--app-side-navigation-bg-color) 0%, transparent 100%);
|
|
86
|
+
height: 60px;
|
|
87
87
|
pointer-events: none;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
.side-navigation-fade-top {
|
|
91
|
-
background: linear-gradient(to bottom, var(--app-side-navigation-bg-color) 0%,
|
|
92
|
-
height:
|
|
91
|
+
background: linear-gradient(to bottom, var(--app-side-navigation-bg-color) 0%, transparent 100%);
|
|
92
|
+
height: 60px;
|
|
93
93
|
pointer-events: none;
|
|
94
94
|
}
|
|
95
95
|
|
|
@@ -5,25 +5,6 @@
|
|
|
5
5
|
top: var(--app-top-navigation-height);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
.btn-close-panel {
|
|
9
|
-
align-items: center;
|
|
10
|
-
background: transparent;
|
|
11
|
-
border: none;
|
|
12
|
-
border-radius: 50%;
|
|
13
|
-
color: var(--app-primary);
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
display: flex;
|
|
16
|
-
height: 28px;
|
|
17
|
-
justify-content: center;
|
|
18
|
-
transition: background 0.2s ease, color 0.2s ease;
|
|
19
|
-
width: 28px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.btn-close-panel:hover {
|
|
23
|
-
background: var(--app-primary);
|
|
24
|
-
color: var(--app-default-button-text-color);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
8
|
.panel-toggle-container {
|
|
28
9
|
height: 30px;
|
|
29
10
|
position: fixed;
|
|
@@ -50,32 +31,6 @@
|
|
|
50
31
|
width: 30px !important;
|
|
51
32
|
}
|
|
52
33
|
|
|
53
|
-
.side-panel-transition-enter {
|
|
54
|
-
transition: opacity 0.3s ease;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.side-panel-transition-enter-start-left,
|
|
58
|
-
.side-panel-transition-enter-start-right {
|
|
59
|
-
opacity: 0;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.side-panel-transition-enter-end {
|
|
63
|
-
opacity: 1;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.side-panel-transition-leave {
|
|
67
|
-
transition: opacity 0.3s ease;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.side-panel-transition-leave-start {
|
|
71
|
-
opacity: 1;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.side-panel-transition-leave-end-left,
|
|
75
|
-
.side-panel-transition-leave-end-right {
|
|
76
|
-
opacity: 0;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
34
|
@media (min-width: 992px) {
|
|
80
35
|
.panel-toggle-container-left {
|
|
81
36
|
left: var(--app-side-navigation-width);
|
|
@@ -13,10 +13,11 @@ class TagSetBot(Bot):
|
|
|
13
13
|
Prompt()
|
|
14
14
|
.list([
|
|
15
15
|
'Make sure to have enough tags to properly cover all the provided content.',
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
16
|
+
'Include tags that help searchability.',
|
|
17
|
+
'Focus on tagging the words in the content.',
|
|
18
|
+
'Only add additional words that are very relevant to the content.',
|
|
19
|
+
'Use spaces to separate words in tags.',
|
|
20
|
+
'Include common acronyms in addition to the tags.',
|
|
20
21
|
])
|
|
21
22
|
)
|
|
22
23
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from django.db import models
|
|
2
|
+
|
|
3
|
+
from django_spire.core.tag.models import Tag
|
|
4
|
+
from django_spire.core.tag.tools import simplify_and_weight_tag_set_to_dict, simplify_tag_set
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TagModelMixin(models.Model):
|
|
8
|
+
tags = models.ManyToManyField(Tag, related_name='+', null=True, blank=True, editable=False)
|
|
9
|
+
|
|
10
|
+
class Meta:
|
|
11
|
+
abstract = True
|
|
12
|
+
|
|
13
|
+
@property
|
|
14
|
+
def tag_set(self) -> set[str]:
|
|
15
|
+
return set(self.tags.values_list('name', flat=True))
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
def simplified_tag_set(self) -> set[str]:
|
|
19
|
+
return simplify_tag_set(self.tag_set)
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def simplified_and_weighted_tag_dict(self) -> dict[str, int]:
|
|
23
|
+
return simplify_and_weight_tag_set_to_dict(self.tag_set)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
from abc import abstractmethod, ABC
|
|
2
|
+
from typing import Generic
|
|
3
|
+
|
|
4
|
+
from django.db.models import QuerySet
|
|
5
|
+
|
|
6
|
+
from django_spire.contrib.constructor.django_model_constructor import TypeDjangoModel
|
|
7
|
+
from django_spire.contrib.service import BaseDjangoModelService
|
|
8
|
+
from django_spire.core.tag import tools
|
|
9
|
+
from django_spire.core.tag.models import Tag
|
|
10
|
+
from django_spire.core.tag.tools import get_score_percentage_from_tag_set_weighted
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class BaseTagService(
|
|
14
|
+
BaseDjangoModelService[TypeDjangoModel],
|
|
15
|
+
ABC,
|
|
16
|
+
Generic[TypeDjangoModel]
|
|
17
|
+
):
|
|
18
|
+
obj: TypeDjangoModel
|
|
19
|
+
|
|
20
|
+
@abstractmethod
|
|
21
|
+
def process_and_set_tags(self):
|
|
22
|
+
raise NotImplementedError
|
|
23
|
+
|
|
24
|
+
def add_tags_from_tag_set(self, tag_set: set[str]):
|
|
25
|
+
self._update_global_tags_from_set(tag_set)
|
|
26
|
+
|
|
27
|
+
self.obj.tags.add(*Tag.objects.in_tag_set(tag_set))
|
|
28
|
+
|
|
29
|
+
def clear_tags(self):
|
|
30
|
+
self.obj.tags.clear()
|
|
31
|
+
|
|
32
|
+
def get_matching_tags_from_tag_set(self, tag_set: set[str]) -> QuerySet:
|
|
33
|
+
return self.obj.tags.in_tag_set(tag_set)
|
|
34
|
+
|
|
35
|
+
def get_matching_percentage_of_tag_set(self, tag_set: set[str]) -> float:
|
|
36
|
+
return tools.get_matching_a_percentage_from_tag_sets(tag_set, self.obj.tag_set)
|
|
37
|
+
|
|
38
|
+
def get_matching_percentage_of_model_tags_from_tag_set(self, tag_set: set[str]) -> float:
|
|
39
|
+
return tools.get_matching_b_percentage_from_tag_sets(tag_set, self.obj.tag_set)
|
|
40
|
+
|
|
41
|
+
def get_score_percentage_from_tag_set_weighted(self, tag_set: set[str]) -> float:
|
|
42
|
+
return get_score_percentage_from_tag_set_weighted(
|
|
43
|
+
tag_set_actual=tag_set,
|
|
44
|
+
tag_set_reference=self.obj.tag_set
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
def get_simplified_and_weighted_tag_dict_above_minimum(self, minimum_weight: int = 1) -> dict[str, int]:
|
|
48
|
+
above_minimum_tag_dict = self.obj.simplified_and_weighted_tag_dict
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
tag: weight
|
|
52
|
+
for tag, weight in above_minimum_tag_dict.items()
|
|
53
|
+
if weight >= minimum_weight
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
def has_tags_in_tag_set(self, tag_set: set[str]) -> bool:
|
|
57
|
+
return self.obj.tag_set.issuperset(tag_set)
|
|
58
|
+
|
|
59
|
+
def remove_tags_by_tag_set(self, tag_set: set[str]):
|
|
60
|
+
tag_objects = Tag.objects.in_tag_set(tag_set)
|
|
61
|
+
|
|
62
|
+
self.obj.tags.remove(*tag_objects)
|
|
63
|
+
|
|
64
|
+
def set_tags_from_tag_set(self, tag_set: set[str]):
|
|
65
|
+
self._update_global_tags_from_set(tag_set)
|
|
66
|
+
|
|
67
|
+
tag_objects = Tag.objects.in_tag_set(tag_set)
|
|
68
|
+
self.obj.tags.set(tag_objects)
|
|
69
|
+
|
|
70
|
+
@staticmethod
|
|
71
|
+
def _update_global_tags_from_set(tag_set: set[str]):
|
|
72
|
+
Tag.add_tags([Tag(name=tag) for tag in tag_set])
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from unittest import TestCase
|
|
2
2
|
|
|
3
|
-
from django_spire.core.
|
|
3
|
+
from django_spire.core.tag.intelligence.tag_set_bot import TagSetBot
|
|
4
4
|
|
|
5
5
|
TEST_INPUT = """
|
|
6
6
|
I love reading books about science fiction, fantasy, and adventure, especially ones
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
from django.test import TestCase
|
|
2
|
+
|
|
3
|
+
from django_spire.core.tag.models import Tag
|
|
4
|
+
from django_spire.knowledge.collection.models import Collection
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TestTags(TestCase):
|
|
8
|
+
def setUp(self):
|
|
9
|
+
self.collection = Collection.objects.create(
|
|
10
|
+
name='Test Collection', description='Test Collection Description'
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
self.tag_set_a = {'apple', 'banana', 'orange'}
|
|
14
|
+
self.tag_set_b = {'grape', 'kiwi', 'pear'}
|
|
15
|
+
self.tag_set_c = {'lemon', 'lime', 'mango'}
|
|
16
|
+
|
|
17
|
+
self.mixed_tag_set = {'apple', 'grape', 'lemon'}
|
|
18
|
+
|
|
19
|
+
self.dirty_tag_set = {'HaT~', 'four* tacos', '123 hoop!!'}
|
|
20
|
+
|
|
21
|
+
self.collection.services.tag.add_tags_from_tag_set(self.tag_set_a)
|
|
22
|
+
self.collection.services.tag.add_tags_from_tag_set(self.tag_set_b)
|
|
23
|
+
self.collection.services.tag.add_tags_from_tag_set(self.tag_set_c)
|
|
24
|
+
|
|
25
|
+
self.collection.services.tag.add_tags_from_tag_set(self.mixed_tag_set)
|
|
26
|
+
|
|
27
|
+
self.collection.services.tag.add_tags_from_tag_set(self.dirty_tag_set)
|
|
28
|
+
|
|
29
|
+
def test_tag_removal(self):
|
|
30
|
+
self.assertIn('apple', self.collection.tag_set)
|
|
31
|
+
|
|
32
|
+
self.collection.services.tag.remove_tags_by_tag_set(self.mixed_tag_set)
|
|
33
|
+
|
|
34
|
+
self.assertNotIn('lemon', self.collection.tag_set)
|
|
35
|
+
|
|
36
|
+
self.assertIn('kiwi', self.collection.tag_set)
|
|
37
|
+
|
|
38
|
+
def test_tag_add_and_set(self):
|
|
39
|
+
self.collection.services.tag.set_tags_from_tag_set(self.mixed_tag_set)
|
|
40
|
+
|
|
41
|
+
self.assertIn('lemon', self.collection.tag_set)
|
|
42
|
+
|
|
43
|
+
self.assertNotIn('banana', self.collection.tag_set)
|
|
44
|
+
|
|
45
|
+
def test_tag_count(self):
|
|
46
|
+
self.assertEqual(Tag.objects.count(), 12)
|
|
47
|
+
self.assertEqual(self.collection.tags.count(), 12)
|
|
48
|
+
|
|
49
|
+
def test_tag_removal(self):
|
|
50
|
+
self.collection.services.tag.remove_tags_by_tag_set(self.tag_set_a)
|
|
51
|
+
|
|
52
|
+
self.assertEqual(self.collection.tags.count(), 9)
|
|
53
|
+
|
|
54
|
+
def test_tag_bool_methods(self):
|
|
55
|
+
self.collection.services.tag.remove_tags_by_tag_set(self.tag_set_b)
|
|
56
|
+
|
|
57
|
+
self.assertTrue(self.collection.services.tag.has_tags_in_tag_set(self.tag_set_c))
|
|
58
|
+
self.assertFalse(self.collection.services.tag.has_tags_in_tag_set(self.mixed_tag_set))
|
|
59
|
+
|
|
60
|
+
def test_tag_matching_methods(self):
|
|
61
|
+
self.assertEqual(len(self.collection.services.tag.get_matching_tags_from_tag_set(self.tag_set_a)), 3)
|
|
62
|
+
|
|
63
|
+
self.collection.services.tag.remove_tags_by_tag_set(self.tag_set_a)
|
|
64
|
+
|
|
65
|
+
self.assertEqual(len(self.collection.services.tag.get_matching_tags_from_tag_set(self.tag_set_a)), 0)
|
|
66
|
+
self.assertEqual(len(self.collection.services.tag.get_matching_tags_from_tag_set(self.tag_set_b)), 3)
|
|
67
|
+
self.assertEqual(len(self.collection.services.tag.get_matching_tags_from_tag_set(self.mixed_tag_set)), 2)
|
|
68
|
+
|
|
69
|
+
self.collection.services.tag.remove_tags_by_tag_set(self.tag_set_b)
|
|
70
|
+
|
|
71
|
+
self.assertEqual(len(self.collection.services.tag.get_matching_tags_from_tag_set(self.tag_set_b)), 0)
|
|
72
|
+
|
|
73
|
+
self.assertEqual(len(self.collection.services.tag.get_matching_tags_from_tag_set(self.mixed_tag_set)), 1)
|
|
74
|
+
|
|
75
|
+
def test_tag_metric_methods(self):
|
|
76
|
+
self.assertAlmostEqual(
|
|
77
|
+
self.collection.services.tag.get_matching_percentage_of_tag_set(self.tag_set_a),
|
|
78
|
+
1.00,
|
|
79
|
+
2
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
self.assertAlmostEqual(
|
|
83
|
+
self.collection.services.tag.get_matching_percentage_of_model_tags_from_tag_set(self.tag_set_b),
|
|
84
|
+
0.25,
|
|
85
|
+
2
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
self.collection.services.tag.remove_tags_by_tag_set(self.mixed_tag_set)
|
|
89
|
+
|
|
90
|
+
self.assertAlmostEqual(
|
|
91
|
+
self.collection.services.tag.get_matching_percentage_of_tag_set(self.tag_set_a),
|
|
92
|
+
0.666,
|
|
93
|
+
2
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
self.assertAlmostEqual(
|
|
98
|
+
self.collection.services.tag.get_matching_percentage_of_model_tags_from_tag_set(self.tag_set_b),
|
|
99
|
+
0.222,
|
|
100
|
+
2
|
|
101
|
+
)
|
|
102
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
def get_matching_tag_set_from_tag_sets(tag_set_a: set[str], tag_set_b: set[str]) -> set[str]:
|
|
2
|
+
return tag_set_a.intersection(tag_set_b)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def get_matching_count_from_tag_sets(tag_set_a: set[str], tag_set_b: set[str]) -> int:
|
|
6
|
+
return len(get_matching_tag_set_from_tag_sets(tag_set_a, tag_set_b))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def get_matching_a_percentage_from_tag_sets(tag_set_a: set[str], tag_set_b: set[str]) -> float:
|
|
10
|
+
try:
|
|
11
|
+
return get_matching_count_from_tag_sets(tag_set_a, tag_set_b) / len(tag_set_a)
|
|
12
|
+
except ZeroDivisionError:
|
|
13
|
+
return 0.0
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def get_matching_b_percentage_from_tag_sets(tag_set_a: set[str], tag_set_b: set[str]) -> float:
|
|
17
|
+
try:
|
|
18
|
+
return get_matching_count_from_tag_sets(tag_set_a, tag_set_b) / len(tag_set_b)
|
|
19
|
+
except ZeroDivisionError:
|
|
20
|
+
return 0.0
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def get_score_percentage_from_tag_set_weighted(tag_set_actual: set[str], tag_set_reference: set[str]) -> float:
|
|
24
|
+
total_points = len(simplify_tag_set(tag_set_reference))
|
|
25
|
+
|
|
26
|
+
multiplier = get_matching_count_from_tag_sets(tag_set_actual, tag_set_reference)
|
|
27
|
+
|
|
28
|
+
weighted_points = sum(
|
|
29
|
+
weight
|
|
30
|
+
for tag, weight in simplify_and_weight_tag_set_to_dict(tag_set_reference).items()
|
|
31
|
+
if tag in tag_set_actual
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
if weighted_points == 0 or total_points == 0:
|
|
35
|
+
return 0.0
|
|
36
|
+
|
|
37
|
+
return (weighted_points / total_points) * multiplier
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def simplify_tag_set(tag_set: set[str]) -> set[str]:
|
|
41
|
+
return set(simplify_tag_set_to_list(tag_set))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def simplify_tag_set_to_list(tag_set: set[str]) -> list[str]:
|
|
45
|
+
simplified_tag_words = []
|
|
46
|
+
|
|
47
|
+
for tag in tag_set:
|
|
48
|
+
tag_words = tag.split('-')
|
|
49
|
+
simplified_tag_words.extend(tag_words)
|
|
50
|
+
|
|
51
|
+
return simplified_tag_words
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def simplify_and_weight_tag_set_to_dict(tag_set: set[str]) -> dict[str, int]:
|
|
55
|
+
simplified_and_weighted_tag_words = {}
|
|
56
|
+
|
|
57
|
+
for tag_word in simplify_tag_set_to_list(tag_set):
|
|
58
|
+
simplified_and_weighted_tag_words[tag_word] = simplified_and_weighted_tag_words.get(tag_word, 0) + 1
|
|
59
|
+
|
|
60
|
+
return dict(
|
|
61
|
+
sorted(
|
|
62
|
+
simplified_and_weighted_tag_words.items(),
|
|
63
|
+
key=lambda item: item[1],
|
|
64
|
+
reverse=True
|
|
65
|
+
)
|
|
66
|
+
)
|
|
@@ -37,49 +37,53 @@
|
|
|
37
37
|
</div>
|
|
38
38
|
{% endblock %}
|
|
39
39
|
|
|
40
|
-
{%
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
{% if request.user.is_authenticated %}
|
|
41
|
+
{% block notification_icon %}
|
|
42
|
+
<div>
|
|
43
|
+
{% include 'django_spire/notification/app/element/notification_bell.html' %}
|
|
44
|
+
</div>
|
|
45
|
+
{% endblock %}
|
|
46
|
+
{% endif %}
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
48
|
+
{% if request.user.is_authenticated %}
|
|
49
|
+
<div class="dropdown">
|
|
50
|
+
<i
|
|
51
|
+
class="bi bi-person-circle fs-2 mx-2 cursor-pointer"
|
|
52
|
+
id="dropdownMenuButton1"
|
|
53
|
+
data-bs-toggle="dropdown"
|
|
54
|
+
aria-expanded="false"
|
|
55
|
+
>
|
|
56
|
+
</i>
|
|
57
|
+
<ul class="dropdown-menu py-0 bg-app-layer-one" aria-labelledby="dropdownMenuButton1">
|
|
58
|
+
{% if request.user.is_superuser %}
|
|
59
|
+
<li class="py-0">
|
|
60
|
+
<a class="dropdown-item fs--1 bg-app-layer-three-hover"
|
|
61
|
+
href="{% url 'admin:index' %}" target="_blank">
|
|
62
|
+
Admin Panel
|
|
63
|
+
</a>
|
|
64
|
+
</li>
|
|
65
|
+
<li class="py-0">
|
|
66
|
+
<a class="dropdown-item fs--1 bg-app-layer-three-hover"
|
|
67
|
+
href="{% url 'django_spire:theme:page:dashboard' %}" target="_blank">
|
|
68
|
+
Theme Dashboard
|
|
69
|
+
</a>
|
|
70
|
+
</li>
|
|
71
|
+
{% endif %}
|
|
72
|
+
<li class="py-0">
|
|
73
|
+
<a href="{% url 'django_spire:auth:admin:password_change' %}"
|
|
74
|
+
class="dropdown-item fs--1 bg-app-layer-three-hover">
|
|
75
|
+
Change Password
|
|
60
76
|
</a>
|
|
61
77
|
</li>
|
|
62
|
-
<li class="py-0
|
|
63
|
-
<a
|
|
64
|
-
|
|
65
|
-
|
|
78
|
+
<li class="py-0">
|
|
79
|
+
<a href="{% url 'django_spire:auth:redirect:logout' %}"
|
|
80
|
+
class="dropdown-item fs--1 bg-app-layer-three-hover">
|
|
81
|
+
Logout
|
|
66
82
|
</a>
|
|
67
83
|
</li>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
class="dropdown-item fs--1 bg-app-layer-three-hover">
|
|
72
|
-
Change Password
|
|
73
|
-
</a>
|
|
74
|
-
</li>
|
|
75
|
-
<li class="py-0">
|
|
76
|
-
<a href="{% url 'django_spire:auth:redirect:logout' %}"
|
|
77
|
-
class="dropdown-item fs--1 bg-app-layer-three-hover">
|
|
78
|
-
Logout
|
|
79
|
-
</a>
|
|
80
|
-
</li>
|
|
81
|
-
</ul>
|
|
82
|
-
</div>
|
|
84
|
+
</ul>
|
|
85
|
+
</div>
|
|
86
|
+
{% endif %}
|
|
83
87
|
|
|
84
88
|
<div class="col-auto d-lg-none">
|
|
85
89
|
{% include 'django_spire/navigation/mobile_navigation.html' %}
|