mirror of
https://github.com/hexastack/hexabot
synced 2024-12-02 00:54:56 +00:00
fix: feedback updates v0.0.1
This commit is contained in:
parent
3b72ad8ded
commit
28dc3e0e4f
@ -68,6 +68,7 @@ const PatternInput: FC<PatternInputProps> = ({
|
||||
// const getNlpEntityFromCache = useGetFromCache(EntityType.NLP_ENTITY);
|
||||
const [pattern, setPattern] = useState<Pattern>(value);
|
||||
const [patternType, setPatternType] = useState<PatternType>(getType(value));
|
||||
const isPostbackType = ["payload", "content", "menu"].includes(patternType);
|
||||
const types = [
|
||||
{ value: "text", label: t("label.match_sound") },
|
||||
{ value: "regex", label: t("label.regex") },
|
||||
@ -104,11 +105,7 @@ const PatternInput: FC<PatternInputProps> = ({
|
||||
<Input
|
||||
select
|
||||
label={t("label.type")}
|
||||
value={
|
||||
["menu", "content", "payload"].includes(patternType)
|
||||
? "payload"
|
||||
: patternType
|
||||
}
|
||||
value={isPostbackType ? "payload" : patternType}
|
||||
onChange={(e) => {
|
||||
const selected = e.target.value as PatternType;
|
||||
|
||||
@ -149,7 +146,7 @@ const PatternInput: FC<PatternInputProps> = ({
|
||||
onChange={setPattern}
|
||||
/>
|
||||
)}
|
||||
{["payload", "content", "menu"].includes(patternType) ? (
|
||||
{isPostbackType ? (
|
||||
<PostbackInput
|
||||
onChange={(payload) => {
|
||||
payload && setPattern(payload);
|
||||
|
@ -16,6 +16,8 @@ import { useTranslate } from "@/hooks/useTranslate";
|
||||
import { EntityType, Format } from "@/services/types";
|
||||
import { IBlock, PayloadPattern } from "@/types/block.types";
|
||||
import {
|
||||
ButtonType,
|
||||
PayloadType,
|
||||
PostBackButton,
|
||||
StdOutgoingButtonsMessage,
|
||||
StdOutgoingQuickRepliesMessage,
|
||||
@ -81,7 +83,7 @@ export const PostbackInput = ({ value, onChange }: PostbackInputProps) => {
|
||||
const postbackButtons = (
|
||||
(b.message as StdOutgoingButtonsMessage)?.buttons || []
|
||||
)
|
||||
.filter((btn) => btn.type === "postback")
|
||||
.filter((btn) => btn.type === ButtonType.postback)
|
||||
.map((btn) => {
|
||||
return { ...btn, group: b.name };
|
||||
});
|
||||
@ -205,9 +207,9 @@ export const PostbackInput = ({ value, onChange }: PostbackInputProps) => {
|
||||
label: content.label,
|
||||
value: content.id,
|
||||
type: ["content", "menu"].includes(content.group || "")
|
||||
? content.group
|
||||
? PayloadType[content?.group || ""]
|
||||
: undefined,
|
||||
} as PayloadPattern);
|
||||
});
|
||||
}}
|
||||
groupBy={(option) => {
|
||||
return option.group ?? t("label.other");
|
||||
|
Loading…
Reference in New Issue
Block a user