mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 15:39:24 +08:00
fix: bug
This commit is contained in:
parent
5b534deb51
commit
ee57d39220
@ -175,7 +175,7 @@ export const ChatMessagesProvider: React.FC<{ children: React.ReactNode }> = ({
|
|||||||
if (!sendMsgs.length) return;
|
if (!sendMsgs.length) return;
|
||||||
|
|
||||||
const last = messages[messages.length - 1];
|
const last = messages[messages.length - 1];
|
||||||
if (last.role === 'error') {
|
if (last?.role === 'error') {
|
||||||
setMessages((prev) => prev.slice(0, -1));
|
setMessages((prev) => prev.slice(0, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ import { useT } from '../../locale';
|
|||||||
import { useChatMessages } from './ChatMessagesProvider';
|
import { useChatMessages } from './ChatMessagesProvider';
|
||||||
import { useChatBoxContext } from './ChatBoxContext';
|
import { useChatBoxContext } from './ChatBoxContext';
|
||||||
import { useChatConversations } from './ChatConversationsProvider';
|
import { useChatConversations } from './ChatConversationsProvider';
|
||||||
|
import { SchemaComponent } from '@nocobase/client';
|
||||||
|
|
||||||
const MessageWrapper = React.forwardRef<
|
const MessageWrapper = React.forwardRef<
|
||||||
HTMLDivElement,
|
HTMLDivElement,
|
||||||
@ -47,7 +48,23 @@ const AIMessageRenderer: React.FC<{
|
|||||||
case 'text':
|
case 'text':
|
||||||
return (
|
return (
|
||||||
<Bubble
|
<Bubble
|
||||||
content={msg.content}
|
content={
|
||||||
|
<SchemaComponent
|
||||||
|
schema={{
|
||||||
|
type: 'void',
|
||||||
|
properties: {
|
||||||
|
[msg.key]: {
|
||||||
|
type: 'void',
|
||||||
|
'x-component': 'Markdown.Void',
|
||||||
|
'x-component-props': {
|
||||||
|
content: msg.content,
|
||||||
|
},
|
||||||
|
'x-read-pretty': true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
footer={
|
footer={
|
||||||
<Space>
|
<Space>
|
||||||
<Button
|
<Button
|
||||||
|
@ -38,7 +38,7 @@ export const useAIEmployeeButtonVariableOptions = () => {
|
|||||||
const fields = useMemo(() => {
|
const fields = useMemo(() => {
|
||||||
return Schema.compile(fieldsOptions, { t });
|
return Schema.compile(fieldsOptions, { t });
|
||||||
}, [fieldsOptions]);
|
}, [fieldsOptions]);
|
||||||
return useMemo(() => {
|
const options = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
recordData && {
|
recordData && {
|
||||||
name: 'currentRecord',
|
name: 'currentRecord',
|
||||||
@ -52,6 +52,7 @@ export const useAIEmployeeButtonVariableOptions = () => {
|
|||||||
},
|
},
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
}, [recordData, t, fields, blockType]);
|
}, [recordData, t, fields, blockType]);
|
||||||
|
return options;
|
||||||
};
|
};
|
||||||
|
|
||||||
const SettingsForm: React.FC<{
|
const SettingsForm: React.FC<{
|
||||||
@ -71,6 +72,7 @@ const SettingsForm: React.FC<{
|
|||||||
'x-component': 'FormV2',
|
'x-component': 'FormV2',
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
form,
|
form,
|
||||||
|
disabled: false,
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
profile: {
|
profile: {
|
||||||
@ -121,10 +123,10 @@ const SettingsForm: React.FC<{
|
|||||||
label: t('Text'),
|
label: t('Text'),
|
||||||
value: 'text',
|
value: 'text',
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
label: t('Image'),
|
// label: t('Image'),
|
||||||
value: 'image',
|
// value: 'image',
|
||||||
},
|
// },
|
||||||
],
|
],
|
||||||
default: 'text',
|
default: 'text',
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
@ -147,14 +149,6 @@ const SettingsForm: React.FC<{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
default: dn.getSchemaAttribute('x-component-props.message'),
|
default: dn.getSchemaAttribute('x-component-props.message'),
|
||||||
'x-reactions': {
|
|
||||||
dependencies: ['.manualMessage'],
|
|
||||||
fulfill: {
|
|
||||||
state: {
|
|
||||||
visible: '{{ !$deps[0] }}',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
autoSend: {
|
autoSend: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user