@amaster.ai/components-templates 1.6.0 → 1.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/components/ai-assistant/package.json +10 -12
- package/components/ai-assistant/template/ai-assistant.tsx +48 -7
- package/components/ai-assistant/template/components/chat-assistant-message.tsx +78 -7
- package/components/ai-assistant/template/components/chat-display-mode-switcher.tsx +35 -11
- package/components/ai-assistant/template/components/chat-floating-button.tsx +2 -1
- package/components/ai-assistant/template/components/chat-floating-card.tsx +49 -3
- package/components/ai-assistant/template/components/chat-header.tsx +1 -1
- package/components/ai-assistant/template/components/chat-input.tsx +57 -22
- package/components/ai-assistant/template/components/chat-messages.tsx +118 -25
- package/components/ai-assistant/template/components/chat-recommends.tsx +79 -15
- package/components/ai-assistant/template/components/voice-input.tsx +11 -2
- package/components/ai-assistant/template/hooks/useAssistantSize.ts +360 -0
- package/components/ai-assistant/template/hooks/useConversation.ts +0 -23
- package/components/ai-assistant/template/hooks/useDisplayMode.tsx +52 -5
- package/components/ai-assistant/template/hooks/useDraggable.ts +11 -3
- package/components/ai-assistant/template/hooks/usePosition.ts +19 -31
- package/components/ai-assistant/template/i18n.ts +8 -0
- package/components/ai-assistant/template/types.ts +2 -0
- package/components/ai-assistant-taro/package.json +16 -8
- package/components/ai-assistant-taro/template/components/ChatAssistantMessage.tsx +24 -2
- package/components/ai-assistant-taro/template/components/ChatInput.tsx +50 -28
- package/components/ai-assistant-taro/template/components/RecommendedQuestions.tsx +39 -0
- package/components/ai-assistant-taro/template/components/markdown.tsx +343 -137
- package/components/ai-assistant-taro/template/hooks/useConversation.ts +542 -424
- package/components/ai-assistant-taro/template/index.tsx +2 -2
- package/components/ai-assistant-taro/template/types.ts +16 -0
- package/package.json +1 -1
- package/packages/cli/package.json +1 -1
|
@@ -4,7 +4,7 @@ import { useEffect, useState } from "react";
|
|
|
4
4
|
import { ChatHeader } from "./components/ChatHeader";
|
|
5
5
|
import { ChatInput } from "./components/ChatInput";
|
|
6
6
|
import { ChatMessages } from "./components/ChatMessages";
|
|
7
|
-
import {
|
|
7
|
+
import { useConversation } from "./hooks/useConversation";
|
|
8
8
|
import { useAiAssistantI18n } from "./i18n";
|
|
9
9
|
import type { AIAssistantProps } from "./types";
|
|
10
10
|
|
|
@@ -26,7 +26,7 @@ const AIAssistantInner: React.FC<AIAssistantProps> = (props) => {
|
|
|
26
26
|
loadMoreHistory,
|
|
27
27
|
resetConversation,
|
|
28
28
|
cancelChat,
|
|
29
|
-
} =
|
|
29
|
+
} = useConversation();
|
|
30
30
|
|
|
31
31
|
useEffect(() => {
|
|
32
32
|
!starting && conversations.length === 0 && resetConversation(greeting);
|
|
@@ -29,10 +29,26 @@ export interface ToolMessage extends BaseMessage {
|
|
|
29
29
|
toolDescription?: string;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
export interface UIRenderMessage extends BaseMessage {
|
|
33
|
+
kind: "ui-render";
|
|
34
|
+
spec: {
|
|
35
|
+
root: string;
|
|
36
|
+
elements: Record<
|
|
37
|
+
string,
|
|
38
|
+
{
|
|
39
|
+
type: string;
|
|
40
|
+
props?: Record<string, unknown>;
|
|
41
|
+
children?: string[];
|
|
42
|
+
}
|
|
43
|
+
>;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
32
47
|
export type MessagesItem =
|
|
33
48
|
| TextMessage
|
|
34
49
|
| ThoughtMessage
|
|
35
50
|
| ToolMessage
|
|
51
|
+
| UIRenderMessage
|
|
36
52
|
| BaseMessage;
|
|
37
53
|
|
|
38
54
|
export interface Conversation {
|
package/package.json
CHANGED