diff --git a/packages/nextjs/generated/deployedContracts.ts b/packages/nextjs/generated/deployedContracts.ts index 77380a6..72768a6 100644 --- a/packages/nextjs/generated/deployedContracts.ts +++ b/packages/nextjs/generated/deployedContracts.ts @@ -1,197 +1,130 @@ const contracts = { // modifile here. - 534351: [ + 84531: [ { - chainId: "534351", - name: "scrollSepolia", + chainId: "84531", + name: "baseGoerli", contracts: { VectorDBProposalGovernancer: { - address: "0xEd6a0A29A962B4296bCeEC4e1E55F5Ec0474EAC7", + address: "0x604dcaEC4E9ad55737F00D87B47ae497d2d78608", abi: [ { - inputs: [], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [], - name: "chairperson", - outputs: [ + "inputs": [ { - internalType: "address", - name: "", - type: "address", - }, + "internalType": "string", + "name": "_vectorName", + "type": "string" + } ], - stateMutability: "view", - type: "function", + "stateMutability": "nonpayable", + "type": "constructor" }, { - inputs: [ - { - internalType: "string", - name: "_title", - type: "string", - }, + "anonymous": false, + "inputs": [ { - internalType: "string", - name: "_content", - type: "string", + "indexed": false, + "internalType": "string", + "name": "uuid", + "type": "string" }, - ], - name: "createProposal", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ { - internalType: "address", - name: "to", - type: "address", - }, + "indexed": false, + "internalType": "bool", + "name": "decide", + "type": "bool" + } ], - name: "delegate", - outputs: [], - stateMutability: "nonpayable", - type: "function", + "name": "JudgeSet", + "type": "event" }, { - inputs: [ + "inputs": [ { - internalType: "uint32", - name: "id", - type: "uint32", + "internalType": "string", + "name": "_uuid", + "type": "string" }, - ], - name: "getProposal", - outputs: [ { - components: [ - { - internalType: "string", - name: "title", - type: "string", - }, - { - internalType: "string", - name: "content", - type: "string", - }, - { - internalType: "address", - name: "proposaler", - type: "address", - }, - { - internalType: "uint256", - name: "voteCount", - type: "uint256", - }, - ], - internalType: "struct YourContract.Proposal", - name: "", - type: "tuple", - }, + "internalType": "bool", + "name": "_decide", + "type": "bool" + } ], - stateMutability: "view", - type: "function", + "name": "judgeTag", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - inputs: [ + "inputs": [ { - internalType: "address", - name: "voter", - type: "address", + "internalType": "string", + "name": "_uuid", + "type": "string" }, + { + "internalType": "string", + "name": "_meta_data", + "type": "string" + } ], - name: "giveRightToVote", - outputs: [], - stateMutability: "nonpayable", - type: "function", + "name": "tagItem", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - inputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - name: "proposals", - outputs: [ - { - internalType: "string", - name: "title", - type: "string", - }, + "anonymous": false, + "inputs": [ { - internalType: "string", - name: "content", - type: "string", + "indexed": true, + "internalType": "address", + "name": "tagger", + "type": "address" }, { - internalType: "address", - name: "proposaler", - type: "address", + "indexed": false, + "internalType": "string", + "name": "uuid", + "type": "string" }, { - internalType: "uint256", - name: "voteCount", - type: "uint256", - }, + "indexed": false, + "internalType": "string", + "name": "metadata", + "type": "string" + } ], - stateMutability: "view", - type: "function", + "name": "TagSet", + "type": "event" }, { - inputs: [ - { - internalType: "uint256", - name: "proposal", - type: "uint256", - }, + "inputs": [], + "name": "chairperson", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } ], - name: "vote", - outputs: [], - stateMutability: "nonpayable", - type: "function", + "stateMutability": "view", + "type": "function" }, { - inputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - name: "voters", - outputs: [ - { - internalType: "uint256", - name: "weight", - type: "uint256", - }, - { - internalType: "bool", - name: "voted", - type: "bool", - }, - { - internalType: "address", - name: "delegate", - type: "address", - }, - { - internalType: "uint256", - name: "vote", - type: "uint256", - }, + "inputs": [], + "name": "vectorName", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } ], - stateMutability: "view", - type: "function", - }, + "stateMutability": "view", + "type": "function" + } ], }, }, diff --git a/packages/nextjs/pages/debug.tsx b/packages/nextjs/pages/debug.tsx index 3dbef7f..ca1646e 100644 --- a/packages/nextjs/pages/debug.tsx +++ b/packages/nextjs/pages/debug.tsx @@ -1,4 +1,4 @@ -import { useEffect } from "react"; +import { useEffect, useState } from "react"; import type { NextPage } from "next"; import { useLocalStorage } from "usehooks-ts"; import { MetaHeader } from "~~/components/MetaHeader"; @@ -10,11 +10,18 @@ const selectedContractStorageKey = "scaffoldEth2.selectedContract"; const contractNames = getContractNames(); const Debug: NextPage = () => { + const [uuid, setUuid] = useState(""); + const [selectedContract, setSelectedContract] = useLocalStorage( selectedContractStorageKey, contractNames[0], ); + useEffect(() => { + const queryParameters = new URLSearchParams(window.location.search); + const uuid = queryParameters.get("uuid"); + setUuid(uuid); + }); useEffect(() => { if (!contractNames.includes(selectedContract)) { setSelectedContract(contractNames[0]); @@ -47,6 +54,7 @@ const Debug: NextPage = () => { ))} )} +

uuid: {uuid}

{contractNames.map(contractName => ( { @@ -34,17 +35,17 @@ const ETHSpace: NextPage = () => { //从后端获取数据集列表 const fetchOptions = async () => { - const response = await fetch("https://faasbyleeduckgo.gigalixirapp.com/api/v1/run?name=VectorAPI&func_name=get_cluster", { - method: "POST", - headers:{ - 'Content-Type':'application/json;charset=utf-8', - }, - body:JSON.stringify({ - "params": ["ai-based-smart-contract-explorer"] - }) - }); - const data=await response.json(); - setOptions(data.result); + // const response = await fetch("https://faas.movespace.xyz/api/v1/run?name=VectorAPI&func_name=get_cluster", { + // method: "POST", + // headers:{ + // 'Content-Type':'application/json;charset=utf-8', + // }, + // body:JSON.stringify({ + // "params": ["ai-based-smart-contract-explorer"] + // }) + // }); + // const data=await response.json(); + setOptions(["base-chain"]); }; //获取search prompt与dataset名字后向后端发request const handleonClick = async() => { @@ -53,7 +54,7 @@ const ETHSpace: NextPage = () => { //如果用户选择的是mix混合搜索,则需要向所有get-cluster得来的VecDB列表发请求,但我觉得其实这个逻辑在后端做会比较好,尤其如果访问量大的话,3倍请求很容易造成服务器压力过大 if(dataset=='mixed'){ options.map(async (option)=>{ - const response = await fetch("https://faasbyleeduckgo.gigalixirapp.com/api/v1/run?name=VectorAPI&func_name=search_data",{ + const response = await fetch("https://faas.movespace.xyz/api/v1/run?name=VectorAPI&func_name=search_data",{ method:"POST", headers:{ 'Content-Type':'application/json; charset=utf-8', @@ -67,10 +68,11 @@ const ETHSpace: NextPage = () => { //现在把每个接口的数据都保存下来 const res1:resultByDataset={ dataset_id:data.result.dataset_id, - results:data.result.similarities.map((s: { data: any; metadata: any; })=>{ + results:data.result.similarities.map((s: { id: any ; data: any; metadata: any; })=>{ return { data:s.data, - metadata:s.metadata + metadata:s.metadata, + id: s.id, } }) }; @@ -81,7 +83,7 @@ const ETHSpace: NextPage = () => { }); // console.log(res); }else{ - const response = await fetch("https://faasbyleeduckgo.gigalixirapp.com/api/v1/run?name=VectorAPI&func_name=search_data",{ + const response = await fetch("https://faas.movespace.xyz/api/v1/run?name=VectorAPI&func_name=search_data",{ method:"POST", headers:{ 'Content-Type':'application/json; charset=utf-8', @@ -111,8 +113,7 @@ const ETHSpace: NextPage = () => {

AI-based Smart Contract Explorer

-

-- Smart Contract Search Platform based on AI

- -- Let AI fully assist smart contract developers

+

-- Project Search & Tagger Platform based on AI

-

A search question example:

-

* Give me some function examples about NFT

-

* 0x73c7448760517E3E6e416b2c130E3c6dB2026A1d

+

Some search question examples:

+

* friend.tech

+

* social

@@ -203,6 +204,12 @@ const ETHSpace: NextPage = () => { Metadata
{JSON.stringify(item.metadata,null,2)}
+ id +
{item.id}
+ + + +
)) } diff --git a/packages/nextjs/scaffold.config.ts b/packages/nextjs/scaffold.config.ts index 8092926..10b8a1f 100644 --- a/packages/nextjs/scaffold.config.ts +++ b/packages/nextjs/scaffold.config.ts @@ -11,7 +11,7 @@ export type ScaffoldConfig = { const scaffoldConfig = { // The network where your DApp lives in - targetNetwork: chains.scrollSepolia, + targetNetwork: chains.baseGoerli, // The interval at which your front-end polls the RPC servers for new data // it has no effect on the local network