feat(Anthropic, Google, OpenAI): allow changing settings/presets conversations mid-convo (#636)

feat(AnthropicClient.js, GoogleClient.js): add promptPrefix and modelLabel to getSaveOptions method
This commit is contained in:
Danny Avila 2023-07-13 23:59:44 -04:00 committed by GitHub
parent 1b999108e4
commit 637bb6bc11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 11 deletions

View file

@ -14,13 +14,14 @@ function AnthropicOptions() {
const [saveAsDialogShow, setSaveAsDialogShow] = useState(false);
const [conversation, setConversation] = useRecoilState(store.conversation) || {};
const { endpoint, conversationId } = conversation;
const { endpoint } = conversation;
const { model, modelLabel, promptPrefix, temperature, topP, topK, maxOutputTokens } =
conversation;
const endpointsConfig = useRecoilValue(store.endpointsConfig);
if (endpoint !== 'anthropic') return null;
if (conversationId !== 'new') return null;
if (endpoint !== 'anthropic') {
return null;
}
const models = endpointsConfig?.['anthropic']?.['availableModels'] || [];

View file

@ -16,14 +16,15 @@ function GoogleOptions() {
const [saveAsDialogShow, setSaveAsDialogShow] = useState(false);
const [conversation, setConversation] = useRecoilState(store.conversation) || {};
const { endpoint, conversationId } = conversation;
const { endpoint } = conversation;
const { model, modelLabel, promptPrefix, examples, temperature, topP, topK, maxOutputTokens } =
conversation;
const endpointsConfig = useRecoilValue(store.endpointsConfig);
if (endpoint !== 'google') return null;
if (conversationId !== 'new') return null;
if (endpoint !== 'google') {
return null;
}
const models = endpointsConfig?.['google']?.['availableModels'] || [];

View file

@ -37,8 +37,8 @@ export default function NewConversationMenu() {
const availableEndpoints = useRecoilValue(store.availableEndpoints);
const endpointsConfig = useRecoilValue(store.endpointsConfig);
const [presets, setPresets] = useRecoilState(store.presets);
const modularEndpoints = new Set(['gptPlugins', 'anthropic', 'google', 'openAI']);
// const conversation = useRecoilValue(store.conversation) || {};
const { endpoint, conversationId } = conversation;
const { newConversation } = store.useConversation();
@ -108,7 +108,7 @@ export default function NewConversationMenu() {
const onSelectPreset = (newPreset) => {
setMenuOpen(false);
if (endpoint === 'gptPlugins' && newPreset?.endpoint === 'gptPlugins') {
if (modularEndpoints.has(endpoint) && modularEndpoints.has(newPreset?.endpoint)) {
const currentConvo = getDefaultConversation({
conversation,
endpointsConfig,

View file

@ -15,7 +15,7 @@ function OpenAIOptions() {
const [saveAsDialogShow, setSaveAsDialogShow] = useState(false);
const [conversation, setConversation] = useRecoilState(store.conversation) || {};
const { endpoint, conversationId } = conversation;
const { endpoint } = conversation;
const {
model,
chatGptLabel,
@ -28,8 +28,9 @@ function OpenAIOptions() {
const endpointsConfig = useRecoilValue(store.endpointsConfig);
const isOpenAI = endpoint === 'openAI' || endpoint === 'azureOpenAI';
if (!isOpenAI) return null;
if (conversationId !== 'new') return null;
if (!isOpenAI) {
return null;
}
const models = endpointsConfig?.[endpoint]?.['availableModels'] || [];