Spaces:
Runtime error
Runtime error
Bug fixes
Browse files
src/ctp_slack_bot/api/main.py
CHANGED
@@ -39,8 +39,10 @@ async def main() -> None:
|
|
39 |
@bolt_app.event("message")
|
40 |
async def handle_message(body: Dict[str, Any]) -> None:
|
41 |
logger.debug("Ignored regular message: {}", body.get("event").get("text"))
|
|
|
42 |
@bolt_app.event("app_mention")
|
43 |
async def handle_app_mention(body: Dict[str, Any]) -> None:
|
|
|
44 |
await slack_service.process_message(body)
|
45 |
|
46 |
# Start Socket Mode handler in a background thread
|
|
|
39 |
@bolt_app.event("message")
|
40 |
async def handle_message(body: Dict[str, Any]) -> None:
|
41 |
logger.debug("Ignored regular message: {}", body.get("event").get("text"))
|
42 |
+
#await slack_service.process_message(body)
|
43 |
@bolt_app.event("app_mention")
|
44 |
async def handle_app_mention(body: Dict[str, Any]) -> None:
|
45 |
+
#logger.debug("Ignored app mention: {}", body.get("event").get("text"))
|
46 |
await slack_service.process_message(body)
|
47 |
|
48 |
# Start Socket Mode handler in a background thread
|
src/ctp_slack_bot/models/__init__.py
CHANGED
@@ -1,3 +1,2 @@
|
|
1 |
-
from ctp_slack_bot.models.base import Chunk, Content, VectorizedChunk
|
2 |
from ctp_slack_bot.models.slack import SlackEventPayload, SlackMessage, SlackReaction, SlackResponse, SlackUserTimestampPair
|
3 |
-
from ctp_slack_bot.models.vector_query import VectorQuery
|
|
|
1 |
+
from ctp_slack_bot.models.base import Chunk, Content, VectorizedChunk, VectorQuery
|
2 |
from ctp_slack_bot.models.slack import SlackEventPayload, SlackMessage, SlackReaction, SlackResponse, SlackUserTimestampPair
|
|
src/ctp_slack_bot/services/context_retrieval_service.py
CHANGED
@@ -14,7 +14,7 @@ class ContextRetrievalService(BaseModel):
|
|
14 |
|
15 |
settings: Settings
|
16 |
vectorization_service: VectorizationService
|
17 |
-
|
18 |
|
19 |
# Should not allow initialization calls to bubble up all the way to the surface ― sequester in `post_init` or the class on which it depends.
|
20 |
@model_validator(mode='after')
|
@@ -54,7 +54,7 @@ class ContextRetrievalService(BaseModel):
|
|
54 |
# Perform similarity search
|
55 |
try:
|
56 |
results = await self.vector_db_service.search_by_similarity(query)
|
57 |
-
logger.info(f"Retrieved {len(results)} context chunks for query")
|
58 |
return results
|
59 |
except Exception as e:
|
60 |
logger.error(f"Error retrieving context: {str(e)}")
|
|
|
14 |
|
15 |
settings: Settings
|
16 |
vectorization_service: VectorizationService
|
17 |
+
vector_database_service: VectorDatabaseService
|
18 |
|
19 |
# Should not allow initialization calls to bubble up all the way to the surface ― sequester in `post_init` or the class on which it depends.
|
20 |
@model_validator(mode='after')
|
|
|
54 |
# Perform similarity search
|
55 |
try:
|
56 |
results = await self.vector_db_service.search_by_similarity(query)
|
57 |
+
#logger.info(f"Retrieved {len(results)} context chunks for query")
|
58 |
return results
|
59 |
except Exception as e:
|
60 |
logger.error(f"Error retrieving context: {str(e)}")
|
src/ctp_slack_bot/services/question_dispatch_service.py
CHANGED
@@ -30,5 +30,5 @@ class QuestionDispatchService(BaseModel):
|
|
30 |
async def __process_incoming_slack_message(self: Self, message: SlackMessage) -> None:
|
31 |
if message.subtype != 'bot_message':
|
32 |
logger.debug("Question dispatch service received an answerable question: {}", message.text)
|
33 |
-
context = self.context_retrieval_service.get_context(message)
|
34 |
await self.answer_retrieval_service.push(message, context)
|
|
|
30 |
async def __process_incoming_slack_message(self: Self, message: SlackMessage) -> None:
|
31 |
if message.subtype != 'bot_message':
|
32 |
logger.debug("Question dispatch service received an answerable question: {}", message.text)
|
33 |
+
context = await self.context_retrieval_service.get_context(message)
|
34 |
await self.answer_retrieval_service.push(message, context)
|