eli-video-interview 1.2.39-alpha.9 → 1.2.40-alpha.1

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.
Files changed (53) hide show
  1. package/esm/constants/ai-question.d.ts +8 -0
  2. package/esm/constants/ai-question.js +30 -2
  3. package/esm/enum/ai-question.d.ts +5 -2
  4. package/esm/enum/ai-question.js +3 -0
  5. package/esm/modules/ai-ability/Root.js +15 -4
  6. package/esm/modules/ai-ability-select/Root.js +2 -2
  7. package/esm/modules/ai-ability-select/interface.d.ts +1 -0
  8. package/esm/modules/ai-question/components/QuestionModel/Item.js +8 -11
  9. package/esm/modules/ai-question/components/QuestionTemplate/AiEvaluation.js +10 -5
  10. package/esm/modules/ai-question/components/QuestionUpdate/Chioce.d.ts +17 -0
  11. package/esm/modules/ai-question/components/QuestionUpdate/Chioce.js +91 -0
  12. package/esm/modules/ai-question/components/QuestionUpdate/Form.js +42 -12
  13. package/esm/modules/ai-question/components/QuestionUpdate/RandomQuestion.js +14 -4
  14. package/esm/modules/ai-question/components/QuestionUpdate/const.js +2 -0
  15. package/esm/modules/ai-question/components/QuestionUpdate/index.js +12 -14
  16. package/esm/modules/ai-question/components/QuestionUpdate/interface.d.ts +6 -0
  17. package/esm/modules/ai-question/components/QuestionUpdate/styled.d.ts +15 -0
  18. package/esm/modules/ai-question/components/QuestionUpdate/styled.js +53 -1
  19. package/esm/modules/ai-report/components/ScoreReport/Score.js +4 -1
  20. package/esm/modules/ai-report/components/VideoQuestion/QuestionItem.js +4 -3
  21. package/esm/modules/ai-report/components/VideoQuestion/SingleChoice.d.ts +8 -0
  22. package/esm/modules/ai-report/components/VideoQuestion/SingleChoice.js +25 -0
  23. package/esm/modules/ai-report/components/VideoQuestion/styled.js +1 -1
  24. package/esm/modules/ai-report/interface.d.ts +8 -0
  25. package/esm/services/ai-ability.d.ts +1 -1
  26. package/esm/services/ai-ability.js +1 -1
  27. package/lib/constants/ai-question.d.ts +8 -0
  28. package/lib/constants/ai-question.js +31 -3
  29. package/lib/enum/ai-question.d.ts +5 -2
  30. package/lib/enum/ai-question.js +3 -0
  31. package/lib/modules/ai-ability/Root.js +15 -4
  32. package/lib/modules/ai-ability-select/Root.js +2 -2
  33. package/lib/modules/ai-ability-select/interface.d.ts +1 -0
  34. package/lib/modules/ai-question/components/QuestionModel/Item.js +5 -8
  35. package/lib/modules/ai-question/components/QuestionTemplate/AiEvaluation.js +8 -3
  36. package/lib/modules/ai-question/components/QuestionUpdate/Chioce.d.ts +17 -0
  37. package/lib/modules/ai-question/components/QuestionUpdate/Chioce.js +98 -0
  38. package/lib/modules/ai-question/components/QuestionUpdate/Form.js +40 -10
  39. package/lib/modules/ai-question/components/QuestionUpdate/RandomQuestion.js +12 -2
  40. package/lib/modules/ai-question/components/QuestionUpdate/const.js +2 -0
  41. package/lib/modules/ai-question/components/QuestionUpdate/index.js +11 -13
  42. package/lib/modules/ai-question/components/QuestionUpdate/interface.d.ts +6 -0
  43. package/lib/modules/ai-question/components/QuestionUpdate/styled.d.ts +15 -0
  44. package/lib/modules/ai-question/components/QuestionUpdate/styled.js +53 -1
  45. package/lib/modules/ai-report/components/ScoreReport/Score.js +4 -1
  46. package/lib/modules/ai-report/components/VideoQuestion/QuestionItem.js +3 -2
  47. package/lib/modules/ai-report/components/VideoQuestion/SingleChoice.d.ts +8 -0
  48. package/lib/modules/ai-report/components/VideoQuestion/SingleChoice.js +27 -0
  49. package/lib/modules/ai-report/components/VideoQuestion/styled.js +1 -1
  50. package/lib/modules/ai-report/interface.d.ts +8 -0
  51. package/lib/services/ai-ability.d.ts +1 -1
  52. package/lib/services/ai-ability.js +1 -1
  53. package/package.json +1 -1
@@ -2,9 +2,17 @@ import { QuestionParams } from '@/modules/ai-question/components/QuestionUpdate/
2
2
  import { ADD_QUESTION_TYPE } from '@enum/ai-question';
3
3
  export declare const ADD_QUESTION_TYPE_LIST: {
4
4
  type: ADD_QUESTION_TYPE;
5
+ hide: boolean;
5
6
  title: string;
6
7
  desc: string;
7
8
  }[];
9
+ export declare const ADD_QUESTION_TYPE_SHOW_LIST: {
10
+ type: ADD_QUESTION_TYPE;
11
+ hide: boolean;
12
+ title: string;
13
+ desc: string;
14
+ }[];
15
+ export declare const QUESTION_TYPE_TITLE_MAP: {};
8
16
  export declare const QUESTION_TYPE_MAPPING_LABEL: {
9
17
  1: string;
10
18
  2: string;
@@ -1,19 +1,47 @@
1
1
  var _a;
2
2
  import { ADD_QUESTION_TYPE, QUESTION_TYPE } from "../enum/ai-question";
3
- var FREE = ADD_QUESTION_TYPE.FREE, LANGUAGE = ADD_QUESTION_TYPE.LANGUAGE;
3
+ var FREE = ADD_QUESTION_TYPE.FREE, LANGUAGE = ADD_QUESTION_TYPE.LANGUAGE, EVALUATION = ADD_QUESTION_TYPE.EVALUATION, SINGLECHIOCE = ADD_QUESTION_TYPE.SINGLECHIOCE;
4
4
  var QA = QUESTION_TYPE.QA, COLOR_BLINDNESS = QUESTION_TYPE.COLOR_BLINDNESS, ALPHABETIC_DICTATION = QUESTION_TYPE.ALPHABETIC_DICTATION, AI_ANALYSIS = QUESTION_TYPE.AI_ANALYSIS, POLICY_DECISION_GAME = QUESTION_TYPE.POLICY_DECISION_GAME, MEMORY_GAME = QUESTION_TYPE.MEMORY_GAME, EMOTION_GAME = QUESTION_TYPE.EMOTION_GAME;
5
+ /*
6
+ * 题目类型列表
7
+ */
5
8
  export var ADD_QUESTION_TYPE_LIST = [
6
9
  {
7
10
  type: FREE,
8
- title: '自由作答题',
11
+ hide: false,
12
+ title: '问答题',
9
13
  desc: '以问答的形式要求候选人对你定问题作答。',
10
14
  },
11
15
  {
12
16
  type: LANGUAGE,
17
+ hide: false,
13
18
  title: '朗读题',
14
19
  desc: '候选人根据所提供的文案进行朗读。',
15
20
  },
21
+ {
22
+ type: EVALUATION,
23
+ hide: true,
24
+ title: '评估题',
25
+ desc: '候选人根据所提供的文案进行朗读。',
26
+ },
27
+ {
28
+ type: SINGLECHIOCE,
29
+ hide: false,
30
+ title: '单选题',
31
+ desc: '以单选的形式要求候选人对问题进行作答。',
32
+ },
16
33
  ];
34
+ /*
35
+ * 可以自定义的题目类型列表
36
+ */
37
+ export var ADD_QUESTION_TYPE_SHOW_LIST = ADD_QUESTION_TYPE_LIST.filter(function (v) { return !v.hide; });
38
+ /*
39
+ * 题目类型名称映射表
40
+ */
41
+ export var QUESTION_TYPE_TITLE_MAP = ADD_QUESTION_TYPE_LIST.reduce(function (acc, cur) {
42
+ acc[cur.type] = cur.title;
43
+ return acc;
44
+ }, {});
17
45
  export var QUESTION_TYPE_MAPPING_LABEL = (_a = {},
18
46
  _a[QA] = '问答题',
19
47
  _a[COLOR_BLINDNESS] = '色盲题',
@@ -3,7 +3,9 @@
3
3
  */
4
4
  export declare enum ADD_QUESTION_TYPE {
5
5
  FREE = 1,
6
- LANGUAGE = 2
6
+ LANGUAGE = 2,
7
+ EVALUATION = 3,
8
+ SINGLECHIOCE = 4
7
9
  }
8
10
  /**
9
11
  * AI考核标准类型
@@ -34,5 +36,6 @@ export declare enum QUESTION_TYPE {
34
36
  AI_ANALYSIS = 6,
35
37
  POLICY_DECISION_GAME = 7,
36
38
  MEMORY_GAME = 8,
37
- EMOTION_GAME = 9
39
+ EMOTION_GAME = 9,
40
+ SINGLECHIOCE = 17
38
41
  }
@@ -5,6 +5,8 @@ export var ADD_QUESTION_TYPE;
5
5
  (function (ADD_QUESTION_TYPE) {
6
6
  ADD_QUESTION_TYPE[ADD_QUESTION_TYPE["FREE"] = 1] = "FREE";
7
7
  ADD_QUESTION_TYPE[ADD_QUESTION_TYPE["LANGUAGE"] = 2] = "LANGUAGE";
8
+ ADD_QUESTION_TYPE[ADD_QUESTION_TYPE["EVALUATION"] = 3] = "EVALUATION";
9
+ ADD_QUESTION_TYPE[ADD_QUESTION_TYPE["SINGLECHIOCE"] = 4] = "SINGLECHIOCE";
8
10
  })(ADD_QUESTION_TYPE || (ADD_QUESTION_TYPE = {}));
9
11
  /**
10
12
  * AI考核标准类型
@@ -39,4 +41,5 @@ export var QUESTION_TYPE;
39
41
  QUESTION_TYPE[QUESTION_TYPE["POLICY_DECISION_GAME"] = 7] = "POLICY_DECISION_GAME";
40
42
  QUESTION_TYPE[QUESTION_TYPE["MEMORY_GAME"] = 8] = "MEMORY_GAME";
41
43
  QUESTION_TYPE[QUESTION_TYPE["EMOTION_GAME"] = 9] = "EMOTION_GAME";
44
+ QUESTION_TYPE[QUESTION_TYPE["SINGLECHIOCE"] = 17] = "SINGLECHIOCE";
42
45
  })(QUESTION_TYPE || (QUESTION_TYPE = {}));
@@ -54,6 +54,7 @@ import { useRequest, useSetState } from 'ahooks';
54
54
  import dayjs from 'dayjs';
55
55
  import { AddIcon, Box, Button, confirm, DeleteIcon, DocumentIcon, Header, Link, Message, Table, Tooltip } from 'fbm-ui';
56
56
  import { useCallback, useState } from 'react';
57
+ var PAGE_SIZE = 20;
57
58
  var AiAbilityRoot = function (_a) {
58
59
  var _b = _a.ablilityNameLength, ablilityNameLength = _b === void 0 ? 30 : _b;
59
60
  var _c = useSetState({
@@ -62,9 +63,12 @@ var AiAbilityRoot = function (_a) {
62
63
  type: 3,
63
64
  isWorkplace: false,
64
65
  }), state = _c[0], setState = _c[1];
65
- var _d = useState(false), AddAbilityOpen = _d[0], setAddAbilityOpen = _d[1];
66
- var _e = useState(false), UpdateAbilityOpen = _e[0], setUpdateAbilityOpen = _e[1];
67
- var _f = useRequest(PostQuestionCollectionList), data = _f.data, getList = _f.run, listLoading = _f.loading;
66
+ var _d = useState(0), page = _d[0], setPage = _d[1];
67
+ var _e = useState(false), AddAbilityOpen = _e[0], setAddAbilityOpen = _e[1];
68
+ var _f = useState(false), UpdateAbilityOpen = _f[0], setUpdateAbilityOpen = _f[1];
69
+ var _g = useRequest(function () { return PostQuestionCollectionList({ page: page, pageSize: PAGE_SIZE }); }, {
70
+ refreshDeps: [page],
71
+ }), data = _g.data, getList = _g.run, listLoading = _g.loading;
68
72
  var deleteList = useRequest(PostQuestionCollectionDelete, {
69
73
  manual: true,
70
74
  onSuccess: function () {
@@ -143,6 +147,13 @@ var AiAbilityRoot = function (_a) {
143
147
  },
144
148
  },
145
149
  ];
146
- return (_jsxs(AbilityRoot, { children: [AddAbilityOpen && (_jsx(AddAbility, __assign({}, state, { open: AddAbilityOpen, ablilityNameLength: ablilityNameLength, onClose: handleClose, onSuccess: getList }))), UpdateAbilityOpen && (_jsx(UpdateAbility, __assign({}, state, { open: UpdateAbilityOpen, ablilityNameLength: ablilityNameLength, onClose: handleClose, onSuccess: getList }))), _jsx(Header, { title: "\u8003\u5BDF\u80FD\u529B\u7BA1\u7406", renderAction: function () { return (_jsx(Button, __assign({ icon: _jsx(AddIcon, {}), onClick: handleAdd }, { children: "\u65B0\u589E\u80FD\u529B" }))); } }), _jsx(Box, __assign({ mt: 2, border: "1px solid rgba(0, 0, 0, 0.08)", borderRadius: 0.5, overflow: "hidden" }, { children: _jsx(Table, { emptyText: "\u6682\u65E0\u6570\u636E", nameText: "\u8003\u5BDF\u80FD\u529B", loading: listLoading, data: data === null || data === void 0 ? void 0 : data.data.list, columns: columns }) }))] }));
150
+ return (_jsxs(AbilityRoot, { children: [AddAbilityOpen && (_jsx(AddAbility, __assign({}, state, { open: AddAbilityOpen, ablilityNameLength: ablilityNameLength, onClose: handleClose, onSuccess: getList }))), UpdateAbilityOpen && (_jsx(UpdateAbility, __assign({}, state, { open: UpdateAbilityOpen, ablilityNameLength: ablilityNameLength, onClose: handleClose, onSuccess: getList }))), _jsx(Header, { title: "\u8003\u5BDF\u80FD\u529B\u7BA1\u7406", renderAction: function () { return (_jsx(Button, __assign({ icon: _jsx(AddIcon, {}), onClick: handleAdd }, { children: "\u65B0\u589E\u80FD\u529B" }))); } }), _jsx(Box, __assign({ mt: 2, border: "1px solid rgba(0, 0, 0, 0.08)", borderRadius: 0.5, overflow: "hidden" }, { children: _jsx(Table, { emptyText: "\u6682\u65E0\u6570\u636E", nameText: "\u8003\u5BDF\u80FD\u529B", loading: listLoading, data: data === null || data === void 0 ? void 0 : data.data.list, columns: columns, PaginationProps: {
151
+ total: (data === null || data === void 0 ? void 0 : data.data.total) || 0,
152
+ pageSize: PAGE_SIZE,
153
+ onPageChange: function (page) {
154
+ setPage(Math.max(0, page - 1));
155
+ return true;
156
+ },
157
+ } }) }))] }));
147
158
  };
148
159
  export default AiAbilityRoot;
@@ -24,7 +24,7 @@ var ScrollDialogContent = styled(Box)({
24
24
  overflow: 'scroll',
25
25
  });
26
26
  var AiAbilitySelectRoot = forwardRef(function (_a, ref) {
27
- var jobToken = _a.jobToken, thirdToken = _a.thirdToken, token = _a.token;
27
+ var jobToken = _a.jobToken, thirdToken = _a.thirdToken, token = _a.token, hiddenTips = _a.hiddenTips;
28
28
  var _b = useAiAbilityListStore(), aiAbilityList = _b.aiAbilityList, setAiAbilityList = _b.setAiAbilityList, selctedAbilitys = _b.selctedAbilitys;
29
29
  var setEnterprise = useEnterpriseStore().setEnterprise;
30
30
  var data = useRequest(function () { return GetAiAbilityList({ jobToken: jobToken, thirdToken: thirdToken }); }, {
@@ -41,7 +41,7 @@ var AiAbilitySelectRoot = forwardRef(function (_a, ref) {
41
41
  setEnterprise({ jobToken: jobToken, thirdToken: thirdToken });
42
42
  // eslint-disable-next-line react-hooks/exhaustive-deps
43
43
  }, [jobToken, thirdToken]);
44
- return (_jsx(ScrollDialogContent, __assign({ ref: ref }, { children: _jsxs(Box, __assign({ display: "flex", flexDirection: "column", width: 760 }, { children: [_jsxs(Stack, __assign({ spacing: 2, mb: 2 }, { children: [_jsx(Typography, __assign({ variant: "body1", fontWeight: 500 }, { children: "\u8BF7\u9009\u62E9\u8981\u4F18\u5148\u4F7F\u7528\u7684\u8003\u5BDF\u80FD\u529B\uFF0C\u4E5F\u53EF\u4EE5\u70B9\u51FB\u300C\u4E0B\u4E00\u6B65\u300D\u76F4\u63A5\u51FA\u9898" })), (aiAbilityList === null || aiAbilityList === void 0 ? void 0 : aiAbilityList.some(function (v) { return v.isNew; })) && (_jsxs(Stack, __assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx("img", { src: "//webcdn.fbmms.cn/assets/XXRf/bdUI9qZoTx-l2k_OHTotn", alt: "", width: 38, height: 16 }), _jsx(Typography, __assign({ variant: "caption", color: "textSecondary" }, { children: "AI\u6839\u636E\u5C97\u4F4D\u4FE1\u606F\u751F\u6210\u7684\u80FD\u529B\uFF0C\u521B\u5EFA\u5B8C\u6B65\u9AA4\u540E\uFF0C\u4F1A\u81EA\u52A8\u5C06\u9009\u62E9\u7684\u65B0\u589E\u80FD\u529B\u52A0\u5165\u5230\u8BBE\u7F6E\u9875\u7684\u8003\u5BDF\u80FD\u529B\u5217\u8868\u4E2D\u3002" }))] })))] })), _jsx(AiAbilityList, { items: aiAbilityList })] })) })));
44
+ return (_jsx(ScrollDialogContent, __assign({ ref: ref }, { children: _jsxs(Box, __assign({ display: "flex", flexDirection: "column", width: 760 }, { children: [_jsxs(Stack, __assign({ spacing: 2, mb: 2 }, { children: [_jsx(Typography, __assign({ variant: "body1", fontWeight: 500 }, { children: !hiddenTips ? '请选择要优先使用的考察能力,也可以点击「下一步」直接出题' : '已选择的考察能力会优先在面试题目中展示' })), (aiAbilityList === null || aiAbilityList === void 0 ? void 0 : aiAbilityList.some(function (v) { return v.isNew; })) && (_jsxs(Stack, __assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx("img", { src: "//webcdn.fbmms.cn/assets/XXRf/bdUI9qZoTx-l2k_OHTotn", alt: "", width: 38, height: 16 }), _jsx(Typography, __assign({ variant: "caption", color: "textSecondary" }, { children: "AI\u6839\u636E\u5C97\u4F4D\u4FE1\u606F\u751F\u6210\u7684\u80FD\u529B\uFF0C\u521B\u5EFA\u5B8C\u6B65\u9AA4\u540E\uFF0C\u4F1A\u81EA\u52A8\u5C06\u9009\u62E9\u7684\u65B0\u589E\u80FD\u529B\u52A0\u5165\u5230\u8BBE\u7F6E\u9875\u7684\u8003\u5BDF\u80FD\u529B\u5217\u8868\u4E2D\u3002" }))] })))] })), _jsx(AiAbilityList, { items: aiAbilityList })] })) })));
45
45
  });
46
46
  AiAbilitySelectRoot.displayName = 'AiAbilitySelectRoot';
47
47
  export default memo(AiAbilitySelectRoot);
@@ -3,6 +3,7 @@ export interface AiAbilitySelectProps {
3
3
  thirdToken?: string;
4
4
  selectedTokens?: string[];
5
5
  token?: string;
6
+ hiddenTips?: boolean;
6
7
  }
7
8
  interface AiAbilityDetailInfo {
8
9
  name: string;
@@ -20,19 +20,19 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
23
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
24
24
  import { useInterviewRoomStore } from "../../../../store/ai-question/interview-room-store";
25
- import { DISABLED_REPEAT_TYPE, IS_AI_ANALYSIS, TEST_TYPE_READONLY } from "../../../../constants/ai-question";
25
+ import { DISABLED_REPEAT_TYPE, IS_AI_ANALYSIS, QUESTION_TYPE_TITLE_MAP, TEST_TYPE_READONLY } from "../../../../constants/ai-question";
26
26
  import { useQuestionModelStore } from "../../../../store/ai-question/question-model-store";
27
27
  import { useUpdateQuestionStore } from "../../../../store/ai-question/question-update-store";
28
28
  import { getSecondToTime } from "../../../../utils/utils";
29
- import { Box, Chip, confirm, DeleteIcon, DragIndicatorIcon, EditIcon, IconButton, InfoIcon, Input, Switch, Tooltip, Typography } from 'fbm-ui';
29
+ import { Box, Chip, confirm, DeleteIcon, DragHandleIcon, EditIcon, IconButton, InfoIcon, Input, Switch, Tooltip, Typography } from 'fbm-ui';
30
30
  import { Paper, Stack } from 'fbm-ui/lib/mui';
31
31
  import { memo, useCallback, useMemo } from 'react';
32
32
  var QuestionModelListItem = function (props) {
33
33
  var _a = useInterviewRoomStore(), interactType = _a.interactType, aiInterviewerProfile = _a.aiInterviewerProfile;
34
34
  var index = props.index, disabledWeight = props.disabledWeight, steps = props.steps, step = __rest(props, ["index", "disabledWeight", "steps"]);
35
- var token = step.token, name = step.name, questions = step.questions, duration = step.duration, weight = step.weight, type = step.type, aiShowType = step.aiShowType, aiType = step.aiType, answerStatus = step.answerStatus, category = step.category, isOpenAIFollowUp = step.isOpenAIFollowUp, enableScoreOptimization = step.enableScoreOptimization;
35
+ var token = step.token, name = step.name, questions = step.questions, duration = step.duration, weight = step.weight, type = step.type, aiShowType = step.aiShowType, aiType = step.aiType, answerStatus = step.answerStatus, category = step.category, isOpenAIFollowUp = step.isOpenAIFollowUp;
36
36
  var isAiAnalysis = IS_AI_ANALYSIS(step);
37
37
  var _b = useQuestionModelStore(), editModel = _b.editModel, removeModel = _b.removeModel, updateModelWeight = _b.updateModelWeight;
38
38
  var updateQuestionState = useUpdateQuestionStore().updateQuestionState;
@@ -71,17 +71,14 @@ var QuestionModelListItem = function (props) {
71
71
  var handleOpenAIFollowUpStatus = useCallback(function () {
72
72
  editModel(__assign(__assign({}, step), { isOpenAIFollowUp: !isOpenAIFollowUp }), index);
73
73
  }, [editModel, isOpenAIFollowUp, step, index]);
74
- var handleEnableScoreOptimizationStatus = useCallback(function () {
75
- editModel(__assign(__assign({}, step), { enableScoreOptimization: !enableScoreOptimization }), index);
76
- }, [editModel, enableScoreOptimization, step, index]);
77
74
  var formatQuestion = useMemo(function () {
78
75
  if ((questions === null || questions === void 0 ? void 0 : questions.length) > 1) {
79
- return (_jsxs(Stack, __assign({ direction: "row", spacing: 1 }, { children: [_jsx(Typography, __assign({ variant: "body2", color: "#F5C441", flexShrink: 0, fontWeight: 500 }, { children: "[\u5185\u5BB9\u968F\u673A]" })), _jsx(Stack, __assign({ spacing: 1 }, { children: questions.map(function (v, index) { return (_jsxs(Typography, __assign({ variant: "body2", color: "text.secondary" }, { children: ["\u2022\u00A0", v.content] }), index)); }) }))] })));
76
+ return (_jsx(Stack, __assign({ direction: "row", spacing: 1 }, { children: _jsx(Stack, __assign({ spacing: 1 }, { children: questions.map(function (v, i) { return (_jsxs(Typography, __assign({ variant: "body2", color: "text.secondary" }, { children: ["\u2022\u00A0", v.content] }), i)); }) })) })));
80
77
  }
81
78
  return questions.map(function (v) { return v.content; }).join('\n');
82
79
  }, [questions]);
83
- return (_jsxs(Paper, __assign({ variant: "outlined", sx: { display: 'block', mt: 2 } }, { children: [_jsxs(Box, __assign({ display: "flex", borderBottom: !DISABLED_REPEAT_TYPE.includes(type) || isAiAnalysis ? '1px solid rgba(0, 0, 0, 0.08)' : 'none' }, { children: [_jsx(Box, __assign({ width: 40, display: "flex", alignItems: "center", justifyContent: "center", sx: { cursor: 'move' } }, { children: _jsx(DragIndicatorIcon, { className: "dragHandle" }) })), _jsxs(Box, __assign({ flex: "1 0", padding: "16px 0" }, { children: [_jsxs(Box, __assign({ display: "flex", justifyContent: "space-between" }, { children: [_jsxs(Box, __assign({ flex: "1 0", display: "flex", alignItems: "center" }, { children: [_jsx(Typography, __assign({ variant: "subtitle1" }, { children: name })), category === null || category === void 0 ? void 0 : category.map(function (label) {
84
- return label && (_jsx(Tooltip, __assign({ title: "".concat(label), placement: "bottom" }, { children: _jsx(Chip, { color: "default", label: label, size: "medium", sx: { ml: 1, maxWidth: '158px', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' } }, label) })));
85
- }), aiType === 2 && _jsx(Chip, { variant: "filled", color: "primary", label: "AI\u8BC4\u5206", size: "medium", sx: { ml: 1 } })] })), _jsxs(Box, __assign({ width: 62, mr: 1, textAlign: "right" }, { children: [!TEST_TYPE_READONLY.includes(type) && (_jsx(IconButton, __assign({ size: "small", onClick: handleEdit }, { children: _jsx(EditIcon, {}) }))), _jsx(IconButton, __assign({ size: "small", onClick: handleRemove }, { children: _jsx(DeleteIcon, {}) }))] }))] })), _jsxs(Box, __assign({ mt: 1, pr: 2, display: "flex", alignItems: "center", justifyContent: "space-between" }, { children: [_jsx(Typography, __assign({ variant: "body2", color: "secondary" }, { children: formatQuestion })), _jsxs(Typography, __assign({ sx: { ml: 2, flexShrink: 0 }, variant: "caption", color: "secondary", alignSelf: "flex-end" }, { children: ["\u56DE\u7B54\u65F6\u957F:\u00A0", getSecondToTime(Number(duration))] }))] }))] }))] })), (!DISABLED_REPEAT_TYPE.includes(type) || isAiAnalysis) && (_jsxs(Stack, __assign({ direction: "row", justifyContent: "space-between", spacing: 1, height: 42 }, { children: [_jsx(Box, __assign({ display: "flex", alignItems: "center", padding: "3px 0 3px 40px" }, { children: isAiAnalysis && (_jsxs(_Fragment, { children: [_jsx(Typography, __assign({ variant: "body2" }, { children: "\u6743\u91CD\u5360\u6BD4\uFF1A" })), _jsx(Input, { sx: { width: 92 }, size: "small", value: weight, endAdornment: _jsx(Typography, __assign({ variant: "caption", color: "textSecondary" }, { children: "%" })), disabled: disabledWeight, onChange: handleWeightChange, onBlur: handleWeightBlur }), _jsx(Tooltip, __assign({ title: "AI\u6D4B\u8BC4\u9898\u53EF\u4EE5\u8BBE\u7F6E\u6743\u91CD\uFF0C\u7CFB\u7EDF\u5BF9\u5019\u9009\u4EBA\u89C6\u9891\u9762\u8BD5\u7ED3\u679C\u4F1A\u52A0\u5165\u6743\u91CD\u8FDB\u884C\u8BA1\u7B97\uFF0C\u5F97\u51FAAI\u89C6\u9891\u9762\u8BD5\u5F97\u5206\u3002\u8BBE\u7F6E\u540E5\u5206\u949F\u8D77\u6548" }, { children: _jsx("span", __assign({ style: { display: 'flex', alignItems: 'center', marginLeft: '8px' } }, { children: _jsx(InfoIcon, { sx: { fontSize: 14, color: 'rgba(0, 0, 0, 0.26)' } }) })) }))] })) })), !DISABLED_REPEAT_TYPE.includes(type) && (_jsxs(Stack, __assign({ direction: "row" }, { children: [_jsx(Switch, { sx: { flexShrink: 0, ml: 2, mr: 2 }, size: "small", checked: answerStatus === 1, label: _jsx(Typography, __assign({ fontSize: 12, lineHeight: 1.5, color: "rgba(0, 0, 0, 0.56)" }, { children: "\u5141\u8BB8\u91CD\u590D\u7B54\u9898" })), onChange: handleAnswerStatus }), type === 1 && aiShowType === 1 && ((aiInterviewerProfile === null || aiInterviewerProfile === void 0 ? void 0 : aiInterviewerProfile.humanType) !== 2 || interactType === 1) && (_jsx(Switch, { sx: { flexShrink: 0, ml: 2, mr: 2 }, size: "small", checked: isOpenAIFollowUp, label: _jsx(Typography, __assign({ fontSize: 12, lineHeight: 1.5, color: "rgba(0, 0, 0, 0.56)" }, { children: "\u5019\u9009\u4EBA\u56DE\u7B54\u4E0D\u5145\u5206\u65F6\u8FFD\u95EE" })), onChange: handleOpenAIFollowUpStatus }))] })))] })))] })));
80
+ return (_jsxs(Paper, __assign({ variant: "outlined", sx: { display: 'block', mt: 2 } }, { children: [_jsx(Box, __assign({ display: "flex", borderBottom: !DISABLED_REPEAT_TYPE.includes(type) || isAiAnalysis ? '1px solid rgba(0, 0, 0, 0.08)' : 'none' }, { children: _jsxs(Box, __assign({ flex: "1 0", padding: "8px 0px 16px 16px" }, { children: [_jsxs(Box, __assign({ display: "flex", alignItems: "center", justifyContent: "space-between" }, { children: [_jsxs(Typography, __assign({ variant: "body2", color: "primary.main", fontWeight: "medium" }, { children: ["\u9898\u76EE", index + 1] })), _jsx(Box, __assign({ width: 40, display: "flex", alignItems: "center", justifyContent: "center", sx: { cursor: 'move' } }, { children: _jsx(DragHandleIcon, { className: "dragHandle" }) })), _jsxs(Box, __assign({ width: 62, mr: 1, textAlign: "right" }, { children: [!TEST_TYPE_READONLY.includes(type) && (_jsx(IconButton, __assign({ size: "small", onClick: handleEdit }, { children: _jsx(EditIcon, {}) }))), _jsx(IconButton, __assign({ size: "small", onClick: handleRemove }, { children: _jsx(DeleteIcon, {}) }))] }))] })), _jsx(Box, __assign({ display: "flex", justifyContent: "space-between" }, { children: _jsxs(Box, __assign({ flex: "1 0", display: "flex", alignItems: "center" }, { children: [_jsxs(Typography, __assign({ variant: "body2", color: "primary.main", fontWeight: "medium", mr: 0.5 }, { children: ["[", QUESTION_TYPE_TITLE_MAP[aiShowType], "]"] })), _jsx(Typography, __assign({ variant: "subtitle1" }, { children: name })), category === null || category === void 0 ? void 0 : category.map(function (label) {
81
+ return label && (_jsx(Tooltip, __assign({ title: "".concat(label), placement: "bottom" }, { children: _jsx(Chip, { color: "default", label: label, size: "medium", sx: { ml: 1, maxWidth: '158px', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' } }, label) })));
82
+ }), aiType === 2 && _jsx(Chip, { variant: "filled", color: "primary", label: "AI\u8BC4\u5206", size: "medium", sx: { ml: 1 } }), (questions === null || questions === void 0 ? void 0 : questions.length) > 1 && _jsx(Chip, { variant: "filled", color: "warning", label: "\u5185\u5BB9\u968F\u673A", size: "medium", sx: { ml: 1 } })] })) })), _jsxs(Box, __assign({ mt: 1, pr: 2, display: "flex", alignItems: "center", justifyContent: "space-between" }, { children: [_jsx(Typography, __assign({ variant: "body2", color: "secondary" }, { children: formatQuestion })), _jsxs(Typography, __assign({ sx: { ml: 2, flexShrink: 0 }, variant: "caption", color: "secondary", alignSelf: "flex-end" }, { children: ["\u56DE\u7B54\u65F6\u957F:\u00A0", getSecondToTime(Number(duration))] }))] }))] })) })), (!DISABLED_REPEAT_TYPE.includes(type) || isAiAnalysis) && (_jsxs(Stack, __assign({ direction: "row", justifyContent: "space-between", spacing: 1, height: 42 }, { children: [_jsx(Box, __assign({ display: "flex", alignItems: "center", padding: "3px 0 3px 40px" }, { children: isAiAnalysis && (_jsxs(_Fragment, { children: [_jsx(Typography, __assign({ variant: "body2", sx: { flexShrink: 0 } }, { children: "\u6743\u91CD\u5360\u6BD4\uFF1A" })), _jsx(Input, { sx: { width: 92 }, size: "small", value: weight, endAdornment: _jsx(Typography, __assign({ variant: "caption", color: "textSecondary" }, { children: "%" })), disabled: disabledWeight, onChange: handleWeightChange, onBlur: handleWeightBlur }), _jsx(Tooltip, __assign({ title: "AI\u6D4B\u8BC4\u9898\u53EF\u4EE5\u8BBE\u7F6E\u6743\u91CD\uFF0C\u7CFB\u7EDF\u5BF9\u5019\u9009\u4EBA\u89C6\u9891\u9762\u8BD5\u7ED3\u679C\u4F1A\u52A0\u5165\u6743\u91CD\u8FDB\u884C\u8BA1\u7B97\uFF0C\u5F97\u51FAAI\u89C6\u9891\u9762\u8BD5\u5F97\u5206\u3002\u8BBE\u7F6E\u540E5\u5206\u949F\u8D77\u6548" }, { children: _jsx("span", __assign({ style: { display: 'flex', alignItems: 'center', marginLeft: '8px' } }, { children: _jsx(InfoIcon, { sx: { fontSize: 14, color: 'rgba(0, 0, 0, 0.26)' } }) })) }))] })) })), !DISABLED_REPEAT_TYPE.includes(type) && (_jsxs(Stack, __assign({ direction: "row" }, { children: [_jsx(Switch, { sx: { flexShrink: 0, ml: 2, mr: 2 }, size: "small", checked: answerStatus === 1, label: _jsx(Typography, __assign({ fontSize: 12, lineHeight: 1.5, color: "rgba(0, 0, 0, 0.56)" }, { children: "\u5141\u8BB8\u91CD\u590D\u7B54\u9898" })), onChange: handleAnswerStatus }), type === 1 && aiShowType === 1 && ((aiInterviewerProfile === null || aiInterviewerProfile === void 0 ? void 0 : aiInterviewerProfile.humanType) !== 2 || interactType === 1) && (_jsx(Switch, { sx: { flexShrink: 0, mr: 2 }, size: "small", checked: isOpenAIFollowUp, label: _jsx(Typography, __assign({ fontSize: 12, lineHeight: 1.5, color: "rgba(0, 0, 0, 0.56)" }, { children: "\u56DE\u7B54\u4E0D\u5145\u5206\u65F6\u8FFD\u95EE" })), onChange: handleOpenAIFollowUpStatus }))] })))] })))] })));
86
83
  };
87
84
  export default memo(QuestionModelListItem);
@@ -9,12 +9,12 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var _a;
12
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
14
  import BaseAccordion from '../BaseAccordion';
14
15
  import { defaultQuestionParams } from '../QuestionUpdate/const';
15
16
  import { useAiAbilityListStore } from "../../../../store/ai-ability-select/question-ability-store";
16
- import SvgIcon from "../../../../components/SvgIcon";
17
- import { ADD_QUESTION_TYPE_LIST } from "../../../../constants/ai-question";
17
+ import { ADD_QUESTION_TYPE_SHOW_LIST } from "../../../../constants/ai-question";
18
18
  import { ADD_QUESTION_TYPE } from "../../../../enum/ai-question";
19
19
  import { useAiQuestionStore } from "../../../../store/ai-question/global-store";
20
20
  import { getQuestionModelStore, useQuestionModelStore } from "../../../../store/ai-question/question-model-store";
@@ -22,9 +22,14 @@ import { useQuestionTemplateStore } from "../../../../store/ai-question/question
22
22
  import { useUpdateQuestionStore } from "../../../../store/ai-question/question-update-store";
23
23
  import { uniqueId } from "../../../../utils/utils";
24
24
  import { useSetState } from 'ahooks';
25
- import { AddIcon, Box, Button, LayerOutlineIcon, Popover, SMSOneIcon, Typography } from 'fbm-ui';
25
+ import { AddIcon, Box, Button, LayerOutlineIcon, MicIcon, Popover, RadioCheckedIcon, SMSOneIcon, Typography } from 'fbm-ui';
26
26
  import { List, ListItem, ListItemButton, ListItemIcon, ListItemText } from 'fbm-ui/lib/mui';
27
27
  import { useCallback } from 'react';
28
+ var ICONS = (_a = {},
29
+ _a[ADD_QUESTION_TYPE.FREE] = _jsx(SMSOneIcon, { color: "secondary" }),
30
+ _a[ADD_QUESTION_TYPE.LANGUAGE] = _jsx(MicIcon, { color: "secondary" }),
31
+ _a[ADD_QUESTION_TYPE.SINGLECHIOCE] = _jsx(RadioCheckedIcon, { color: "secondary" }),
32
+ _a);
28
33
  var AiEvaluation = function () {
29
34
  var onOpenTemplate = useAiQuestionStore(function (store) { return [store.onOpenTemplate]; }).onOpenTemplate;
30
35
  var updateQuestionState = useUpdateQuestionStore(function (store) { return [store.updateQuestionState]; }).updateQuestionState;
@@ -41,9 +46,9 @@ var AiEvaluation = function () {
41
46
  setState({ addQuestionOpen: false });
42
47
  updateQuestionState({ open: true, aiShowType: aiShowType, token: '', index: -1, item: __assign(__assign({}, defaultQuestionParams), { aiShowType: aiShowType, token: uniqueId() }) });
43
48
  }, [setState, updateQuestionState]);
44
- var content = (_jsx(List, { children: ADD_QUESTION_TYPE_LIST.map(function (_a) {
49
+ var content = (_jsx(List, { children: ADD_QUESTION_TYPE_SHOW_LIST.map(function (_a) {
45
50
  var title = _a.title, desc = _a.desc, type = _a.type;
46
- return (_jsx(ListItem, __assign({ disablePadding: true }, { children: _jsxs(ListItemButton, __assign({ onClick: function () { return handleClickAdd(type); } }, { children: [_jsx(ListItemIcon, __assign({ sx: { minWidth: 40 } }, { children: type === ADD_QUESTION_TYPE.FREE ? _jsx(SMSOneIcon, { color: "secondary" }) : _jsx(SvgIcon, { name: "free", style: { fill: 'rgba(0, 0, 0, 0.56)' } }) })), _jsx(ListItemText, { primary: title, secondary: desc })] })) }), "question_type_".concat(type)));
51
+ return (_jsx(ListItem, __assign({ disablePadding: true }, { children: _jsxs(ListItemButton, __assign({ onClick: function () { return handleClickAdd(type); } }, { children: [_jsx(ListItemIcon, __assign({ sx: { minWidth: 40 } }, { children: ICONS[type] })), _jsx(ListItemText, { primary: title, secondary: desc })] })) }), "question_type_".concat(type)));
47
52
  }) }));
48
53
  return (_jsxs(Box, { children: [_jsxs(Box, __assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [_jsx(Button, __assign({ variant: "outlined", color: "inherit", icon: _jsx(LayerOutlineIcon, {}), onClick: function () { return onOpenTemplate === null || onOpenTemplate === void 0 ? void 0 : onOpenTemplate(questionModelData === null || questionModelData === void 0 ? void 0 : questionModelData.steps); } }, { children: "\u5C97\u4F4D\u6A21\u7248\u5E93" })), _jsx(Popover, __assign({ open: addQuestionOpen, arrow: false, content: content, onClickAway: function () { return setState({ addQuestionOpen: false }); } }, { children: _jsx(Button, __assign({ variant: "outlined", icon: _jsx(AddIcon, {}), onClick: function () { return setState({ addQuestionOpen: true }); } }, { children: "\u81EA\u5B9A\u4E49\u9898\u76EE" })) }))] })), aiEvaluationData.map(function (_a, index) {
49
54
  var name = _a.name, list = _a.list;
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * 验证0-9的整数
4
+ */
5
+ export declare const IS_INTEGER_REG: RegExp;
6
+ /**
7
+ * 可输入最大分值
8
+ */
9
+ export declare const MAX_SCORE_VALUE = 100;
10
+ export declare const VERIFICATION_SCORE: (value: string) => boolean;
11
+ export interface QuestionItemProps {
12
+ index: number;
13
+ item: any;
14
+ onChange: (key: string, value: any, index: number) => void;
15
+ }
16
+ declare const Choice: React.FC<QuestionItemProps>;
17
+ export default Choice;
@@ -0,0 +1,91 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
20
+ };
21
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
+ import { ChoiceIcon, ChoiceItem, ChoiceItemInput, ScoreInput } from './styled';
23
+ import { uniqueId } from "../../../../utils/utils";
24
+ import { arrayMoveImmutable } from 'array-move';
25
+ import { AddIcon, Box, Button, CloseIcon, DragIndicatorIcon, FormItem, IconButton } from 'fbm-ui';
26
+ import { FieldArray } from 'formik';
27
+ import { useCallback, useEffect, useRef } from 'react';
28
+ import Sortable from 'sortablejs';
29
+ /**
30
+ * 验证0-9的整数
31
+ */
32
+ export var IS_INTEGER_REG = /^[0-9]\d*$/;
33
+ /**
34
+ * 可输入最大分值
35
+ */
36
+ export var MAX_SCORE_VALUE = 100;
37
+ export var VERIFICATION_SCORE = function (value) { return (value ? !IS_INTEGER_REG.test(value) || Number(value) > MAX_SCORE_VALUE : false); };
38
+ var Choice = function (_a) {
39
+ var _b;
40
+ var index = _a.index, item = _a.item, onChange = _a.onChange;
41
+ var ref = useRef();
42
+ var sortable = useRef();
43
+ var handleOptionAdd = useCallback(function () {
44
+ var optionItem = { key: uniqueId(), content: '', score: 0 };
45
+ onChange('options', __spreadArray(__spreadArray([], ((item === null || item === void 0 ? void 0 : item.options) || []), true), [optionItem], false), index);
46
+ }, [index, item, onChange]);
47
+ useEffect(function () {
48
+ sortable.current && sortable.current.destroy();
49
+ sortable.current = new Sortable(ref.current, {
50
+ handle: '.optionItemDragHandle',
51
+ animation: 150,
52
+ forceFallback: true,
53
+ onEnd: function (_a) {
54
+ var oldIndex = _a.oldIndex, newIndex = _a.newIndex;
55
+ var options = arrayMoveImmutable((item === null || item === void 0 ? void 0 : item.options) || [], oldIndex, newIndex);
56
+ onChange('options', __spreadArray([], options, true), index);
57
+ },
58
+ });
59
+ }, [index, item, onChange]);
60
+ useEffect(function () {
61
+ var _a;
62
+ if (!((_a = item === null || item === void 0 ? void 0 : item.options) === null || _a === void 0 ? void 0 : _a.length)) {
63
+ handleOptionAdd();
64
+ }
65
+ }, [item, handleOptionAdd, index]);
66
+ return (_jsxs(Box, __assign({ width: "100%" }, { children: [_jsx(Box, __assign({ ref: ref }, { children: ((_b = item === null || item === void 0 ? void 0 : item.options) === null || _b === void 0 ? void 0 : _b.length) > 0 && (_jsx(FieldArray, { name: "questions.".concat(index, ".options"), render: function (p) {
67
+ var _a;
68
+ return (_a = p.form.values.questions[index].options) === null || _a === void 0 ? void 0 : _a.map(function (v, i) {
69
+ var _a;
70
+ return (_jsxs(ChoiceItem, { children: [_jsx(DragIndicatorIcon, { className: "optionItemDragHandle" }), _jsx(ChoiceIcon, { borderRadius: 2 }), _jsx(FormItem, __assign({ required: true, name: "questions[".concat(index, "].options[").concat(i, "].content"), placeholder: "\u65B0\u9009\u9879", InputProps: {
71
+ variant: 'standard',
72
+ multiline: true,
73
+ sx: {
74
+ mr: 1.5,
75
+ },
76
+ }, sx: { height: 'auto', flexGrow: 1, overflow: 'hidden' } }, { children: _jsx(ChoiceItemInput, { multiline: true, maxRows: 3, placeholder: "\u65B0\u9009\u9879", variant: "standard" }) })), _jsx(Box, __assign({ width: 36, flexShrink: 0 }, { children: ((_a = p.form.values.questions[index].options) === null || _a === void 0 ? void 0 : _a.length) > 1 && (_jsx(IconButton, __assign({ className: "choice-item-delete-icon", onClick: function () { return p.remove(i); } }, { children: _jsx(CloseIcon, {}) }))) })), _jsx(FormItem, __assign({ required: true, name: "questions[".concat(index, "].options[").concat(i, "].score"), placeholder: "\u5206\u503C", InputProps: {
77
+ multiline: true,
78
+ }, rules: [function (_a) {
79
+ var value = _a.value;
80
+ return VERIFICATION_SCORE(value);
81
+ }], sx: { height: 'auto', widht: 84 }, onChange: function (e) {
82
+ var value = e.target.value;
83
+ if (VERIFICATION_SCORE(value) || Number(value) > MAX_SCORE_VALUE || Number(value) < 1) {
84
+ return;
85
+ }
86
+ onChange('options', __spreadArray([], ((item === null || item === void 0 ? void 0 : item.options) || []).map(function (v, index) { return (i === index ? __assign(__assign({}, v), { score: Number(value) }) : v); }), true), index);
87
+ } }, { children: _jsx(ScoreInput, { size: "small", placeholder: "\u5206\u503C", endAdornment: "\u5206" }) }))] }, i));
88
+ });
89
+ } })) })), _jsx(ChoiceItem, { children: _jsx(Button, __assign({ icon: _jsx(AddIcon, {}), variant: "outlined", color: "inherit", size: "small", onClick: handleOptionAdd, sx: { ml: -2 } }, { children: "\u6DFB\u52A0\u9009\u9879" })) })] })));
90
+ };
91
+ export default Choice;
@@ -56,6 +56,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
56
56
  };
57
57
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
58
58
  import AiAnalysis from '../AiAnalysis';
59
+ import Chioce from './Chioce';
59
60
  import { broadcastModeOptions, durationOptions, prepareTimeOptions } from './const';
60
61
  import RandomQuestion from './RandomQuestion';
61
62
  import VideoVoice from './VideoVoice';
@@ -64,8 +65,8 @@ import { useEnterpriseStore } from "../../../../store/enterprise/enterprise-stor
64
65
  import { ADD_QUESTION_TYPE } from "../../../../enum/ai-question";
65
66
  import { GetAiAbilityList } from "../../../../services/ai-ability";
66
67
  import { useRequest } from 'ahooks';
67
- import { Autocomplete, Box, CloseIcon, Form, FormItem, IconButton, Select, useForm } from 'fbm-ui';
68
- import { Stack } from 'fbm-ui/lib/mui';
68
+ import { Autocomplete, Box, CloseIcon, DeleteIcon, Form, FormItem, IconButton, Select, useForm } from 'fbm-ui';
69
+ import { Paper, Stack } from 'fbm-ui/lib/mui';
69
70
  import { FieldArray } from 'formik';
70
71
  import { forwardRef, memo, useEffect, useImperativeHandle } from 'react';
71
72
  var QuestionForm = forwardRef(function (props, ref) {
@@ -82,6 +83,11 @@ var QuestionForm = forwardRef(function (props, ref) {
82
83
  }, [data]);
83
84
  var form = useForm({
84
85
  initialValues: initialValues,
86
+ validate: function (values) {
87
+ var errors = {};
88
+ // console.log(values);
89
+ return errors;
90
+ },
85
91
  onSubmit: function (values) { return __awaiter(void 0, void 0, void 0, function () {
86
92
  return __generator(this, function (_a) {
87
93
  switch (_a.label) {
@@ -139,16 +145,40 @@ var QuestionForm = forwardRef(function (props, ref) {
139
145
  define: define,
140
146
  isWorkplace: isWorkplace,
141
147
  });
142
- }), onChange: handleCategoryChange }) })))] })), (form === null || form === void 0 ? void 0 : form.values.broadcastType) === 1 || preview ? (_jsx(FieldArray, { name: "questions", render: function () {
143
- var _a;
144
- return (_a = form.values.questions) === null || _a === void 0 ? void 0 : _a.map(function (_, index) { return (_jsxs(Stack, __assign({ direction: "row", justifyContent: "space-between", spacing: 1 }, { children: [_jsx(FormItem, { required: true, name: "questions.".concat(index, ".content"), label: "\u9762\u8BD5\u5185\u5BB9", max: 300, placeholder: "\u9762\u8BD5\u5185\u5BB9\uFF08\u7CFB\u7EDF\u5C06\u6839\u636E\u6B64\u5185\u5BB9\u5411\u5019\u9009\u4EBA\u8FDB\u884C\u8BED\u97F3\u64AD\u62A5\uFF09", InputProps: {
145
- rows: 3,
146
- multiline: true,
147
- sx: { padding: 0 },
148
- }, sx: { flexGrow: 1, height: 120 } }), form.values.questions.length > 1 && (_jsx(Box, __assign({ height: 84, pt: 1 }, { children: _jsx(IconButton, __assign({ size: "small", onClick: function () {
149
- form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray([], form.values.questions.filter(function (_, i) { return i !== index; }), true) }));
150
- } }, { children: _jsx(CloseIcon, {}) })) })))] }), index)); });
151
- } })) : (_jsx(VideoVoice, {})), !preview && aiShowType === ADD_QUESTION_TYPE.FREE && (_jsx(RandomQuestion, { category: aiAbilityList === null || aiAbilityList === void 0 ? void 0 : aiAbilityList.find(function (v) { var _a; return v.name === ((_a = form.values.category) === null || _a === void 0 ? void 0 : _a.value); }), broadcastType: form.values.broadcastType, onAddCustonQuestion: function () {
148
+ }), onChange: handleCategoryChange }) })))] })), aiShowType !== ADD_QUESTION_TYPE.SINGLECHIOCE &&
149
+ ((form === null || form === void 0 ? void 0 : form.values.broadcastType) === 1 || preview ? (_jsx(FieldArray, { name: "questions", render: function () {
150
+ var _a;
151
+ return (_a = form.values.questions) === null || _a === void 0 ? void 0 : _a.map(function (_, index) { return (_jsxs(Stack, __assign({ direction: "row", justifyContent: "space-between", spacing: 1 }, { children: [_jsx(FormItem, { required: true, name: "questions.".concat(index, ".content"), label: "\u9762\u8BD5\u5185\u5BB9", max: 300, placeholder: "\u9762\u8BD5\u5185\u5BB9\uFF08\u7CFB\u7EDF\u5C06\u6839\u636E\u6B64\u5185\u5BB9\u5411\u5019\u9009\u4EBA\u8FDB\u884C\u8BED\u97F3\u64AD\u62A5\uFF09", InputProps: {
152
+ rows: 3,
153
+ multiline: true,
154
+ sx: { padding: 0 },
155
+ }, sx: { flexGrow: 1, height: 120 } }), form.values.questions.length > 1 && (_jsx(Box, __assign({ height: 84, pt: 1 }, { children: _jsx(IconButton, __assign({ size: "small", onClick: function () {
156
+ form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray([], form.values.questions.filter(function (_, i) { return i !== index; }), true) }));
157
+ } }, { children: _jsx(CloseIcon, {}) })) })))] }), index)); });
158
+ } })) : (_jsx(VideoVoice, {}))), !preview && aiShowType === ADD_QUESTION_TYPE.SINGLECHIOCE && (
159
+ // @ts-ignore
160
+ _jsx(Box, __assign({ component: Paper, variant: "outlined", px: 2, pb: 2, pt: 0.5 }, { children: _jsx(FieldArray, { name: "questions", render: function () {
161
+ var _a;
162
+ return (_a = form.values.questions) === null || _a === void 0 ? void 0 : _a.map(function (v, index) {
163
+ var _a, _b;
164
+ return (_jsxs(Stack, __assign({ width: "100%", justifyContent: "space-between", spacing: 1 }, { children: [_jsx(Box, __assign({ display: "flex", alignItems: "center", justifyContent: "flex-end" }, { children: ((_b = (_a = form === null || form === void 0 ? void 0 : form.values) === null || _a === void 0 ? void 0 : _a.questions) === null || _b === void 0 ? void 0 : _b.length) > 1 && (_jsx(IconButton, __assign({ sx: { mr: -1 }, onClick: function () {
165
+ form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray([], form.values.questions.filter(function (_, i) { return i !== index; }), true) }));
166
+ } }, { children: _jsx(DeleteIcon, {}) }))) })), _jsx(FormItem, { required: true, name: "questions.".concat(index, ".content"), label: "\u9762\u8BD5\u5185\u5BB9", max: 300, placeholder: "\u9762\u8BD5\u5185\u5BB9\uFF08\u7CFB\u7EDF\u5C06\u6839\u636E\u6B64\u5185\u5BB9\u5411\u5019\u9009\u4EBA\u8FDB\u884C\u8BED\u97F3\u64AD\u62A5\uFF09", InputProps: {
167
+ // rows: 3,
168
+ maxRows: 3,
169
+ minRows: 1,
170
+ multiline: true,
171
+ sx: { padding: 0 },
172
+ }, sx: {
173
+ flexGrow: 1,
174
+ height: 'auto',
175
+ } }), _jsx(Chioce, { index: index, item: v, onChange: function (_, options, i) {
176
+ form.values.questions[index].options = options;
177
+ console.log(form.values.questions, options);
178
+ form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray([], form.values.questions, true) }));
179
+ } })] }), index));
180
+ });
181
+ } }) }))), !preview && aiShowType !== ADD_QUESTION_TYPE.LANGUAGE && (_jsx(RandomQuestion, { aiShowType: aiShowType, category: aiAbilityList === null || aiAbilityList === void 0 ? void 0 : aiAbilityList.find(function (v) { var _a; return v.name === ((_a = form.values.category) === null || _a === void 0 ? void 0 : _a.value); }), broadcastType: form.values.broadcastType, onAddCustonQuestion: function () {
152
182
  form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray(__spreadArray([], form.values.questions, true), [{ content: '', videoUrl: '' }], false) }));
153
183
  }, onAddRandomQuestion: function (qs) {
154
184
  form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray(__spreadArray([], form.values.questions, true), qs.map(function (v) { return ({ content: v, videoUrl: '' }); }), true) }));
@@ -11,14 +11,15 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import SelectQuestion from './SelectQuestion';
14
+ import { ADD_QUESTION_TYPE } from "../../../../enum/ai-question";
14
15
  import { useUpdateQuestionStore } from "../../../../store/ai-question/question-update-store";
15
- import { AddIcon, Box, Button, InfoIcon, Layout, Message, Popactions, Tooltip } from 'fbm-ui';
16
- import { Checkbox, FormControlLabel, FormGroup, Typography } from 'fbm-ui/lib/mui';
16
+ import { AddIcon, Box, Button, Checkbox, InfoIcon, Layout, Message, Popactions, Tooltip } from 'fbm-ui';
17
+ import { Typography } from 'fbm-ui/lib/mui';
17
18
  import { Stack } from 'fbm-ui/lib/mui';
18
19
  import { useState } from 'react';
19
20
  var RandomQuestion = function (_a) {
20
21
  var _b, _c;
21
- var broadcastType = _a.broadcastType, onAddCustonQuestion = _a.onAddCustonQuestion, onAddRandomQuestion = _a.onAddRandomQuestion, category = _a.category;
22
+ var broadcastType = _a.broadcastType, onAddCustonQuestion = _a.onAddCustonQuestion, onAddRandomQuestion = _a.onAddRandomQuestion, category = _a.category, aiShowType = _a.aiShowType;
22
23
  var _d = useUpdateQuestionStore(function (store) { return [store.questionState]; }), questionState = _d.questionState, updateQuestionState = _d.updateQuestionState;
23
24
  var _e = useState(false), open = _e[0], setOpen = _e[1];
24
25
  var item = questionState.item;
@@ -53,6 +54,15 @@ var RandomQuestion = function (_a) {
53
54
  item: __assign(__assign({}, item), { videoBroadcast: __assign(__assign({}, item === null || item === void 0 ? void 0 : item.videoBroadcast), (_a = {}, _a[key] = checked ? 1 : 2, _a)) }),
54
55
  });
55
56
  };
56
- return (_jsxs(Layout, { children: [_jsxs(Stack, __assign({ spacing: 2, mb: 1, direction: "row", alignItems: "center", justifyContent: "space-between", mt: 0.375 }, { children: [_jsxs(Stack, __assign({ spacing: 1, direction: "row", alignItems: "center" }, { children: [_jsx(Popactions, __assign({ actions: actions, trigger: "click", isClickAway: true, sx: { height: 1 } }, { children: _jsx(Button, __assign({ variant: "outlined", color: "inherit", icon: _jsx(AddIcon, {}) }, { children: "\u968F\u673A\u9762\u8BD5\u5185\u5BB9" })) })), _jsx(Tooltip, __assign({ title: desc, placement: "bottom-start" }, { children: _jsx(Box, __assign({ display: "flex", alignItems: "center", sx: { ml: 1, height: 48 } }, { children: _jsx(InfoIcon, { sx: { color: 'rgba(0, 0, 0, 0.26)', fontSize: 16 } }) })) }))] })), _jsx(Stack, __assign({ spacing: 1, direction: "row", alignItems: "center", mb: 2 }, { children: isVideoBroadcast && (_jsx(FormGroup, { children: _jsxs(Box, __assign({ display: "flex" }, { children: [_jsx(FormControlLabel, { control: _jsx(Checkbox, { checked: ((_b = item === null || item === void 0 ? void 0 : item.videoBroadcast) === null || _b === void 0 ? void 0 : _b.videoRetry) === 1 }), label: _jsx(Typography, __assign({ variant: "body2" }, { children: "\u5141\u8BB8\u91CD\u590D\u542C\u9898" })), onChange: function (e, checked) { return handleVideoBroadcastChange('videoRetry', checked); } }), _jsx(FormControlLabel, { control: _jsx(Checkbox, { checked: ((_c = item === null || item === void 0 ? void 0 : item.videoBroadcast) === null || _c === void 0 ? void 0 : _c.videoSkip) === 1 }), label: _jsx(Typography, __assign({ variant: "body2" }, { children: "\u5141\u8BB8\u8DF3\u8FC7" })), onChange: function (e, checked) { return handleVideoBroadcastChange('videoSkip', checked); } })] })) })) }))] })), open && _jsx(SelectQuestion, { token: category === null || category === void 0 ? void 0 : category.token, open: open, onClose: function () { return setOpen(false); }, onOk: onAddRandomQuestion })] }));
57
+ var handleEnableScoreOptimizationStatus = function () {
58
+ updateQuestionState({
59
+ item: __assign(__assign({}, item), { enableScoreOptimization: !item.enableScoreOptimization }),
60
+ });
61
+ };
62
+ return (_jsxs(Layout, { children: [_jsxs(Stack, __assign({ spacing: 2, mb: 1, direction: "row", alignItems: "center", justifyContent: "space-between", mt: 0.375 }, { children: [_jsxs(Stack, __assign({ spacing: 1, direction: "row", alignItems: "center" }, { children: [_jsx(Popactions, __assign({ actions: aiShowType === ADD_QUESTION_TYPE.SINGLECHIOCE ? [actions[1]] : actions, trigger: "click", isClickAway: true, sx: { height: 1 } }, { children: _jsx(Button, __assign({ variant: "outlined", color: "inherit", icon: _jsx(AddIcon, {}) }, { children: "\u968F\u673A\u9762\u8BD5\u5185\u5BB9" })) })), _jsx(Tooltip, __assign({ title: desc, placement: "bottom-start" }, { children: _jsx(Box, __assign({ display: "flex", alignItems: "center", sx: { ml: 1, height: 48 } }, { children: _jsx(InfoIcon, { sx: { color: 'rgba(0, 0, 0, 0.26)', fontSize: 16 } }) })) }))] })), _jsxs(Stack, __assign({ spacing: 1, direction: "row", alignItems: "center", mb: 2 }, { children: [isVideoBroadcast && (_jsxs(Stack, __assign({ spacing: 1, direction: "row" }, { children: [_jsx(Checkbox, { sx: {
63
+ mr: 0,
64
+ }, checked: ((_b = item === null || item === void 0 ? void 0 : item.videoBroadcast) === null || _b === void 0 ? void 0 : _b.videoRetry) === 1, label: _jsx(Typography, __assign({ variant: "body2" }, { children: "\u5141\u8BB8\u91CD\u590D\u542C\u9898" })), onChange: function (e, checked) { return handleVideoBroadcastChange('videoRetry', checked); } }), _jsx(Checkbox, { sx: {
65
+ mr: 0,
66
+ }, checked: ((_c = item === null || item === void 0 ? void 0 : item.videoBroadcast) === null || _c === void 0 ? void 0 : _c.videoSkip) === 1, label: _jsx(Typography, __assign({ variant: "body2" }, { children: "\u5141\u8BB8\u8DF3\u8FC7" })), onChange: function (e, checked) { return handleVideoBroadcastChange('videoSkip', checked); } })] }))), item.type === 1 && item.aiShowType === 1 && (_jsx(Checkbox, { checked: item === null || item === void 0 ? void 0 : item.enableScoreOptimization, label: _jsxs(Typography, __assign({ variant: "body2", display: "flex" }, { children: ["\u56DE\u7B54\u8FC7\u77ED\u6263\u5206", _jsx(Tooltip, __assign({ title: "\u82E5\u5B57\u6570\u5C0F\u4E8E\u7B49\u4E8E80\u65F6\uFF0C\u5BF9AI\u5206\u6570\u8FDB\u884C\u4E00\u5B9A\u7684\u51CF\u5C11\uFF0C\u6700\u5C11\n\u51CF10\u5206\uFF0C\u6700\u9AD8\u51CF40\u5206\uFF0C\u6309\u7167\u5B57\u6570\u9010\u51CF\u3002" }, { children: _jsx("span", __assign({ style: { display: 'flex', alignItems: 'center', marginLeft: '8px' } }, { children: _jsx(InfoIcon, { sx: { fontSize: 14, color: 'rgba(0, 0, 0, 0.26)' } }) })) }))] })), onChange: handleEnableScoreOptimizationStatus }))] }))] })), open && _jsx(SelectQuestion, { token: category === null || category === void 0 ? void 0 : category.token, open: open, onClose: function () { return setOpen(false); }, onOk: onAddRandomQuestion })] }));
57
67
  };
58
68
  export default RandomQuestion;
@@ -54,5 +54,7 @@ export var durationOptions = [
54
54
  { value: 30, label: '30s' },
55
55
  { value: 60, label: '1m' },
56
56
  { value: 180, label: '3m' },
57
+ { value: 300, label: '5m' },
58
+ { value: 600, label: '10m' },
57
59
  { value: 1200, label: '20m' },
58
60
  ];
@@ -56,12 +56,12 @@ var __rest = (this && this.__rest) || function (s, e) {
56
56
  }
57
57
  return t;
58
58
  };
59
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
59
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
60
60
  import { defaultQuestionParams } from './const';
61
61
  import Form from './Form';
62
+ import { ADD_QUESTION_TYPE_SHOW_LIST, QUESTION_TYPE_TITLE_MAP } from "../../../../constants/ai-question";
62
63
  import { useQuestionCollectionListStore } from "../../../../store/ai-ability/question-ability-store";
63
64
  import ScrollDialogContent from "../../../../components/ScrollDialogContent";
64
- import { ADD_QUESTION_TYPE } from "../../../../enum/ai-question";
65
65
  import { useAiAnalysisStore } from "../../../../store/ai-question/ai-analysis-store";
66
66
  import { useQuestionModelStore } from "../../../../store/ai-question/question-model-store";
67
67
  import { useUpdateQuestionStore } from "../../../../store/ai-question/question-update-store";
@@ -93,18 +93,16 @@ var QuestionUpdate = function () {
93
93
  category: (item === null || item === void 0 ? void 0 : item.category) ? { label: (item === null || item === void 0 ? void 0 : item.category[0]) || '', value: (item === null || item === void 0 ? void 0 : item.category[0]) || '' } : { label: '', value: '' },
94
94
  };
95
95
  var CustomHeader = function () {
96
- var content = (_jsxs(_Fragment, { children: [_jsx(MenuItem, __assign({ sx: { backgroundColor: aiShowType === ADD_QUESTION_TYPE.FREE ? 'rgba(76, 175, 80, 0.08)' : 'rgba(255, 255, 255, 1)' }, onClick: function () {
97
- var _a;
98
- setSwitchTypeOpen(false);
99
- (_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.setFormValues({ broadcastType: defaultQuestionParams.broadcastType });
100
- updateQuestionState({ aiShowType: ADD_QUESTION_TYPE.FREE });
101
- } }, { children: _jsx(Typography, __assign({ variant: "body2" }, { children: "\u81EA\u7531\u4F5C\u7B54" })) })), _jsx(MenuItem, __assign({ sx: { backgroundColor: aiShowType === ADD_QUESTION_TYPE.LANGUAGE ? 'rgba(76, 175, 80, 0.08)' : 'rgba(255, 255, 255, 1)' }, onClick: function () {
102
- var _a;
103
- setSwitchTypeOpen(false);
104
- (_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.setFormValues({ broadcastType: defaultQuestionParams.broadcastType });
105
- updateQuestionState({ aiShowType: ADD_QUESTION_TYPE.LANGUAGE });
106
- } }, { children: _jsx(Typography, __assign({ variant: "body2" }, { children: "\u6717\u8BFB\u9898" })) }))] }));
107
- return (_jsxs(Box, __assign({ display: "flex", alignItems: "center", height: 56 }, { children: [_jsx(Typography, __assign({ ml: 3, variant: "subtitle1" }, { children: aiShowType === ADD_QUESTION_TYPE.FREE ? '自由作答' : '朗读题' })), _jsx(Popover, __assign({ open: switchTypeOpen, content: content, onClickAway: function () { return setSwitchTypeOpen(false); } }, { children: _jsx(Button, __assign({ variant: "text", size: "small", sx: { fontSize: 12, color: 'rgb(87, 107, 149)' }, onClick: function () { return setSwitchTypeOpen(true); } }, { children: "\u5207\u6362\u9898\u578B" })) }))] })));
96
+ var content = ADD_QUESTION_TYPE_SHOW_LIST.map(function (_a) {
97
+ var title = _a.title, type = _a.type;
98
+ return (_jsx(MenuItem, __assign({ sx: { backgroundColor: aiShowType === type ? 'rgba(76, 175, 80, 0.08)' : 'rgba(255, 255, 255, 1)' }, onClick: function () {
99
+ var _a;
100
+ setSwitchTypeOpen(false);
101
+ (_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.setFormValues({ broadcastType: defaultQuestionParams.broadcastType });
102
+ updateQuestionState({ aiShowType: type });
103
+ } }, { children: _jsx(Typography, __assign({ variant: "body2" }, { children: title })) }), "question_type_".concat(type)));
104
+ });
105
+ return (_jsxs(Box, __assign({ display: "flex", alignItems: "center", height: 56 }, { children: [_jsx(Typography, __assign({ ml: 3, variant: "subtitle1" }, { children: QUESTION_TYPE_TITLE_MAP[aiShowType] })), _jsx(Popover, __assign({ open: switchTypeOpen, content: content, onClickAway: function () { return setSwitchTypeOpen(false); } }, { children: _jsx(Button, __assign({ variant: "text", size: "small", sx: { fontSize: 12, color: 'rgb(87, 107, 149)' }, onClick: function () { return setSwitchTypeOpen(true); } }, { children: "\u5207\u6362\u9898\u578B" })) }))] })));
108
106
  };
109
107
  var getModelParams = useCallback(function (values, isSubmit) {
110
108
  return new Promise(function (resolve, reject) {