@assistant-ui/react 0.5.20 → 0.5.22
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{ModelConfigTypes-ComYH1b6.d.mts → AssistantTypes-BNB-knVq.d.mts} +64 -60
- package/dist/{ModelConfigTypes-ComYH1b6.d.ts → AssistantTypes-BNB-knVq.d.ts} +64 -60
- package/dist/chunk-BJPOCE4O.mjs +11 -0
- package/dist/chunk-BJPOCE4O.mjs.map +1 -0
- package/dist/chunk-DCHYNTHI.js +11 -0
- package/dist/chunk-DCHYNTHI.js.map +1 -0
- package/dist/chunk-NSPHKRLF.js +819 -0
- package/dist/chunk-NSPHKRLF.js.map +1 -0
- package/dist/chunk-ZWRFAYHH.mjs +819 -0
- package/dist/chunk-ZWRFAYHH.mjs.map +1 -0
- package/dist/edge.d.mts +90 -5
- package/dist/edge.d.ts +90 -5
- package/dist/edge.mjs +56 -44
- package/dist/edge.mjs.map +1 -1
- package/dist/index.d.mts +7 -159
- package/dist/index.d.ts +7 -159
- package/dist/index.js +724 -1596
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -810
- package/dist/index.mjs.map +1 -1
- package/dist/tailwindcss/index.js +24 -52
- package/dist/tailwindcss/index.js.map +1 -1
- package/dist/tailwindcss/index.mjs +3 -0
- package/dist/tailwindcss/index.mjs.map +1 -1
- package/package.json +1 -12
- package/dist/chunk-BV6Y7C43.mjs +0 -61
- package/dist/chunk-BV6Y7C43.mjs.map +0 -1
- package/dist/internal.d.mts +0 -128
- package/dist/internal.d.ts +0 -128
- package/dist/internal.js +0 -619
- package/dist/internal.js.map +0 -1
- package/dist/internal.mjs +0 -531
- package/dist/internal.mjs.map +0 -1
- package/internal/README.md +0 -1
- package/internal/package.json +0 -5
package/dist/internal.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/internal.ts","../src/types/ModelConfigTypes.ts","../src/utils/ProxyConfigProvider.ts","../src/utils/idUtils.tsx","../src/runtimes/edge/converters/fromCoreMessage.ts","../src/runtimes/utils/MessageRepository.tsx","../src/runtimes/core/BaseAssistantRuntime.tsx","../src/utils/smooth/useSmooth.tsx","../src/context/react/MessageContext.ts","../src/context/react/ContentPartContext.ts","../src/utils/smooth/SmoothContext.tsx","../src/ui/base/tooltip-icon-button.tsx","../src/ui/base/tooltip.tsx","../src/ui/utils/withDefaults.tsx","../src/ui/base/button.tsx"],"sourcesContent":["export { ProxyConfigProvider } from \"./utils/ProxyConfigProvider\";\nexport { MessageRepository } from \"./runtimes/utils/MessageRepository\";\nexport { BaseAssistantRuntime } from \"./runtimes/core/BaseAssistantRuntime\";\nexport * from \"./utils/smooth\";\nexport { TooltipIconButton } from \"./ui/base/tooltip-icon-button\";\nexport { generateId } from \"./utils/idUtils\";\n","import { z } from \"zod\";\nimport type { JSONSchema7 } from \"json-schema\";\n\nexport const LanguageModelV1CallSettingsSchema = z.object({\n maxTokens: z.number().int().positive().optional(),\n temperature: z.number().optional(),\n topP: z.number().optional(),\n presencePenalty: z.number().optional(),\n frequencyPenalty: z.number().optional(),\n seed: z.number().int().optional(),\n headers: z.record(z.string().optional()).optional(),\n});\n\nexport type LanguageModelV1CallSettings = z.infer<\n typeof LanguageModelV1CallSettingsSchema\n>;\n\nexport const LanguageModelConfigSchema = z.object({\n apiKey: z.string().optional(),\n baseUrl: z.string().optional(),\n modelName: z.string().optional(),\n});\n\nexport type LanguageModelConfig = z.infer<typeof LanguageModelConfigSchema>;\n\ntype ToolExecuteFunction<TArgs, TResult> = (\n args: TArgs,\n) => TResult | Promise<TResult>;\n\nexport type Tool<\n TArgs extends Record<string, unknown> = Record<string | number, unknown>,\n TResult = unknown,\n> = {\n description?: string | undefined;\n parameters: z.ZodSchema<TArgs> | JSONSchema7;\n execute?: ToolExecuteFunction<TArgs, TResult>;\n};\n\nexport type ModelConfig = {\n priority?: number | undefined;\n system?: string | undefined;\n tools?: Record<string, Tool<any, any>> | undefined;\n callSettings?: LanguageModelV1CallSettings | undefined;\n config?: LanguageModelConfig | undefined;\n};\n\nexport type ModelConfigProvider = { getModelConfig: () => ModelConfig };\n\nexport const mergeModelConfigs = (\n configSet: Set<ModelConfigProvider>,\n): ModelConfig => {\n const configs = Array.from(configSet)\n .map((c) => c.getModelConfig())\n .sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));\n\n return configs.reduce((acc, config) => {\n if (config.system) {\n if (acc.system) {\n // TODO should the separator be configurable?\n acc.system += `\\n\\n${config.system}`;\n } else {\n acc.system = config.system;\n }\n }\n if (config.tools) {\n for (const [name, tool] of Object.entries(config.tools)) {\n if (acc.tools?.[name]) {\n throw new Error(\n `You tried to define a tool with the name ${name}, but it already exists.`,\n );\n }\n if (!acc.tools) acc.tools = {};\n acc.tools[name] = tool;\n }\n }\n if (config.config) {\n acc.config = {\n ...acc.config,\n ...config.config,\n };\n }\n if (config.callSettings) {\n acc.callSettings = {\n ...acc.callSettings,\n ...config.callSettings,\n };\n }\n return acc;\n }, {} as ModelConfig);\n};\n","\"use client\";\nimport {\n type ModelConfigProvider,\n mergeModelConfigs,\n} from \"../types/ModelConfigTypes\";\n\nexport class ProxyConfigProvider implements ModelConfigProvider {\n private _providers = new Set<ModelConfigProvider>();\n\n getModelConfig() {\n return mergeModelConfigs(this._providers);\n }\n\n registerModelConfigProvider(provider: ModelConfigProvider) {\n this._providers.add(provider);\n return () => {\n this._providers.delete(provider);\n };\n }\n}\n","import { customAlphabet } from \"nanoid/non-secure\";\n\nexport const generateId = customAlphabet(\n \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\",\n 7,\n);\n\nconst optimisticPrefix = \"__optimistic__\";\nexport const generateOptimisticId = () => `${optimisticPrefix}${generateId()}`;\nexport const isOptimisticId = (id: string) => id.startsWith(optimisticPrefix);\n","import { generateId } from \"../../../internal\";\nimport {\n ThreadMessage,\n CoreMessage,\n ToolCallContentPart,\n MessageStatus,\n} from \"../../../types\";\n\nexport const fromCoreMessages = (\n message: readonly CoreMessage[],\n): ThreadMessage[] => {\n return message.map((message) => fromCoreMessage(message));\n};\n\nexport const fromCoreMessage = (\n message: CoreMessage,\n {\n id = generateId(),\n status = { type: \"complete\", reason: \"unknown\" } as MessageStatus,\n } = {},\n): ThreadMessage => {\n const commonProps = {\n id,\n createdAt: new Date(),\n };\n\n const role = message.role;\n switch (role) {\n case \"assistant\":\n return {\n ...commonProps,\n role,\n content: message.content.map((part) => {\n if (part.type === \"tool-call\") {\n return {\n ...part,\n argsText: JSON.stringify(part.args),\n } satisfies ToolCallContentPart;\n }\n return part;\n }),\n status,\n } satisfies ThreadMessage;\n\n case \"user\":\n return {\n ...commonProps,\n role,\n content: message.content,\n } satisfies ThreadMessage;\n\n case \"system\":\n return {\n ...commonProps,\n role,\n content: message.content,\n } satisfies ThreadMessage;\n\n default: {\n const unsupportedRole: never = role;\n throw new Error(`Unknown message role: ${unsupportedRole}`);\n }\n }\n};\n","import type { CoreMessage, ThreadMessage } from \"../../types/AssistantTypes\";\nimport { generateOptimisticId } from \"../../utils/idUtils\";\nimport { fromCoreMessage } from \"../edge/converters/fromCoreMessage\";\n\ntype RepositoryParent = {\n children: string[];\n};\n\ntype RepositoryMessage = RepositoryParent & {\n prev: RepositoryMessage | null;\n current: ThreadMessage;\n next: RepositoryMessage | null;\n level: number;\n};\n\nconst findHead = (message: RepositoryMessage): RepositoryMessage => {\n if (message.next) return findHead(message.next);\n return message;\n};\n\nexport class MessageRepository {\n private messages = new Map<string, RepositoryMessage>(); // message_id -> item\n private head: RepositoryMessage | null = null;\n private root: RepositoryParent = {\n children: [],\n };\n\n private performOp(\n newParent: RepositoryMessage | null,\n child: RepositoryMessage,\n operation: \"cut\" | \"link\" | \"relink\",\n ) {\n const parentOrRoot = child.prev ?? this.root;\n const newParentOrRoot = newParent ?? this.root;\n\n if (operation === \"relink\" && parentOrRoot === newParentOrRoot) return;\n\n // cut\n if (operation !== \"link\") {\n parentOrRoot.children = parentOrRoot.children.filter(\n (m) => m !== child.current.id,\n );\n\n if (child.prev?.next === child) {\n const fallbackId = child.prev.children.at(-1);\n const fallback = fallbackId ? this.messages.get(fallbackId) : null;\n if (fallback === undefined) {\n throw new Error(\n \"MessageRepository(performOp/cut): Fallback sibling message not found. This is likely an internal bug in assistant-ui.\",\n );\n }\n child.prev.next = fallback;\n }\n }\n\n // link\n if (operation !== \"cut\") {\n newParentOrRoot.children = [\n ...newParentOrRoot.children,\n child.current.id,\n ];\n\n if (\n newParent &&\n (findHead(child) === this.head || newParent.next === null)\n ) {\n newParent.next = child;\n }\n\n child.prev = newParent;\n }\n }\n getMessages() {\n const messages = new Array<ThreadMessage>(this.head?.level ?? 0);\n for (let current = this.head; current; current = current.prev) {\n messages[current.level] = current.current;\n }\n return messages;\n }\n\n addOrUpdateMessage(parentId: string | null, message: ThreadMessage) {\n const existingItem = this.messages.get(message.id);\n const prev = parentId ? this.messages.get(parentId) : null;\n if (prev === undefined)\n throw new Error(\n \"MessageRepository(addOrUpdateMessage): Parent message not found. This is likely an internal bug in assistant-ui.\",\n );\n\n // update existing message\n if (existingItem) {\n existingItem.current = message;\n this.performOp(prev, existingItem, \"relink\");\n return;\n }\n\n // create a new message\n const newItem: RepositoryMessage = {\n prev,\n current: message,\n next: null,\n children: [],\n level: prev ? prev.level + 1 : 0,\n };\n\n this.messages.set(message.id, newItem);\n this.performOp(prev, newItem, \"link\");\n\n if (this.head === prev) {\n this.head = newItem;\n }\n }\n\n getMessage(messageId: string) {\n const message = this.messages.get(messageId);\n if (!message)\n throw new Error(\n \"MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui.\",\n );\n\n return {\n parentId: message.prev?.current.id ?? null,\n message: message.current,\n };\n }\n\n appendOptimisticMessage(parentId: string | null, message: CoreMessage) {\n let optimisticId: string;\n do {\n optimisticId = generateOptimisticId();\n } while (this.messages.has(optimisticId));\n\n this.addOrUpdateMessage(\n parentId,\n fromCoreMessage(message, {\n id: optimisticId,\n status: { type: \"running\" },\n }),\n );\n\n return optimisticId;\n }\n\n deleteMessage(messageId: string, replacementId?: string | null | undefined) {\n const message = this.messages.get(messageId);\n\n if (!message)\n throw new Error(\n \"MessageRepository(deleteMessage): Optimistic message not found. This is likely an internal bug in assistant-ui.\",\n );\n\n const replacement =\n replacementId === undefined\n ? message.prev // if no replacementId is provided, use the parent\n : replacementId === null\n ? null\n : this.messages.get(replacementId);\n if (replacement === undefined)\n throw new Error(\n \"MessageRepository(deleteMessage): Replacement not found. This is likely an internal bug in assistant-ui.\",\n );\n\n for (const child of message.children) {\n const childMessage = this.messages.get(child);\n if (!childMessage)\n throw new Error(\n \"MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui.\",\n );\n this.performOp(replacement, childMessage, \"relink\");\n }\n\n this.performOp(null, message, \"cut\");\n this.messages.delete(messageId);\n\n if (this.head === message) {\n this.head = replacement ? findHead(replacement) : null;\n }\n }\n\n getBranches(messageId: string) {\n const message = this.messages.get(messageId);\n if (!message)\n throw new Error(\n \"MessageRepository(getBranches): Message not found. This is likely an internal bug in assistant-ui.\",\n );\n\n const { children } = message.prev ?? this.root;\n return children;\n }\n\n switchToBranch(messageId: string) {\n const message = this.messages.get(messageId);\n if (!message)\n throw new Error(\n \"MessageRepository(switchToBranch): Branch not found. This is likely an internal bug in assistant-ui.\",\n );\n\n if (message.prev) {\n message.prev.next = message;\n }\n\n this.head = findHead(message);\n }\n\n resetHead(messageId: string | null) {\n if (messageId === null) {\n this.head = null;\n return;\n }\n\n const message = this.messages.get(messageId);\n if (!message)\n throw new Error(\n \"MessageRepository(resetHead): Branch not found. This is likely an internal bug in assistant-ui.\",\n );\n\n this.head = message;\n for (\n let current: RepositoryMessage | null = message;\n current;\n current = current.prev\n ) {\n if (current.prev) {\n current.prev.next = current;\n }\n }\n }\n}\n","import { type ModelConfigProvider } from \"../../types/ModelConfigTypes\";\nimport type { Unsubscribe } from \"../../types/Unsubscribe\";\nimport type { AssistantRuntime } from \"./AssistantRuntime\";\nimport { ReactThreadRuntime } from \"./ReactThreadRuntime\";\n\nexport abstract class BaseAssistantRuntime<\n TThreadRuntime extends ReactThreadRuntime,\n> implements AssistantRuntime\n{\n constructor(private _thread: TThreadRuntime) {\n this._thread = _thread;\n }\n\n get thread() {\n return this._thread;\n }\n\n set thread(thread: TThreadRuntime) {\n this._thread = thread;\n this.subscriptionHandler();\n }\n\n public abstract registerModelConfigProvider(\n provider: ModelConfigProvider,\n ): Unsubscribe;\n public abstract switchToThread(threadId: string | null): void;\n\n private _subscriptions = new Set<() => void>();\n\n public subscribe(callback: () => void): Unsubscribe {\n this._subscriptions.add(callback);\n return () => this._subscriptions.delete(callback);\n }\n\n private subscriptionHandler = () => {\n for (const callback of this._subscriptions) callback();\n };\n}\n","\"use client\";\n\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { useMessageContext } from \"../../context\";\nimport {\n ContentPartStatus,\n ToolCallContentPartStatus,\n} from \"../../types/AssistantTypes\";\nimport { TextContentPartState } from \"../../context/stores/ContentPart\";\nimport { useSmoothContext } from \"./SmoothContext\";\nimport { StoreApi } from \"zustand\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\n\nclass TextStreamAnimator {\n private animationFrameId: number | null = null;\n private lastUpdateTime: number = Date.now();\n\n public targetText: string = \"\";\n\n constructor(\n public currentText: string,\n private setText: (newText: string) => void,\n ) {}\n\n start() {\n if (this.animationFrameId !== null) return;\n this.lastUpdateTime = Date.now();\n this.animate();\n }\n\n stop() {\n if (this.animationFrameId !== null) {\n cancelAnimationFrame(this.animationFrameId);\n this.animationFrameId = null;\n }\n }\n\n private animate = () => {\n const currentTime = Date.now();\n const deltaTime = currentTime - this.lastUpdateTime;\n let timeToConsume = deltaTime;\n\n const remainingChars = this.targetText.length - this.currentText.length;\n const baseTimePerChar = Math.min(5, 250 / remainingChars);\n\n let charsToAdd = 0;\n while (timeToConsume >= baseTimePerChar && charsToAdd < remainingChars) {\n charsToAdd++;\n timeToConsume -= baseTimePerChar;\n }\n\n if (charsToAdd !== remainingChars) {\n this.animationFrameId = requestAnimationFrame(this.animate);\n } else {\n this.animationFrameId = null;\n }\n if (charsToAdd === 0) return;\n\n this.currentText = this.targetText.slice(\n 0,\n this.currentText.length + charsToAdd,\n );\n this.lastUpdateTime = currentTime - timeToConsume;\n this.setText(this.currentText);\n };\n}\n\nconst SMOOTH_STATUS: ContentPartStatus = Object.freeze({\n type: \"running\",\n});\n\nexport const useSmooth = (\n state: TextContentPartState,\n smooth: boolean = false,\n): TextContentPartState => {\n const { useSmoothStatus } = useSmoothContext({ optional: true }) ?? {};\n\n const {\n part: { text },\n } = state;\n const { useMessage } = useMessageContext();\n const id = useMessage((m) => m.message.id);\n\n const idRef = useRef(id);\n const [displayedText, setDisplayedText] = useState(text);\n\n const setText = useCallbackRef((text: string) => {\n setDisplayedText(text);\n (\n useSmoothStatus as unknown as\n | StoreApi<ToolCallContentPartStatus>\n | undefined\n )?.setState(text !== state.part.text ? SMOOTH_STATUS : state.status);\n });\n\n const [animatorRef] = useState<TextStreamAnimator>(\n new TextStreamAnimator(text, setText),\n );\n\n useEffect(() => {\n if (!smooth) {\n animatorRef.stop();\n return;\n }\n\n if (idRef.current !== id || !text.startsWith(animatorRef.targetText)) {\n idRef.current = id;\n setText(text);\n\n animatorRef.currentText = text;\n animatorRef.targetText = text;\n animatorRef.stop();\n\n return;\n }\n\n animatorRef.targetText = text;\n animatorRef.start();\n }, [setText, animatorRef, id, smooth, text]);\n\n useEffect(() => {\n return () => {\n animatorRef.stop();\n };\n }, [animatorRef]);\n\n return useMemo(\n () =>\n smooth\n ? {\n part: { type: \"text\", text: displayedText },\n status: text === displayedText ? state.status : SMOOTH_STATUS,\n }\n : state,\n [smooth, displayedText, state, text],\n );\n};\n","\"use client\";\n\nimport { createContext, useContext } from \"react\";\nimport type { MessageState } from \"../stores/Message\";\nimport type { EditComposerState } from \"../stores/EditComposer\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { MessageUtilsState } from \"../stores/MessageUtils\";\n\nexport type MessageContextValue = {\n useMessage: ReadonlyStore<MessageState>;\n useMessageUtils: ReadonlyStore<MessageUtilsState>;\n useEditComposer: ReadonlyStore<EditComposerState>;\n};\n\nexport const MessageContext = createContext<MessageContextValue | null>(null);\n\nexport function useMessageContext(): MessageContextValue;\nexport function useMessageContext(options: {\n optional: true;\n}): MessageContextValue | null;\nexport function useMessageContext(options?: { optional: true }) {\n const context = useContext(MessageContext);\n if (!options?.optional && !context)\n throw new Error(\n \"This component can only be used inside a component passed to <ThreadPrimitive.Messages components={...} />.\",\n );\n return context;\n}\n","\"use client\";\n\nimport { createContext, useContext } from \"react\";\nimport type { ContentPartState } from \"../stores/ContentPart\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\n\nexport type ContentPartContextValue = {\n useContentPart: ReadonlyStore<ContentPartState>;\n};\n\nexport const ContentPartContext = createContext<ContentPartContextValue | null>(\n null,\n);\n\nexport function useContentPartContext(): ContentPartContextValue;\nexport function useContentPartContext(options: {\n optional: true;\n}): ContentPartContextValue | null;\nexport function useContentPartContext(options?: { optional: true }) {\n const context = useContext(ContentPartContext);\n if (!options?.optional && !context)\n throw new Error(\n \"This component can only be used inside a component passed to <MessagePrimitive.Content components={...} >.\",\n );\n return context;\n}\n","import {\n createContext,\n FC,\n forwardRef,\n PropsWithChildren,\n useContext,\n useState,\n} from \"react\";\nimport { useContentPartContext } from \"../../context\";\nimport { ReadonlyStore } from \"../../context/ReadonlyStore\";\nimport { create } from \"zustand\";\nimport {\n ContentPartStatus,\n ToolCallContentPartStatus,\n} from \"../../types/AssistantTypes\";\n\ntype SmoothContextValue = {\n useSmoothStatus: ReadonlyStore<ToolCallContentPartStatus | ContentPartStatus>;\n};\n\nconst SmoothContext = createContext<SmoothContextValue | null>(null);\n\nconst makeSmoothContext = (\n initialState: ContentPartStatus | ToolCallContentPartStatus,\n) => {\n const useSmoothStatus = create(() => initialState);\n return { useSmoothStatus };\n};\n\nexport const SmoothContextProvider: FC<PropsWithChildren> = ({ children }) => {\n const outer = useSmoothContext({ optional: true });\n const { useContentPart } = useContentPartContext();\n\n const [context] = useState(() =>\n makeSmoothContext(useContentPart.getState().status),\n );\n\n // do not wrap if there is an outer SmoothContextProvider\n if (outer) return children;\n\n return (\n <SmoothContext.Provider value={context}>{children}</SmoothContext.Provider>\n );\n};\n\nexport const withSmoothContextProvider = <C extends React.ComponentType<any>>(\n Component: C,\n): C => {\n const Wrapped = forwardRef((props, ref) => {\n return (\n <SmoothContextProvider>\n <Component {...(props as any)} ref={ref} />\n </SmoothContextProvider>\n );\n });\n Wrapped.displayName = Component.displayName;\n return Wrapped as any;\n};\n\nexport function useSmoothContext(): SmoothContextValue;\nexport function useSmoothContext(options: {\n optional: true;\n}): SmoothContextValue | null;\nexport function useSmoothContext(options?: { optional: true }) {\n const context = useContext(SmoothContext);\n if (!options?.optional && !context)\n throw new Error(\n \"This component must be used within a SmoothContextProvider.\",\n );\n return context;\n}\n\nexport const useSmoothStatus = () => {\n const { useSmoothStatus } = useSmoothContext();\n return useSmoothStatus();\n};\n","\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./tooltip\";\nimport { Button, ButtonProps } from \"./button\";\n\nexport type TooltipIconButtonProps = ButtonProps & {\n tooltip: string;\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n};\n\nexport const TooltipIconButton = forwardRef<\n HTMLButtonElement,\n TooltipIconButtonProps\n>(({ children, tooltip, side = \"bottom\", ...rest }, ref) => {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"ghost\" size=\"icon\" {...rest} ref={ref}>\n {children}\n <span className=\"aui-sr-only\">{tooltip}</span>\n </Button>\n </TooltipTrigger>\n <TooltipContent side={side}>{tooltip}</TooltipContent>\n </Tooltip>\n );\n});\n\nTooltipIconButton.displayName = \"TooltipIconButton\";\n","\"use client\";\n\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport { withDefaults } from \"../utils/withDefaults\";\nimport { FC } from \"react\";\n\nexport const Tooltip: FC<TooltipPrimitive.TooltipProps> = (props) => {\n return (\n <TooltipPrimitive.Provider>\n <TooltipPrimitive.Root {...props} />\n </TooltipPrimitive.Provider>\n );\n};\n\nTooltip.displayName = \"Tooltip\";\n\nexport const TooltipTrigger = TooltipPrimitive.Trigger;\n\nexport const TooltipContent = withDefaults(TooltipPrimitive.Content, {\n sideOffset: 4,\n className: \"aui-tooltip-content\",\n});\n\nTooltipContent.displayName = \"TooltipContent\";\n","import {\n ComponentPropsWithoutRef,\n ElementRef,\n ElementType,\n forwardRef,\n} from \"react\";\nimport classNames from \"classnames\";\n\nexport const withDefaultProps =\n <TProps extends { className?: string }>({\n className,\n ...defaultProps\n }: Partial<TProps>) =>\n ({ className: classNameProp, ...props }: TProps) => {\n return {\n className: classNames(className, classNameProp),\n ...defaultProps,\n ...props,\n } as TProps;\n };\n\nexport const withDefaults = <TComponent extends ElementType>(\n Component: TComponent,\n defaultProps: Partial<Omit<ComponentPropsWithoutRef<TComponent>, \"asChild\">>,\n) => {\n type TComponentProps = typeof defaultProps;\n const getProps = withDefaultProps<TComponentProps>(defaultProps);\n const WithDefaults = forwardRef<ElementRef<TComponent>, TComponentProps>(\n (props, ref) => {\n const ComponentAsAny = Component as any;\n return <ComponentAsAny {...getProps(props)} ref={ref} />;\n },\n );\n WithDefaults.displayName =\n \"withDefaults(\" +\n (typeof Component === \"string\" ? Component : Component.displayName) +\n \")\";\n return WithDefaults;\n};\n","import { cva, type VariantProps } from \"class-variance-authority\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { ElementRef, forwardRef } from \"react\";\n\nconst buttonVariants = cva(\"aui-button\", {\n variants: {\n variant: {\n default: \"aui-button-primary\",\n outline: \"aui-button-outline\",\n ghost: \"aui-button-ghost\",\n },\n size: {\n default: \"aui-button-medium\",\n icon: \"aui-button-icon\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n});\n\ntype ButtonElement = ElementRef<typeof Primitive.button>;\n\nexport type ButtonProps = React.ComponentPropsWithoutRef<\n typeof Primitive.button\n> &\n VariantProps<typeof buttonVariants>;\n\nconst Button = forwardRef<ButtonElement, ButtonProps>(\n ({ className, variant, size, ...props }, ref) => {\n return (\n <Primitive.button\n className={buttonVariants({ variant, size, className })}\n {...props}\n ref={ref}\n />\n );\n },\n);\n\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAkB;AAGX,IAAM,oCAAoC,aAAE,OAAO;AAAA,EACxD,WAAW,aAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EAChD,aAAa,aAAE,OAAO,EAAE,SAAS;AAAA,EACjC,MAAM,aAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,iBAAiB,aAAE,OAAO,EAAE,SAAS;AAAA,EACrC,kBAAkB,aAAE,OAAO,EAAE,SAAS;AAAA,EACtC,MAAM,aAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EAChC,SAAS,aAAE,OAAO,aAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS;AACpD,CAAC;AAMM,IAAM,4BAA4B,aAAE,OAAO;AAAA,EAChD,QAAQ,aAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,SAAS,aAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,WAAW,aAAE,OAAO,EAAE,SAAS;AACjC,CAAC;AA2BM,IAAM,oBAAoB,CAC/B,cACgB;AAChB,QAAM,UAAU,MAAM,KAAK,SAAS,EACjC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC,EAC7B,KAAK,CAAC,GAAG,OAAO,EAAE,YAAY,MAAM,EAAE,YAAY,EAAE;AAEvD,SAAO,QAAQ,OAAO,CAAC,KAAK,WAAW;AACrC,QAAI,OAAO,QAAQ;AACjB,UAAI,IAAI,QAAQ;A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EAAE,WAAW,SAAS,MAAM,GAAG,MAAM,GAAG,QAAQ;AAC/C,WACE;AAAA,MAAC,iCAAU;AAAA,MAAV;AAAA,QACC,WAAW,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC;AAAA,QACrD,GAAG;AAAA,QACJ;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,OAAO,cAAc;;;AHvBb,IAAAC,sBAAA;AAPD,IAAM,wBAAoB,0BAG/B,CAAC,EAAE,UAAU,SAAS,OAAO,UAAU,GAAG,KAAK,GAAG,QAAQ;AAC1D,SACE,8CAAC,WACC;AAAA,iDAAC,kBAAe,SAAO,MACrB,wDAAC,UAAO,SAAQ,SAAQ,MAAK,QAAQ,GAAG,MAAM,KAC3C;AAAA;AAAA,MACD,6CAAC,UAAK,WAAU,eAAe,mBAAQ;AAAA,OACzC,GACF;AAAA,IACA,6CAAC,kBAAe,MAAa,mBAAQ;AAAA,KACvC;AAEJ,CAAC;AAED,kBAAkB,cAAc;","names":["import_react","import_react","import_react","useSmoothStatus","useSmoothStatus","text","import_react","import_react","import_jsx_runtime","classNames","import_jsx_runtime","import_react","import_jsx_runtime","import_jsx_runtime"]}
|
package/dist/internal.mjs
DELETED
@@ -1,531 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
mergeModelConfigs
|
3
|
-
} from "./chunk-BV6Y7C43.mjs";
|
4
|
-
|
5
|
-
// src/utils/ProxyConfigProvider.ts
|
6
|
-
var ProxyConfigProvider = class {
|
7
|
-
_providers = /* @__PURE__ */ new Set();
|
8
|
-
getModelConfig() {
|
9
|
-
return mergeModelConfigs(this._providers);
|
10
|
-
}
|
11
|
-
registerModelConfigProvider(provider) {
|
12
|
-
this._providers.add(provider);
|
13
|
-
return () => {
|
14
|
-
this._providers.delete(provider);
|
15
|
-
};
|
16
|
-
}
|
17
|
-
};
|
18
|
-
|
19
|
-
// src/utils/idUtils.tsx
|
20
|
-
import { customAlphabet } from "nanoid/non-secure";
|
21
|
-
var generateId = customAlphabet(
|
22
|
-
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
23
|
-
7
|
24
|
-
);
|
25
|
-
var optimisticPrefix = "__optimistic__";
|
26
|
-
var generateOptimisticId = () => `${optimisticPrefix}${generateId()}`;
|
27
|
-
|
28
|
-
// src/runtimes/edge/converters/fromCoreMessage.ts
|
29
|
-
var fromCoreMessage = (message, {
|
30
|
-
id = generateId(),
|
31
|
-
status = { type: "complete", reason: "unknown" }
|
32
|
-
} = {}) => {
|
33
|
-
const commonProps = {
|
34
|
-
id,
|
35
|
-
createdAt: /* @__PURE__ */ new Date()
|
36
|
-
};
|
37
|
-
const role = message.role;
|
38
|
-
switch (role) {
|
39
|
-
case "assistant":
|
40
|
-
return {
|
41
|
-
...commonProps,
|
42
|
-
role,
|
43
|
-
content: message.content.map((part) => {
|
44
|
-
if (part.type === "tool-call") {
|
45
|
-
return {
|
46
|
-
...part,
|
47
|
-
argsText: JSON.stringify(part.args)
|
48
|
-
};
|
49
|
-
}
|
50
|
-
return part;
|
51
|
-
}),
|
52
|
-
status
|
53
|
-
};
|
54
|
-
case "user":
|
55
|
-
return {
|
56
|
-
...commonProps,
|
57
|
-
role,
|
58
|
-
content: message.content
|
59
|
-
};
|
60
|
-
case "system":
|
61
|
-
return {
|
62
|
-
...commonProps,
|
63
|
-
role,
|
64
|
-
content: message.content
|
65
|
-
};
|
66
|
-
default: {
|
67
|
-
const unsupportedRole = role;
|
68
|
-
throw new Error(`Unknown message role: ${unsupportedRole}`);
|
69
|
-
}
|
70
|
-
}
|
71
|
-
};
|
72
|
-
|
73
|
-
// src/runtimes/utils/MessageRepository.tsx
|
74
|
-
var findHead = (message) => {
|
75
|
-
if (message.next) return findHead(message.next);
|
76
|
-
return message;
|
77
|
-
};
|
78
|
-
var MessageRepository = class {
|
79
|
-
messages = /* @__PURE__ */ new Map();
|
80
|
-
// message_id -> item
|
81
|
-
head = null;
|
82
|
-
root = {
|
83
|
-
children: []
|
84
|
-
};
|
85
|
-
performOp(newParent, child, operation) {
|
86
|
-
const parentOrRoot = child.prev ?? this.root;
|
87
|
-
const newParentOrRoot = newParent ?? this.root;
|
88
|
-
if (operation === "relink" && parentOrRoot === newParentOrRoot) return;
|
89
|
-
if (operation !== "link") {
|
90
|
-
parentOrRoot.children = parentOrRoot.children.filter(
|
91
|
-
(m) => m !== child.current.id
|
92
|
-
);
|
93
|
-
if (child.prev?.next === child) {
|
94
|
-
const fallbackId = child.prev.children.at(-1);
|
95
|
-
const fallback = fallbackId ? this.messages.get(fallbackId) : null;
|
96
|
-
if (fallback === void 0) {
|
97
|
-
throw new Error(
|
98
|
-
"MessageRepository(performOp/cut): Fallback sibling message not found. This is likely an internal bug in assistant-ui."
|
99
|
-
);
|
100
|
-
}
|
101
|
-
child.prev.next = fallback;
|
102
|
-
}
|
103
|
-
}
|
104
|
-
if (operation !== "cut") {
|
105
|
-
newParentOrRoot.children = [
|
106
|
-
...newParentOrRoot.children,
|
107
|
-
child.current.id
|
108
|
-
];
|
109
|
-
if (newParent && (findHead(child) === this.head || newParent.next === null)) {
|
110
|
-
newParent.next = child;
|
111
|
-
}
|
112
|
-
child.prev = newParent;
|
113
|
-
}
|
114
|
-
}
|
115
|
-
getMessages() {
|
116
|
-
const messages = new Array(this.head?.level ?? 0);
|
117
|
-
for (let current = this.head; current; current = current.prev) {
|
118
|
-
messages[current.level] = current.current;
|
119
|
-
}
|
120
|
-
return messages;
|
121
|
-
}
|
122
|
-
addOrUpdateMessage(parentId, message) {
|
123
|
-
const existingItem = this.messages.get(message.id);
|
124
|
-
const prev = parentId ? this.messages.get(parentId) : null;
|
125
|
-
if (prev === void 0)
|
126
|
-
throw new Error(
|
127
|
-
"MessageRepository(addOrUpdateMessage): Parent message not found. This is likely an internal bug in assistant-ui."
|
128
|
-
);
|
129
|
-
if (existingItem) {
|
130
|
-
existingItem.current = message;
|
131
|
-
this.performOp(prev, existingItem, "relink");
|
132
|
-
return;
|
133
|
-
}
|
134
|
-
const newItem = {
|
135
|
-
prev,
|
136
|
-
current: message,
|
137
|
-
next: null,
|
138
|
-
children: [],
|
139
|
-
level: prev ? prev.level + 1 : 0
|
140
|
-
};
|
141
|
-
this.messages.set(message.id, newItem);
|
142
|
-
this.performOp(prev, newItem, "link");
|
143
|
-
if (this.head === prev) {
|
144
|
-
this.head = newItem;
|
145
|
-
}
|
146
|
-
}
|
147
|
-
getMessage(messageId) {
|
148
|
-
const message = this.messages.get(messageId);
|
149
|
-
if (!message)
|
150
|
-
throw new Error(
|
151
|
-
"MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui."
|
152
|
-
);
|
153
|
-
return {
|
154
|
-
parentId: message.prev?.current.id ?? null,
|
155
|
-
message: message.current
|
156
|
-
};
|
157
|
-
}
|
158
|
-
appendOptimisticMessage(parentId, message) {
|
159
|
-
let optimisticId;
|
160
|
-
do {
|
161
|
-
optimisticId = generateOptimisticId();
|
162
|
-
} while (this.messages.has(optimisticId));
|
163
|
-
this.addOrUpdateMessage(
|
164
|
-
parentId,
|
165
|
-
fromCoreMessage(message, {
|
166
|
-
id: optimisticId,
|
167
|
-
status: { type: "running" }
|
168
|
-
})
|
169
|
-
);
|
170
|
-
return optimisticId;
|
171
|
-
}
|
172
|
-
deleteMessage(messageId, replacementId) {
|
173
|
-
const message = this.messages.get(messageId);
|
174
|
-
if (!message)
|
175
|
-
throw new Error(
|
176
|
-
"MessageRepository(deleteMessage): Optimistic message not found. This is likely an internal bug in assistant-ui."
|
177
|
-
);
|
178
|
-
const replacement = replacementId === void 0 ? message.prev : replacementId === null ? null : this.messages.get(replacementId);
|
179
|
-
if (replacement === void 0)
|
180
|
-
throw new Error(
|
181
|
-
"MessageRepository(deleteMessage): Replacement not found. This is likely an internal bug in assistant-ui."
|
182
|
-
);
|
183
|
-
for (const child of message.children) {
|
184
|
-
const childMessage = this.messages.get(child);
|
185
|
-
if (!childMessage)
|
186
|
-
throw new Error(
|
187
|
-
"MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui."
|
188
|
-
);
|
189
|
-
this.performOp(replacement, childMessage, "relink");
|
190
|
-
}
|
191
|
-
this.performOp(null, message, "cut");
|
192
|
-
this.messages.delete(messageId);
|
193
|
-
if (this.head === message) {
|
194
|
-
this.head = replacement ? findHead(replacement) : null;
|
195
|
-
}
|
196
|
-
}
|
197
|
-
getBranches(messageId) {
|
198
|
-
const message = this.messages.get(messageId);
|
199
|
-
if (!message)
|
200
|
-
throw new Error(
|
201
|
-
"MessageRepository(getBranches): Message not found. This is likely an internal bug in assistant-ui."
|
202
|
-
);
|
203
|
-
const { children } = message.prev ?? this.root;
|
204
|
-
return children;
|
205
|
-
}
|
206
|
-
switchToBranch(messageId) {
|
207
|
-
const message = this.messages.get(messageId);
|
208
|
-
if (!message)
|
209
|
-
throw new Error(
|
210
|
-
"MessageRepository(switchToBranch): Branch not found. This is likely an internal bug in assistant-ui."
|
211
|
-
);
|
212
|
-
if (message.prev) {
|
213
|
-
message.prev.next = message;
|
214
|
-
}
|
215
|
-
this.head = findHead(message);
|
216
|
-
}
|
217
|
-
resetHead(messageId) {
|
218
|
-
if (messageId === null) {
|
219
|
-
this.head = null;
|
220
|
-
return;
|
221
|
-
}
|
222
|
-
const message = this.messages.get(messageId);
|
223
|
-
if (!message)
|
224
|
-
throw new Error(
|
225
|
-
"MessageRepository(resetHead): Branch not found. This is likely an internal bug in assistant-ui."
|
226
|
-
);
|
227
|
-
this.head = message;
|
228
|
-
for (let current = message; current; current = current.prev) {
|
229
|
-
if (current.prev) {
|
230
|
-
current.prev.next = current;
|
231
|
-
}
|
232
|
-
}
|
233
|
-
}
|
234
|
-
};
|
235
|
-
|
236
|
-
// src/runtimes/core/BaseAssistantRuntime.tsx
|
237
|
-
var BaseAssistantRuntime = class {
|
238
|
-
constructor(_thread) {
|
239
|
-
this._thread = _thread;
|
240
|
-
this._thread = _thread;
|
241
|
-
}
|
242
|
-
get thread() {
|
243
|
-
return this._thread;
|
244
|
-
}
|
245
|
-
set thread(thread) {
|
246
|
-
this._thread = thread;
|
247
|
-
this.subscriptionHandler();
|
248
|
-
}
|
249
|
-
_subscriptions = /* @__PURE__ */ new Set();
|
250
|
-
subscribe(callback) {
|
251
|
-
this._subscriptions.add(callback);
|
252
|
-
return () => this._subscriptions.delete(callback);
|
253
|
-
}
|
254
|
-
subscriptionHandler = () => {
|
255
|
-
for (const callback of this._subscriptions) callback();
|
256
|
-
};
|
257
|
-
};
|
258
|
-
|
259
|
-
// src/utils/smooth/useSmooth.tsx
|
260
|
-
import { useEffect, useMemo, useRef, useState as useState2 } from "react";
|
261
|
-
|
262
|
-
// src/context/react/MessageContext.ts
|
263
|
-
import { createContext, useContext } from "react";
|
264
|
-
var MessageContext = createContext(null);
|
265
|
-
function useMessageContext(options) {
|
266
|
-
const context = useContext(MessageContext);
|
267
|
-
if (!options?.optional && !context)
|
268
|
-
throw new Error(
|
269
|
-
"This component can only be used inside a component passed to <ThreadPrimitive.Messages components={...} />."
|
270
|
-
);
|
271
|
-
return context;
|
272
|
-
}
|
273
|
-
|
274
|
-
// src/context/react/ContentPartContext.ts
|
275
|
-
import { createContext as createContext2, useContext as useContext2 } from "react";
|
276
|
-
var ContentPartContext = createContext2(
|
277
|
-
null
|
278
|
-
);
|
279
|
-
function useContentPartContext(options) {
|
280
|
-
const context = useContext2(ContentPartContext);
|
281
|
-
if (!options?.optional && !context)
|
282
|
-
throw new Error(
|
283
|
-
"This component can only be used inside a component passed to <MessagePrimitive.Content components={...} >."
|
284
|
-
);
|
285
|
-
return context;
|
286
|
-
}
|
287
|
-
|
288
|
-
// src/utils/smooth/SmoothContext.tsx
|
289
|
-
import {
|
290
|
-
createContext as createContext3,
|
291
|
-
forwardRef,
|
292
|
-
useContext as useContext3,
|
293
|
-
useState
|
294
|
-
} from "react";
|
295
|
-
import { create } from "zustand";
|
296
|
-
import { jsx } from "react/jsx-runtime";
|
297
|
-
var SmoothContext = createContext3(null);
|
298
|
-
var makeSmoothContext = (initialState) => {
|
299
|
-
const useSmoothStatus2 = create(() => initialState);
|
300
|
-
return { useSmoothStatus: useSmoothStatus2 };
|
301
|
-
};
|
302
|
-
var SmoothContextProvider = ({ children }) => {
|
303
|
-
const outer = useSmoothContext({ optional: true });
|
304
|
-
const { useContentPart } = useContentPartContext();
|
305
|
-
const [context] = useState(
|
306
|
-
() => makeSmoothContext(useContentPart.getState().status)
|
307
|
-
);
|
308
|
-
if (outer) return children;
|
309
|
-
return /* @__PURE__ */ jsx(SmoothContext.Provider, { value: context, children });
|
310
|
-
};
|
311
|
-
var withSmoothContextProvider = (Component) => {
|
312
|
-
const Wrapped = forwardRef((props, ref) => {
|
313
|
-
return /* @__PURE__ */ jsx(SmoothContextProvider, { children: /* @__PURE__ */ jsx(Component, { ...props, ref }) });
|
314
|
-
});
|
315
|
-
Wrapped.displayName = Component.displayName;
|
316
|
-
return Wrapped;
|
317
|
-
};
|
318
|
-
function useSmoothContext(options) {
|
319
|
-
const context = useContext3(SmoothContext);
|
320
|
-
if (!options?.optional && !context)
|
321
|
-
throw new Error(
|
322
|
-
"This component must be used within a SmoothContextProvider."
|
323
|
-
);
|
324
|
-
return context;
|
325
|
-
}
|
326
|
-
var useSmoothStatus = () => {
|
327
|
-
const { useSmoothStatus: useSmoothStatus2 } = useSmoothContext();
|
328
|
-
return useSmoothStatus2();
|
329
|
-
};
|
330
|
-
|
331
|
-
// src/utils/smooth/useSmooth.tsx
|
332
|
-
import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
|
333
|
-
var TextStreamAnimator = class {
|
334
|
-
constructor(currentText, setText) {
|
335
|
-
this.currentText = currentText;
|
336
|
-
this.setText = setText;
|
337
|
-
}
|
338
|
-
animationFrameId = null;
|
339
|
-
lastUpdateTime = Date.now();
|
340
|
-
targetText = "";
|
341
|
-
start() {
|
342
|
-
if (this.animationFrameId !== null) return;
|
343
|
-
this.lastUpdateTime = Date.now();
|
344
|
-
this.animate();
|
345
|
-
}
|
346
|
-
stop() {
|
347
|
-
if (this.animationFrameId !== null) {
|
348
|
-
cancelAnimationFrame(this.animationFrameId);
|
349
|
-
this.animationFrameId = null;
|
350
|
-
}
|
351
|
-
}
|
352
|
-
animate = () => {
|
353
|
-
const currentTime = Date.now();
|
354
|
-
const deltaTime = currentTime - this.lastUpdateTime;
|
355
|
-
let timeToConsume = deltaTime;
|
356
|
-
const remainingChars = this.targetText.length - this.currentText.length;
|
357
|
-
const baseTimePerChar = Math.min(5, 250 / remainingChars);
|
358
|
-
let charsToAdd = 0;
|
359
|
-
while (timeToConsume >= baseTimePerChar && charsToAdd < remainingChars) {
|
360
|
-
charsToAdd++;
|
361
|
-
timeToConsume -= baseTimePerChar;
|
362
|
-
}
|
363
|
-
if (charsToAdd !== remainingChars) {
|
364
|
-
this.animationFrameId = requestAnimationFrame(this.animate);
|
365
|
-
} else {
|
366
|
-
this.animationFrameId = null;
|
367
|
-
}
|
368
|
-
if (charsToAdd === 0) return;
|
369
|
-
this.currentText = this.targetText.slice(
|
370
|
-
0,
|
371
|
-
this.currentText.length + charsToAdd
|
372
|
-
);
|
373
|
-
this.lastUpdateTime = currentTime - timeToConsume;
|
374
|
-
this.setText(this.currentText);
|
375
|
-
};
|
376
|
-
};
|
377
|
-
var SMOOTH_STATUS = Object.freeze({
|
378
|
-
type: "running"
|
379
|
-
});
|
380
|
-
var useSmooth = (state, smooth = false) => {
|
381
|
-
const { useSmoothStatus: useSmoothStatus2 } = useSmoothContext({ optional: true }) ?? {};
|
382
|
-
const {
|
383
|
-
part: { text }
|
384
|
-
} = state;
|
385
|
-
const { useMessage } = useMessageContext();
|
386
|
-
const id = useMessage((m) => m.message.id);
|
387
|
-
const idRef = useRef(id);
|
388
|
-
const [displayedText, setDisplayedText] = useState2(text);
|
389
|
-
const setText = useCallbackRef((text2) => {
|
390
|
-
setDisplayedText(text2);
|
391
|
-
useSmoothStatus2?.setState(text2 !== state.part.text ? SMOOTH_STATUS : state.status);
|
392
|
-
});
|
393
|
-
const [animatorRef] = useState2(
|
394
|
-
new TextStreamAnimator(text, setText)
|
395
|
-
);
|
396
|
-
useEffect(() => {
|
397
|
-
if (!smooth) {
|
398
|
-
animatorRef.stop();
|
399
|
-
return;
|
400
|
-
}
|
401
|
-
if (idRef.current !== id || !text.startsWith(animatorRef.targetText)) {
|
402
|
-
idRef.current = id;
|
403
|
-
setText(text);
|
404
|
-
animatorRef.currentText = text;
|
405
|
-
animatorRef.targetText = text;
|
406
|
-
animatorRef.stop();
|
407
|
-
return;
|
408
|
-
}
|
409
|
-
animatorRef.targetText = text;
|
410
|
-
animatorRef.start();
|
411
|
-
}, [setText, animatorRef, id, smooth, text]);
|
412
|
-
useEffect(() => {
|
413
|
-
return () => {
|
414
|
-
animatorRef.stop();
|
415
|
-
};
|
416
|
-
}, [animatorRef]);
|
417
|
-
return useMemo(
|
418
|
-
() => smooth ? {
|
419
|
-
part: { type: "text", text: displayedText },
|
420
|
-
status: text === displayedText ? state.status : SMOOTH_STATUS
|
421
|
-
} : state,
|
422
|
-
[smooth, displayedText, state, text]
|
423
|
-
);
|
424
|
-
};
|
425
|
-
|
426
|
-
// src/ui/base/tooltip-icon-button.tsx
|
427
|
-
import { forwardRef as forwardRef4 } from "react";
|
428
|
-
|
429
|
-
// src/ui/base/tooltip.tsx
|
430
|
-
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
431
|
-
|
432
|
-
// src/ui/utils/withDefaults.tsx
|
433
|
-
import {
|
434
|
-
forwardRef as forwardRef2
|
435
|
-
} from "react";
|
436
|
-
import classNames from "classnames";
|
437
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
438
|
-
var withDefaultProps = ({
|
439
|
-
className,
|
440
|
-
...defaultProps
|
441
|
-
}) => ({ className: classNameProp, ...props }) => {
|
442
|
-
return {
|
443
|
-
className: classNames(className, classNameProp),
|
444
|
-
...defaultProps,
|
445
|
-
...props
|
446
|
-
};
|
447
|
-
};
|
448
|
-
var withDefaults = (Component, defaultProps) => {
|
449
|
-
const getProps = withDefaultProps(defaultProps);
|
450
|
-
const WithDefaults = forwardRef2(
|
451
|
-
(props, ref) => {
|
452
|
-
const ComponentAsAny = Component;
|
453
|
-
return /* @__PURE__ */ jsx2(ComponentAsAny, { ...getProps(props), ref });
|
454
|
-
}
|
455
|
-
);
|
456
|
-
WithDefaults.displayName = "withDefaults(" + (typeof Component === "string" ? Component : Component.displayName) + ")";
|
457
|
-
return WithDefaults;
|
458
|
-
};
|
459
|
-
|
460
|
-
// src/ui/base/tooltip.tsx
|
461
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
462
|
-
var Tooltip = (props) => {
|
463
|
-
return /* @__PURE__ */ jsx3(TooltipPrimitive.Provider, { children: /* @__PURE__ */ jsx3(TooltipPrimitive.Root, { ...props }) });
|
464
|
-
};
|
465
|
-
Tooltip.displayName = "Tooltip";
|
466
|
-
var TooltipTrigger = TooltipPrimitive.Trigger;
|
467
|
-
var TooltipContent = withDefaults(TooltipPrimitive.Content, {
|
468
|
-
sideOffset: 4,
|
469
|
-
className: "aui-tooltip-content"
|
470
|
-
});
|
471
|
-
TooltipContent.displayName = "TooltipContent";
|
472
|
-
|
473
|
-
// src/ui/base/button.tsx
|
474
|
-
import { cva } from "class-variance-authority";
|
475
|
-
import { Primitive } from "@radix-ui/react-primitive";
|
476
|
-
import { forwardRef as forwardRef3 } from "react";
|
477
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
478
|
-
var buttonVariants = cva("aui-button", {
|
479
|
-
variants: {
|
480
|
-
variant: {
|
481
|
-
default: "aui-button-primary",
|
482
|
-
outline: "aui-button-outline",
|
483
|
-
ghost: "aui-button-ghost"
|
484
|
-
},
|
485
|
-
size: {
|
486
|
-
default: "aui-button-medium",
|
487
|
-
icon: "aui-button-icon"
|
488
|
-
}
|
489
|
-
},
|
490
|
-
defaultVariants: {
|
491
|
-
variant: "default",
|
492
|
-
size: "default"
|
493
|
-
}
|
494
|
-
});
|
495
|
-
var Button = forwardRef3(
|
496
|
-
({ className, variant, size, ...props }, ref) => {
|
497
|
-
return /* @__PURE__ */ jsx4(
|
498
|
-
Primitive.button,
|
499
|
-
{
|
500
|
-
className: buttonVariants({ variant, size, className }),
|
501
|
-
...props,
|
502
|
-
ref
|
503
|
-
}
|
504
|
-
);
|
505
|
-
}
|
506
|
-
);
|
507
|
-
Button.displayName = "Button";
|
508
|
-
|
509
|
-
// src/ui/base/tooltip-icon-button.tsx
|
510
|
-
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
511
|
-
var TooltipIconButton = forwardRef4(({ children, tooltip, side = "bottom", ...rest }, ref) => {
|
512
|
-
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
513
|
-
/* @__PURE__ */ jsx5(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "icon", ...rest, ref, children: [
|
514
|
-
children,
|
515
|
-
/* @__PURE__ */ jsx5("span", { className: "aui-sr-only", children: tooltip })
|
516
|
-
] }) }),
|
517
|
-
/* @__PURE__ */ jsx5(TooltipContent, { side, children: tooltip })
|
518
|
-
] });
|
519
|
-
});
|
520
|
-
TooltipIconButton.displayName = "TooltipIconButton";
|
521
|
-
export {
|
522
|
-
BaseAssistantRuntime,
|
523
|
-
MessageRepository,
|
524
|
-
ProxyConfigProvider,
|
525
|
-
TooltipIconButton,
|
526
|
-
generateId,
|
527
|
-
useSmooth,
|
528
|
-
useSmoothStatus,
|
529
|
-
withSmoothContextProvider
|
530
|
-
};
|
531
|
-
//# sourceMappingURL=internal.mjs.map
|