zhiwen0905 commited on
Commit
7c05698
·
1 Parent(s): cdf2b67

feature(#137): created firebase config and implement planner...

Browse files
Extension/.gitignore CHANGED
@@ -15,6 +15,9 @@
15
  # .idea
16
  /.idea
17
 
 
 
 
18
  # misc
19
  .DS_Store
20
  .env.local
 
15
  # .idea
16
  /.idea
17
 
18
+ # config files
19
+ /src/configs/
20
+
21
  # misc
22
  .DS_Store
23
  .env.local
Extension/package.json CHANGED
@@ -12,6 +12,7 @@
12
  "@ant-design/icons": "^5.1.4",
13
  "antd": "^5.3.2",
14
  "axios": "^1.4.0",
 
15
  "react": "^18.2.0",
16
  "react-dom": "^18.2.0"
17
  },
 
12
  "@ant-design/icons": "^5.1.4",
13
  "antd": "^5.3.2",
14
  "axios": "^1.4.0",
15
+ "firebase": "^9.23.0",
16
  "react": "^18.2.0",
17
  "react-dom": "^18.2.0"
18
  },
Extension/src/pages/Panel/Panel.jsx CHANGED
@@ -1,9 +1,11 @@
1
  import React, {useEffect, useRef, useState} from 'react';
2
  import {Divider, Input, Layout} from 'antd';
3
  import {SendOutlined} from '@ant-design/icons';
4
- import Message from './Message'
5
 
 
6
  import './Panel.css';
 
7
 
8
  const {Footer, Content} = Layout;
9
  const confs = {
@@ -18,6 +20,8 @@ const confs = {
18
  }
19
  }
20
 
 
 
21
  const URL_BASE = 'https://ttt246-brain.hf.space/'
22
  const URL_SEND_NOTIFICATION = URL_BASE + 'sendNotification'
23
  const URL_BROWSER_ITEM = URL_BASE + 'browser/item'
@@ -31,10 +35,6 @@ const Panel = () => {
31
  const [isLoading, setLoadingStatus] = useState(false);
32
  const chat_box = useRef(null);
33
 
34
- /*
35
- * methods for states in ui
36
- * lifecycle methods
37
- */
38
  const handleQuestionUpdated = (event) => {
39
  if (event.key === "Enter" && !isLoading) {
40
  addMessage(question, true);
@@ -166,6 +166,9 @@ const Panel = () => {
166
  case 'askwebsite':
167
  askAboutCurrentWebsite()
168
  break
 
 
 
169
  default:
170
  break
171
  }
@@ -231,6 +234,18 @@ const Panel = () => {
231
  return data
232
  }
233
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  /// Check if the user's system is in dark mode
235
  const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
236
  const isDarkMode = darkModeMediaQuery.matches;
 
1
  import React, {useEffect, useRef, useState} from 'react';
2
  import {Divider, Input, Layout} from 'antd';
3
  import {SendOutlined} from '@ant-design/icons';
4
+ import { onValue, ref } from "firebase/database";
5
 
6
+ import Message from './Message'
7
  import './Panel.css';
8
+ import db from '../../configs/firebasedb'
9
 
10
  const {Footer, Content} = Layout;
11
  const confs = {
 
20
  }
21
  }
22
 
23
+ const URL_FIREBASE_REAL_TIME = "https://test3-83ffc-default-rtdb.firebaseio.com"
24
+
25
  const URL_BASE = 'https://ttt246-brain.hf.space/'
26
  const URL_SEND_NOTIFICATION = URL_BASE + 'sendNotification'
27
  const URL_BROWSER_ITEM = URL_BASE + 'browser/item'
 
35
  const [isLoading, setLoadingStatus] = useState(false);
36
  const chat_box = useRef(null);
37
 
 
 
 
 
38
  const handleQuestionUpdated = (event) => {
39
  if (event.key === "Enter" && !isLoading) {
40
  addMessage(question, true);
 
166
  case 'askwebsite':
167
  askAboutCurrentWebsite()
168
  break
169
+ case 'autotask':
170
+ autoTask(data.result.content)
171
+ break
172
  default:
173
  break
174
  }
 
234
  return data
235
  }
236
 
237
+ const autoTask = (referenceUrl) => {
238
+ console.log('call autoTask function----------->', referenceUrl)
239
+
240
+ const dbRef = ref(db, "/auto/autogpt_956a11be45cba4a4_1688452004960/-NZU_GbvZSA1Ghvbs-Qe");
241
+
242
+ onValue(dbRef, (snapshot) => {
243
+ console.log('res dat success======>')
244
+ }, (error) => {
245
+ console.error(error);
246
+ })
247
+ }
248
+
249
  /// Check if the user's system is in dark mode
250
  const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
251
  const isDarkMode = darkModeMediaQuery.matches;