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;
|
||||
|
||||
const last = messages[messages.length - 1];
|
||||
if (last.role === 'error') {
|
||||
if (last?.role === 'error') {
|
||||
setMessages((prev) => prev.slice(0, -1));
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ import { useT } from '../../locale';
|
||||
import { useChatMessages } from './ChatMessagesProvider';
|
||||
import { useChatBoxContext } from './ChatBoxContext';
|
||||
import { useChatConversations } from './ChatConversationsProvider';
|
||||
import { SchemaComponent } from '@nocobase/client';
|
||||
|
||||
const MessageWrapper = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
@ -47,7 +48,23 @@ const AIMessageRenderer: React.FC<{
|
||||
case 'text':
|
||||
return (
|
||||
<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={
|
||||
<Space>
|
||||
<Button
|
||||
|
@ -38,7 +38,7 @@ export const useAIEmployeeButtonVariableOptions = () => {
|
||||
const fields = useMemo(() => {
|
||||
return Schema.compile(fieldsOptions, { t });
|
||||
}, [fieldsOptions]);
|
||||
return useMemo(() => {
|
||||
const options = useMemo(() => {
|
||||
return [
|
||||
recordData && {
|
||||
name: 'currentRecord',
|
||||
@ -52,6 +52,7 @@ export const useAIEmployeeButtonVariableOptions = () => {
|
||||
},
|
||||
].filter(Boolean);
|
||||
}, [recordData, t, fields, blockType]);
|
||||
return options;
|
||||
};
|
||||
|
||||
const SettingsForm: React.FC<{
|
||||
@ -71,6 +72,7 @@ const SettingsForm: React.FC<{
|
||||
'x-component': 'FormV2',
|
||||
'x-component-props': {
|
||||
form,
|
||||
disabled: false,
|
||||
},
|
||||
properties: {
|
||||
profile: {
|
||||
@ -121,10 +123,10 @@ const SettingsForm: React.FC<{
|
||||
label: t('Text'),
|
||||
value: 'text',
|
||||
},
|
||||
{
|
||||
label: t('Image'),
|
||||
value: 'image',
|
||||
},
|
||||
// {
|
||||
// label: t('Image'),
|
||||
// value: 'image',
|
||||
// },
|
||||
],
|
||||
default: 'text',
|
||||
'x-component-props': {
|
||||
@ -147,14 +149,6 @@ const SettingsForm: React.FC<{
|
||||
},
|
||||
},
|
||||
default: dn.getSchemaAttribute('x-component-props.message'),
|
||||
'x-reactions': {
|
||||
dependencies: ['.manualMessage'],
|
||||
fulfill: {
|
||||
state: {
|
||||
visible: '{{ !$deps[0] }}',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
autoSend: {
|
||||
type: 'boolean',
|
||||
|
Loading…
x
Reference in New Issue
Block a user