From c58e5c1043b93c1db1e754e053f2ef2f2e580239 Mon Sep 17 00:00:00 2001 From: Arindam Majumder Date: Mon, 26 Feb 2024 17:18:26 +0530 Subject: [PATCH] draft: Added Model Options --- src/app/App.tsx | 10 ++++----- src/app/components/Copilot/Copilot.tsx | 30 +++++++++++++++++++++++-- src/app/components/WorkflowActivity.tsx | 4 ++-- 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/app/App.tsx b/src/app/App.tsx index 4ee4294..c82f14e 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -77,7 +77,7 @@ export function App(): React.JSX.Element { name: assets.iterable[i].name, classification: assets.iterable[i].original.reference.classification.specific } - console.log("refreshSnippet",i,_local); + // console.log("refreshSnippet",i,_local); refresh(_local); } }).catch((error) => { @@ -105,7 +105,7 @@ export function App(): React.JSX.Element { // assign that name to the matchName variable: matchName = asset.name; - console.log("the matchName is" + matchName); + // console.log("the matchName is" + matchName); // then you can do whatever you would like with that match: return matchName; @@ -125,8 +125,8 @@ export function App(): React.JSX.Element { } setSearchTerm(searchTerm ); let result = await searchSnippetList(searchTerm); - console.log("The Result is "+ result); - console.log(searchTerm); + // console.log("The Result is "+ result); + // console.log(searchTerm); setSearchResult(result.toString()); } @@ -208,7 +208,7 @@ connect().then(__ => { let _t = JSON.parse(JSON.stringify(full_context)); applicationData = _t.application; let osVersion = _t.health.os.version - console.log('Application Data: ', applicationData); + // console.log('Application Data: ', applicationData); localStorage.setItem("version", osVersion) // define the indicator now that it exists. _indicator = document.getElementById("indicator"); diff --git a/src/app/components/Copilot/Copilot.tsx b/src/app/components/Copilot/Copilot.tsx index 5e700b0..8726bfa 100644 --- a/src/app/components/Copilot/Copilot.tsx +++ b/src/app/components/Copilot/Copilot.tsx @@ -76,9 +76,11 @@ export function createNewConversation() { export async function askQuestion({ query, relevant, + // model, }: { query: string; relevant: string; + // model: string; }) { // TODO: need to get instance here - current config is stored in app.tsx (maybe not actually) // const config = ConnectorSingleton.getInstance(); @@ -103,6 +105,7 @@ export async function askQuestion({ }, ], }, + // model, }; // const result = await Pieces.QGPTApi.question({qGPTQuestionInput: params}); const result = new Pieces.QGPTApi().question({qGPTQuestionInput: params}); @@ -124,6 +127,7 @@ export function CopilotChat(): React.JSX.Element { CopilotStreamController.getInstance().askQGPT({ query: chatInputData, setMessage, + // model: selectedModel, }); setData(""); } @@ -157,15 +161,37 @@ export function CopilotChat(): React.JSX.Element { setChatSelected(_name); } }; - getInitialChat(); + getInitialChat(); + // get all the models and set them to the state. + async function getModels() { + const models = await new Pieces.ModelsApi().modelsSnapshot(); + const names = models.iterable.map((model) => model.name); + setModelNames(names); + } + getModels(); }, []); + + const [modelNames, setModelNames] = useState([]); + const [selectedModel, setSelectedModel] = useState('GPT-4 Chat Model'); + + + return (
-

Copilot Chat

+

Copilot Chat

+ +
diff --git a/src/app/components/WorkflowActivity.tsx b/src/app/components/WorkflowActivity.tsx index 3b584e5..206862c 100644 --- a/src/app/components/WorkflowActivity.tsx +++ b/src/app/components/WorkflowActivity.tsx @@ -21,7 +21,7 @@ const WorkflowActivityList: React.FC = () => { React.useEffect(() => { new Pieces.ActivitiesApi().activitiesSnapshot({}).then((activities) => { - console.log(activities); + // console.log(activities); clearActivities(); for(let i = 0; i < activities.iterable.length; i++){ if(activities.iterable[i].asset == null){ @@ -32,7 +32,7 @@ const WorkflowActivityList: React.FC = () => { name : activities.iterable[i].asset.name, description : activities.iterable[i].event.asset.identifierDescriptionPair } - console.log(_activity); + // console.log(_activity); refreshActivities(_activity); } })