mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-09 03:58:51 +01:00
✨ refactor: Imports to Prevent Circular Type Refs (#8423)
This commit is contained in:
parent
f1b29ffb45
commit
170cc340d8
12 changed files with 201 additions and 196 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { Spinner } from '~/components/svg';
|
||||
import { useLocalize } from '~/hooks';
|
||||
import VersionItem from './VersionItem';
|
||||
import { VersionContext } from './VersionPanel';
|
||||
import type { VersionContext } from './types';
|
||||
|
||||
type VersionContentProps = {
|
||||
selectedAgentId: string;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { useLocalize } from '~/hooks';
|
||||
import { VersionRecord } from './VersionPanel';
|
||||
import type { VersionRecord } from './types';
|
||||
|
||||
type VersionItemProps = {
|
||||
version: VersionRecord;
|
||||
|
|
|
|||
|
|
@ -1,44 +1,13 @@
|
|||
import { ChevronLeft } from 'lucide-react';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { useGetAgentByIdQuery, useRevertAgentVersionMutation } from '~/data-provider';
|
||||
import type { Agent } from 'librechat-data-provider';
|
||||
import type { AgentWithVersions, VersionContext } from './types';
|
||||
import { isActiveVersion } from './isActiveVersion';
|
||||
import { useAgentPanelContext } from '~/Providers';
|
||||
import { useLocalize, useToast } from '~/hooks';
|
||||
import VersionContent from './VersionContent';
|
||||
import { Panel } from '~/common';
|
||||
|
||||
export type VersionRecord = Record<string, any>;
|
||||
|
||||
export type AgentState = {
|
||||
name: string | null;
|
||||
description: string | null;
|
||||
instructions: string | null;
|
||||
artifacts?: string | null;
|
||||
capabilities?: string[];
|
||||
tools?: string[];
|
||||
} | null;
|
||||
|
||||
export type VersionWithId = {
|
||||
id: number;
|
||||
originalIndex: number;
|
||||
version: VersionRecord;
|
||||
isActive: boolean;
|
||||
};
|
||||
|
||||
export type VersionContext = {
|
||||
versions: VersionRecord[];
|
||||
versionIds: VersionWithId[];
|
||||
currentAgent: AgentState;
|
||||
selectedAgentId: string;
|
||||
activeVersion: VersionRecord | null;
|
||||
};
|
||||
|
||||
export interface AgentWithVersions extends Agent {
|
||||
capabilities?: string[];
|
||||
versions?: Array<VersionRecord>;
|
||||
}
|
||||
|
||||
export default function VersionPanel() {
|
||||
const localize = useLocalize();
|
||||
const { showToast } = useToast();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { AgentState, VersionRecord } from './VersionPanel';
|
||||
import type { AgentState, VersionRecord } from './types';
|
||||
|
||||
export const isActiveVersion = (
|
||||
version: VersionRecord,
|
||||
|
|
|
|||
35
client/src/components/SidePanel/Agents/Version/types.ts
Normal file
35
client/src/components/SidePanel/Agents/Version/types.ts
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
export type VersionRecord = Record<string, any>;
|
||||
|
||||
export type AgentState = {
|
||||
name: string | null;
|
||||
description: string | null;
|
||||
instructions: string | null;
|
||||
artifacts?: string | null;
|
||||
capabilities?: string[];
|
||||
tools?: string[];
|
||||
} | null;
|
||||
|
||||
export type VersionWithId = {
|
||||
id: number;
|
||||
originalIndex: number;
|
||||
version: VersionRecord;
|
||||
isActive: boolean;
|
||||
};
|
||||
|
||||
export type VersionContext = {
|
||||
versions: VersionRecord[];
|
||||
versionIds: VersionWithId[];
|
||||
currentAgent: AgentState;
|
||||
selectedAgentId: string;
|
||||
activeVersion: VersionRecord | null;
|
||||
};
|
||||
|
||||
export interface AgentWithVersions {
|
||||
name: string;
|
||||
description: string | null;
|
||||
instructions: string | null;
|
||||
artifacts?: string | null;
|
||||
capabilities?: string[];
|
||||
tools?: string[];
|
||||
versions?: Array<VersionRecord>;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue