pygpt-net 2.4.41__py3-none-any.whl → 2.4.43__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.
Files changed (146) hide show
  1. CHANGELOG.md +13 -0
  2. README.md +142 -70
  3. pygpt_net/CHANGELOG.txt +13 -0
  4. pygpt_net/__init__.py +3 -3
  5. pygpt_net/app.py +3 -1
  6. pygpt_net/controller/audio/__init__.py +2 -2
  7. pygpt_net/controller/camera.py +1 -10
  8. pygpt_net/controller/chat/attachment.py +36 -23
  9. pygpt_net/controller/chat/audio.py +2 -2
  10. pygpt_net/controller/config/placeholder.py +15 -1
  11. pygpt_net/controller/ui/mode.py +16 -21
  12. pygpt_net/core/attachments/__init__.py +1 -1
  13. pygpt_net/core/attachments/context.py +10 -8
  14. pygpt_net/core/audio/__init__.py +4 -1
  15. pygpt_net/core/audio/whisper.py +37 -0
  16. pygpt_net/core/bridge/worker.py +2 -2
  17. pygpt_net/core/db/__init__.py +2 -1
  18. pygpt_net/core/debug/events.py +22 -10
  19. pygpt_net/core/debug/tabs.py +6 -3
  20. pygpt_net/core/history.py +3 -2
  21. pygpt_net/core/idx/__init__.py +16 -4
  22. pygpt_net/core/idx/chat.py +15 -5
  23. pygpt_net/core/idx/indexing.py +24 -8
  24. pygpt_net/core/installer.py +2 -4
  25. pygpt_net/core/models.py +62 -17
  26. pygpt_net/core/modes.py +11 -13
  27. pygpt_net/core/notepad.py +4 -4
  28. pygpt_net/core/plugins.py +27 -16
  29. pygpt_net/core/presets.py +20 -9
  30. pygpt_net/core/profile.py +11 -3
  31. pygpt_net/core/render/web/parser.py +3 -1
  32. pygpt_net/core/settings.py +5 -5
  33. pygpt_net/core/tabs/tab.py +10 -2
  34. pygpt_net/core/tokens.py +8 -6
  35. pygpt_net/core/web/__init__.py +105 -0
  36. pygpt_net/core/{web.py → web/helpers.py} +93 -67
  37. pygpt_net/data/config/config.json +3 -3
  38. pygpt_net/data/config/models.json +3 -3
  39. pygpt_net/data/config/modes.json +3 -3
  40. pygpt_net/data/locale/locale.en.ini +1 -0
  41. pygpt_net/data/locale/plugin.cmd_web.en.ini +2 -0
  42. pygpt_net/data/locale/plugin.mailer.en.ini +21 -0
  43. pygpt_net/item/ctx.py +66 -3
  44. pygpt_net/migrations/Version20241215110000.py +25 -0
  45. pygpt_net/migrations/__init__.py +3 -1
  46. pygpt_net/plugin/agent/__init__.py +7 -2
  47. pygpt_net/plugin/audio_output/__init__.py +6 -1
  48. pygpt_net/plugin/base/plugin.py +58 -26
  49. pygpt_net/plugin/base/worker.py +20 -17
  50. pygpt_net/plugin/cmd_history/config.py +2 -2
  51. pygpt_net/plugin/cmd_web/__init__.py +3 -4
  52. pygpt_net/plugin/cmd_web/config.py +71 -3
  53. pygpt_net/plugin/cmd_web/websearch.py +20 -12
  54. pygpt_net/plugin/cmd_web/worker.py +67 -4
  55. pygpt_net/plugin/idx_llama_index/config.py +3 -3
  56. pygpt_net/plugin/mailer/__init__.py +123 -0
  57. pygpt_net/plugin/mailer/config.py +149 -0
  58. pygpt_net/plugin/mailer/runner.py +285 -0
  59. pygpt_net/plugin/mailer/worker.py +123 -0
  60. pygpt_net/provider/agents/base.py +5 -2
  61. pygpt_net/provider/agents/openai.py +4 -2
  62. pygpt_net/provider/agents/openai_assistant.py +4 -2
  63. pygpt_net/provider/agents/planner.py +4 -2
  64. pygpt_net/provider/agents/react.py +4 -2
  65. pygpt_net/provider/audio_output/openai_tts.py +5 -11
  66. pygpt_net/provider/core/assistant/base.py +5 -3
  67. pygpt_net/provider/core/assistant/json_file.py +8 -5
  68. pygpt_net/provider/core/assistant_file/base.py +4 -3
  69. pygpt_net/provider/core/assistant_file/db_sqlite/__init__.py +4 -3
  70. pygpt_net/provider/core/assistant_file/db_sqlite/storage.py +3 -2
  71. pygpt_net/provider/core/assistant_store/base.py +6 -4
  72. pygpt_net/provider/core/assistant_store/db_sqlite/__init__.py +5 -4
  73. pygpt_net/provider/core/assistant_store/db_sqlite/storage.py +5 -3
  74. pygpt_net/provider/core/attachment/base.py +5 -3
  75. pygpt_net/provider/core/attachment/json_file.py +4 -3
  76. pygpt_net/provider/core/calendar/base.py +5 -3
  77. pygpt_net/provider/core/calendar/db_sqlite/__init__.py +6 -5
  78. pygpt_net/provider/core/calendar/db_sqlite/storage.py +5 -4
  79. pygpt_net/provider/core/config/base.py +8 -6
  80. pygpt_net/provider/core/config/json_file.py +9 -7
  81. pygpt_net/provider/core/ctx/base.py +27 -25
  82. pygpt_net/provider/core/ctx/db_sqlite/__init__.py +51 -35
  83. pygpt_net/provider/core/ctx/db_sqlite/storage.py +92 -38
  84. pygpt_net/provider/core/ctx/db_sqlite/utils.py +37 -11
  85. pygpt_net/provider/core/index/base.py +129 -23
  86. pygpt_net/provider/core/index/db_sqlite/__init__.py +130 -23
  87. pygpt_net/provider/core/index/db_sqlite/storage.py +130 -23
  88. pygpt_net/provider/core/index/db_sqlite/utils.py +4 -2
  89. pygpt_net/provider/core/mode/base.py +5 -3
  90. pygpt_net/provider/core/mode/json_file.py +7 -6
  91. pygpt_net/provider/core/model/base.py +6 -4
  92. pygpt_net/provider/core/model/json_file.py +9 -7
  93. pygpt_net/provider/core/notepad/base.py +5 -3
  94. pygpt_net/provider/core/notepad/db_sqlite/__init__.py +5 -4
  95. pygpt_net/provider/core/notepad/db_sqlite/storage.py +4 -3
  96. pygpt_net/provider/core/plugin_preset/base.py +4 -2
  97. pygpt_net/provider/core/plugin_preset/json_file.py +5 -3
  98. pygpt_net/provider/core/preset/base.py +6 -4
  99. pygpt_net/provider/core/preset/json_file.py +9 -9
  100. pygpt_net/provider/core/prompt/base.py +6 -3
  101. pygpt_net/provider/core/prompt/json_file.py +11 -6
  102. pygpt_net/provider/gpt/assistants.py +15 -6
  103. pygpt_net/provider/gpt/audio.py +5 -5
  104. pygpt_net/provider/gpt/chat.py +7 -5
  105. pygpt_net/provider/gpt/completion.py +8 -4
  106. pygpt_net/provider/gpt/image.py +3 -3
  107. pygpt_net/provider/gpt/store.py +46 -12
  108. pygpt_net/provider/gpt/vision.py +16 -11
  109. pygpt_net/provider/llms/anthropic.py +7 -2
  110. pygpt_net/provider/llms/azure_openai.py +26 -5
  111. pygpt_net/provider/llms/base.py +47 -9
  112. pygpt_net/provider/llms/google.py +7 -2
  113. pygpt_net/provider/llms/hugging_face.py +13 -3
  114. pygpt_net/provider/llms/hugging_face_api.py +18 -4
  115. pygpt_net/provider/llms/local.py +7 -2
  116. pygpt_net/provider/llms/ollama.py +30 -6
  117. pygpt_net/provider/llms/openai.py +32 -6
  118. pygpt_net/provider/vector_stores/__init__.py +45 -14
  119. pygpt_net/provider/vector_stores/base.py +35 -8
  120. pygpt_net/provider/vector_stores/chroma.py +13 -3
  121. pygpt_net/provider/vector_stores/ctx_attachment.py +32 -13
  122. pygpt_net/provider/vector_stores/elasticsearch.py +12 -3
  123. pygpt_net/provider/vector_stores/pinecode.py +12 -3
  124. pygpt_net/provider/vector_stores/redis.py +12 -3
  125. pygpt_net/provider/vector_stores/simple.py +12 -3
  126. pygpt_net/provider/vector_stores/temp.py +16 -4
  127. pygpt_net/provider/web/base.py +10 -3
  128. pygpt_net/provider/web/google_custom_search.py +9 -3
  129. pygpt_net/provider/web/microsoft_bing.py +9 -3
  130. pygpt_net/tools/__init__.py +13 -5
  131. pygpt_net/tools/audio_transcriber/__init__.py +4 -3
  132. pygpt_net/tools/base.py +15 -8
  133. pygpt_net/tools/code_interpreter/__init__.py +4 -3
  134. pygpt_net/tools/html_canvas/__init__.py +4 -3
  135. pygpt_net/tools/image_viewer/__init__.py +10 -4
  136. pygpt_net/tools/indexer/__init__.py +8 -7
  137. pygpt_net/tools/media_player/__init__.py +4 -3
  138. pygpt_net/tools/text_editor/__init__.py +36 -10
  139. pygpt_net/ui/layout/chat/output.py +2 -2
  140. pygpt_net/ui/layout/ctx/ctx_list.py +1 -1
  141. pygpt_net/ui/menu/audio.py +12 -1
  142. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.43.dist-info}/METADATA +143 -71
  143. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.43.dist-info}/RECORD +146 -138
  144. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.43.dist-info}/LICENSE +0 -0
  145. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.43.dist-info}/WHEEL +0 -0
  146. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.43.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # ================================================== #
4
+ # This file is a part of PYGPT package #
5
+ # Website: https://pygpt.net #
6
+ # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
+ # MIT License #
8
+ # Created By : Marcin Szczygliński #
9
+ # Updated Date: 2024.12.15 04:00:00 #
10
+ # ================================================== #
11
+
12
+ from PySide6.QtCore import Slot, Signal
13
+
14
+ from pygpt_net.plugin.base.worker import BaseWorker, BaseSignals
15
+
16
+
17
+ class WorkerSignals(BaseSignals):
18
+ output = Signal(object, str)
19
+ html_output = Signal(object)
20
+ ipython_output = Signal(object)
21
+ build_finished = Signal()
22
+ clear = Signal()
23
+
24
+
25
+ class Worker(BaseWorker):
26
+ def __init__(self, *args, **kwargs):
27
+ super(Worker, self).__init__()
28
+ self.signals = WorkerSignals()
29
+ self.args = args
30
+ self.kwargs = kwargs
31
+ self.plugin = None
32
+ self.cmds = None
33
+ self.ctx = None
34
+
35
+ @Slot()
36
+ def run(self):
37
+ responses = []
38
+ for item in self.cmds:
39
+ if self.is_stopped():
40
+ break
41
+ try:
42
+ response = None
43
+ if (item["cmd"] in self.plugin.allowed_cmds
44
+ and (self.plugin.has_cmd(item["cmd"]) or 'force' in item)):
45
+
46
+ if item["cmd"] == "send_email":
47
+ response = self.cmd_send_mail(item)
48
+
49
+ elif item["cmd"] == "get_emails":
50
+ response = self.cmd_receive_emails(item)
51
+
52
+ elif item["cmd"] == "get_email_body":
53
+ response = self.cmd_get_email_body(item)
54
+
55
+ if response:
56
+ responses.append(response)
57
+
58
+ except Exception as e:
59
+ responses.append(
60
+ self.make_response(
61
+ item,
62
+ self.throw_error(e)
63
+ )
64
+ )
65
+
66
+ # send response
67
+ if len(responses) > 0:
68
+ self.reply_more(responses)
69
+
70
+ def cmd_send_mail(self, item: dict) -> dict:
71
+ """
72
+ Send email command
73
+
74
+ :param item: command item
75
+ :return: response item
76
+ """
77
+ request = self.from_request(item)
78
+ try:
79
+ result = self.plugin.runner.smtp_send_email(
80
+ ctx=self.ctx,
81
+ item=item,
82
+ request=request,
83
+ )
84
+ except Exception as e:
85
+ result = self.throw_error(e)
86
+ return self.make_response(item, result)
87
+
88
+ def cmd_receive_emails(self, item: dict) -> dict:
89
+ """
90
+ Receive emails command
91
+
92
+ :param item: command item
93
+ :return: response item
94
+ """
95
+ request = self.from_request(item)
96
+ try:
97
+ result = self.plugin.runner.smtp_receive_emails(
98
+ ctx=self.ctx,
99
+ item=item,
100
+ request=request,
101
+ )
102
+ except Exception as e:
103
+ result = self.throw_error(e)
104
+ return self.make_response(item, result)
105
+
106
+ def cmd_get_email_body(self, item: dict) -> dict:
107
+ """
108
+ Get email body command
109
+
110
+ :param item: command item
111
+ :return: response item
112
+ """
113
+ request = self.from_request(item)
114
+ try:
115
+ result = self.plugin.runner.smtp_get_email_body(
116
+ ctx=self.ctx,
117
+ item=item,
118
+ request=request,
119
+ )
120
+ except Exception as e:
121
+ result = self.throw_error(e)
122
+ return self.make_response(item, result)
123
+
@@ -6,9 +6,12 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.11.15 00:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
+ from typing import Dict, Any
13
+
14
+
12
15
  class BaseAgent:
13
16
  def __init__(self, *args, **kwargs):
14
17
  self.id = ""
@@ -22,7 +25,7 @@ class BaseAgent:
22
25
  """
23
26
  return self.mode
24
27
 
25
- def get_agent(self, window, kwargs: dict):
28
+ def get_agent(self, window, kwargs: Dict[str, Any]):
26
29
  """
27
30
  Return Agent provider instance
28
31
 
@@ -6,9 +6,11 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.11.15 00:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
+ from typing import Dict, Any
13
+
12
14
  from llama_index.agent.openai import OpenAIAgent as Agent
13
15
 
14
16
  from .base import BaseAgent
@@ -19,7 +21,7 @@ class OpenAIAgent(BaseAgent):
19
21
  self.id = "openai"
20
22
  self.mode = "step" # step|plan
21
23
 
22
- def get_agent(self, window, kwargs: dict):
24
+ def get_agent(self, window, kwargs: Dict[str, Any]):
23
25
  """
24
26
  Return Agent provider instance
25
27
 
@@ -6,9 +6,11 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.11.15 00:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
+ from typing import Dict, Any
13
+
12
14
  from llama_index.agent.openai import OpenAIAssistantAgent as Agent
13
15
 
14
16
  from pygpt_net.core.bridge.context import BridgeContext
@@ -21,7 +23,7 @@ class OpenAIAssistantAgent(BaseAgent):
21
23
  self.id = "openai_assistant"
22
24
  self.mode = "assistant" # step|plan|...
23
25
 
24
- def get_agent(self, window, kwargs: dict):
26
+ def get_agent(self, window, kwargs: Dict[str, Any]):
25
27
  """
26
28
  Return Agent provider instance
27
29
 
@@ -6,9 +6,11 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.11.15 00:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
+ from typing import Dict, Any
13
+
12
14
  from llama_index.core.agent import (
13
15
  StructuredPlannerAgent,
14
16
  FunctionCallingAgentWorker,
@@ -23,7 +25,7 @@ class PlannerAgent(BaseAgent):
23
25
  self.id = "planner"
24
26
  self.mode = "plan" # step|plan
25
27
 
26
- def get_agent(self, window, kwargs: dict):
28
+ def get_agent(self, window, kwargs: Dict[str, Any]):
27
29
  """
28
30
  Return Agent provider instance
29
31
 
@@ -6,9 +6,11 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.11.21 20:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
+ from typing import Dict, Any
13
+
12
14
  from llama_index.core.agent import ReActAgent as Agent
13
15
  from llama_index.core.agent.react_multimodal.step import (
14
16
  MultimodalReActAgentWorker,
@@ -26,7 +28,7 @@ class ReactAgent(BaseAgent):
26
28
  self.id = "react"
27
29
  self.mode = "step" # step|plan
28
30
 
29
- def get_agent(self, window, kwargs: dict):
31
+ def get_agent(self, window, kwargs: Dict[str, Any]):
30
32
  """
31
33
  Return Agent provider instance
32
34
 
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.02.23 19:00:00 #
9
+ # Updated Date: 2024.12.14 18:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import os
@@ -26,14 +26,6 @@ class OpenAITextToSpeech(BaseProvider):
26
26
  self.plugin = kwargs.get("plugin")
27
27
  self.id = "openai_tts"
28
28
  self.name = "OpenAI TTS"
29
- self.allowed_voices = [
30
- 'alloy',
31
- 'echo',
32
- 'fable',
33
- 'onyx',
34
- 'nova',
35
- 'shimmer',
36
- ]
37
29
  self.allowed_models = [
38
30
  'tts-1',
39
31
  'tts-1-hd',
@@ -52,10 +44,11 @@ class OpenAITextToSpeech(BaseProvider):
52
44
  )
53
45
  self.plugin.add_option(
54
46
  "openai_voice",
55
- type="text",
47
+ type="combo",
56
48
  value="alloy",
57
49
  label="Voice",
58
50
  tab="openai_tts",
51
+ use="audio_tts_whisper_voices",
59
52
  description="Specify voice, available voices: "
60
53
  "alloy, echo, fable, onyx, nova, shimmer",
61
54
  )
@@ -71,9 +64,10 @@ class OpenAITextToSpeech(BaseProvider):
71
64
  output_file = self.plugin.output_file
72
65
  voice = self.plugin.get_option_value('openai_voice')
73
66
  model = self.plugin.get_option_value('openai_model')
67
+ allowed_voices = self.plugin.window.core.audio.whisper.get_voices()
74
68
  if model not in self.allowed_models:
75
69
  model = 'tts-1'
76
- if voice not in self.allowed_voices:
70
+ if voice not in allowed_voices:
77
71
  voice = 'alloy'
78
72
  path = os.path.join(
79
73
  self.plugin.window.core.config.path,
@@ -6,9 +6,11 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2023.12.31 04:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
+ from typing import Dict
13
+
12
14
  from packaging.version import Version
13
15
 
14
16
  from pygpt_net.item.assistant import AssistantItem
@@ -32,10 +34,10 @@ class BaseProvider:
32
34
  def create(self, assistant: AssistantItem) -> str:
33
35
  pass
34
36
 
35
- def load(self) -> dict:
37
+ def load(self) -> Dict[str, AssistantItem]:
36
38
  pass
37
39
 
38
- def save(self, items: dict):
40
+ def save(self, items: Dict[str, AssistantItem]):
39
41
  pass
40
42
 
41
43
  def remove(self, id: str):
@@ -6,12 +6,13 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2023.12.31 04:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import json
13
13
  import os
14
14
  import uuid
15
+ from typing import Dict, Any
15
16
 
16
17
  from packaging.version import Version
17
18
 
@@ -48,7 +49,7 @@ class JsonFileProvider(BaseProvider):
48
49
  assistant.id = self.create_id()
49
50
  return assistant.id
50
51
 
51
- def load(self) -> dict:
52
+ def load(self) -> Dict[str, AssistantItem]:
52
53
  """
53
54
  Load assistants from file
54
55
 
@@ -75,9 +76,11 @@ class JsonFileProvider(BaseProvider):
75
76
 
76
77
  return items
77
78
 
78
- def save(self, items: dict):
79
+ def save(self, items: Dict[str, AssistantItem]):
79
80
  """
80
81
  Save assistants to file
82
+
83
+ :param items: dict of assistants
81
84
  """
82
85
  try:
83
86
  # update assistants
@@ -122,7 +125,7 @@ class JsonFileProvider(BaseProvider):
122
125
  return False
123
126
 
124
127
  @staticmethod
125
- def serialize(item: AssistantItem) -> dict:
128
+ def serialize(item: AssistantItem) -> Dict[str, Any]:
126
129
  """
127
130
  Serialize item to dict
128
131
 
@@ -149,7 +152,7 @@ class JsonFileProvider(BaseProvider):
149
152
  }
150
153
 
151
154
  @staticmethod
152
- def deserialize(data: dict, item: AssistantItem):
155
+ def deserialize(data: Dict[str, Any], item: AssistantItem):
153
156
  """
154
157
  Deserialize item from dict
155
158
 
@@ -6,9 +6,10 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.04.26 23:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
+ from typing import Dict
12
13
  from packaging.version import Version
13
14
 
14
15
  from pygpt_net.item.assistant import AssistantFileItem
@@ -35,13 +36,13 @@ class BaseProvider:
35
36
  def load(self, id) -> AssistantFileItem:
36
37
  pass
37
38
 
38
- def load_all(self) -> dict:
39
+ def load_all(self) -> Dict[str, AssistantFileItem]:
39
40
  pass
40
41
 
41
42
  def save(self, file: AssistantFileItem):
42
43
  pass
43
44
 
44
- def save_all(self, items: dict):
45
+ def save_all(self, items: Dict[str, AssistantFileItem]):
45
46
  pass
46
47
 
47
48
  def remove(self, id):
@@ -6,10 +6,11 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.04.29 16:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import uuid
13
+ from typing import Dict
13
14
 
14
15
  from packaging.version import Version
15
16
 
@@ -67,7 +68,7 @@ class DbSqliteProvider(BaseProvider):
67
68
  file.record_id = self.storage.insert(file)
68
69
  return file.record_id
69
70
 
70
- def load_all(self) -> dict:
71
+ def load_all(self) -> Dict[str, AssistantFileItem]:
71
72
  """
72
73
  Load files from DB
73
74
 
@@ -96,7 +97,7 @@ class DbSqliteProvider(BaseProvider):
96
97
  self.window.core.debug.log(e)
97
98
  print("Error while saving filed: {}".format(str(e)))
98
99
 
99
- def save_all(self, items: dict):
100
+ def save_all(self, items: Dict[str, AssistantFileItem]):
100
101
  """
101
102
  Save all files to DB
102
103
 
@@ -6,10 +6,11 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.04.29 16:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import time
13
+ from typing import Dict
13
14
 
14
15
  from sqlalchemy import text
15
16
 
@@ -34,7 +35,7 @@ class Storage:
34
35
  """
35
36
  self.window = window
36
37
 
37
- def get_all(self) -> dict:
38
+ def get_all(self) -> Dict[str, AssistantFileItem]:
38
39
  """
39
40
  Return dict with AssistantFileItem objects, indexed by ID
40
41
 
@@ -6,9 +6,11 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.04.26 23:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
+ from typing import Dict
13
+
12
14
  from packaging.version import Version
13
15
 
14
16
  from pygpt_net.item.assistant import AssistantStoreItem
@@ -32,16 +34,16 @@ class BaseProvider:
32
34
  def create(self, store: AssistantStoreItem) -> str:
33
35
  pass
34
36
 
35
- def load(self, id) -> dict:
37
+ def load(self, id) -> AssistantStoreItem:
36
38
  pass
37
39
 
38
- def load_all(self) -> dict:
40
+ def load_all(self) -> Dict[str, AssistantStoreItem]:
39
41
  pass
40
42
 
41
43
  def save(self, file: AssistantStoreItem):
42
44
  pass
43
45
 
44
- def save_all(self, items: dict):
46
+ def save_all(self, items: Dict[str, AssistantStoreItem]):
45
47
  pass
46
48
 
47
49
  def remove(self, id: str):
@@ -1,15 +1,16 @@
1
1
  #!/usr/bin/env python3
2
2
  # -*- coding: utf-8 -*-
3
3
  # ================================================== #
4
- # This store is a part of PYGPT package #
4
+ # This store is a part of PYGPT package #
5
5
  # Website: https://pygpt.net #
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.04.26 23:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import uuid
13
+ from typing import Dict
13
14
 
14
15
  from packaging.version import Version
15
16
 
@@ -62,7 +63,7 @@ class DbSqliteProvider(BaseProvider):
62
63
  store.record_id = self.storage.insert(store)
63
64
  return store.record_id
64
65
 
65
- def load_all(self) -> dict:
66
+ def load_all(self) -> Dict[str, AssistantStoreItem]:
66
67
  """
67
68
  Load stores from DB
68
69
 
@@ -91,7 +92,7 @@ class DbSqliteProvider(BaseProvider):
91
92
  self.window.core.debug.log(e)
92
93
  print("Error while saving stored: {}".format(str(e)))
93
94
 
94
- def save_all(self, items: dict):
95
+ def save_all(self, items: Dict[str, AssistantStoreItem]):
95
96
  """
96
97
  Save all stores to DB
97
98
 
@@ -1,19 +1,21 @@
1
1
  #!/usr/bin/env python3
2
2
  # -*- coding: utf-8 -*-
3
3
  # ================================================== #
4
- # This store is a part of PYGPT package #
4
+ # This store is a part of PYGPT package #
5
5
  # Website: https://pygpt.net #
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.04.26 23:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import time
13
+ from typing import Dict
13
14
 
14
15
  from sqlalchemy import text
15
16
 
16
17
  from pygpt_net.item.assistant import AssistantStoreItem
18
+
17
19
  from .utils import pack_item_value, unpack_store
18
20
 
19
21
  class Storage:
@@ -33,7 +35,7 @@ class Storage:
33
35
  """
34
36
  self.window = window
35
37
 
36
- def get_all(self) -> dict:
38
+ def get_all(self) -> Dict[str, AssistantStoreItem]:
37
39
  """
38
40
  Return dict with AssistantStoreItem objects, indexed by ID
39
41
 
@@ -6,9 +6,11 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2023.12.31 04:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
+ from typing import Dict
13
+
12
14
  from packaging.version import Version
13
15
 
14
16
  from pygpt_net.item.attachment import AttachmentItem
@@ -32,10 +34,10 @@ class BaseProvider:
32
34
  def create(self, attachment: AttachmentItem) -> str:
33
35
  pass
34
36
 
35
- def load(self) -> dict:
37
+ def load(self) -> Dict[str, Dict[str, AttachmentItem]]:
36
38
  pass
37
39
 
38
- def save(self, items: dict):
40
+ def save(self, items: Dict[str, Dict[str, AttachmentItem]]):
39
41
  pass
40
42
 
41
43
  def remove(self, id: str):
@@ -6,12 +6,13 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.11.26 02:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import json
13
13
  import os
14
14
  import uuid
15
+ from typing import Dict
15
16
 
16
17
  from packaging.version import Version
17
18
 
@@ -46,7 +47,7 @@ class JsonFileProvider(BaseProvider):
46
47
  attachment.id = self.create_id()
47
48
  return attachment.id
48
49
 
49
- def load(self) -> dict:
50
+ def load(self) -> Dict[str, Dict[str, AttachmentItem]]:
50
51
  """
51
52
  Load attachments from file
52
53
 
@@ -74,7 +75,7 @@ class JsonFileProvider(BaseProvider):
74
75
 
75
76
  return items
76
77
 
77
- def save(self, items: dict):
78
+ def save(self, items: Dict[str, Dict[str, AttachmentItem]]):
78
79
  """
79
80
  Save attachments to file
80
81
  """
@@ -6,9 +6,11 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.01.06 04:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
+ from typing import Dict
13
+
12
14
  from packaging.version import Version
13
15
 
14
16
  from pygpt_net.item.calendar_note import CalendarNoteItem
@@ -35,13 +37,13 @@ class BaseProvider:
35
37
  def load(self, year, month, day) -> CalendarNoteItem:
36
38
  pass
37
39
 
38
- def load_all(self) -> dict:
40
+ def load_all(self) -> Dict[str, CalendarNoteItem]:
39
41
  pass
40
42
 
41
43
  def save(self, notepad: CalendarNoteItem):
42
44
  pass
43
45
 
44
- def save_all(self, items: dict):
46
+ def save_all(self, items: Dict[str, CalendarNoteItem]):
45
47
  pass
46
48
 
47
49
  def remove(self, year, month, day):