Skip to content

draft: Added Model Options #99

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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;
Expand All @@ -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());
}

Expand Down Expand Up @@ -237,5 +237,4 @@ export function App(): React.JSX.Element {
</div>
</div>
)
}

}
30 changes: 28 additions & 2 deletions src/app/components/Copilot/Copilot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ export function createNewConversation() {
export async function askQuestion({
query,
relevant,
// model,
}: {
query: string;
relevant: string;
// model: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is correct here to define this for the askQuestion() - then you can pass in the model ID where you have the model: selectedModel. You will just have to only use the cloud models here (for now) since we are not handling the download and usage of any local model.

Using the local models requires the modelProgressDownloadController file that you can see an example of here to monitor their download status so they can actually be passed into your question logic.

For now i would just stick to the cloud models:

  • OpenAI models (4 models)
  • Palm2 models (2 models)
  • gemini models (1 model)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}) {
// TODO: need to get instance here - current config is stored in app.tsx (maybe not actually)
// const config = ConnectorSingleton.getInstance();
Expand All @@ -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});
Expand All @@ -124,6 +127,7 @@ export function CopilotChat(): React.JSX.Element {
CopilotStreamController.getInstance().askQGPT({
query: chatInputData,
setMessage,
// model: selectedModel,
});
setData("");
}
Expand Down Expand Up @@ -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<String>('GPT-4 Chat Model');



return (
<div className="container">
<div className="header">
<div>
<h1>Copilot Chat</h1>
<h1>Copilot Chat</h1>

<button className="button" onClick={handleNewConversation}>Create Fresh Conversation</button>
<select className='button' onChange={(e) => setSelectedModel(e.target.value)}>
{/* style={{width: '100px', height: '30px', borderRadius: '5px',margin: '0 10px'}} */}
{modelNames.map((name, index) => (
<option key={index} value={name}>
{name}
</option>
))}
</select>
</div>
<div className="footer">
<button>back</button>
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/WorkflowActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand All @@ -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);
}
})
Expand Down