2
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
"dependencies": {
|
||||
"@heroui/react": "2.8.3",
|
||||
"@heroui/theme": "2.4.21",
|
||||
"@mujian/js-sdk": "0.0.6-beta.33",
|
||||
"@mujian/js-sdk": "0.0.6-beta.41",
|
||||
"@tailwindcss/vite": "4.1.12",
|
||||
"ahooks": "3.9.5",
|
||||
"axios": "1.11.0",
|
||||
|
||||
10
pnpm-lock.yaml
generated
10
pnpm-lock.yaml
generated
@@ -15,8 +15,8 @@ importers:
|
||||
specifier: 2.4.21
|
||||
version: 2.4.21(tailwindcss@4.1.12)
|
||||
'@mujian/js-sdk':
|
||||
specifier: 0.0.6-beta.33
|
||||
version: 0.0.6-beta.33(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
|
||||
specifier: 0.0.6-beta.41
|
||||
version: 0.0.6-beta.41(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
|
||||
'@tailwindcss/vite':
|
||||
specifier: 4.1.12
|
||||
version: 4.1.12(vite@7.1.2(@types/node@22.13.9)(jiti@2.5.1)(lightningcss@1.30.1))
|
||||
@@ -951,8 +951,8 @@ packages:
|
||||
engines: {node: '>=18.0.0'}
|
||||
hasBin: true
|
||||
|
||||
'@mujian/js-sdk@0.0.6-beta.33':
|
||||
resolution: {integrity: sha512-x2pT2rD3c1njXMbyPpVGMuA2mhN4qZ6bKtyUCKaOiqKPsj0U7VzCBcMBu2PvJWEFTCGfkvxNWRLRe6ebVg/uew==}
|
||||
'@mujian/js-sdk@0.0.6-beta.41':
|
||||
resolution: {integrity: sha512-D61IblTK5h7LfL/4maeikxRkNzq+SVGDVPY18MBCKfJ8c+AEvaEM3QKnq9V0ytAQikV8oA+sOnJkAgmwXxEFTQ==}
|
||||
peerDependencies:
|
||||
react: ~19.1.1
|
||||
react-dom: ~19.1.1
|
||||
@@ -4471,7 +4471,7 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@mujian/js-sdk@0.0.6-beta.33(react-dom@19.1.1(react@19.1.1))(react@19.1.1)':
|
||||
'@mujian/js-sdk@0.0.6-beta.41(react-dom@19.1.1(react@19.1.1))(react@19.1.1)':
|
||||
dependencies:
|
||||
'@adobe/css-tools': 4.4.4
|
||||
ahooks: 3.9.5(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
|
||||
|
||||
@@ -22,7 +22,6 @@ export const MessageEditArea = ({
|
||||
const t = textareaRef.current;
|
||||
if (t) {
|
||||
const parent = t.parentElement;
|
||||
console.log(parent);
|
||||
|
||||
t.style.height = 'auto';
|
||||
t.style.height = t.scrollHeight + 'px';
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Alert, ScrollShadow, Spinner } from '@heroui/react';
|
||||
import { useChat, useMujian } from '@mujian/js-sdk/react';
|
||||
import type { ProjectInfo } from '@mujian/js-sdk/types';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { useGlobalStore } from '@/store/global';
|
||||
import { MessageList } from './MessageList';
|
||||
@@ -9,15 +10,23 @@ import { MsgSend } from './MsgSend';
|
||||
declare global {
|
||||
interface Window {
|
||||
$mj_engine: {
|
||||
chat: {
|
||||
complete?: (message: string) => Promise<void>;
|
||||
ai: {
|
||||
chat: {
|
||||
complete?: (message: string) => Promise<void>;
|
||||
project?: ProjectInfo;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
window.$mj_engine = {
|
||||
chat: {},
|
||||
ai: {
|
||||
chat: {
|
||||
complete: undefined,
|
||||
project: undefined,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const Chat = () => {
|
||||
@@ -41,6 +50,10 @@ export const Chat = () => {
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
window.$mj_engine.ai.chat.project = projectInfo ?? undefined;
|
||||
}, [projectInfo]);
|
||||
|
||||
// 自定义删除消息函数
|
||||
const handleDeleteMessage = async (messageId: string) => {
|
||||
// 找到要删除的消息
|
||||
@@ -83,12 +96,12 @@ export const Chat = () => {
|
||||
|
||||
// 将chat对象挂载到window上
|
||||
useEffect(() => {
|
||||
window.$mj_engine.chat.complete = async (message: string) => {
|
||||
window.$mj_engine.ai.chat.complete = async (message: string) => {
|
||||
await onSend(message);
|
||||
};
|
||||
|
||||
return () => {
|
||||
delete window.$mj_engine.chat.complete;
|
||||
delete window.$mj_engine.ai.chat.complete;
|
||||
};
|
||||
}, [onSend]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user