django-spire 0.21.1__py3-none-any.whl → 0.22.1__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/consts.py +1 -1
- django_spire/contrib/generic_views/portal_views.py +43 -0
- django_spire/core/models.py +9 -0
- django_spire/core/static/django_spire/css/bootstrap-extension.css +41 -0
- django_spire/core/static/django_spire/css/bootstrap-override.css +28 -4
- 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 -2
- 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/dropdown/ellipsis_table_dropdown.html +26 -0
- django_spire/core/templates/django_spire/filtering/form/base_session_filter_form.html +4 -4
- django_spire/core/templates/django_spire/modal/content/dispatch_modal_delete_confirmation_content.html +6 -4
- django_spire/core/templates/django_spire/table/base.html +409 -0
- django_spire/core/templates/django_spire/table/element/child_row.html +59 -0
- django_spire/core/templates/django_spire/table/element/expandable_row.html +45 -0
- django_spire/core/templates/django_spire/table/element/footer.html +17 -0
- django_spire/core/templates/django_spire/table/element/header.html +9 -0
- django_spire/core/templates/django_spire/table/element/loading_skeleton.html +13 -0
- django_spire/core/templates/django_spire/table/element/refreshing_skeleton.html +13 -0
- django_spire/core/templates/django_spire/table/element/row.html +94 -0
- django_spire/core/templates/django_spire/table/element/trigger.html +1 -0
- django_spire/core/templates/django_spire/table/item/no_data_item.html +11 -0
- 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/models.py +12 -4
- 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/settings.py +1 -1
- {django_spire-0.21.1.dist-info → django_spire-0.22.1.dist-info}/METADATA +2 -2
- {django_spire-0.21.1.dist-info → django_spire-0.22.1.dist-info}/RECORD +50 -40
- 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.1.dist-info → django_spire-0.22.1.dist-info}/WHEEL +0 -0
- {django_spire-0.21.1.dist-info → django_spire-0.22.1.dist-info}/licenses/LICENSE.md +0 -0
- {django_spire-0.21.1.dist-info → django_spire-0.22.1.dist-info}/top_level.txt +0 -0
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import random
|
|
4
4
|
import string
|
|
5
|
+
from typing import Any
|
|
5
6
|
|
|
6
7
|
from typing_extensions import Sequence, TYPE_CHECKING, TypeVar
|
|
7
8
|
|
|
@@ -48,6 +49,17 @@ def content_type_url(url_name: str, obj: T, **kwargs) -> str:
|
|
|
48
49
|
return reverse(url_name, kwargs=kwargs)
|
|
49
50
|
|
|
50
51
|
|
|
52
|
+
@register.filter
|
|
53
|
+
def safe_dict_items(dictionary: dict) -> Any:
|
|
54
|
+
"""
|
|
55
|
+
Explicitly call .items() on a dictionary, bypassing key lookup.
|
|
56
|
+
Use when the dict has a key named 'items' and you need the method.
|
|
57
|
+
"""
|
|
58
|
+
if hasattr(dictionary, 'items'):
|
|
59
|
+
return dictionary.items()
|
|
60
|
+
return []
|
|
61
|
+
|
|
62
|
+
|
|
51
63
|
@register.filter
|
|
52
64
|
def in_list(value: str, arg: str) -> bool:
|
|
53
65
|
"""
|
|
@@ -5,7 +5,7 @@ from django.db import models
|
|
|
5
5
|
from django_spire.auth.group.models import AuthGroup
|
|
6
6
|
from django_spire.contrib import Breadcrumbs
|
|
7
7
|
from django_spire.contrib.ordering.mixins import OrderingModelMixin
|
|
8
|
-
from django_spire.core.
|
|
8
|
+
from django_spire.core.tag.mixins import TagModelMixin
|
|
9
9
|
from django_spire.contrib.utils import truncate_string
|
|
10
10
|
from django_spire.history.mixins import HistoryModelMixin
|
|
11
11
|
from django_spire.knowledge.collection.querysets import CollectionQuerySet
|
|
@@ -16,7 +16,7 @@ from django_spire.knowledge.collection.services.service import CollectionGroupSe
|
|
|
16
16
|
class Collection(
|
|
17
17
|
HistoryModelMixin,
|
|
18
18
|
OrderingModelMixin,
|
|
19
|
-
|
|
19
|
+
TagModelMixin,
|
|
20
20
|
):
|
|
21
21
|
parent = models.ForeignKey(
|
|
22
22
|
'self',
|
|
@@ -4,14 +4,16 @@ from typing import TYPE_CHECKING
|
|
|
4
4
|
|
|
5
5
|
from dandy import Prompt
|
|
6
6
|
|
|
7
|
-
from django_spire.
|
|
8
|
-
from django_spire.core.
|
|
7
|
+
from django_spire.core.tag.intelligence.tag_set_bot import TagSetBot
|
|
8
|
+
from django_spire.core.tag.service.tag_service import BaseTagService
|
|
9
|
+
from django_spire.core.tag.tools import simplify_tag_set, simplify_and_weight_tag_set_to_dict, \
|
|
10
|
+
get_score_percentage_from_tag_set_weighted
|
|
9
11
|
|
|
10
12
|
if TYPE_CHECKING:
|
|
11
13
|
from django_spire.knowledge.collection.models import Collection
|
|
12
14
|
|
|
13
15
|
|
|
14
|
-
class CollectionTagService(
|
|
16
|
+
class CollectionTagService(BaseTagService['Collection']):
|
|
15
17
|
obj: Collection
|
|
16
18
|
|
|
17
19
|
def process_and_set_tags(self):
|
|
@@ -24,11 +26,11 @@ class CollectionTagService(BaseDjangoModelService['Collection']):
|
|
|
24
26
|
content=collection_prompt
|
|
25
27
|
)
|
|
26
28
|
|
|
27
|
-
self.
|
|
29
|
+
self.set_tags_from_tag_set(
|
|
28
30
|
tag_set=tag_set,
|
|
29
31
|
)
|
|
30
32
|
|
|
31
|
-
def get_aggregated_tag_set(self):
|
|
33
|
+
def get_aggregated_tag_set(self) -> set[str]:
|
|
32
34
|
tag_set = self.obj.tag_set
|
|
33
35
|
|
|
34
36
|
for collection in self.obj.children.active():
|
|
@@ -39,14 +41,14 @@ class CollectionTagService(BaseDjangoModelService['Collection']):
|
|
|
39
41
|
|
|
40
42
|
return tag_set
|
|
41
43
|
|
|
42
|
-
def
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
for entry in self.obj.entries.active():
|
|
49
|
-
tag_set.update(entry.tag_set_simplified)
|
|
44
|
+
def get_score_percentage_from_aggregated_tag_set_weighted(self, tag_set: set[str]) -> float:
|
|
45
|
+
return get_score_percentage_from_tag_set_weighted(
|
|
46
|
+
tag_set_actual=tag_set,
|
|
47
|
+
tag_set_reference=self.get_aggregated_tag_set()
|
|
48
|
+
)
|
|
50
49
|
|
|
51
|
-
|
|
50
|
+
def get_simplified_aggregated_tag_set(self) -> set[str]:
|
|
51
|
+
return simplify_tag_set(self.get_aggregated_tag_set())
|
|
52
52
|
|
|
53
|
+
def get_simplified_and_weighted_aggregated_tag_set(self) -> dict[str, int]:
|
|
54
|
+
return simplify_and_weight_tag_set_to_dict(self.get_aggregated_tag_set())
|
|
@@ -3,7 +3,7 @@ from django.urls import reverse
|
|
|
3
3
|
|
|
4
4
|
from django_spire.contrib import Breadcrumbs
|
|
5
5
|
from django_spire.contrib.ordering.mixins import OrderingModelMixin
|
|
6
|
-
from django_spire.core.
|
|
6
|
+
from django_spire.core.tag.mixins import TagModelMixin
|
|
7
7
|
from django_spire.contrib.utils import truncate_string
|
|
8
8
|
from django_spire.history.mixins import HistoryModelMixin
|
|
9
9
|
from django_spire.knowledge.collection.models import Collection
|
|
@@ -15,7 +15,7 @@ from django_spire.knowledge.entry.version.models import EntryVersion
|
|
|
15
15
|
class Entry(
|
|
16
16
|
HistoryModelMixin,
|
|
17
17
|
OrderingModelMixin,
|
|
18
|
-
|
|
18
|
+
TagModelMixin
|
|
19
19
|
):
|
|
20
20
|
collection = models.ForeignKey(
|
|
21
21
|
Collection,
|
|
@@ -30,3 +30,8 @@ class EntryQuerySet(HistoryQuerySet, OrderingQuerySetMixin):
|
|
|
30
30
|
current_version__status=EntryVersionStatusChoices.DRAFT
|
|
31
31
|
)
|
|
32
32
|
)
|
|
33
|
+
|
|
34
|
+
def get_by_version_block_id(self, version_block_id: int) -> Entry:
|
|
35
|
+
return self.get(
|
|
36
|
+
current_version__block__id=version_block_id
|
|
37
|
+
)
|
|
@@ -4,21 +4,21 @@ from typing import TYPE_CHECKING
|
|
|
4
4
|
|
|
5
5
|
from dandy import Prompt
|
|
6
6
|
|
|
7
|
-
from django_spire.
|
|
8
|
-
from django_spire.core.
|
|
7
|
+
from django_spire.core.tag.intelligence.tag_set_bot import TagSetBot
|
|
8
|
+
from django_spire.core.tag.service.tag_service import BaseTagService
|
|
9
9
|
|
|
10
10
|
if TYPE_CHECKING:
|
|
11
11
|
from django_spire.knowledge.entry.models import Entry
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
class EntryTagService(
|
|
15
|
+
class EntryTagService(BaseTagService['Entry']):
|
|
16
16
|
obj: Entry
|
|
17
17
|
|
|
18
18
|
def process_and_set_tags(self):
|
|
19
19
|
entry_prompt = Prompt()
|
|
20
20
|
|
|
21
|
-
entry_prompt.
|
|
21
|
+
entry_prompt.sub_heading(self.obj.name)
|
|
22
22
|
|
|
23
23
|
for version_block in self.obj.current_version.blocks.all():
|
|
24
24
|
entry_prompt.text(f'{version_block.render_to_text()}')
|
|
@@ -27,7 +27,7 @@ class EntryTagService(BaseDjangoModelService['Entry']):
|
|
|
27
27
|
content=entry_prompt
|
|
28
28
|
)
|
|
29
29
|
|
|
30
|
-
self.
|
|
30
|
+
self.set_tags_from_tag_set(
|
|
31
31
|
tag_set=tag_set,
|
|
32
32
|
)
|
|
33
33
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from typing import TYPE_CHECKING
|
|
3
|
+
|
|
4
|
+
from dandy import Bot, Prompt
|
|
5
|
+
|
|
6
|
+
from django_spire.knowledge.intelligence.intel.entry_intel import EntriesIntel
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from django_spire.knowledge.entry.models import Entry
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class EntriesSearchBot(Bot):
|
|
13
|
+
llm_role = 'Knowledge Entry Search Assistant'
|
|
14
|
+
llm_task = 'Read through the knowledge and return information and the block id that relevant to the information request.'
|
|
15
|
+
llm_guidelines = (
|
|
16
|
+
Prompt()
|
|
17
|
+
.list([
|
|
18
|
+
'Please read through all the blocks and return 2 of the most relevant ones.',
|
|
19
|
+
'You can add any of the text in the knowledge entries to the 2 responses if it helps.',
|
|
20
|
+
'Make sure the relevant heading text is from a heading with mark down formatting.',
|
|
21
|
+
'When returning the relevant heading remove any of the markdown formating characters.',
|
|
22
|
+
])
|
|
23
|
+
)
|
|
24
|
+
llm_intel_class = EntriesIntel
|
|
25
|
+
|
|
26
|
+
def process(self, user_input: str, entries: list[Entry]) -> EntriesIntel:
|
|
27
|
+
|
|
28
|
+
entry_prompt = Prompt()
|
|
29
|
+
entry_prompt.sub_heading('Information Request')
|
|
30
|
+
entry_prompt.line_break()
|
|
31
|
+
entry_prompt.text(f'{user_input}')
|
|
32
|
+
entry_prompt.line_break()
|
|
33
|
+
entry_prompt.sub_heading('Knowledge Entries')
|
|
34
|
+
entry_prompt.line_break()
|
|
35
|
+
|
|
36
|
+
for entry in entries:
|
|
37
|
+
for version_block in entry.current_version.blocks.all():
|
|
38
|
+
if version_block.render_to_text() != '\n':
|
|
39
|
+
entry_prompt.text(f'{version_block.id}: {version_block.render_to_text()}')
|
|
40
|
+
|
|
41
|
+
return self.llm.prompt_to_intel(
|
|
42
|
+
prompt=entry_prompt,
|
|
43
|
+
)
|
|
44
|
+
|
|
@@ -1,16 +1,36 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
from enum import Enum
|
|
4
|
+
|
|
3
5
|
from dandy import BaseIntel, BaseListIntel
|
|
4
6
|
|
|
5
|
-
from django_spire.knowledge.
|
|
7
|
+
from django_spire.knowledge.entry.models import Entry
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class EntryRelevancy(str, Enum):
|
|
11
|
+
EXTREMELY = 'Extremely'
|
|
12
|
+
VERY = 'Very'
|
|
13
|
+
SOMEWHAT = 'Somewhat'
|
|
14
|
+
NOT_SO_MUCH = 'Not so much'
|
|
15
|
+
NO_RELEVANCE = 'No Relevance'
|
|
6
16
|
|
|
7
17
|
|
|
8
18
|
class EntryIntel(BaseIntel):
|
|
9
19
|
relevant_heading_text: str
|
|
10
|
-
|
|
20
|
+
relevant_text: str
|
|
11
21
|
relevant_block_id: int
|
|
12
|
-
|
|
13
|
-
|
|
22
|
+
relevancy: EntryRelevancy
|
|
23
|
+
|
|
24
|
+
def __str__(self):
|
|
25
|
+
return self.relevant_heading_text + ' ' + self.relevant_text
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def collection(self):
|
|
29
|
+
return self.entry.collection
|
|
30
|
+
|
|
31
|
+
@property
|
|
32
|
+
def entry(self):
|
|
33
|
+
return Entry.objects.get_by_version_block_id(self.relevant_block_id)
|
|
14
34
|
|
|
15
35
|
|
|
16
36
|
class EntriesIntel(BaseListIntel[EntryIntel]):
|
|
@@ -5,51 +5,72 @@ from typing import TYPE_CHECKING
|
|
|
5
5
|
from django.core.handlers.wsgi import WSGIRequest
|
|
6
6
|
|
|
7
7
|
from django_spire.ai.chat.message_intel import DefaultMessageIntel, BaseMessageIntel
|
|
8
|
-
from django_spire.
|
|
9
|
-
from django_spire.knowledge.
|
|
8
|
+
from django_spire.core.tag.intelligence.tag_set_bot import TagSetBot
|
|
9
|
+
from django_spire.knowledge.collection.models import Collection
|
|
10
|
+
from django_spire.knowledge.intelligence.bots.entries_search_llm_bot import EntriesSearchBot
|
|
10
11
|
from django_spire.knowledge.intelligence.intel.message_intel import KnowledgeMessageIntel
|
|
11
|
-
from django_spire.knowledge.intelligence.decoders.collection_decoder import get_collection_decoder
|
|
12
|
-
from django_spire.knowledge.intelligence.decoders.entry_decoder import get_entry_decoder
|
|
13
12
|
|
|
14
13
|
if TYPE_CHECKING:
|
|
15
14
|
from django.core.handlers.wsgi import WSGIRequest
|
|
16
15
|
from dandy.llm.request.message import MessageHistory
|
|
17
16
|
|
|
18
|
-
|
|
19
17
|
NO_KNOWLEDGE_MESSAGE_INTEL = DefaultMessageIntel(
|
|
20
18
|
text='Sorry, I could not find any information on that.'
|
|
21
19
|
)
|
|
22
20
|
|
|
23
21
|
|
|
24
22
|
def knowledge_search_workflow(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
request: WSGIRequest,
|
|
24
|
+
user_input: str,
|
|
25
|
+
message_history: MessageHistory | None = None,
|
|
28
26
|
) -> BaseMessageIntel | None:
|
|
29
|
-
|
|
30
|
-
collections = collection_decoder.process(user_input).values
|
|
27
|
+
user_tag_set = TagSetBot().process(user_input)
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
def get_top_scored_from_dict_to_list(
|
|
30
|
+
scored_dict: dict[str, float],
|
|
31
|
+
score_floor: float = 0.05
|
|
32
|
+
) -> list:
|
|
33
|
+
if not scored_dict:
|
|
34
|
+
return []
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
min_score = min(scored_dict.values())
|
|
37
|
+
max_score = max(scored_dict.values())
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
entry_decoder = get_entry_decoder(collection=collection)
|
|
39
|
+
if min_score == 0 and max_score == 0:
|
|
40
|
+
return []
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
median_score = (max_score - min_score) / 2
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
top_scored_list = []
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
for key, value in scored_dict.items():
|
|
47
|
+
if value >= score_floor and value >= median_score:
|
|
48
|
+
top_scored_list.append(key)
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
return top_scored_list
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
collections = get_top_scored_from_dict_to_list({
|
|
53
|
+
collection: collection.services.tag.get_score_percentage_from_aggregated_tag_set_weighted(
|
|
54
|
+
user_tag_set
|
|
53
55
|
)
|
|
56
|
+
for collection in Collection.objects.all().annotate_entry_count()
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
entries = get_top_scored_from_dict_to_list({
|
|
60
|
+
entry: entry.services.tag.get_score_percentage_from_tag_set_weighted(user_tag_set)
|
|
61
|
+
for collection in collections
|
|
62
|
+
for entry in collection.entries.all()
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
if not entries:
|
|
66
|
+
return NO_KNOWLEDGE_MESSAGE_INTEL
|
|
67
|
+
|
|
68
|
+
entries_intel = EntriesSearchBot(llm_temperature=0.0).process(
|
|
69
|
+
user_input=user_input,
|
|
70
|
+
entries=entries
|
|
71
|
+
)
|
|
54
72
|
|
|
55
|
-
return KnowledgeMessageIntel(
|
|
73
|
+
return KnowledgeMessageIntel(
|
|
74
|
+
body=f'{" ".join([str(entry) for entry in entries_intel])}',
|
|
75
|
+
entries_intel=entries_intel,
|
|
76
|
+
)
|
django_spire/knowledge/models.py
CHANGED
|
@@ -2,7 +2,15 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
# These imports are for the migrations to work as a single app "django_spire_knowledge"
|
|
4
4
|
|
|
5
|
-
from django_spire.knowledge.entry import models
|
|
6
|
-
from django_spire.knowledge.entry.version import models
|
|
7
|
-
from django_spire.knowledge.entry.version.block import models
|
|
8
|
-
|
|
5
|
+
from django_spire.knowledge.entry import models as entry_models
|
|
6
|
+
from django_spire.knowledge.entry.version import models as entry_version_models
|
|
7
|
+
from django_spire.knowledge.entry.version.block import models as \
|
|
8
|
+
entry_version_block_models
|
|
9
|
+
from django_spire.knowledge.collection import models as collection_models
|
|
10
|
+
|
|
11
|
+
# Must assert to stop unused import removals.
|
|
12
|
+
|
|
13
|
+
assert entry_models
|
|
14
|
+
assert entry_version_models
|
|
15
|
+
assert entry_version_block_models
|
|
16
|
+
assert collection_models
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
{% extends 'django_spire/knowledge/page/full_page.html' %}
|
|
2
2
|
|
|
3
|
+
{% load spire_core_tags %}
|
|
4
|
+
|
|
3
5
|
{% block full_page_sub_navigation_title %}
|
|
4
6
|
{{ collection.name_short }}
|
|
5
7
|
{% endblock %}
|
|
@@ -49,16 +51,16 @@
|
|
|
49
51
|
<div class="row">
|
|
50
52
|
<div class="col-12 col-lg-8 mx-auto pb-4">
|
|
51
53
|
Tags:
|
|
52
|
-
{% for tag in collection.
|
|
53
|
-
|
|
54
|
+
{% for tag, weight in collection.simplified_and_weighted_tag_dict|safe_dict_items %}
|
|
55
|
+
{% include 'django_spire/tag/element/tag.html' %}
|
|
54
56
|
{% endfor %}
|
|
55
57
|
</div>
|
|
56
58
|
</div>
|
|
57
59
|
<div class="row">
|
|
58
60
|
<div class="col-12 col-lg-8 mx-auto pb-4">
|
|
59
61
|
Aggregated Tags:
|
|
60
|
-
{% for tag in collection.services.tag.
|
|
61
|
-
|
|
62
|
+
{% for tag, weight in collection.services.tag.get_simplified_and_weighted_aggregated_tag_set|safe_dict_items %}
|
|
63
|
+
{% include 'django_spire/tag/element/tag.html' %}
|
|
62
64
|
{% endfor %}
|
|
63
65
|
</div>
|
|
64
66
|
</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{% extends 'django_spire/knowledge/page/full_page.html' %}
|
|
2
2
|
|
|
3
3
|
{% load static %}
|
|
4
|
+
{% load spire_core_tags %}
|
|
4
5
|
|
|
5
6
|
{% block base_body_additional_top_js %}
|
|
6
7
|
{{ block.super }}
|
|
@@ -46,8 +47,8 @@
|
|
|
46
47
|
<div class="row">
|
|
47
48
|
<div class="col-12 mb-3">
|
|
48
49
|
{% include 'django_spire/element/attribute_element.html' with attribute_title='Tags' %}
|
|
49
|
-
{% for tag in entry.
|
|
50
|
-
|
|
50
|
+
{% for tag, weight in entry.simplified_and_weighted_tag_dict|safe_dict_items %}
|
|
51
|
+
{% include 'django_spire/tag/element/tag.html' %}
|
|
51
52
|
{% endfor %}
|
|
52
53
|
</div>
|
|
53
54
|
</div>
|
django_spire/knowledge/templates/django_spire/knowledge/message/knowledge_message_intel.html
CHANGED
|
@@ -4,19 +4,27 @@
|
|
|
4
4
|
{% for entry_intel in message_intel.entries_intel %}
|
|
5
5
|
|
|
6
6
|
<div class="row">
|
|
7
|
-
<div class="col
|
|
8
|
-
|
|
9
|
-
{{ entry_intel.relevant_heading_text }}
|
|
10
|
-
</a>
|
|
7
|
+
<div class="col">
|
|
8
|
+
{{ entry_intel.relevant_text|linebreaksbr }}
|
|
11
9
|
</div>
|
|
12
10
|
</div>
|
|
13
11
|
|
|
14
12
|
<div class="row">
|
|
15
|
-
<div class="col pb-
|
|
16
|
-
{{ entry_intel.
|
|
13
|
+
<div class="col pt-1 pb-3 fs-7">
|
|
14
|
+
<a href="{% url 'django_spire:knowledge:entry:version:page:editor' pk=entry_intel.entry.id %}?show_sub_nav=false&block_id={{ entry_intel.relevant_block_id }}"
|
|
15
|
+
target="_blank">
|
|
16
|
+
{{ entry_intel.relevant_heading_text }}
|
|
17
|
+
</a>
|
|
17
18
|
</div>
|
|
18
19
|
</div>
|
|
19
20
|
|
|
20
21
|
{% endfor %}
|
|
21
22
|
|
|
23
|
+
<div class="row">
|
|
24
|
+
<div class="col">
|
|
25
|
+
Is there anything else I can help with?
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
|
|
22
30
|
{% endblock %}
|
django_spire/settings.py
CHANGED
|
@@ -14,7 +14,7 @@ DJANGO_SPIRE_AI_CHAT_ROUTERS = {
|
|
|
14
14
|
|
|
15
15
|
DJANGO_SPIRE_AI_INTENT_CHAT_ROUTERS = {
|
|
16
16
|
'KNOWLEDGE_SEARCH': {
|
|
17
|
-
'INTENT_DESCRIPTION': 'The user is asking about information in
|
|
17
|
+
'INTENT_DESCRIPTION': 'The user is asking about information, help or support that could be found in knowledge base.',
|
|
18
18
|
'REQUIRED_PERMISSION': 'django_spire_knowledge.view_collection',
|
|
19
19
|
'CHAT_ROUTER': 'django_spire.knowledge.intelligence.router.KnowledgeSearchRouter',
|
|
20
20
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: django-spire
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.22.1
|
|
4
4
|
Summary: A project for Django Spire
|
|
5
5
|
Author-email: Brayden Carlson <braydenc@stratusadv.com>, Nathan Johnson <nathanj@stratusadv.com>
|
|
6
6
|
License: Copyright (c) 2024 Stratus Advanced Technologies and Contributors.
|
|
@@ -49,7 +49,7 @@ Requires-Dist: beautifulsoup4>=4.14.2
|
|
|
49
49
|
Requires-Dist: boto3>=1.34.0
|
|
50
50
|
Requires-Dist: botocore>=1.34.0
|
|
51
51
|
Requires-Dist: crispy-bootstrap5==2024.10
|
|
52
|
-
Requires-Dist: dandy>=1.3.
|
|
52
|
+
Requires-Dist: dandy>=1.3.5
|
|
53
53
|
Requires-Dist: django>=5.1.8
|
|
54
54
|
Requires-Dist: django-crispy-forms==2.3
|
|
55
55
|
Requires-Dist: django-glue>=0.8.1
|