@fileverse-dev/ddoc 2.2.8 → 2.2.9-patch-1

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/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D as d, P as r, h as s, u as t } from "./index-BUmpEjy9.mjs";
1
+ import { D as d, P as r, h as s, u as t } from "./index-B3EDDkgQ.mjs";
2
2
  export {
3
3
  d as DdocEditor,
4
4
  r as PreviewDdocEditor,
@@ -0,0 +1,3 @@
1
+ import { Extension } from '@tiptap/core';
2
+
3
+ export declare const AiAutocomplete: Extension<any, any>;
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { NodeViewProps } from '@tiptap/react';
3
+
4
+ export declare const AIWriterNodeView: React.MemoExoticComponent<({ node, editor: parentEditor, getPos, updateAttributes }: NodeViewProps) => import("react/jsx-runtime").JSX.Element | null>;
@@ -0,0 +1,20 @@
1
+ import { Node } from '@tiptap/react';
2
+
3
+ export interface AIWriterOptions {
4
+ HTMLAttributes: Record<string, any>;
5
+ }
6
+ declare module '@tiptap/core' {
7
+ interface Commands<ReturnType> {
8
+ aiWriter: {
9
+ /**
10
+ * Add a prompt card
11
+ */
12
+ insertAIWriter: (options: {
13
+ prompt: string;
14
+ content: string;
15
+ tone: string;
16
+ }) => ReturnType;
17
+ };
18
+ }
19
+ }
20
+ export declare const AIWriter: Node<AIWriterOptions, any>;
@@ -0,0 +1 @@
1
+ export * from './ai-writer';
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Represents a tone option for AI text generation
3
+ */
4
+ export interface ToneOption {
5
+ value: string;
6
+ label: string;
7
+ }
8
+ /**
9
+ * Available tone options for AI text generation
10
+ */
11
+ export declare const TONE_OPTIONS: ToneOption[];
12
+ export declare const loadingMessages: string[];
13
+ export interface ModelOption {
14
+ value: string;
15
+ label: string;
16
+ }
17
+ export interface CustomModel {
18
+ modelName: string;
19
+ label: string;
20
+ }
21
+ export interface ModelContextType {
22
+ defaultModels: CustomModel[];
23
+ isLoadingDefaultModels: boolean;
24
+ ollamaError: string | null;
25
+ activeModel?: CustomModel;
26
+ setActiveModel: (model: CustomModel | undefined) => void;
27
+ maxTokens: number;
28
+ setMaxTokens: (maxTokens: number) => void;
29
+ tone: string;
30
+ setTone: (tone: string) => void;
31
+ systemPrompt: string;
32
+ setSystemPrompt: (prompt: string) => void;
33
+ selectedLLM: string | null;
34
+ setSelectedLLM: (llm: string | null) => void;
35
+ onPromptUsage?: () => void;
36
+ }
37
+ export interface ModelService {
38
+ callModel?: (prompt: string, model: string) => Promise<string>;
39
+ streamModel?: (prompt: string, model: string, onChunk: (chunk: string) => void, signal?: AbortSignal) => Promise<void>;
40
+ getAvailableModels?: () => Promise<ModelOption[]>;
41
+ }
42
+ export interface WindowWithModelContext extends Window {
43
+ __MODEL_CONTEXT__?: ModelContextType;
44
+ }
@@ -0,0 +1,5 @@
1
+ import { default as MarkdownIt } from 'markdown-it';
2
+
3
+ export declare const getLoadingMessageInOrder: () => string;
4
+ export declare const getRandomLoadingMessage: () => string;
5
+ export declare const md: MarkdownIt;
@@ -1,3 +1,3 @@
1
- import { Node } from '@tiptap/core';
1
+ import { Node as TiptapNode } from '@tiptap/core';
2
2
 
3
- export declare const Callout: Node<any, any>;
3
+ export declare const Callout: TiptapNode<any, any>;
@@ -4,6 +4,7 @@ export interface DBlockOptions {
4
4
  HTMLAttributes: Record<string, any>;
5
5
  secureImageUploadUrl?: string;
6
6
  onCopyHeadingLink?: (link: string) => void;
7
+ hasAvailableModels?: boolean;
7
8
  }
8
9
  declare module '@tiptap/core' {
9
10
  interface Commands<ReturnType> {
@@ -1,5 +1,5 @@
1
1
  import { Extension } from '@tiptap/core';
2
2
 
3
3
  export declare const Command: Extension<any, any>;
4
- declare const SlashCommand: (onError?: (errorString: string) => void, secureImageUploadUrl?: string) => Extension<any, any>;
4
+ declare const SlashCommand: (onError?: (errorString: string) => void, secureImageUploadUrl?: string, hasAvailableModels?: boolean) => Extension<any, any>;
5
5
  export default SlashCommand;
@@ -1,15 +1,25 @@
1
1
  import { CommandProps } from './types';
2
2
 
3
- export declare const getSuggestionItems: ({ query, onError, secureImageUploadUrl, }: {
3
+ export declare const getSuggestionItems: ({ query, onError, secureImageUploadUrl, hasAvailableModels, }: {
4
4
  query: string;
5
5
  onError?: (errorString: string) => void;
6
6
  secureImageUploadUrl?: string;
7
- }) => {
7
+ hasAvailableModels?: boolean;
8
+ }) => ({
8
9
  title: string;
9
10
  description: string;
10
11
  searchTerms: string[];
11
12
  icon: import("react/jsx-runtime").JSX.Element;
12
13
  image: string;
13
14
  command: ({ editor, range }: CommandProps) => void;
14
- }[];
15
+ isDisabled: boolean;
16
+ } | {
17
+ title: string;
18
+ description: string;
19
+ searchTerms: string[];
20
+ icon: import("react/jsx-runtime").JSX.Element;
21
+ image: string;
22
+ command: ({ editor, range }: CommandProps) => void;
23
+ isDisabled?: undefined;
24
+ })[];
15
25
  export declare const updateScrollView: (container: HTMLElement, item: HTMLElement) => void;
@@ -6,6 +6,7 @@ export interface CommandItemProps {
6
6
  description: string;
7
7
  icon: ReactNode;
8
8
  image?: string;
9
+ isDisabled?: boolean;
9
10
  }
10
11
  export interface CommandProps {
11
12
  editor: Editor;
@@ -23,6 +23,15 @@ export interface CommentAccountProps {
23
23
  connectViaUsername?: (username: string) => Promise<void>;
24
24
  isDDocOwner?: boolean;
25
25
  }
26
+ export interface CustomModel {
27
+ id?: string;
28
+ label: string;
29
+ modelName: string;
30
+ endpoint: string;
31
+ contextSize: number;
32
+ apiKey: string;
33
+ systemPrompt: string;
34
+ }
26
35
  export interface DdocProps extends CommentAccountProps {
27
36
  isCollabDocumentPublished?: boolean;
28
37
  disableInlineComment?: boolean;
@@ -95,6 +104,9 @@ export interface DdocProps extends CommentAccountProps {
95
104
  metadataProxyUrl?: string;
96
105
  onCopyHeadingLink?: (link: string) => void;
97
106
  footerHeight?: string;
107
+ activeModel?: CustomModel;
108
+ maxTokens?: number;
109
+ isAIAgentEnabled?: boolean;
98
110
  }
99
111
  export interface IEditorSelectionData {
100
112
  from: number;
@@ -1,7 +1,7 @@
1
1
  import { DdocProps } from './types';
2
2
 
3
3
  import * as Y from 'yjs';
4
- export declare const useDdocEditor: ({ isPreviewMode, initialContent, enableCollaboration, collaborationId, walletAddress, username, onChange, onCollaboratorChange, onCommentInteraction, ensResolutionUrl, onError, setCharacterCount, setWordCount, secureImageUploadUrl, ddocId, enableIndexeddbSync, unFocused, zoomLevel, onInvalidContentError, ignoreCorruptedData, isPresentationMode, proExtensions, metadataProxyUrl, onCopyHeadingLink, }: Partial<DdocProps>) => {
4
+ export declare const useDdocEditor: ({ isPreviewMode, initialContent, enableCollaboration, collaborationId, walletAddress, username, onChange, onCollaboratorChange, onCommentInteraction, ensResolutionUrl, onError, setCharacterCount, setWordCount, secureImageUploadUrl, ddocId, enableIndexeddbSync, unFocused, zoomLevel, onInvalidContentError, ignoreCorruptedData, isPresentationMode, proExtensions, metadataProxyUrl, onCopyHeadingLink, activeModel, maxTokens, isAIAgentEnabled, }: Partial<DdocProps>) => {
5
5
  editor: import('@tiptap/core').Editor | null;
6
6
  isContentLoading: boolean;
7
7
  ref: import('react').RefObject<HTMLDivElement>;
@@ -0,0 +1 @@
1
+ export declare const isLikelyLatex: (input: string) => boolean;
@@ -5,4 +5,5 @@ export declare const useResponsive: () => {
5
5
  isNativeMobile: boolean;
6
6
  isIOS: boolean;
7
7
  isMobile: boolean;
8
+ isWindows: boolean;
8
9
  };