@next-bricks/ai-portal 0.60.3 → 0.61.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/bricks.json +28 -27
- package/dist/chunks/{1480.0de951a3.js → 1480.a7ffdf61.js} +2 -2
- package/dist/chunks/1480.a7ffdf61.js.map +1 -0
- package/dist/chunks/{2232.085b8abd.js → 2232.06e10f13.js} +2 -2
- package/dist/chunks/2232.06e10f13.js.map +1 -0
- package/dist/chunks/{5712.f692e3f5.js → 5712.6b8e0a77.js} +2 -2
- package/dist/chunks/5712.6b8e0a77.js.map +1 -0
- package/dist/chunks/9164.34a6f72c.js +2 -0
- package/dist/chunks/9164.34a6f72c.js.map +1 -0
- package/dist/chunks/9271.24992b40.js +2 -0
- package/dist/chunks/9271.24992b40.js.map +1 -0
- package/dist/chunks/chat-box.3a31adcd.js +3 -0
- package/dist/chunks/chat-box.3a31adcd.js.map +1 -0
- package/dist/chunks/chat-input.8d663f4e.js +3 -0
- package/dist/chunks/chat-input.8d663f4e.js.LICENSE.txt +1 -0
- package/dist/chunks/chat-input.8d663f4e.js.map +1 -0
- package/dist/chunks/chat-stream.d3cde350.js +2 -0
- package/dist/chunks/chat-stream.d3cde350.js.map +1 -0
- package/dist/chunks/cruise-canvas.c1a7bc9f.js +2 -0
- package/dist/chunks/cruise-canvas.c1a7bc9f.js.map +1 -0
- package/dist/chunks/{main.fc9fd5d4.js → main.08d6c690.js} +2 -2
- package/dist/chunks/{main.fc9fd5d4.js.map → main.08d6c690.js.map} +1 -1
- package/dist/examples.json +17 -17
- package/dist/{index.f2850973.js → index.5a41efb9.js} +2 -2
- package/dist/{index.f2850973.js.map → index.5a41efb9.js.map} +1 -1
- package/dist/manifest.json +256 -220
- package/dist/types.json +844 -868
- package/dist-types/chat-box/index.d.ts +3 -10
- package/dist-types/chat-input/i18n.d.ts +3 -1
- package/dist-types/chat-input/index.d.ts +16 -1
- package/dist-types/chat-stream/ChatStream.d.ts +1 -1
- package/dist-types/chat-stream/index.d.ts +5 -0
- package/dist-types/cruise-canvas/CruiseCanvas.d.ts +1 -1
- package/dist-types/cruise-canvas/index.d.ts +5 -0
- package/dist-types/shared/ChatCompletions/useChatCompletions.d.ts +65 -0
- package/dist-types/shared/TaskContext.d.ts +3 -0
- package/package.json +2 -2
- package/dist/chunks/1480.0de951a3.js.map +0 -1
- package/dist/chunks/2232.085b8abd.js.map +0 -1
- package/dist/chunks/2324.a4a90c77.js +0 -2
- package/dist/chunks/2324.a4a90c77.js.map +0 -1
- package/dist/chunks/5712.f692e3f5.js.map +0 -1
- package/dist/chunks/6792.03e66697.js +0 -2
- package/dist/chunks/6792.03e66697.js.map +0 -1
- package/dist/chunks/chat-box.a8e58e50.js +0 -3
- package/dist/chunks/chat-box.a8e58e50.js.map +0 -1
- package/dist/chunks/chat-input.e999f79c.js +0 -2
- package/dist/chunks/chat-input.e999f79c.js.map +0 -1
- package/dist/chunks/chat-stream.8d8dc5a0.js +0 -2
- package/dist/chunks/chat-stream.8d8dc5a0.js.map +0 -1
- package/dist/chunks/cruise-canvas.4a0692fb.js +0 -2
- package/dist/chunks/cruise-canvas.4a0692fb.js.map +0 -1
- /package/dist/chunks/{chat-box.a8e58e50.js.LICENSE.txt → chat-box.3a31adcd.js.LICENSE.txt} +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ReactNextElement } from "@next-core/react-element";
|
|
3
3
|
import "@next-core/theme";
|
|
4
|
-
import type { ChatPayload,
|
|
4
|
+
import type { ChatPayload, UploadOptions } from "../shared/interfaces.js";
|
|
5
|
+
import { type Command } from "../shared/ChatCompletions/useChatCompletions.js";
|
|
5
6
|
export declare const ChatBoxComponent: React.ForwardRefExoticComponent<Omit<ChatBoxComponentProps, "ref"> & React.RefAttributes<ChatBoxRef>>;
|
|
6
7
|
export interface ChatBoxProps {
|
|
7
8
|
disabled?: boolean;
|
|
@@ -20,16 +21,8 @@ export interface ChatBoxRef {
|
|
|
20
21
|
getValue: () => string;
|
|
21
22
|
focusOnInput: () => void;
|
|
22
23
|
}
|
|
23
|
-
export interface Command {
|
|
24
|
-
label: string;
|
|
25
|
-
value: string;
|
|
26
|
-
groupKey?: string;
|
|
27
|
-
groupLabel?: string;
|
|
28
|
-
subCommands?: Command[];
|
|
29
|
-
payload?: CommandPayload;
|
|
30
|
-
}
|
|
31
24
|
/**
|
|
32
|
-
*
|
|
25
|
+
* 大型聊天输入框,用于首页
|
|
33
26
|
*/
|
|
34
27
|
export declare class ChatBox extends ReactNextElement implements ChatBoxProps {
|
|
35
28
|
#private;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare enum K {
|
|
2
|
-
TERMINATE_THE_TASK = "TERMINATE_THE_TASK"
|
|
2
|
+
TERMINATE_THE_TASK = "TERMINATE_THE_TASK",
|
|
3
|
+
COMMAND_TIPS = "COMMAND_TIPS",
|
|
4
|
+
SEARCH_COMMANDS_TIPS = "SEARCH_COMMANDS_TIPS"
|
|
3
5
|
}
|
|
4
6
|
export declare const NS = "bricks/ai-portal/chat-input";
|
|
5
7
|
export declare const locales: {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ReactNextElement } from "@next-core/react-element";
|
|
3
3
|
import "@next-core/theme";
|
|
4
|
+
import type { ActionsEvents, ActionsEventsMapping, ActionsProps, EoActions } from "@next-bricks/basic/actions";
|
|
4
5
|
import type { ChatPayload, UploadOptions } from "../shared/interfaces.js";
|
|
6
|
+
import { type AIEmployee, type Command } from "../shared/ChatCompletions/useChatCompletions.js";
|
|
7
|
+
export declare const WrappedActions: import("@next-core/react-element").WrappedBrickWithEventsMap<EoActions, ActionsProps & {
|
|
8
|
+
activeKeys?: (string | number)[];
|
|
9
|
+
footerTips?: string;
|
|
10
|
+
}, ActionsEvents, ActionsEventsMapping>;
|
|
5
11
|
export interface ChatInputProps {
|
|
6
12
|
placeholder?: string;
|
|
7
13
|
autoFocus?: boolean;
|
|
@@ -9,6 +15,9 @@ export interface ChatInputProps {
|
|
|
9
15
|
supportsTerminate?: boolean;
|
|
10
16
|
terminating?: boolean;
|
|
11
17
|
uploadOptions?: UploadOptions;
|
|
18
|
+
aiEmployees?: AIEmployee[];
|
|
19
|
+
commands?: Command[];
|
|
20
|
+
suggestionsPlacement?: "top" | "bottom";
|
|
12
21
|
}
|
|
13
22
|
export interface ChatInputEvents {
|
|
14
23
|
"chat.submit": CustomEvent<ChatPayload>;
|
|
@@ -19,7 +28,7 @@ export interface ChatInputMapEvents {
|
|
|
19
28
|
onTerminate: "terminate";
|
|
20
29
|
}
|
|
21
30
|
/**
|
|
22
|
-
*
|
|
31
|
+
* 小型聊天输入框,用于对话等页面
|
|
23
32
|
*/
|
|
24
33
|
export declare class ChatInput extends ReactNextElement implements ChatInputProps {
|
|
25
34
|
#private;
|
|
@@ -29,5 +38,11 @@ export declare class ChatInput extends ReactNextElement implements ChatInputProp
|
|
|
29
38
|
accessor supportsTerminate: boolean | undefined;
|
|
30
39
|
accessor terminating: boolean | undefined;
|
|
31
40
|
accessor uploadOptions: UploadOptions | undefined;
|
|
41
|
+
accessor aiEmployees: AIEmployee[] | undefined;
|
|
42
|
+
accessor commands: Command[] | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* @default "bottom"
|
|
45
|
+
*/
|
|
46
|
+
accessor suggestionsPlacement: "top" | "bottom" | undefined;
|
|
32
47
|
render(): React.JSX.Element;
|
|
33
48
|
}
|
|
@@ -11,5 +11,5 @@ interface ChatStreamComponentProps extends ChatStreamProps {
|
|
|
11
11
|
onDetailChange: (detail: ConversationDetail) => void;
|
|
12
12
|
onSplitChange: (split: boolean) => void;
|
|
13
13
|
}
|
|
14
|
-
export declare function ChatStreamComponent({ conversationId, initialRequest, replay, replayDelay, supports, showHumanActions, showFeedback: propShowFeedback, showFeedbackAfterFailed, showFeedbackOnView, showUiSwitch, previewUrlTemplate, showCases, exampleProjects, tryItOutUrl, uploadOptions, onShare, onTerminate, onSubmitFeedback, onSwitchToCanvas, onFeedbackOnView, onDetailChange, onSplitChange, }: ChatStreamComponentProps, ref: React.Ref<ChatStreamRef>): React.JSX.Element;
|
|
14
|
+
export declare function ChatStreamComponent({ conversationId, initialRequest, replay, replayDelay, supports, showHumanActions, showFeedback: propShowFeedback, showFeedbackAfterFailed, showFeedbackOnView, showUiSwitch, previewUrlTemplate, showCases, exampleProjects, tryItOutUrl, aiEmployees, commands, uploadOptions, onShare, onTerminate, onSubmitFeedback, onSwitchToCanvas, onFeedbackOnView, onDetailChange, onSplitChange, }: ChatStreamComponentProps, ref: React.Ref<ChatStreamRef>): React.JSX.Element;
|
|
15
15
|
export {};
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { ReactNextElement } from "@next-core/react-element";
|
|
3
3
|
import "@next-core/theme";
|
|
4
4
|
import type { ExampleProject, RequestStore, ShowCaseType, UploadOptions } from "../shared/interfaces.js";
|
|
5
|
+
import type { AIEmployee, Command } from "../shared/ChatCompletions/useChatCompletions.js";
|
|
5
6
|
export interface ChatStreamProps {
|
|
6
7
|
conversationId?: string;
|
|
7
8
|
initialRequest?: RequestStore | null;
|
|
@@ -17,6 +18,8 @@ export interface ChatStreamProps {
|
|
|
17
18
|
showCases?: ShowCaseType[];
|
|
18
19
|
exampleProjects?: ExampleProject[];
|
|
19
20
|
tryItOutUrl?: string;
|
|
21
|
+
aiEmployees?: AIEmployee[];
|
|
22
|
+
commands?: Command[];
|
|
20
23
|
uploadOptions?: UploadOptions;
|
|
21
24
|
}
|
|
22
25
|
export interface ConversationDetail {
|
|
@@ -49,6 +52,8 @@ export declare class ChatStream extends ReactNextElement implements ChatStreamPr
|
|
|
49
52
|
accessor showCases: ShowCaseType[] | undefined;
|
|
50
53
|
accessor exampleProjects: ExampleProject[] | undefined;
|
|
51
54
|
accessor tryItOutUrl: string | undefined;
|
|
55
|
+
accessor aiEmployees: AIEmployee[] | undefined;
|
|
56
|
+
accessor commands: Command[] | undefined;
|
|
52
57
|
accessor uploadOptions: UploadOptions | undefined;
|
|
53
58
|
resumed(): void;
|
|
54
59
|
feedbackSubmitDone(): void;
|
|
@@ -17,5 +17,5 @@ export interface CruiseCanvasRef {
|
|
|
17
17
|
feedbackSubmitFailed: () => void;
|
|
18
18
|
feedbackOnViewDone: (viewId: string) => void;
|
|
19
19
|
}
|
|
20
|
-
export declare function CruiseCanvasComponent({ conversationId, initialRequest, replay, replayDelay, supports, showHiddenJobs, showHumanActions, showFeedback: propShowFeedback, showFeedbackAfterFailed, showFeedbackOnView, showUiSwitch, showJsxEditor, previewUrlTemplate, showCases, exampleProjects, tryItOutUrl, separateInstructions, uploadOptions, onShare, onTerminate, onSubmitFeedback, onSwitchToChat, onFeedbackOnView, onDetailChange, }: CruiseCanvasComponentProps, ref: React.Ref<CruiseCanvasRef>): React.JSX.Element;
|
|
20
|
+
export declare function CruiseCanvasComponent({ conversationId, initialRequest, replay, replayDelay, supports, showHiddenJobs, showHumanActions, showFeedback: propShowFeedback, showFeedbackAfterFailed, showFeedbackOnView, showUiSwitch, showJsxEditor, previewUrlTemplate, showCases, exampleProjects, tryItOutUrl, separateInstructions, aiEmployees, commands, uploadOptions, onShare, onTerminate, onSubmitFeedback, onSwitchToChat, onFeedbackOnView, onDetailChange, }: CruiseCanvasComponentProps, ref: React.Ref<CruiseCanvasRef>): React.JSX.Element;
|
|
21
21
|
export {};
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { ReactNextElement } from "@next-core/react-element";
|
|
3
3
|
import "@next-core/theme";
|
|
4
4
|
import type { ExampleProject, RequestStore, ShowCaseType, UploadOptions } from "../shared/interfaces.js";
|
|
5
|
+
import type { AIEmployee, Command } from "../shared/ChatCompletions/useChatCompletions.js";
|
|
5
6
|
export interface CruiseCanvasProps {
|
|
6
7
|
conversationId?: string;
|
|
7
8
|
initialRequest?: RequestStore | null;
|
|
@@ -20,6 +21,8 @@ export interface CruiseCanvasProps {
|
|
|
20
21
|
exampleProjects?: ExampleProject[];
|
|
21
22
|
tryItOutUrl?: string;
|
|
22
23
|
separateInstructions?: boolean;
|
|
24
|
+
aiEmployees?: AIEmployee[];
|
|
25
|
+
commands?: Command[];
|
|
23
26
|
uploadOptions?: UploadOptions;
|
|
24
27
|
}
|
|
25
28
|
export interface ConversationDetail {
|
|
@@ -55,6 +58,8 @@ export declare class CruiseCanvas extends ReactNextElement implements CruiseCanv
|
|
|
55
58
|
accessor exampleProjects: ExampleProject[] | undefined;
|
|
56
59
|
accessor tryItOutUrl: string | undefined;
|
|
57
60
|
accessor separateInstructions: boolean | undefined;
|
|
61
|
+
accessor aiEmployees: AIEmployee[] | undefined;
|
|
62
|
+
accessor commands: Command[] | undefined;
|
|
58
63
|
accessor uploadOptions: UploadOptions | undefined;
|
|
59
64
|
resumed(): void;
|
|
60
65
|
feedbackSubmitDone(): void;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { SimpleAction } from "@next-bricks/basic/actions";
|
|
2
|
+
import { type TextareaAutoResizeRef } from "@next-shared/form";
|
|
3
|
+
import type { CommandPayload } from "../interfaces";
|
|
4
|
+
import type { ChatCommand } from "../../data-providers/set-chat-command";
|
|
5
|
+
export declare const MAX_SHOWN_COMMANDS = 10;
|
|
6
|
+
export interface MentionPopover {
|
|
7
|
+
style: React.CSSProperties;
|
|
8
|
+
range: {
|
|
9
|
+
start: number;
|
|
10
|
+
end: number;
|
|
11
|
+
};
|
|
12
|
+
actions: ActionWithSubCommands[];
|
|
13
|
+
}
|
|
14
|
+
export type ActionWithSubCommands = SimpleAction & {
|
|
15
|
+
key: string | number;
|
|
16
|
+
subCommands?: Command[];
|
|
17
|
+
payload?: CommandPayload;
|
|
18
|
+
};
|
|
19
|
+
export interface Command {
|
|
20
|
+
label: string;
|
|
21
|
+
value: string;
|
|
22
|
+
groupKey?: string;
|
|
23
|
+
groupLabel?: string;
|
|
24
|
+
subCommands?: Command[];
|
|
25
|
+
payload?: CommandPayload;
|
|
26
|
+
}
|
|
27
|
+
export interface AIEmployee {
|
|
28
|
+
employeeId: string;
|
|
29
|
+
name: string;
|
|
30
|
+
}
|
|
31
|
+
export interface UseChatMentionsParams {
|
|
32
|
+
aiEmployees?: AIEmployee[];
|
|
33
|
+
commands?: Command[];
|
|
34
|
+
root: HTMLElement;
|
|
35
|
+
hasFiles: boolean;
|
|
36
|
+
/** @default "bottom" */
|
|
37
|
+
placement?: "top" | "bottom";
|
|
38
|
+
}
|
|
39
|
+
export declare function useChatCompletions({ aiEmployees, commands: propCommands, root, hasFiles, placement, }: UseChatMentionsParams): {
|
|
40
|
+
textareaRef: React.RefObject<TextareaAutoResizeRef>;
|
|
41
|
+
valueRef: React.MutableRefObject<string>;
|
|
42
|
+
value: string;
|
|
43
|
+
setValue: React.Dispatch<React.SetStateAction<string>>;
|
|
44
|
+
selectionRef: React.MutableRefObject<{
|
|
45
|
+
start: number;
|
|
46
|
+
end: number;
|
|
47
|
+
} | null>;
|
|
48
|
+
mentioned: string | null;
|
|
49
|
+
mentionedText: string;
|
|
50
|
+
mentionPopover: MentionPopover | null;
|
|
51
|
+
mentionOverlay: React.CSSProperties[] | null;
|
|
52
|
+
mentionActiveKeys: (string | number)[] | null;
|
|
53
|
+
setInitialMention: React.Dispatch<React.SetStateAction<string | null>>;
|
|
54
|
+
handleMention: (action: SimpleAction) => void;
|
|
55
|
+
command: CommandPayload | null;
|
|
56
|
+
commandText: string;
|
|
57
|
+
commandPrefix: string;
|
|
58
|
+
commandPopover: MentionPopover | null;
|
|
59
|
+
commandOverlay: React.CSSProperties[] | null;
|
|
60
|
+
commandActiveKeys: (string | number)[] | null;
|
|
61
|
+
setInitialCommand: React.Dispatch<React.SetStateAction<ChatCommand | null>>;
|
|
62
|
+
handleSelectCommand: (action: ActionWithSubCommands) => void;
|
|
63
|
+
handleChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
64
|
+
handleKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => false | undefined;
|
|
65
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Dispatch } from "react";
|
|
2
2
|
import type { FeedbackDetail } from "../cruise-canvas/interfaces";
|
|
3
3
|
import type { ActiveDetail, ActiveImages, ConversationError, ConversationState, ExampleProject, ExtraChatPayload, FileInfo, GeneratedView, Job, ShowCaseType, Task, UploadOptions } from "./interfaces";
|
|
4
|
+
import type { AIEmployee, Command } from "./ChatCompletions/useChatCompletions";
|
|
4
5
|
export interface TaskContextValue {
|
|
5
6
|
conversationId?: string;
|
|
6
7
|
conversationState?: ConversationState;
|
|
@@ -11,6 +12,8 @@ export interface TaskContextValue {
|
|
|
11
12
|
replay?: boolean;
|
|
12
13
|
showCases?: ShowCaseType[];
|
|
13
14
|
exampleProjects?: ExampleProject[];
|
|
15
|
+
aiEmployees?: AIEmployee[];
|
|
16
|
+
commands?: Command[];
|
|
14
17
|
uploadOptions?: UploadOptions;
|
|
15
18
|
humanInput: (input: string | null, action?: string, extra?: ExtraChatPayload) => void;
|
|
16
19
|
onShare: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-bricks/ai-portal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.61.0",
|
|
4
4
|
"homepage": "https://github.com/easyops-cn/next-advanced-bricks/tree/master/bricks/ai-portal",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"@next-bricks/presentational": "*",
|
|
50
50
|
"@next-bricks/vs": "*"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "887e63f19b878c63c61f757dee8109353fa6e1a1"
|
|
53
53
|
}
|