From 3ccfe79763a9331d54f83b6eef1d9f9645fb1ee4 Mon Sep 17 00:00:00 2001 From: kgrofelnik Date: Tue, 2 Apr 2024 12:48:37 +0200 Subject: [PATCH] Adds chat with RAG deployment task --- contracts/hardhat.config.ts | 1 + contracts/tasks/deployChatWithRAG.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 contracts/tasks/deployChatWithRAG.ts diff --git a/contracts/hardhat.config.ts b/contracts/hardhat.config.ts index c08cda5..8c6981c 100644 --- a/contracts/hardhat.config.ts +++ b/contracts/hardhat.config.ts @@ -1,6 +1,7 @@ import {HardhatUserConfig} from "hardhat/config"; import "@nomicfoundation/hardhat-toolbox"; import "./tasks/whitelist"; +import "./tasks/deployChatWithRAG"; require('dotenv').config() diff --git a/contracts/tasks/deployChatWithRAG.ts b/contracts/tasks/deployChatWithRAG.ts new file mode 100644 index 0000000..05b3853 --- /dev/null +++ b/contracts/tasks/deployChatWithRAG.ts @@ -0,0 +1,14 @@ +import { task } from "hardhat/config"; + +task("deployChatWithRAG", "Deploys the chat contract with knowledge base") + .addParam("oracleAddress", "The address of the Oracle contract") + .addParam("cid", "Knowledge base CID") + .setAction(async (taskArgs, hre) => { + const oracleAddress = taskArgs.oracleAddress; + const knowledgeBaseCID = taskArgs.cid; + const contract = await hre.ethers.deployContract("ChatGpt", [oracleAddress, knowledgeBaseCID], {}); + await contract.waitForDeployment(); + console.log(`RAG deployed to: ${contract.target}`); + }); + +