Skip to content

Commit 55a57a2

Browse files
committed
fix(frontend): send the selected model to the ai completions api
#oso @conflict @upstream-queue
1 parent 2fac0e5 commit 55a57a2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

frontend/src/components/editor/ai/add-cell-with-ai.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export const AddCellWithAI: React.FC<{
9999
const ai = useAtomValue(aiAtom);
100100
const editModel = ai?.models?.edit_model || DEFAULT_AI_MODEL;
101101
const { saveModelChange } = useModelChange();
102+
const [model, setModel] = useState(editModel);
102103
const inputRef = useRef<ReactCodeMirrorRef>(null);
103104
const runtimeConfig = useAtomValue(runtimeConfigAtom);
104105

@@ -120,6 +121,7 @@ export const AddCellWithAI: React.FC<{
120121
...completionBody,
121122
language: language,
122123
code: "",
124+
model: model,
123125
...(runtimeConfig.authToken && { osoApiKey: runtimeConfig.authToken }),
124126
},
125127
onError: (error) => {
@@ -289,6 +291,7 @@ export const AddCellWithAI: React.FC<{
289291
<AIModelDropdown
290292
value={editModel}
291293
onSelect={(model) => {
294+
setModel(model);
292295
saveModelChange(model, "edit");
293296
}}
294297
triggerClassName="h-7 text-xs max-w-64"

0 commit comments

Comments
 (0)