thomas commited on
Commit
8324b6b
·
1 Parent(s): 4c99672

bugfix: fixed extension config issues and updates sendNotification for brwoser.

Browse files
Brain/src/rising_plugin/guardrails-config/actions/actions.py CHANGED
@@ -114,12 +114,16 @@ async def general_question(query):
114
  else:
115
  # """FALCON_7B:"""
116
  result["content"] = falcon_llm.query(question=query)
117
- return str(result)
118
  except ValueError as e:
119
  # Check sms and browser query
120
  if document_id in COMMAND_SMS_INDEXES:
121
- return str({"program": "sms", "content": chain_data})
122
  elif document_id in COMMAND_BROWSER_OPEN:
123
- return str({"program": "browser", "content": "https://google.com"})
124
 
125
- return str({"program": "message", "content": falcon_llm.query(question=query)})
 
 
 
 
 
114
  else:
115
  # """FALCON_7B:"""
116
  result["content"] = falcon_llm.query(question=query)
117
+ return json.dumps(result)
118
  except ValueError as e:
119
  # Check sms and browser query
120
  if document_id in COMMAND_SMS_INDEXES:
121
+ return json.dumps({"program": "sms", "content": chain_data})
122
  elif document_id in COMMAND_BROWSER_OPEN:
123
+ return json.dumps({"program": "browser", "content": "https://google.com"})
124
 
125
+ if is_browser:
126
+ return json.dumps({"program": "ask_website", "content": ""})
127
+ return json.dumps(
128
+ {"program": "message", "content": falcon_llm.query(question=query)}
129
+ )
Brain/src/rising_plugin/risingplugin.py CHANGED
@@ -117,8 +117,11 @@ def processLargeText(
117
  image_search=image_search,
118
  is_browser=is_browser,
119
  )
120
- result = json.dumps(message["content"])
121
- return parseJsonFromCompletion(result)
 
 
 
122
  else:
123
  first_query = "The total length of the content that I want to send you is too large to send in only one piece.\nFor sending you that content, I will follow this rule:\n[START PART 1/10]\nThis is the content of the part 1 out of 10 in total\n[END PART 1/10]\nThen you just answer: 'Received part 1/10'\nAnd when I tell you 'ALL PART SENT', then you can continue processing the data and answering my requests."
124
  app.generate(messages=[{"role": "user", "content": first_query}])
@@ -174,8 +177,11 @@ def processLargeText(
174
  image_search=image_search,
175
  is_browser=is_browser,
176
  )
177
- result = json.dumps(message["content"])
178
- return parseJsonFromCompletion(result)
 
 
 
179
  # out of for-loop
180
 
181
 
 
117
  image_search=image_search,
118
  is_browser=is_browser,
119
  )
120
+ try:
121
+ return json.loads(message["content"])
122
+ except Exception as e:
123
+ result = json.dumps(message["content"])
124
+ return parseJsonFromCompletion(result)
125
  else:
126
  first_query = "The total length of the content that I want to send you is too large to send in only one piece.\nFor sending you that content, I will follow this rule:\n[START PART 1/10]\nThis is the content of the part 1 out of 10 in total\n[END PART 1/10]\nThen you just answer: 'Received part 1/10'\nAnd when I tell you 'ALL PART SENT', then you can continue processing the data and answering my requests."
127
  app.generate(messages=[{"role": "user", "content": first_query}])
 
177
  image_search=image_search,
178
  is_browser=is_browser,
179
  )
180
+ try:
181
+ return json.loads(message["content"])
182
+ except Exception as e:
183
+ result = json.dumps(message["content"])
184
+ return parseJsonFromCompletion(result)
185
  # out of for-loop
186
 
187
 
Brain/src/router/api.py CHANGED
@@ -96,10 +96,11 @@ def construct_blueprint_api() -> APIRouter:
96
  uuid=uuid, search=result["content"]
97
  )
98
  result["content"] = str(contacts_results)
 
 
 
 
99
 
100
- notification = {"title": "alert", "content": json.dumps(result)}
101
-
102
- state, value = cloud_message.send_message(notification, [token])
103
  return assembler.to_response(200, value, result)
104
  except Exception as e:
105
  logger.error(
 
96
  uuid=uuid, search=result["content"]
97
  )
98
  result["content"] = str(contacts_results)
99
+ value = ""
100
+ if not client_info.is_browser():
101
+ notification = {"title": "alert", "content": json.dumps(result)}
102
+ state, value = cloud_message.send_message(notification, [token])
103
 
 
 
 
104
  return assembler.to_response(200, value, result)
105
  except Exception as e:
106
  logger.error(
Extension/src/pages/Panel/Panel.jsx CHANGED
@@ -7,12 +7,12 @@ import './Panel.css';
7
 
8
  const {Footer, Content} = Layout;
9
  const confs = {
10
- "openai_key": "string",
11
- "pinecone_key": "string",
12
- "pinecone_env": "string",
13
- "firebase_key": "string",
14
  "token": "",
15
- "uuid": "",
16
  "settings": {
17
  "temperature": 0.6
18
  }
 
7
 
8
  const {Footer, Content} = Layout;
9
  const confs = {
10
+ "openai_key": "",
11
+ "pinecone_key": "",
12
+ "pinecone_env": "",
13
+ "firebase_key": "",
14
  "token": "",
15
+ "uuid": "extension-uuid",
16
  "settings": {
17
  "temperature": 0.6
18
  }