jiarongqiu commited on
Commit
7a65857
·
1 Parent(s): f12c88c
Files changed (2) hide show
  1. service/scheduler.py +6 -5
  2. service/vector_store.py +2 -2
service/scheduler.py CHANGED
@@ -20,18 +20,19 @@ class Scheduler:
20
  def update_filecoin_stat(self):
21
  price = api.get_filecoin_price()
22
  deposit = api.get_filecoin_deposit()
23
- tvl = api.get_filecoin_tvl()
24
  total_raw_bytes_power = api.get_fvm_storage()
25
  active_deals_verified_bytes = api.get_fvm_active_deal()
26
  text = """
27
  The price of filecoin(FIL) is currently ${} USD.
28
  The Total DeFi Net Deposits of filecoin(FIL) is {} FIL.
29
- The Total Value Locked(TVL) of filecoin(FIL) is ${} USD.
30
  The Network Raw Byte Power of the Filecoin Network is {} EiB.
 
31
  The Total Active Filecoin Deals of the Filecoin Network is {} EiB.
32
- """.format(price,deposit,tvl,total_raw_bytes_power,active_deals_verified_bytes)
33
- print(f"Update {text}")
34
- vector_store.upsert(text,"dataset_1")
35
 
36
 
37
 
 
20
  def update_filecoin_stat(self):
21
  price = api.get_filecoin_price()
22
  deposit = api.get_filecoin_deposit()
23
+ # tvl = api.get_filecoin_tvl()
24
  total_raw_bytes_power = api.get_fvm_storage()
25
  active_deals_verified_bytes = api.get_fvm_active_deal()
26
  text = """
27
  The price of filecoin(FIL) is currently ${} USD.
28
  The Total DeFi Net Deposits of filecoin(FIL) is {} FIL.
29
+ The Total Value Locked(TVL) of filecoin(FIL) is {} FIL.
30
  The Network Raw Byte Power of the Filecoin Network is {} EiB.
31
+ The Data stored on the Filecoin Network is {} EiB.
32
  The Total Active Filecoin Deals of the Filecoin Network is {} EiB.
33
+ """.format(price,deposit,deposit,total_raw_bytes_power,total_raw_bytes_power,active_deals_verified_bytes)
34
+ # print(f"Update {text}")
35
+ vector_store.upsert(text,"dataset_1",source='https://fvm.starboard.ventures/explorer/leaderboard?utm_source=Starboard-TLDR-HTS')
36
 
37
 
38
 
service/vector_store.py CHANGED
@@ -186,9 +186,9 @@ class VectorStore(Pinecone):
186
  for metadata in selected
187
  ]
188
 
189
- def upsert(self,text,id):
190
  embed = self.embeddings.embed_query(text)
191
- vector_store._index.update(id=id,values=embed,set_metadata={"description":text,"text":text})
192
  print(f"upsert text:{text} with id:{id}")
193
 
194
  vector_store = VectorStore()
 
186
  for metadata in selected
187
  ]
188
 
189
+ def upsert(self,text,id,source=''):
190
  embed = self.embeddings.embed_query(text)
191
+ vector_store._index.update(id=id,values=embed,set_metadata={"description":text,"text":text,source:source})
192
  print(f"upsert text:{text} with id:{id}")
193
 
194
  vector_store = VectorStore()