leadguru-jobs 0.310.0__py3-none-any.whl → 0.312.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.
- {leadguru_jobs-0.310.0.dist-info → leadguru_jobs-0.312.0.dist-info}/METADATA +3 -3
- {leadguru_jobs-0.310.0.dist-info → leadguru_jobs-0.312.0.dist-info}/RECORD +9 -8
- lgt_jobs/__init__.py +5 -0
- lgt_jobs/jobs/inbox_leads.py +4 -4
- lgt_jobs/jobs/reindex_conversation_history.py +27 -0
- lgt_jobs/jobs/update_slack_profile.py +1 -1
- lgt_jobs/jobs/workspace_connect.py +0 -2
- {leadguru_jobs-0.310.0.dist-info → leadguru_jobs-0.312.0.dist-info}/WHEEL +0 -0
- {leadguru_jobs-0.310.0.dist-info → leadguru_jobs-0.312.0.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: leadguru-jobs
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.312.0
|
4
4
|
Summary: LGT jobs builds
|
5
5
|
Author-email: developer@leadguru.co
|
6
6
|
Classifier: Development Status :: 5 - Production/Stable
|
@@ -20,8 +20,8 @@ Classifier: Topic :: Internet
|
|
20
20
|
Requires-Dist: loguru
|
21
21
|
Requires-Dist: pydantic
|
22
22
|
Requires-Dist: cachetools >=3.1.0
|
23
|
-
Requires-Dist: leadguru-common ==0.
|
24
|
-
Requires-Dist: leadguru-data ==0.
|
23
|
+
Requires-Dist: leadguru-common ==0.346.0
|
24
|
+
Requires-Dist: leadguru-data ==0.353.0
|
25
25
|
Requires-Dist: wheel
|
26
26
|
Requires-Dist: setuptools
|
27
27
|
Requires-Dist: twine
|
@@ -1,4 +1,4 @@
|
|
1
|
-
lgt_jobs/__init__.py,sha256=
|
1
|
+
lgt_jobs/__init__.py,sha256=JHgkIlH-HvoLcmaYZfzGC1-OuoA0sEYlPm1ugrOxGYg,3009
|
2
2
|
lgt_jobs/basejobs.py,sha256=LPEclvY6fIG17YMGy9pRK0Q58n62gkI5W1BTK6R2p-c,1234
|
3
3
|
lgt_jobs/env.py,sha256=yzZ3Z2zAlA8B9FAY1GGEz2pkN_IiFqL-Reql1_Ub5qg,639
|
4
4
|
lgt_jobs/main.py,sha256=g9cIpahGFXZZv6fsftbjrOhQMrrD04kxKOuPpxKk3rk,1545
|
@@ -12,18 +12,19 @@ lgt_jobs/jobs/bot_stats_update.py,sha256=-rECA72ptL6V4w49GKwD0fEXVnP21g4sehrL3MX
|
|
12
12
|
lgt_jobs/jobs/chat_history.py,sha256=-kIkTtpNCyuABF31fkPMBaVX_9J3IVK1QK2XR3o-mX8,5965
|
13
13
|
lgt_jobs/jobs/clear_user_analytics.py,sha256=xCq_1TibYJp4Ezq22JPQfQpwCmc2QHJxgTcthxKLHWc,2525
|
14
14
|
lgt_jobs/jobs/conversation_replied.py,sha256=nFEK8afPZ4cnxlU2yxXUAAQW8DiHJ7Du434gPrmQy-4,2870
|
15
|
-
lgt_jobs/jobs/inbox_leads.py,sha256=
|
15
|
+
lgt_jobs/jobs/inbox_leads.py,sha256=wKWlOPe8m4zcI8qf0ciT4csxjbSLkV-ds-8YqXWaNGI,4611
|
16
16
|
lgt_jobs/jobs/mass_message.py,sha256=guXQjAL78fc6V0qWZr6nVB-vOGaMDs_NU4yq3iCyAjE,2033
|
17
17
|
lgt_jobs/jobs/reactions_added.py,sha256=GTSJRZr1fXHLc5-WyFi0wyhuyRKpqhZRtGCar3ZsUos,2465
|
18
|
+
lgt_jobs/jobs/reindex_conversation_history.py,sha256=5kAblOERu3VdqrcV43hBgyBC4iiqVrIP3GQrugv9Mjg,1062
|
18
19
|
lgt_jobs/jobs/send_code.py,sha256=pLzKJhaTvWYPtvOjH02xpZ-h4dMk5hmkcnc5AS8hc9Q,827
|
19
20
|
lgt_jobs/jobs/send_slack_message.py,sha256=hS1eaHaMX9sMPO-3TeeM1K5xTkedlMBfAUnTtCFR3DU,2686
|
20
|
-
lgt_jobs/jobs/update_slack_profile.py,sha256=
|
21
|
+
lgt_jobs/jobs/update_slack_profile.py,sha256=mdZwhvlgc0UCZAcRt2WIa_e2JZVoxHS2PbhaI6RDulI,2901
|
21
22
|
lgt_jobs/jobs/user_balance_update.py,sha256=7LkcpKMilxqUcCS1_OW51qQnaXvGBavkj0a-0_-gK2g,2352
|
22
|
-
lgt_jobs/jobs/workspace_connect.py,sha256=
|
23
|
+
lgt_jobs/jobs/workspace_connect.py,sha256=ftqO93W3pAS_UJGPf2nt50L2mTxc3999W6kWKXQgnGo,6798
|
23
24
|
lgt_jobs/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
25
|
lgt_jobs/services/web_client.py,sha256=SZogxjM0jyACRqBOP5EJvtqwe44og8B5B6TMWLpYmKM,1878
|
25
26
|
lgt_jobs/templates/new_message_mail_template.html,sha256=82XdDPtmkJVUWUcZtgd8bv_9-viAG2WWOnf3AhR6PeY,3635
|
26
|
-
leadguru_jobs-0.
|
27
|
-
leadguru_jobs-0.
|
28
|
-
leadguru_jobs-0.
|
29
|
-
leadguru_jobs-0.
|
27
|
+
leadguru_jobs-0.312.0.dist-info/METADATA,sha256=WJZFIUuwl7saPkP997XkgUrtdMgBSo8HWH3CEyLdt2I,1181
|
28
|
+
leadguru_jobs-0.312.0.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
29
|
+
leadguru_jobs-0.312.0.dist-info/top_level.txt,sha256=rIuw1DqwbnZyeoarBSC-bYeGOhv9mZBs7_afl9q4_JI,9
|
30
|
+
leadguru_jobs-0.312.0.dist-info/RECORD,,
|
lgt_jobs/__init__.py
CHANGED
@@ -9,6 +9,8 @@ from .jobs.archive_leads import (ArchiveLeadsJob, ArchiveLeadsJobData)
|
|
9
9
|
from .jobs.bot_stats_update import (BotStatsUpdateJob, BotStatsUpdateJobData)
|
10
10
|
from .jobs.chat_history import (LoadChatHistoryJob, LoadChatHistoryJobData)
|
11
11
|
from .jobs.update_slack_profile import (UpdateUserSlackProfileJob, UpdateUserSlackProfileJobData)
|
12
|
+
from .jobs.reindex_conversation_history import ReIndexUserLeadsConversationHistoryJob,\
|
13
|
+
ReIndexUserLeadsConversationHistoryJobData
|
12
14
|
from .jobs.clear_user_analytics import ClearUserAnalyticsJobData, ClearUserAnalyticsJob
|
13
15
|
from .jobs.mass_message import SendMassMessageSlackChannelJob, SendMassMessageSlackChannelJobData
|
14
16
|
from .basejobs import (BaseBackgroundJobData, BaseBackgroundJob, InvalidJobTypeException)
|
@@ -28,6 +30,7 @@ jobs_map = {
|
|
28
30
|
"ReactionAddedJob": ReactionAddedJob,
|
29
31
|
"SendSlackMessageJob": SendSlackMessageJob,
|
30
32
|
"UpdateUserBalanceJob": UpdateUserBalanceJob,
|
33
|
+
"ReIndexUserLeadsConversationHistoryJob": ReIndexUserLeadsConversationHistoryJob,
|
31
34
|
"ClearUserAnalyticsJob": ClearUserAnalyticsJob,
|
32
35
|
"SendMassMessageSlackChannelJob": SendMassMessageSlackChannelJob,
|
33
36
|
}
|
@@ -45,6 +48,7 @@ __all__ = [
|
|
45
48
|
ReactionAddedJob,
|
46
49
|
SendSlackMessageJob,
|
47
50
|
UpdateUserBalanceJob,
|
51
|
+
ReIndexUserLeadsConversationHistoryJob,
|
48
52
|
ClearUserAnalyticsJob,
|
49
53
|
SendMassMessageSlackChannelJob,
|
50
54
|
|
@@ -64,6 +68,7 @@ __all__ = [
|
|
64
68
|
ReactionAddedJobData,
|
65
69
|
SendSlackMessageJobData,
|
66
70
|
UpdateUserBalanceJobData,
|
71
|
+
ReIndexUserLeadsConversationHistoryJobData,
|
67
72
|
ClearUserAnalyticsJobData,
|
68
73
|
SendMassMessageSlackChannelJobData,
|
69
74
|
# mapping
|
lgt_jobs/jobs/inbox_leads.py
CHANGED
@@ -3,8 +3,8 @@ from lgt.common.python.lgt_logging import log
|
|
3
3
|
from lgt.common.python.slack_client.web_client import SlackWebClient
|
4
4
|
from lgt_data.enums import DefaultBoards
|
5
5
|
from lgt_data.model import UserModel, DedicatedBotModel, SlackMemberInformation, UserLeadModel
|
6
|
-
from lgt_data.mongo_repository import UserMongoRepository, DedicatedBotRepository, \
|
7
|
-
SlackContactUserRepository, BoardsMongoRepository
|
6
|
+
from lgt_data.mongo_repository import UserLeadMongoRepository, UserMongoRepository, DedicatedBotRepository, \
|
7
|
+
SlackContactUserRepository, BoardsMongoRepository
|
8
8
|
from pydantic import BaseModel
|
9
9
|
from ..basejobs import BaseBackgroundJob, BaseBackgroundJobData
|
10
10
|
from ..services.web_client import V3ServerClient
|
@@ -56,8 +56,8 @@ class InboxLeadsJob(BaseBackgroundJob, ABC):
|
|
56
56
|
messages = history.get('messages', [])
|
57
57
|
log.info(f'[InboxLeadsJob]: Count of messages: {len(messages)} with {sender_id}')
|
58
58
|
if messages:
|
59
|
-
|
60
|
-
if not
|
59
|
+
user_lead = UserLeadMongoRepository().get_lead(user.id, sender_id=sender_id)
|
60
|
+
if not user_lead:
|
61
61
|
people = SlackContactUserRepository().find_one(sender_id)
|
62
62
|
if not people:
|
63
63
|
slack_profile = slack_client.get_profile(sender_id).get('user')
|
@@ -0,0 +1,27 @@
|
|
1
|
+
from abc import ABC
|
2
|
+
from typing import List
|
3
|
+
from lgt_data.model import UserLeadModel
|
4
|
+
from lgt_data.mongo_repository import UserLeadMongoRepository
|
5
|
+
from pydantic import BaseModel
|
6
|
+
from ..basejobs import BaseBackgroundJobData, BaseBackgroundJob
|
7
|
+
|
8
|
+
"""
|
9
|
+
User Leads reindex conversation history
|
10
|
+
"""
|
11
|
+
|
12
|
+
|
13
|
+
class ReIndexUserLeadsConversationHistoryJobData(BaseBackgroundJobData, BaseModel):
|
14
|
+
user_id: str
|
15
|
+
|
16
|
+
|
17
|
+
class ReIndexUserLeadsConversationHistoryJob(BaseBackgroundJob, ABC):
|
18
|
+
@property
|
19
|
+
def job_data_type(self) -> type:
|
20
|
+
return ReIndexUserLeadsConversationHistoryJobData
|
21
|
+
|
22
|
+
def exec(self, data: ReIndexUserLeadsConversationHistoryJobData):
|
23
|
+
leads: List[UserLeadModel] = UserLeadMongoRepository().get_leads(user_id=data.user_id, skip=0, limit=10000)
|
24
|
+
leads = [lead for lead in leads if hasattr(lead, "chat_history") and lead.chat_history]
|
25
|
+
for lead in leads:
|
26
|
+
index = "\n".join([message.text for message in lead.chat_history])
|
27
|
+
UserLeadMongoRepository().update_lead(data.user_id, lead.id, full_message_text=index)
|
@@ -27,7 +27,7 @@ class UpdateUserSlackProfileJob(BaseBackgroundJob, ABC):
|
|
27
27
|
for bot in bots:
|
28
28
|
if bot.invalid_creds:
|
29
29
|
log.warning(
|
30
|
-
f'User: {user.email} dedicated bot: {bot.
|
30
|
+
f'User: {user.email} dedicated bot: {bot.source.source_id} credentials are invalid. '
|
31
31
|
f'Not able to update user profile')
|
32
32
|
continue
|
33
33
|
|
@@ -118,8 +118,6 @@ class ConnectSlackAccountJob(BaseBackgroundJob, ABC):
|
|
118
118
|
slack_user.cookies)
|
119
119
|
dedicated_bot.two_factor_required = workspace.two_factor_required
|
120
120
|
dedicated_bot.banned = False
|
121
|
-
dedicated_bot.source.source_name = workspace.domain
|
122
|
-
dedicated_bot.registration_link = dedicated_bot.slack_url = workspace.url
|
123
121
|
dedicated_bots_repository.add_or_update(dedicated_bot)
|
124
122
|
BackgroundJobRunner.submit(BotStatsUpdateJob, BotStatsUpdateJobData(bot_id=str(dedicated_bot.id)))
|
125
123
|
|
File without changes
|
File without changes
|