Uniaff commited on
Commit
f739e90
·
verified ·
1 Parent(s): a028061

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -13
app.py CHANGED
@@ -7,7 +7,7 @@ import requests
7
  from langchain.prompts import ChatPromptTemplate
8
  from langchain_community.llms import Ollama
9
 
10
- from func_ai import classify_comment, VECTOR_API_URL
11
  from func_facebook import get_page_id, get_unanswered_comments, reply_comment, hide_negative_comments
12
 
13
 
@@ -121,18 +121,16 @@ def process_comments(ACCESS_TOKEN, user_context):
121
 
122
  message = comment['message']
123
  log_message(f"Обработка комментария: {message}")
124
- classification = classify_comment(message)
125
- log_message(f"Классификация комментария: {classification}")
126
- if classification == "interrogative":
127
- response_message = generate_response(message, context=user_context)
128
- log_message(f"Ответ на комментарий: {response_message}")
129
- success = reply_comment(comment_id=comment['id'], message=response_message, token=ACCESS_TOKEN)
130
- if success:
131
- post_replies.append({
132
- 'comment_id': comment['id'],
133
- 'comment_message': comment['message'],
134
- 'reply_message': response_message
135
- })
136
 
137
  processed_posts.append({
138
  'post_id': post_id,
 
7
  from langchain.prompts import ChatPromptTemplate
8
  from langchain_community.llms import Ollama
9
 
10
+ from func_ai import VECTOR_API_URL
11
  from func_facebook import get_page_id, get_unanswered_comments, reply_comment, hide_negative_comments
12
 
13
 
 
121
 
122
  message = comment['message']
123
  log_message(f"Обработка комментария: {message}")
124
+
125
+ response_message = generate_response(message, context=user_context)
126
+ log_message(f"Ответ на комментарий: {response_message}")
127
+ success = reply_comment(comment_id=comment['id'], message=response_message, token=ACCESS_TOKEN)
128
+ if success:
129
+ post_replies.append({
130
+ 'comment_id': comment['id'],
131
+ 'comment_message': comment['message'],
132
+ 'reply_message': response_message
133
+ })
 
 
134
 
135
  processed_posts.append({
136
  'post_id': post_id,