Skip to content

Commit

Permalink
fix(prompt): default model is the last registered
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshinesmilelk authored and BroKun committed Dec 14, 2023
1 parent daba7ad commit 9adcd9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion packages/libro-prompt-cell/src/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,4 @@
.libro-prompt-output-btn {
cursor: pointer;
color: #1677ff;
margin-left: 24px;
}
10 changes: 6 additions & 4 deletions packages/libro-prompt-cell/src/prompt-cell-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,19 @@ const PropmtEditorViewComponent = React.forwardRef<HTMLDivElement>(
instance.handleQueryResponse,
)
.then(() => {
if (instance.modelSelection.length > 0) {
setSelectedModel(instance.modelSelection[0].label);
instance.model.modelType = instance.modelSelection[0].label;
const len = instance.modelSelection.length;
if (len > 0) {
setSelectedModel(instance.modelSelection[len - 1].label);
instance.model.modelType = instance.modelSelection[len - 1].label;
return;
}
return;
})
.catch(() => {
//
});
}, [instance]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const handleChange = (value: string) => {
instance.model.modelType = value;
Expand Down

0 comments on commit 9adcd9b

Please sign in to comment.