gentiq 0.8.3 → 0.10.0
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/{checkbox-hWwU3a5K.js → checkbox-BuMyz6YI.js} +1722 -1753
- package/dist/gentiq-admin.es.js +4479 -3091
- package/dist/gentiq-index.es.js +1975 -1381
- package/dist/gentiq.css +1 -1
- package/dist/src/App.d.ts +1 -1
- package/dist/src/ComponentsContext.d.ts +1 -1
- package/dist/src/Part.d.ts +2 -1
- package/dist/src/admin/components/ErrorBanner.d.ts +7 -0
- package/dist/src/admin/components/I18nPreview.d.ts +6 -0
- package/dist/src/admin/components/ModalCloseButton.d.ts +7 -0
- package/dist/src/admin/components/SectionHeader.d.ts +8 -0
- package/dist/src/admin/lib/api.d.ts +192 -22
- package/dist/src/admin/pages/settings/ChatSection.d.ts +12 -0
- package/dist/src/admin/pages/settings/FieldModeGrid.d.ts +14 -0
- package/dist/src/admin/pages/settings/GeneralSection.d.ts +11 -0
- package/dist/src/admin/pages/settings/JobsSection.d.ts +1 -0
- package/dist/src/admin/pages/settings/SettingsToggleCard.d.ts +10 -0
- package/dist/src/admin/pages/settings/TranslationEditor.d.ts +9 -0
- package/dist/src/admin/pages/settings/types.d.ts +12 -0
- package/dist/src/admin/pages/users/UserBulkBalanceModal.d.ts +11 -0
- package/dist/src/admin/pages/users/UserFormModal.d.ts +13 -0
- package/dist/src/admin/pages/users/UserRechargeModal.d.ts +10 -0
- package/dist/src/admin/pages/users/UserUsageDialog.d.ts +9 -0
- package/dist/src/admin/pages/users/UsersTable.d.ts +21 -0
- package/dist/src/components/PromptInputArea.d.ts +1 -1
- package/dist/src/components/ai-elements/Conversation.d.ts +10 -0
- package/dist/src/hooks/useGentiqAdmin.d.ts +39 -12
- package/dist/src/hooks/useGentiqChat.d.ts +3 -2
- package/dist/src/index.d.ts +4 -3
- package/dist/src/lib/GentiqApiContext.d.ts +12 -0
- package/dist/src/lib/api.d.ts +37 -17
- package/dist/src/lib/errors.d.ts +6 -5
- package/dist/src/lib/messageParts.d.ts +40 -0
- package/dist/src/locales/en.json.d.ts +520 -456
- package/dist/src/locales/fa.json.d.ts +519 -455
- package/dist/src/parts/FilePart.d.ts +1 -1
- package/dist/src/parts/ToolPart.d.ts +1 -1
- package/dist/src/types.d.ts +188 -14
- package/package.json +5 -5
- package/dist/src/components/ai-elements/Branch.d.ts +0 -20
- package/dist/src/components/ai-elements/Image.d.ts +0 -6
- package/dist/src/components/ai-elements/InlineCitation.d.ts +0 -38
- package/dist/src/components/ai-elements/Task.d.ts +0 -14
- package/dist/src/components/ai-elements/WebPreview.d.ts +0 -34
- package/dist/src/components/ui/carousel.d.ts +0 -19
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UIMessage } from 'ai';
|
|
1
2
|
import { ChatReference } from '../types';
|
|
2
3
|
export type ChatStatus = 'idle' | 'loading-history' | 'ready' | 'streaming' | 'error' | 'submitted';
|
|
3
4
|
export interface UseGentiqChatOptions {
|
|
@@ -13,8 +14,8 @@ export declare function useGentiqChat({ onFinish }?: UseGentiqChatOptions): {
|
|
|
13
14
|
isErrorHistory: boolean;
|
|
14
15
|
conversationId: string;
|
|
15
16
|
id: string;
|
|
16
|
-
setMessages: (messages:
|
|
17
|
-
messages:
|
|
17
|
+
setMessages: (messages: UIMessage<unknown, import('ai').UIDataTypes, import('ai').UITools>[] | ((messages: UIMessage<unknown, import('ai').UIDataTypes, import('ai').UITools>[]) => UIMessage<unknown, import('ai').UIDataTypes, import('ai').UITools>[])) => void;
|
|
18
|
+
messages: UIMessage<unknown, import('ai').UIDataTypes, import('ai').UITools>[];
|
|
18
19
|
regenerate: ({ messageId, ...options }?: {
|
|
19
20
|
messageId?: string;
|
|
20
21
|
} & import('ai').ChatRequestOptions) => Promise<void>;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { GentiqProvider, type GentiqProviderProps } from './GentiqProvider';
|
|
2
2
|
export * from './types';
|
|
3
|
-
export {
|
|
3
|
+
export { createGentiqApi, type GentiqApi } from './lib/api';
|
|
4
|
+
export { useGentiqApi } from './lib/GentiqApiContext';
|
|
4
5
|
export { default as ChatUI, type ChatUIProps } from './App';
|
|
5
6
|
export { default as Chat, type ChatProps } from './Chat';
|
|
6
7
|
export { Part, type PartProps } from './Part';
|
|
@@ -17,11 +18,11 @@ export { SettingsDialog } from './components/SettingsDialog';
|
|
|
17
18
|
export { WelcomeScreen } from './components/WelcomeScreen';
|
|
18
19
|
export { AppSidebar } from './components/AppSidebar';
|
|
19
20
|
export { SidebarProvider } from './components/ui/sidebar';
|
|
20
|
-
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from './components/ui/select';
|
|
21
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, } from './components/ui/select';
|
|
21
22
|
export { default as RequireAuth } from './components/RequireAuth';
|
|
22
23
|
export { default as UserLoginPage } from './pages/UserLoginPage';
|
|
23
24
|
export { default as SharedChatView } from './pages/SharedChatView';
|
|
24
25
|
export { useGentiqChat } from './hooks/useGentiqChat';
|
|
25
|
-
export { useGentiqUser, type UseGentiqUserOptions
|
|
26
|
+
export { useGentiqUser, type UseGentiqUserOptions } from './hooks/useGentiqUser';
|
|
26
27
|
export { useComponents } from './ComponentsContext';
|
|
27
28
|
export { useTranslation, withTranslation, Translation, Trans } from 'react-i18next';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { GentiqApi } from './api';
|
|
3
|
+
/**
|
|
4
|
+
* Access the API client of the nearest {@link GentiqProvider}.
|
|
5
|
+
*
|
|
6
|
+
* @throws if called outside a `GentiqProvider`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useGentiqApi(): GentiqApi;
|
|
9
|
+
export declare function GentiqApiProvider({ api, children }: {
|
|
10
|
+
api: GentiqApi;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/src/lib/api.d.ts
CHANGED
|
@@ -1,20 +1,39 @@
|
|
|
1
|
-
import { GentiqConfig, GentiqEndpoints, GentiqUser } from '../types';
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { AppConfigResponse, AuthResponse, FeedbackResponse, GentiqConfig, GentiqEndpoints, GentiqUser, RegisterResponse, ShareThreadResponse, SharedThreadResponse, StatusResponse, ThreadHistoryResponse, ThreadMessagesResponse, UserBalance } from '../types';
|
|
2
|
+
/** Endpoint override functions take string path segments and return a path. */
|
|
3
|
+
type EndpointFn = (...args: string[]) => string;
|
|
4
|
+
/**
|
|
5
|
+
* The user-facing API client. One instance per {@link createGentiqApi} call,
|
|
6
|
+
* each owning its own config and auth adapter so multiple `GentiqProvider`s
|
|
7
|
+
* (multi-tenant / multi-backend) never clobber one another's state.
|
|
8
|
+
*
|
|
9
|
+
* Obtain the active instance with `useGentiqApi()` inside the provider tree;
|
|
10
|
+
* call `createGentiqApi()` directly only for tests or non-React usage.
|
|
11
|
+
*/
|
|
12
|
+
export type GentiqApi = ReturnType<typeof createGentiqApi>;
|
|
13
|
+
/**
|
|
14
|
+
* Create an isolated Gentiq API client. The returned instance closes over its
|
|
15
|
+
* own `config`/`authAdapter`; reconfigure it later via {@link GentiqApi.configure}.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createGentiqApi(initialConfig?: GentiqConfig): {
|
|
18
|
+
/**
|
|
19
|
+
* Merge new config into this instance. Safe to call repeatedly (e.g. when
|
|
20
|
+
* the provider re-resolves config after fetching dynamic settings).
|
|
21
|
+
*/
|
|
22
|
+
configure: (next: GentiqConfig) => void;
|
|
4
23
|
getConfig: () => GentiqConfig;
|
|
5
24
|
getToken: () => string | null;
|
|
6
25
|
setToken: (token: string) => void;
|
|
7
26
|
clearToken: () => void;
|
|
8
27
|
getHeaders: () => Record<string, string>;
|
|
9
|
-
getEndpoint: (key: keyof GentiqEndpoints, fallback: string |
|
|
10
|
-
handleResponse: (res: Response, fallbackMessage?: string) => Promise<
|
|
11
|
-
login: (phone: string, password: string) => Promise<
|
|
12
|
-
register: (phone: string, password: string, name: string, surname: string, metadata?: Record<string, any>) => Promise<
|
|
13
|
-
getBalance: () => Promise<
|
|
14
|
-
getHistory: (skip?: number, limit?: number) => Promise<
|
|
15
|
-
getThreadMessages: (threadId: string) => Promise<
|
|
16
|
-
deleteThread: (threadId: string) => Promise<
|
|
17
|
-
updateThreadTitle: (threadId: string, title: string) => Promise<
|
|
28
|
+
getEndpoint: (key: keyof GentiqEndpoints, fallback: string | EndpointFn, ...args: string[]) => string;
|
|
29
|
+
handleResponse: <T = unknown>(res: Response, fallbackMessage?: string) => Promise<T>;
|
|
30
|
+
login: (phone: string, password: string) => Promise<AuthResponse>;
|
|
31
|
+
register: (phone: string, password: string, name: string, surname: string, metadata?: Record<string, any>) => Promise<RegisterResponse>;
|
|
32
|
+
getBalance: () => Promise<UserBalance>;
|
|
33
|
+
getHistory: (skip?: number, limit?: number) => Promise<ThreadHistoryResponse>;
|
|
34
|
+
getThreadMessages: (threadId: string) => Promise<ThreadMessagesResponse>;
|
|
35
|
+
deleteThread: (threadId: string) => Promise<StatusResponse>;
|
|
36
|
+
updateThreadTitle: (threadId: string, title: string) => Promise<StatusResponse>;
|
|
18
37
|
/**
|
|
19
38
|
* Fetch an attachment from the Minio-backed proxy endpoint and return
|
|
20
39
|
* a local blob URL usable in <img src>. Caller should revoke via
|
|
@@ -26,7 +45,7 @@ export declare const userAPI: {
|
|
|
26
45
|
* a local blob URL.
|
|
27
46
|
*/
|
|
28
47
|
getPublicAttachmentBlobUrl(object_name: string): Promise<string>;
|
|
29
|
-
saveFeedback: (threadId: string, messageId: string, sentiment: "like" | "dislike" | null) => Promise<
|
|
48
|
+
saveFeedback: (threadId: string, messageId: string, sentiment: "like" | "dislike" | null) => Promise<FeedbackResponse>;
|
|
30
49
|
getMe: () => Promise<GentiqUser>;
|
|
31
50
|
updateMe: (data: {
|
|
32
51
|
name?: string;
|
|
@@ -35,8 +54,9 @@ export declare const userAPI: {
|
|
|
35
54
|
password?: string;
|
|
36
55
|
metadata?: Record<string, any>;
|
|
37
56
|
}) => Promise<GentiqUser>;
|
|
38
|
-
pinThread: (threadId: string, pinned: boolean) => Promise<
|
|
39
|
-
shareThread: (threadId: string) => Promise<
|
|
40
|
-
getSharedThread: (shareId: string) => Promise<
|
|
41
|
-
getAppConfig: () => Promise<
|
|
57
|
+
pinThread: (threadId: string, pinned: boolean) => Promise<StatusResponse>;
|
|
58
|
+
shareThread: (threadId: string) => Promise<ShareThreadResponse>;
|
|
59
|
+
getSharedThread: (shareId: string) => Promise<SharedThreadResponse>;
|
|
60
|
+
getAppConfig: () => Promise<AppConfigResponse>;
|
|
42
61
|
};
|
|
62
|
+
export {};
|
package/dist/src/lib/errors.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TFunction } from 'i18next';
|
|
1
2
|
/**
|
|
2
3
|
* Standardized error codes for the Gentiq framework.
|
|
3
4
|
* These should match the ErrorCode Enum in the backend.
|
|
@@ -29,25 +30,25 @@ export declare const GentiqErrorCode: {
|
|
|
29
30
|
readonly VALIDATION_ERROR: "validation_error";
|
|
30
31
|
readonly NOT_FOUND: "not_found";
|
|
31
32
|
};
|
|
32
|
-
export type GentiqErrorCode = typeof GentiqErrorCode[keyof typeof GentiqErrorCode];
|
|
33
|
+
export type GentiqErrorCode = (typeof GentiqErrorCode)[keyof typeof GentiqErrorCode];
|
|
33
34
|
export interface GentiqErrorResponse {
|
|
34
35
|
error: {
|
|
35
36
|
code: GentiqErrorCode | string;
|
|
36
37
|
message: string;
|
|
37
|
-
details?:
|
|
38
|
+
details?: unknown;
|
|
38
39
|
};
|
|
39
40
|
}
|
|
40
41
|
export declare class GentiqError extends Error {
|
|
41
42
|
code: GentiqErrorCode | string;
|
|
42
43
|
status?: number;
|
|
43
|
-
details?:
|
|
44
|
+
details?: unknown;
|
|
44
45
|
constructor(response: GentiqErrorResponse, status?: number);
|
|
45
46
|
}
|
|
46
47
|
/**
|
|
47
48
|
* Checks if an error is a GentiqError.
|
|
48
49
|
*/
|
|
49
|
-
export declare function isGentiqError(error:
|
|
50
|
+
export declare function isGentiqError(error: unknown): error is GentiqError;
|
|
50
51
|
/**
|
|
51
52
|
* Returns a localized error message for a given error or code.
|
|
52
53
|
*/
|
|
53
|
-
export declare function getLocalizedErrorMessage(error:
|
|
54
|
+
export declare function getLocalizedErrorMessage(error: unknown, t: TFunction): string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { UIDataTypes, UIMessagePart, UITools } from 'ai';
|
|
2
|
+
/**
|
|
3
|
+
* A message part from the AI SDK union — covers `text`, `reasoning`, `tool-*`,
|
|
4
|
+
* `file`, and `data-*` parts. Use this instead of `any` for typed `parts` arrays.
|
|
5
|
+
*/
|
|
6
|
+
export type MessagePart = UIMessagePart<UIDataTypes, UITools>;
|
|
7
|
+
/**
|
|
8
|
+
* A loose, structural view of a message part.
|
|
9
|
+
*
|
|
10
|
+
* The AI SDK's part union (and the backend's persisted thread items) expose
|
|
11
|
+
* per-variant fields — `text`, tool `input`/`output`, file metadata, `data-*`
|
|
12
|
+
* payloads — that are not surfaced uniformly on {@link MessagePart}. Renderers
|
|
13
|
+
* read those fields through this shape so the narrowing casts live in one place
|
|
14
|
+
* instead of being scattered as `as any` across the codebase.
|
|
15
|
+
*
|
|
16
|
+
* `data` is intentionally `any`: `data-*` parts carry arbitrary payloads that
|
|
17
|
+
* are sometimes arrays (`data[0].title`) and sometimes objects (`data.id`).
|
|
18
|
+
*/
|
|
19
|
+
export interface LooseMessagePart {
|
|
20
|
+
type: string;
|
|
21
|
+
text?: string;
|
|
22
|
+
data?: any;
|
|
23
|
+
url?: string;
|
|
24
|
+
filename?: string;
|
|
25
|
+
mediaType?: string;
|
|
26
|
+
media_type?: string;
|
|
27
|
+
mime_type?: string;
|
|
28
|
+
toolName?: string;
|
|
29
|
+
tool_name?: string;
|
|
30
|
+
toolCallId?: string;
|
|
31
|
+
tool_call_id?: string;
|
|
32
|
+
state?: string;
|
|
33
|
+
input?: unknown;
|
|
34
|
+
output?: unknown;
|
|
35
|
+
error_text?: string;
|
|
36
|
+
errorText?: string;
|
|
37
|
+
object_name?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Narrow an AI SDK / backend message part to its {@link LooseMessagePart} view. */
|
|
40
|
+
export declare const asLoosePart: (part: unknown) => LooseMessagePart;
|