feat: settings command dev done
This commit is contained in:
parent
cdf0311d27
commit
15e595837b
|
@ -979,6 +979,7 @@ function _Chat() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// set openai key & endpoint url
|
||||||
settings: (text) => {
|
settings: (text) => {
|
||||||
try {
|
try {
|
||||||
const payload = JSON.parse(text) as {
|
const payload = JSON.parse(text) as {
|
||||||
|
@ -996,9 +997,17 @@ function _Chat() {
|
||||||
if (!res) return;
|
if (!res) return;
|
||||||
if (payload.key) {
|
if (payload.key) {
|
||||||
// TODO: auto-fill openai api key here, must specific provider type
|
// TODO: auto-fill openai api key here, must specific provider type
|
||||||
|
config.update(
|
||||||
|
(config) =>
|
||||||
|
(config.providerConfig.openai.apiKey = payload.key!),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (payload.url) {
|
if (payload.url) {
|
||||||
// TODO: auto-fill openai url here, must specific provider type
|
// TODO: auto-fill openai url here, must specific provider type
|
||||||
|
config.update(
|
||||||
|
(config) =>
|
||||||
|
(config.providerConfig.openai.endpoint = payload.url!),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,6 @@ import EmojiPicker, {
|
||||||
Theme as EmojiTheme,
|
Theme as EmojiTheme,
|
||||||
} from "emoji-picker-react";
|
} from "emoji-picker-react";
|
||||||
|
|
||||||
import { ModelType } from "../store";
|
|
||||||
|
|
||||||
import BotIcon from "../icons/bot.svg";
|
import BotIcon from "../icons/bot.svg";
|
||||||
import BlackBotIcon from "../icons/black-bot.svg";
|
import BlackBotIcon from "../icons/black-bot.svg";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue