mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-24 04:10:15 +01:00
refactor(useGenerationsByLatest): make agents and bedrock editable
This commit is contained in:
parent
9cda192c1b
commit
2c2dd57af5
1 changed files with 26 additions and 14 deletions
|
|
@ -3,7 +3,7 @@ import { EModelEndpoint, isAssistantsEndpoint } from 'librechat-data-provider';
|
|||
|
||||
type TUseGenerations = {
|
||||
endpoint?: string;
|
||||
message: TMessage;
|
||||
message?: TMessage;
|
||||
isSubmitting: boolean;
|
||||
isEditing?: boolean;
|
||||
latestMessage: TMessage | null;
|
||||
|
|
@ -16,15 +16,25 @@ export default function useGenerationsByLatest({
|
|||
isEditing = false,
|
||||
latestMessage,
|
||||
}: TUseGenerations) {
|
||||
const { error, messageId, searchResult, finish_reason, isCreatedByUser } = message ?? {};
|
||||
const isEditableEndpoint = !![
|
||||
EModelEndpoint.openAI,
|
||||
EModelEndpoint.custom,
|
||||
EModelEndpoint.google,
|
||||
EModelEndpoint.anthropic,
|
||||
EModelEndpoint.gptPlugins,
|
||||
EModelEndpoint.azureOpenAI,
|
||||
].find((e) => e === endpoint);
|
||||
const {
|
||||
messageId,
|
||||
searchResult = false,
|
||||
error = false,
|
||||
finish_reason = '',
|
||||
isCreatedByUser = false,
|
||||
} = message ?? {};
|
||||
const isEditableEndpoint = Boolean(
|
||||
[
|
||||
EModelEndpoint.openAI,
|
||||
EModelEndpoint.custom,
|
||||
EModelEndpoint.google,
|
||||
EModelEndpoint.agents,
|
||||
EModelEndpoint.bedrock,
|
||||
EModelEndpoint.anthropic,
|
||||
EModelEndpoint.gptPlugins,
|
||||
EModelEndpoint.azureOpenAI,
|
||||
].find((e) => e === endpoint),
|
||||
);
|
||||
|
||||
const continueSupported =
|
||||
latestMessage?.messageId === messageId &&
|
||||
|
|
@ -34,18 +44,20 @@ export default function useGenerationsByLatest({
|
|||
!searchResult &&
|
||||
isEditableEndpoint;
|
||||
|
||||
const branchingSupported =
|
||||
// 5/21/23: Bing is allowing editing and Message regenerating
|
||||
!![
|
||||
const branchingSupported = Boolean(
|
||||
[
|
||||
EModelEndpoint.azureOpenAI,
|
||||
EModelEndpoint.openAI,
|
||||
EModelEndpoint.custom,
|
||||
EModelEndpoint.agents,
|
||||
EModelEndpoint.bedrock,
|
||||
EModelEndpoint.chatGPTBrowser,
|
||||
EModelEndpoint.google,
|
||||
EModelEndpoint.bingAI,
|
||||
EModelEndpoint.gptPlugins,
|
||||
EModelEndpoint.anthropic,
|
||||
].find((e) => e === endpoint);
|
||||
].find((e) => e === endpoint),
|
||||
);
|
||||
|
||||
const regenerateEnabled =
|
||||
!isCreatedByUser && !searchResult && !isEditing && !isSubmitting && branchingSupported;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue