feat: settings command dev done

This commit is contained in:
butterfly 2024-04-02 14:21:49 +08:00
parent cdf0311d27
commit 15e595837b
2 changed files with 9 additions and 2 deletions

View File

@ -979,6 +979,7 @@ function _Chat() {
}
});
},
// set openai key & endpoint url
settings: (text) => {
try {
const payload = JSON.parse(text) as {
@ -996,9 +997,17 @@ function _Chat() {
if (!res) return;
if (payload.key) {
// TODO: auto-fill openai api key here, must specific provider type
config.update(
(config) =>
(config.providerConfig.openai.apiKey = payload.key!),
);
}
if (payload.url) {
// TODO: auto-fill openai url here, must specific provider type
config.update(
(config) =>
(config.providerConfig.openai.endpoint = payload.url!),
);
}
});
}

View File

@ -4,8 +4,6 @@ import EmojiPicker, {
Theme as EmojiTheme,
} from "emoji-picker-react";
import { ModelType } from "../store";
import BotIcon from "../icons/bot.svg";
import BlackBotIcon from "../icons/black-bot.svg";