@infuro/cms-core 1.0.7 → 1.0.8
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/admin.cjs +270 -41
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.d.cts +3 -1
- package/dist/admin.d.ts +3 -1
- package/dist/admin.js +304 -75
- package/dist/admin.js.map +1 -1
- package/dist/api.cjs +131 -1
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +131 -1
- package/dist/api.js.map +1 -1
- package/dist/{index-BPnATEXW.d.cts → index-P5ajDo8-.d.cts} +9 -0
- package/dist/{index-BPnATEXW.d.ts → index-P5ajDo8-.d.ts} +9 -0
- package/dist/index.cjs +699 -263
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +91 -3
- package/dist/index.d.ts +91 -3
- package/dist/index.js +682 -252
- package/dist/index.js.map +1 -1
- package/dist/migrations/1731800000000-ChatAndKnowledgeBase.ts +39 -0
- package/dist/migrations/1731900000000-KnowledgeBaseVector.ts +17 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as StorageService } from './index-
|
|
2
|
-
export { A as AnalyticsHandlerConfig, a as AuthHandlersConfig, B as BlogBySlugConfig, C as ChangePasswordConfig, b as CmsApiHandlerConfig, c as CmsGetter, d as CrudHandlerOptions, D as DashboardStatsConfig, E as EntityMap, F as ForgotPasswordConfig, e as FormBySlugConfig, I as InviteAcceptConfig, f as SetPasswordConfig, g as SettingsApiConfig, U as UploadHandlerConfig, h as UserAuthApiConfig, i as UserAvatarConfig, j as UserProfileConfig, k as UsersApiConfig, l as createAnalyticsHandlers, m as createBlogBySlugHandler, n as createChangePasswordHandler, o as createCmsApiHandler, p as createCrudByIdHandler, q as createCrudHandler, r as createDashboardStatsHandler, s as createForgotPasswordHandler, t as createFormBySlugHandler, u as createInviteAcceptHandler, v as createSetPasswordHandler, w as createSettingsApiHandlers, x as createUploadHandler, y as createUserAuthApiRouter, z as createUserAvatarHandler, G as createUserProfileHandler, H as createUsersApiHandlers } from './index-
|
|
1
|
+
import { S as StorageService } from './index-P5ajDo8-.cjs';
|
|
2
|
+
export { A as AnalyticsHandlerConfig, a as AuthHandlersConfig, B as BlogBySlugConfig, C as ChangePasswordConfig, b as CmsApiHandlerConfig, c as CmsGetter, d as CrudHandlerOptions, D as DashboardStatsConfig, E as EntityMap, F as ForgotPasswordConfig, e as FormBySlugConfig, I as InviteAcceptConfig, f as SetPasswordConfig, g as SettingsApiConfig, U as UploadHandlerConfig, h as UserAuthApiConfig, i as UserAvatarConfig, j as UserProfileConfig, k as UsersApiConfig, l as createAnalyticsHandlers, m as createBlogBySlugHandler, n as createChangePasswordHandler, o as createCmsApiHandler, p as createCrudByIdHandler, q as createCrudHandler, r as createDashboardStatsHandler, s as createForgotPasswordHandler, t as createFormBySlugHandler, u as createInviteAcceptHandler, v as createSetPasswordHandler, w as createSettingsApiHandlers, x as createUploadHandler, y as createUserAuthApiRouter, z as createUserAvatarHandler, G as createUserProfileHandler, H as createUsersApiHandlers } from './index-P5ajDo8-.cjs';
|
|
3
3
|
import { ClassValue } from 'clsx';
|
|
4
4
|
import * as typeorm from 'typeorm';
|
|
5
5
|
import { EntityTarget } from 'typeorm';
|
|
@@ -281,6 +281,56 @@ interface LocalStoragePluginConfig {
|
|
|
281
281
|
}
|
|
282
282
|
declare function localStoragePlugin(config?: LocalStoragePluginConfig): CmsPlugin<StorageService>;
|
|
283
283
|
|
|
284
|
+
interface LlmMessage {
|
|
285
|
+
role: 'user' | 'assistant' | 'system';
|
|
286
|
+
content: string;
|
|
287
|
+
}
|
|
288
|
+
interface LlmChatOptions {
|
|
289
|
+
model?: string;
|
|
290
|
+
temperature?: number;
|
|
291
|
+
max_tokens?: number;
|
|
292
|
+
}
|
|
293
|
+
interface LlmServiceInterface {
|
|
294
|
+
chat(messages: LlmMessage[], options?: LlmChatOptions): Promise<{
|
|
295
|
+
content: string;
|
|
296
|
+
}>;
|
|
297
|
+
streamChat(messages: LlmMessage[], options?: LlmChatOptions): AsyncIterable<string>;
|
|
298
|
+
/** OpenAI-compatible embeddings; returns [] if gateway does not support /v1/embeddings */
|
|
299
|
+
embed?(text: string, options?: {
|
|
300
|
+
model?: string;
|
|
301
|
+
}): Promise<number[]>;
|
|
302
|
+
}
|
|
303
|
+
declare class LlmService implements LlmServiceInterface {
|
|
304
|
+
private readonly baseURL;
|
|
305
|
+
private readonly apiKey;
|
|
306
|
+
private readonly defaultEmbeddingModel?;
|
|
307
|
+
private static embedWarned;
|
|
308
|
+
constructor(baseURL: string, apiKey: string, defaultEmbeddingModel?: string | undefined);
|
|
309
|
+
private get base();
|
|
310
|
+
private get url();
|
|
311
|
+
/**
|
|
312
|
+
* OpenAI-compatible embeddings. Returns [] if endpoint not available or unexpected response.
|
|
313
|
+
* Server must implement: POST /v1/embeddings
|
|
314
|
+
* Body: { model: string, input: string }
|
|
315
|
+
* Response: { data: [ { embedding: number[] } ] } or { embedding: number[] }
|
|
316
|
+
*/
|
|
317
|
+
embed(text: string, options?: {
|
|
318
|
+
model?: string;
|
|
319
|
+
}): Promise<number[]>;
|
|
320
|
+
chat(messages: LlmMessage[], options?: LlmChatOptions): Promise<{
|
|
321
|
+
content: string;
|
|
322
|
+
}>;
|
|
323
|
+
streamChat(messages: LlmMessage[], options?: LlmChatOptions): AsyncIterable<string>;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
interface LlmPluginConfig {
|
|
327
|
+
baseURL?: string;
|
|
328
|
+
apiKey?: string;
|
|
329
|
+
/** Default model for embed(); also from env EMBEDDING_MODEL (e.g. for Qwen use your server's embedding model name). */
|
|
330
|
+
embeddingModel?: string;
|
|
331
|
+
}
|
|
332
|
+
declare function llmPlugin(config?: LlmPluginConfig): CmsPlugin<LlmService | undefined>;
|
|
333
|
+
|
|
284
334
|
declare function cn(...inputs: ClassValue[]): string;
|
|
285
335
|
declare function generateSlug(title: string): string;
|
|
286
336
|
declare function validateSlug(slug: string): boolean;
|
|
@@ -722,6 +772,24 @@ declare class Order {
|
|
|
722
772
|
payments: Payment[];
|
|
723
773
|
}
|
|
724
774
|
|
|
775
|
+
declare class ChatMessage {
|
|
776
|
+
id: number;
|
|
777
|
+
conversationId: number;
|
|
778
|
+
role: 'user' | 'assistant' | 'system';
|
|
779
|
+
content: string;
|
|
780
|
+
createdAt: Date;
|
|
781
|
+
conversation: ChatConversation;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
declare class ChatConversation {
|
|
785
|
+
id: number;
|
|
786
|
+
contactId: number;
|
|
787
|
+
createdAt: Date;
|
|
788
|
+
updatedAt: Date;
|
|
789
|
+
contact: Contact;
|
|
790
|
+
messages: ChatMessage[];
|
|
791
|
+
}
|
|
792
|
+
|
|
725
793
|
declare class Contact {
|
|
726
794
|
id: number;
|
|
727
795
|
name: string;
|
|
@@ -742,6 +810,7 @@ declare class Contact {
|
|
|
742
810
|
addresses: Address[];
|
|
743
811
|
orders: Order[];
|
|
744
812
|
payments: Payment[];
|
|
813
|
+
chatConversations: ChatConversation[];
|
|
745
814
|
}
|
|
746
815
|
|
|
747
816
|
declare class Config {
|
|
@@ -794,7 +863,26 @@ declare class Page {
|
|
|
794
863
|
deletedBy: number | null;
|
|
795
864
|
}
|
|
796
865
|
|
|
866
|
+
declare class KnowledgeBaseChunk {
|
|
867
|
+
id: number;
|
|
868
|
+
documentId: number;
|
|
869
|
+
content: string;
|
|
870
|
+
chunkIndex: number;
|
|
871
|
+
createdAt: Date;
|
|
872
|
+
document: KnowledgeBaseDocument;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
declare class KnowledgeBaseDocument {
|
|
876
|
+
id: number;
|
|
877
|
+
name: string;
|
|
878
|
+
sourceUrl: string | null;
|
|
879
|
+
content: string;
|
|
880
|
+
createdAt: Date;
|
|
881
|
+
updatedAt: Date;
|
|
882
|
+
chunks: KnowledgeBaseChunk[];
|
|
883
|
+
}
|
|
884
|
+
|
|
797
885
|
/** Map API resource segment (e.g. "blogs", "form_submissions") to entity. Used by CRUD handler. */
|
|
798
886
|
declare const CMS_ENTITY_MAP: Record<string, EntityTarget<typeorm.ObjectLiteral>>;
|
|
799
887
|
|
|
800
|
-
export { type AnalyticsPluginConfig, Attribute, Blog, Brand, CMS_ENTITY_MAP, Category, type CmsApp, type CmsPlugin, Collection, Comment, Config, Contact, type CreateCmsAppOptions, type ERPPluginConfig, type ERPPluginInstance, type EmailData, type EmailPluginConfig, EmailService, type EmailServiceInterface, Form, FormField, FormSubmission, type LocalStoragePluginConfig, type Logger, Media, Order, OrderItem, Page, PasswordResetToken, Payment, type PaymentIntent, type PaymentPluginConfig, type PaymentServiceInterface, Permission, type PluginContext, Product, ProductAttribute, ProductCategory, ProductTax, type S3StoragePluginConfig, Seo, StorageService, Tag, Tax, User, UserGroup, analyticsPlugin, cn, createCmsApp, emailPlugin, emailTemplates, erpPlugin, formatDate, formatDateOnly, formatDateTime, generateSlug, localStoragePlugin, paymentPlugin, s3StoragePlugin, smsPlugin, truncateText, validateSlug };
|
|
888
|
+
export { type AnalyticsPluginConfig, Attribute, Blog, Brand, CMS_ENTITY_MAP, Category, ChatConversation, ChatMessage, type CmsApp, type CmsPlugin, Collection, Comment, Config, Contact, type CreateCmsAppOptions, type ERPPluginConfig, type ERPPluginInstance, type EmailData, type EmailPluginConfig, EmailService, type EmailServiceInterface, Form, FormField, FormSubmission, KnowledgeBaseChunk, KnowledgeBaseDocument, type LlmChatOptions, type LlmMessage, type LlmPluginConfig, LlmService, type LlmServiceInterface, type LocalStoragePluginConfig, type Logger, Media, Order, OrderItem, Page, PasswordResetToken, Payment, type PaymentIntent, type PaymentPluginConfig, type PaymentServiceInterface, Permission, type PluginContext, Product, ProductAttribute, ProductCategory, ProductTax, type S3StoragePluginConfig, Seo, StorageService, Tag, Tax, User, UserGroup, analyticsPlugin, cn, createCmsApp, emailPlugin, emailTemplates, erpPlugin, formatDate, formatDateOnly, formatDateTime, generateSlug, llmPlugin, localStoragePlugin, paymentPlugin, s3StoragePlugin, smsPlugin, truncateText, validateSlug };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as StorageService } from './index-
|
|
2
|
-
export { A as AnalyticsHandlerConfig, a as AuthHandlersConfig, B as BlogBySlugConfig, C as ChangePasswordConfig, b as CmsApiHandlerConfig, c as CmsGetter, d as CrudHandlerOptions, D as DashboardStatsConfig, E as EntityMap, F as ForgotPasswordConfig, e as FormBySlugConfig, I as InviteAcceptConfig, f as SetPasswordConfig, g as SettingsApiConfig, U as UploadHandlerConfig, h as UserAuthApiConfig, i as UserAvatarConfig, j as UserProfileConfig, k as UsersApiConfig, l as createAnalyticsHandlers, m as createBlogBySlugHandler, n as createChangePasswordHandler, o as createCmsApiHandler, p as createCrudByIdHandler, q as createCrudHandler, r as createDashboardStatsHandler, s as createForgotPasswordHandler, t as createFormBySlugHandler, u as createInviteAcceptHandler, v as createSetPasswordHandler, w as createSettingsApiHandlers, x as createUploadHandler, y as createUserAuthApiRouter, z as createUserAvatarHandler, G as createUserProfileHandler, H as createUsersApiHandlers } from './index-
|
|
1
|
+
import { S as StorageService } from './index-P5ajDo8-.js';
|
|
2
|
+
export { A as AnalyticsHandlerConfig, a as AuthHandlersConfig, B as BlogBySlugConfig, C as ChangePasswordConfig, b as CmsApiHandlerConfig, c as CmsGetter, d as CrudHandlerOptions, D as DashboardStatsConfig, E as EntityMap, F as ForgotPasswordConfig, e as FormBySlugConfig, I as InviteAcceptConfig, f as SetPasswordConfig, g as SettingsApiConfig, U as UploadHandlerConfig, h as UserAuthApiConfig, i as UserAvatarConfig, j as UserProfileConfig, k as UsersApiConfig, l as createAnalyticsHandlers, m as createBlogBySlugHandler, n as createChangePasswordHandler, o as createCmsApiHandler, p as createCrudByIdHandler, q as createCrudHandler, r as createDashboardStatsHandler, s as createForgotPasswordHandler, t as createFormBySlugHandler, u as createInviteAcceptHandler, v as createSetPasswordHandler, w as createSettingsApiHandlers, x as createUploadHandler, y as createUserAuthApiRouter, z as createUserAvatarHandler, G as createUserProfileHandler, H as createUsersApiHandlers } from './index-P5ajDo8-.js';
|
|
3
3
|
import { ClassValue } from 'clsx';
|
|
4
4
|
import * as typeorm from 'typeorm';
|
|
5
5
|
import { EntityTarget } from 'typeorm';
|
|
@@ -281,6 +281,56 @@ interface LocalStoragePluginConfig {
|
|
|
281
281
|
}
|
|
282
282
|
declare function localStoragePlugin(config?: LocalStoragePluginConfig): CmsPlugin<StorageService>;
|
|
283
283
|
|
|
284
|
+
interface LlmMessage {
|
|
285
|
+
role: 'user' | 'assistant' | 'system';
|
|
286
|
+
content: string;
|
|
287
|
+
}
|
|
288
|
+
interface LlmChatOptions {
|
|
289
|
+
model?: string;
|
|
290
|
+
temperature?: number;
|
|
291
|
+
max_tokens?: number;
|
|
292
|
+
}
|
|
293
|
+
interface LlmServiceInterface {
|
|
294
|
+
chat(messages: LlmMessage[], options?: LlmChatOptions): Promise<{
|
|
295
|
+
content: string;
|
|
296
|
+
}>;
|
|
297
|
+
streamChat(messages: LlmMessage[], options?: LlmChatOptions): AsyncIterable<string>;
|
|
298
|
+
/** OpenAI-compatible embeddings; returns [] if gateway does not support /v1/embeddings */
|
|
299
|
+
embed?(text: string, options?: {
|
|
300
|
+
model?: string;
|
|
301
|
+
}): Promise<number[]>;
|
|
302
|
+
}
|
|
303
|
+
declare class LlmService implements LlmServiceInterface {
|
|
304
|
+
private readonly baseURL;
|
|
305
|
+
private readonly apiKey;
|
|
306
|
+
private readonly defaultEmbeddingModel?;
|
|
307
|
+
private static embedWarned;
|
|
308
|
+
constructor(baseURL: string, apiKey: string, defaultEmbeddingModel?: string | undefined);
|
|
309
|
+
private get base();
|
|
310
|
+
private get url();
|
|
311
|
+
/**
|
|
312
|
+
* OpenAI-compatible embeddings. Returns [] if endpoint not available or unexpected response.
|
|
313
|
+
* Server must implement: POST /v1/embeddings
|
|
314
|
+
* Body: { model: string, input: string }
|
|
315
|
+
* Response: { data: [ { embedding: number[] } ] } or { embedding: number[] }
|
|
316
|
+
*/
|
|
317
|
+
embed(text: string, options?: {
|
|
318
|
+
model?: string;
|
|
319
|
+
}): Promise<number[]>;
|
|
320
|
+
chat(messages: LlmMessage[], options?: LlmChatOptions): Promise<{
|
|
321
|
+
content: string;
|
|
322
|
+
}>;
|
|
323
|
+
streamChat(messages: LlmMessage[], options?: LlmChatOptions): AsyncIterable<string>;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
interface LlmPluginConfig {
|
|
327
|
+
baseURL?: string;
|
|
328
|
+
apiKey?: string;
|
|
329
|
+
/** Default model for embed(); also from env EMBEDDING_MODEL (e.g. for Qwen use your server's embedding model name). */
|
|
330
|
+
embeddingModel?: string;
|
|
331
|
+
}
|
|
332
|
+
declare function llmPlugin(config?: LlmPluginConfig): CmsPlugin<LlmService | undefined>;
|
|
333
|
+
|
|
284
334
|
declare function cn(...inputs: ClassValue[]): string;
|
|
285
335
|
declare function generateSlug(title: string): string;
|
|
286
336
|
declare function validateSlug(slug: string): boolean;
|
|
@@ -722,6 +772,24 @@ declare class Order {
|
|
|
722
772
|
payments: Payment[];
|
|
723
773
|
}
|
|
724
774
|
|
|
775
|
+
declare class ChatMessage {
|
|
776
|
+
id: number;
|
|
777
|
+
conversationId: number;
|
|
778
|
+
role: 'user' | 'assistant' | 'system';
|
|
779
|
+
content: string;
|
|
780
|
+
createdAt: Date;
|
|
781
|
+
conversation: ChatConversation;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
declare class ChatConversation {
|
|
785
|
+
id: number;
|
|
786
|
+
contactId: number;
|
|
787
|
+
createdAt: Date;
|
|
788
|
+
updatedAt: Date;
|
|
789
|
+
contact: Contact;
|
|
790
|
+
messages: ChatMessage[];
|
|
791
|
+
}
|
|
792
|
+
|
|
725
793
|
declare class Contact {
|
|
726
794
|
id: number;
|
|
727
795
|
name: string;
|
|
@@ -742,6 +810,7 @@ declare class Contact {
|
|
|
742
810
|
addresses: Address[];
|
|
743
811
|
orders: Order[];
|
|
744
812
|
payments: Payment[];
|
|
813
|
+
chatConversations: ChatConversation[];
|
|
745
814
|
}
|
|
746
815
|
|
|
747
816
|
declare class Config {
|
|
@@ -794,7 +863,26 @@ declare class Page {
|
|
|
794
863
|
deletedBy: number | null;
|
|
795
864
|
}
|
|
796
865
|
|
|
866
|
+
declare class KnowledgeBaseChunk {
|
|
867
|
+
id: number;
|
|
868
|
+
documentId: number;
|
|
869
|
+
content: string;
|
|
870
|
+
chunkIndex: number;
|
|
871
|
+
createdAt: Date;
|
|
872
|
+
document: KnowledgeBaseDocument;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
declare class KnowledgeBaseDocument {
|
|
876
|
+
id: number;
|
|
877
|
+
name: string;
|
|
878
|
+
sourceUrl: string | null;
|
|
879
|
+
content: string;
|
|
880
|
+
createdAt: Date;
|
|
881
|
+
updatedAt: Date;
|
|
882
|
+
chunks: KnowledgeBaseChunk[];
|
|
883
|
+
}
|
|
884
|
+
|
|
797
885
|
/** Map API resource segment (e.g. "blogs", "form_submissions") to entity. Used by CRUD handler. */
|
|
798
886
|
declare const CMS_ENTITY_MAP: Record<string, EntityTarget<typeorm.ObjectLiteral>>;
|
|
799
887
|
|
|
800
|
-
export { type AnalyticsPluginConfig, Attribute, Blog, Brand, CMS_ENTITY_MAP, Category, type CmsApp, type CmsPlugin, Collection, Comment, Config, Contact, type CreateCmsAppOptions, type ERPPluginConfig, type ERPPluginInstance, type EmailData, type EmailPluginConfig, EmailService, type EmailServiceInterface, Form, FormField, FormSubmission, type LocalStoragePluginConfig, type Logger, Media, Order, OrderItem, Page, PasswordResetToken, Payment, type PaymentIntent, type PaymentPluginConfig, type PaymentServiceInterface, Permission, type PluginContext, Product, ProductAttribute, ProductCategory, ProductTax, type S3StoragePluginConfig, Seo, StorageService, Tag, Tax, User, UserGroup, analyticsPlugin, cn, createCmsApp, emailPlugin, emailTemplates, erpPlugin, formatDate, formatDateOnly, formatDateTime, generateSlug, localStoragePlugin, paymentPlugin, s3StoragePlugin, smsPlugin, truncateText, validateSlug };
|
|
888
|
+
export { type AnalyticsPluginConfig, Attribute, Blog, Brand, CMS_ENTITY_MAP, Category, ChatConversation, ChatMessage, type CmsApp, type CmsPlugin, Collection, Comment, Config, Contact, type CreateCmsAppOptions, type ERPPluginConfig, type ERPPluginInstance, type EmailData, type EmailPluginConfig, EmailService, type EmailServiceInterface, Form, FormField, FormSubmission, KnowledgeBaseChunk, KnowledgeBaseDocument, type LlmChatOptions, type LlmMessage, type LlmPluginConfig, LlmService, type LlmServiceInterface, type LocalStoragePluginConfig, type Logger, Media, Order, OrderItem, Page, PasswordResetToken, Payment, type PaymentIntent, type PaymentPluginConfig, type PaymentServiceInterface, Permission, type PluginContext, Product, ProductAttribute, ProductCategory, ProductTax, type S3StoragePluginConfig, Seo, StorageService, Tag, Tax, User, UserGroup, analyticsPlugin, cn, createCmsApp, emailPlugin, emailTemplates, erpPlugin, formatDate, formatDateOnly, formatDateTime, generateSlug, llmPlugin, localStoragePlugin, paymentPlugin, s3StoragePlugin, smsPlugin, truncateText, validateSlug };
|