@mujian/js-sdk 0.0.6-beta.31 → 0.0.6-beta.33
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.
|
@@ -4,7 +4,7 @@ import type { UseChatCommon } from '..';
|
|
|
4
4
|
import type { Message } from '../message';
|
|
5
5
|
interface ChatStreamingProps {
|
|
6
6
|
common: UseChatCommon;
|
|
7
|
-
setError: (error:
|
|
7
|
+
setError: (error: unknown) => void;
|
|
8
8
|
setMessages: Dispatch<SetStateAction<Message[]>>;
|
|
9
9
|
mujian: MujianSdk;
|
|
10
10
|
}
|
package/dist/react.js
CHANGED
|
@@ -931,7 +931,7 @@ const useChatStreaming = ({ common, setError, setMessages, mujian })=>{
|
|
|
931
931
|
}
|
|
932
932
|
} catch (error) {
|
|
933
933
|
console.log('Stream error', error);
|
|
934
|
-
|
|
934
|
+
'object' == typeof error && error && 'message' in error && 'string' == typeof error.message ? setError(new SendMessageError(error.message)) : setError(error);
|
|
935
935
|
} finally{
|
|
936
936
|
console.log('stream end finally');
|
|
937
937
|
setMessages((prev)=>{
|
|
@@ -1061,11 +1061,11 @@ const useChat = ({ body, onError, onFinish })=>{
|
|
|
1061
1061
|
abortController?.abort();
|
|
1062
1062
|
};
|
|
1063
1063
|
const setSwipe = async (messageId, swipeId)=>{
|
|
1064
|
-
await mujian.ai.chat.message.swipe(messageId, swipeId);
|
|
1065
1064
|
setMessages((prev)=>prev.map((msg)=>msg.id === messageId ? {
|
|
1066
1065
|
...msg,
|
|
1067
1066
|
activeSwipeId: swipeId
|
|
1068
1067
|
} : msg));
|
|
1068
|
+
await mujian.ai.chat.message.swipe(messageId, swipeId);
|
|
1069
1069
|
};
|
|
1070
1070
|
const editMessage = async (messageId, content)=>{
|
|
1071
1071
|
await mujian.ai.chat.message.editOne(messageId, content);
|