sopel-ai 1.0.8__py3-none-any.whl → 1.0.10__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
sopel_ai/__init__.py CHANGED
@@ -13,11 +13,11 @@ from sopel_ai.errors import M0tokoError
13
13
  from tinydb import Query
14
14
  from tinydb import TinyDB
15
15
 
16
- import logging
16
+ # import logging
17
17
  import os
18
18
 
19
19
 
20
- __VERSION__ = '1.0.8'
20
+ __VERSION__ = '1.0.10'
21
21
 
22
22
 
23
23
  # +++ constants +++
@@ -28,16 +28,22 @@ DEFAULT_LLM_PROVIDER = 'PerplexityAI'
28
28
  DEFAULT_LLM_SERVICE = PERPLEXITY_API_URL
29
29
  DEFAULT_LOG_LEVEL = 'info'
30
30
  GITHUB_NEW_ISSUE_URL = 'https://github.com/pr3d4t0r/sopel_ai/issues/new'
31
- LOGGER = logging.getLogger(__name__)
32
31
  MAX_RESPONSE_LENGTH = 448
33
32
  USER_DB_FILE = os.path.join('/', os.environ['HOME'], '.sopel/sopel_ai-DB.json')
34
33
 
35
34
 
35
+ # +++ initializations +++
36
+
37
+ # logging.basicConfig(format = '%(asctime)s %(clientip)-15s %(user)-8s %(message)s', encoding = 'utf-8', level = logging.INFO)
38
+
39
+
40
+
36
41
  # +++ globals +++
37
42
 
38
43
  _client = None
39
44
  _clientCache = dict()
40
45
  _database = None
46
+ # _log = logging.getLogger(__name__)
41
47
 
42
48
 
43
49
  # +++ implementation +++
@@ -82,7 +88,9 @@ def runQuery(query: str, nick: str = None) -> str:
82
88
  Python run-time.
83
89
  """
84
90
 
85
- if not nick or getModelForUser(nick, USER_DB_FILE) == DEFAULT_LLM:
91
+ model = getModelForUser(nick, USER_DB_FILE)
92
+ print('*** nick = %s, query = %s, model = %s' % (nick, query, model))
93
+ if not nick or model == DEFAULT_LLM:
86
94
  _checkClientInstance()
87
95
  client = _client
88
96
  else:
sopel_ai/plugin.py CHANGED
@@ -52,22 +52,21 @@ def _queryCommand(bot: SopelWrapper, trigger: Trigger) -> None:
52
52
  return
53
53
 
54
54
  # TODO: Log this
55
- bot.reply(runQuery(trigger.group(2)))
55
+ bot.reply(runQuery(trigger.group(2), trigger.nick))
56
56
 
57
57
 
58
58
  @plugin.commands('qpm', 'llmqpm')
59
- @plugin.example('.qpm|.llmqpm Some question about anything; reply in private message')
59
+ @plugin.example('.qpm|.llmqpm Some question about anything; I will reply to you in a private message')
60
60
  @plugin.output_prefix(PLUGIN_OUTPUT_PREFIX)
61
61
  @plugin.require_account(message = 'You must be a registered to use this command.', reply = True)
62
62
  @plugin.thread(True)
63
63
  def _queryCommandPrivateMessage(bot: SopelWrapper, trigger: Trigger) -> None:
64
64
  if not trigger.group(2):
65
65
  # TODO: Log this
66
- bot.say('No search term. Usage: {}q Some question about anything'.format(bot.config.core.help_prefix), trigger.nick)
66
+ bot.reply('No search term. Usage: {}qpm Some question about anything'.format(bot.config.core.help_prefix))
67
67
  return
68
68
 
69
- # TODO: Log this
70
- bot.say(runQuery(trigger.group(2)), trigger.nick)
69
+ bot.say(runQuery(trigger.group(2), trigger.nick), trigger.nick)
71
70
 
72
71
 
73
72
  @plugin.commands('mver')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sopel-ai
3
- Version: 1.0.8
3
+ Version: 1.0.10
4
4
  Summary: Sopel AI - an LLM enhanced chat bot plug-in
5
5
  Author-email: The SopelAI team <sopel_ai@cime.net>
6
6
  Project-URL: Homepage, https://github.com/pr3d4t0r/sopel_ai
@@ -23,7 +23,7 @@ Requires-Dist: perplexipy
23
23
  Requires-Dist: sopel (>=7.1)
24
24
  Requires-Dist: tinydb
25
25
 
26
- % sopel_ai(1) Version 1.0.8 chatbot plugin
26
+ % sopel_ai(1) Version 1.0.10 chatbot plugin
27
27
 
28
28
  Name
29
29
  ====
@@ -0,0 +1,10 @@
1
+ sopel_ai/__init__.py,sha256=COsPkQDg6ftVLhY4j4vVaoX6bCon1ViqS6Bxzzz7HLU,5813
2
+ sopel_ai/config.py,sha256=DOL1Eqj1ctUgCrLW3TvInP3NFbvQm7ARoNKWB0ulTgU,698
3
+ sopel_ai/errors.py,sha256=fgc9mjYJMnq1AxFXOwiknFwnJBJTWRNkZIHzRKS9m5g,191
4
+ sopel_ai/plugin.py,sha256=C-NEKwC1NtBSUoQF-ulape_TptVsSafm4Mps0LRYcLk,5800
5
+ sopel_ai-1.0.10.dist-info/LICENSE.txt,sha256=Zu2THICc4hWm3NlzcKss5xjgku2JwQ0sUDYQZ9Pjhcw,1522
6
+ sopel_ai-1.0.10.dist-info/METADATA,sha256=7JfcxrD4LAqODMdNMZTquSNeq_KP_3vE1QHRt4N9Srw,1623
7
+ sopel_ai-1.0.10.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
8
+ sopel_ai-1.0.10.dist-info/entry_points.txt,sha256=7Juxcn6L4j6F83TjkviiTwiyXLM4gZxAAXFQDR2G_m4,43
9
+ sopel_ai-1.0.10.dist-info/top_level.txt,sha256=kpNMzNEGbhCXkyn7oc3uQPmrX1J6qLxn59IcZBpwSYg,9
10
+ sopel_ai-1.0.10.dist-info/RECORD,,
@@ -0,0 +1,2 @@
1
+ [sopel.plugins]
2
+ sopel_ai = sopel_ai.plugin
@@ -1,10 +0,0 @@
1
- sopel_ai/__init__.py,sha256=qvxWAbH5DZmfmfu7Q9kv4GE7Fpm8BH3bZI9vLPmpyvc,5561
2
- sopel_ai/config.py,sha256=DOL1Eqj1ctUgCrLW3TvInP3NFbvQm7ARoNKWB0ulTgU,698
3
- sopel_ai/errors.py,sha256=fgc9mjYJMnq1AxFXOwiknFwnJBJTWRNkZIHzRKS9m5g,191
4
- sopel_ai/plugin.py,sha256=fwz-TbEwBa_rPdJfnNFuk2VhH8UcV6QUEhvKmRm_yiQ,5788
5
- sopel_ai-1.0.8.dist-info/LICENSE.txt,sha256=Zu2THICc4hWm3NlzcKss5xjgku2JwQ0sUDYQZ9Pjhcw,1522
6
- sopel_ai-1.0.8.dist-info/METADATA,sha256=nLT0p8E9TiHwTZcOVx2c93KkIuBbXBasQ65nz0t60XU,1621
7
- sopel_ai-1.0.8.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
8
- sopel_ai-1.0.8.dist-info/entry_points.txt,sha256=t-4zSjOW3sqjR8xzOumUiSgprU0iZJOLu1nU_BDg2qo,41
9
- sopel_ai-1.0.8.dist-info/top_level.txt,sha256=kpNMzNEGbhCXkyn7oc3uQPmrX1J6qLxn59IcZBpwSYg,9
10
- sopel_ai-1.0.8.dist-info/RECORD,,
@@ -1,2 +0,0 @@
1
- [sopel.plugins]
2
- motoko = sopel_ai.plugin