Input,
renderAfter: () => (index === $attrs.length - 1 ? Remove : undefined),
- onChange: (v: any) => confirm(v, index),
+ onChange: (v: any) => {
+ return confirm(v, index)
+ },
+ onInputChange: (v: any) => {
+ setInput(v)
+ },
onClick: () => focusOnTarget(index),
sharedInputProps: {
value: input,
@@ -359,8 +377,6 @@ export default function FilterRenderer({
}
})
- // trace('filter', { isFocus, focusTarget, property, inputRef, filter, attrs })
-
// if target active trigger onActive
useEffect(() => {
attrs[focusTarget]?.onActive?.()
diff --git a/console/packages/starwhale-ui/src/Search/Search.tsx b/console/packages/starwhale-ui/src/Search/Search.tsx
index fe043ebc93..c969d154c5 100644
--- a/console/packages/starwhale-ui/src/Search/Search.tsx
+++ b/console/packages/starwhale-ui/src/Search/Search.tsx
@@ -1,5 +1,5 @@
import { createUseStyles } from 'react-jss'
-import React, { useRef } from 'react'
+import React, { useRef, useState } from 'react'
import { useClickAway } from 'react-use'
import FilterRenderer from './FilterRenderer'
import { FilterT, ValueT } from './types'
@@ -71,6 +71,7 @@ export default function Search({ value = [], onChange, getFilters }: ISearchProp
const styles = useStyles()
const [t] = useTranslation()
const ref = useRef(null)
+ const [isItemEditing, setIsItemEditing] = useState(false)
const state = useSearchState({ onChange })
const {
@@ -128,6 +129,7 @@ export default function Search({ value = [], onChange, getFilters }: ISearchProp
containerRef={ref}
onRemove={focusToPrevItem}
onChange={onItemCreate}
+ onItemEditing={setIsItemEditing}
/>
)
return tmps
@@ -154,7 +156,7 @@ export default function Search({ value = [], onChange, getFilters }: ISearchProp
- {!isEditing && items.length === 0 && (
+ {!isEditing && items.length === 0 && !isItemEditing && (
{t('table.search.placeholder')}
diff --git a/console/packages/starwhale-ui/src/Search/components/FieldDefault.tsx b/console/packages/starwhale-ui/src/Search/components/FieldDefault.tsx
index 87ad070995..1b00b24d58 100644
--- a/console/packages/starwhale-ui/src/Search/components/FieldDefault.tsx
+++ b/console/packages/starwhale-ui/src/Search/components/FieldDefault.tsx
@@ -10,7 +10,8 @@ function FieldDefault({ options: renderOptions = [], optionFilter = () => true,
isOpen={isEditing}
Content={!rest.multi ? SingleSelectMenu : MultiSelectMenu}
onItemSelect={({ item }) => rest.onChange?.(item.type)}
- onItemIdsChange={(ids = []) => rest.onChange?.(ids.join(','))}
+ onItemIdsConfirm={(ids = []) => rest.onChange?.(ids.join(','))}
+ onItemIdsChange={(ids = []) => rest.onInputChange?.(ids.join(','))}
>
{isEditing && rest.renderInput?.()}
{!isEditing && (
diff --git a/console/packages/starwhale-ui/src/Search/types.ts b/console/packages/starwhale-ui/src/Search/types.ts
index d9a6de6568..8a5692365c 100644
--- a/console/packages/starwhale-ui/src/Search/types.ts
+++ b/console/packages/starwhale-ui/src/Search/types.ts
@@ -257,6 +257,7 @@ export interface FilterPropsT extends FilterSharedPropsT {
value?: ValueT
onChange?: (newValue?: ValueT) => void
options?: any[]
+ onItemEditing?: (args: boolean) => void
}
export type ValueT = {
diff --git a/console/packages/starwhale-ui/src/Serving/components/ChatGroup.tsx b/console/packages/starwhale-ui/src/Serving/components/ChatGroup.tsx
index 31193c83ef..22b201d5f2 100644
--- a/console/packages/starwhale-ui/src/Serving/components/ChatGroup.tsx
+++ b/console/packages/starwhale-ui/src/Serving/components/ChatGroup.tsx
@@ -220,75 +220,8 @@ function Chat({
isUser ? 'bg-white' : 'bg-[#EBF1FF]'
}`}
>
-
-
-
- {/* }
- onClick={async () => {
- const newMessage = await showPrompt(
- Locale.Chat.Actions.Edit,
- message.content,
- 10
- )
- chatStore.updateCurrentSession((session) => {
- const m = session.mask.context
- .concat(session.messages)
- .find((m) => m.id === message.id)
- if (m) {
- m.content = newMessage
- }
- })
- }}
- > */}
-
-
-
- {/* {showActions && (
-
-
- {message.streaming ? (
- }
- onClick={() => onUserStop(message.id ?? i)}
- />
- ) : (
- <>
- }
- onClick={() => onResend(message)}
- />
-
- }
- onClick={() => onDelete(message.id ?? i)}
- />
-
- }
- onClick={() => onPinMessage(message)}
- />
- }
- onClick={() => copyToClipboard(message.content)}
- />
- >
- )}
-
-
- )} */}
-
- {isUser ? (
-
{message.content}
- ) : (
-
{message.content}
- )}
+
{message.content}
diff --git a/console/packages/starwhale-ui/src/Serving/store/chat.ts b/console/packages/starwhale-ui/src/Serving/store/chat.ts
index caa332e319..5fcf7ab4c0 100644
--- a/console/packages/starwhale-ui/src/Serving/store/chat.ts
+++ b/console/packages/starwhale-ui/src/Serving/store/chat.ts
@@ -349,8 +349,8 @@ function create(name = StoreKey.Chat) {
if (!serving) return Promise.resolve()
const { exposedLink, apiSpec } = serving
const data: ILLMChatQuerySchema = {
- user_input: content,
- history: messages as any,
+ user_input: '',
+ history: [],
}
apiSpec?.components?.forEach((cur) => {
@@ -363,6 +363,8 @@ function create(name = StoreKey.Chat) {
return axios
.post