teodor-new-chat-ui 1.5.13 → 1.5.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/chat/ChatInterface.d.ts +2 -0
- package/dist/components/chat/ChatProvider.d.ts +3 -14
- package/dist/components/ui/resizable.d.ts +1 -1
- package/dist/config/env.d.ts +39 -0
- package/dist/hooks/use-chat.d.ts +0 -5
- package/dist/index.esm.js +6193 -4275
- package/dist/index.umd.js +25 -19
- package/dist/lib/api.d.ts +101 -0
- package/dist/lib/index.d.ts +5 -1
- package/package.json +4 -3
- package/dist/api/api-client.d.ts +0 -48
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ChatProvider.tsx — lean provider that composes:
|
|
3
|
-
* - ChatApi (REST)
|
|
4
|
-
* - useChatStream (POST + SSE)
|
|
5
|
-
* - useMessagesReducer (client-side message assembly)
|
|
6
|
-
*
|
|
7
|
-
* Why keep a provider if we have hooks?
|
|
8
|
-
* - Centralize baseUrl/auth & one ChatApi instance
|
|
9
|
-
* - Keep current thread + messages when navigating pages
|
|
10
|
-
* - Share a single stream connection + reducer across components
|
|
11
|
-
*/
|
|
12
1
|
import React from "react";
|
|
13
2
|
import { ChatMessage, ThreadSummary, CheckpointList, ApiConfig } from "@/types/api";
|
|
14
|
-
import {
|
|
3
|
+
import { Api } from "@/lib/api";
|
|
15
4
|
export interface SendOptions {
|
|
16
5
|
checkpointId?: string;
|
|
17
6
|
checkpointNs?: string;
|
|
@@ -24,7 +13,7 @@ export interface ChatContextValue {
|
|
|
24
13
|
baseUrl: string;
|
|
25
14
|
token: string | null;
|
|
26
15
|
setToken: (t: string | null) => void;
|
|
27
|
-
api:
|
|
16
|
+
api: Api;
|
|
28
17
|
threads: ThreadSummary[];
|
|
29
18
|
currentThreadId: string | null;
|
|
30
19
|
setCurrentThreadId: (id: string | null) => void;
|
|
@@ -51,5 +40,5 @@ export interface ChatProviderProps {
|
|
|
51
40
|
onThreadChange?: (threadId: string | null) => void;
|
|
52
41
|
initialThreadId?: string | null;
|
|
53
42
|
}
|
|
54
|
-
export declare function ChatProvider({ children, apiConfig, onError, onThreadChange, initialThreadId
|
|
43
|
+
export declare function ChatProvider({ children, apiConfig, onError, onThreadChange, initialThreadId }: ChatProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
55
44
|
export declare function useChat(): ChatContextValue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ResizablePrimitive from "react-resizable-panels";
|
|
2
2
|
declare const ResizablePanelGroup: ({ className, ...props }: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
declare const ResizablePanel: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLButtonElement | HTMLElement | HTMLTextAreaElement | HTMLDivElement | HTMLParagraphElement | HTMLUListElement | HTMLOListElement | HTMLLIElement | HTMLQuoteElement | HTMLTableElement | HTMLTableCellElement | HTMLPreElement | HTMLDListElement | HTMLSpanElement | HTMLAnchorElement | HTMLImageElement | HTMLObjectElement |
|
|
3
|
+
declare const ResizablePanel: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLButtonElement | HTMLElement | HTMLTextAreaElement | HTMLDivElement | HTMLParagraphElement | HTMLUListElement | HTMLOListElement | HTMLLIElement | HTMLQuoteElement | HTMLTableElement | HTMLTableCellElement | HTMLPreElement | HTMLDListElement | HTMLSpanElement | HTMLAnchorElement | HTMLImageElement | HTMLObjectElement | HTMLDataElement | HTMLHeadElement | HTMLLinkElement | HTMLBodyElement | HTMLMapElement | HTMLTitleElement | HTMLFormElement | HTMLSlotElement | HTMLStyleElement | HTMLDialogElement | HTMLOptionElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLBRElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLHeadingElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLMetaElement | HTMLMeterElement | HTMLOptGroupElement | HTMLOutputElement | HTMLProgressElement | HTMLScriptElement | HTMLSelectElement | HTMLSourceElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTimeElement | HTMLTableRowElement | HTMLTrackElement | HTMLVideoElement | HTMLTableCaptionElement | HTMLMenuElement | HTMLPictureElement>, "id" | "onResize"> & {
|
|
4
4
|
className?: string | undefined;
|
|
5
5
|
collapsedSize?: number | undefined;
|
|
6
6
|
collapsible?: boolean | undefined;
|
package/dist/config/env.d.ts
CHANGED
|
@@ -1,4 +1,43 @@
|
|
|
1
1
|
import type { ApiConfig } from "@/types/api";
|
|
2
2
|
export declare function getEnvApiBaseUrl(): string | undefined;
|
|
3
3
|
export declare function getEnvApiKey(): string | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Get the default API configuration from environment variables
|
|
6
|
+
*/
|
|
4
7
|
export declare function getDefaultApiConfig(): ApiConfig;
|
|
8
|
+
/**
|
|
9
|
+
* Default settings that integrate with the API client
|
|
10
|
+
*/
|
|
11
|
+
export interface ChatConfig {
|
|
12
|
+
apiBaseUrl: string;
|
|
13
|
+
apiKey: string;
|
|
14
|
+
model: string;
|
|
15
|
+
temperature: number;
|
|
16
|
+
maxTokens: number;
|
|
17
|
+
layoutSize: 'phone' | 'tablet' | 'desktop' | 'half-screen';
|
|
18
|
+
showThreads: boolean;
|
|
19
|
+
autoScrollMessages: boolean;
|
|
20
|
+
truncateToolMessages: boolean;
|
|
21
|
+
toolMessagePreviewLength: number;
|
|
22
|
+
darkMode: boolean;
|
|
23
|
+
enableSound: boolean;
|
|
24
|
+
messageHistory: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Create default settings using environment and API client state
|
|
28
|
+
*/
|
|
29
|
+
export declare function getDefaultChatSettings(): ChatConfig;
|
|
30
|
+
/**
|
|
31
|
+
* Settings persistence utilities
|
|
32
|
+
*/
|
|
33
|
+
export declare const SETTINGS_STORAGE_KEY = "chat-settings";
|
|
34
|
+
export declare function loadStoredSettings(): Partial<ChatConfig>;
|
|
35
|
+
export declare function saveSettings(settings: ChatConfig): void;
|
|
36
|
+
/**
|
|
37
|
+
* Get merged settings (defaults + stored + current API state)
|
|
38
|
+
*/
|
|
39
|
+
export declare function getCurrentSettings(): ChatConfig;
|
|
40
|
+
/**
|
|
41
|
+
* Apply settings to the API client and save to storage
|
|
42
|
+
*/
|
|
43
|
+
export declare function applySettings(settings: ChatConfig): void;
|
package/dist/hooks/use-chat.d.ts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { ChatRequest, StreamEvent } from "@/types/api";
|
|
2
2
|
export type UseChatStreamOptions = {
|
|
3
|
-
/** Base URL for the API, e.g. "/api/v1" or "https://host/api/v1" */
|
|
4
3
|
baseUrl?: string;
|
|
5
|
-
/** Path for the streaming endpoint relative to baseUrl (default: "/stream") */
|
|
6
4
|
streamPath?: string;
|
|
7
|
-
/** Bearer token for Authorization header */
|
|
8
5
|
token?: string;
|
|
9
|
-
/** Extra headers to include with every request */
|
|
10
6
|
headers?: Record<string, string>;
|
|
11
|
-
/** Auto-append assistant message to local state as it streams */
|
|
12
7
|
autoAppendAssistant?: boolean;
|
|
13
8
|
};
|
|
14
9
|
export type UseChatStream = {
|