eli-video-interview 1.2.3-5.alpha.10 → 1.2.3-5.alpha.12

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 (23) hide show
  1. package/esm/modules/ai-ability-select/Root.js +7 -4
  2. package/esm/modules/ai-ability-select/components/AiAbilityItem/index.js +0 -10
  3. package/esm/modules/ai-ability-select/interface.d.ts +5 -0
  4. package/esm/modules/ai-question/components/BaseAccordion/interface.d.ts +0 -1
  5. package/esm/modules/ai-question/components/QuestionTemplate/AiEvaluation.js +7 -2
  6. package/esm/modules/ai-question/components/QuestionTemplate/interface.d.ts +1 -0
  7. package/esm/modules/ai-question/components/QuestionUpdate/Form.js +17 -8
  8. package/esm/store/ai-ability-select/question-ability-store.d.ts +3 -0
  9. package/esm/store/ai-ability-select/question-ability-store.js +9 -1
  10. package/esm/store/ai-question/question-model-store.d.ts +3 -0
  11. package/esm/store/ai-question/question-model-store.js +3 -1
  12. package/lib/modules/ai-ability-select/Root.js +7 -4
  13. package/lib/modules/ai-ability-select/components/AiAbilityItem/index.js +0 -10
  14. package/lib/modules/ai-ability-select/interface.d.ts +5 -0
  15. package/lib/modules/ai-question/components/BaseAccordion/interface.d.ts +0 -1
  16. package/lib/modules/ai-question/components/QuestionTemplate/AiEvaluation.js +6 -1
  17. package/lib/modules/ai-question/components/QuestionTemplate/interface.d.ts +1 -0
  18. package/lib/modules/ai-question/components/QuestionUpdate/Form.js +16 -7
  19. package/lib/store/ai-ability-select/question-ability-store.d.ts +3 -0
  20. package/lib/store/ai-ability-select/question-ability-store.js +8 -0
  21. package/lib/store/ai-question/question-model-store.d.ts +3 -0
  22. package/lib/store/ai-question/question-model-store.js +2 -0
  23. package/package.json +1 -1
@@ -20,16 +20,19 @@ import { Box, Typography } from 'fbm-ui';
20
20
  import { Stack } from 'fbm-ui/lib/mui';
21
21
  import { forwardRef, memo, useEffect } from 'react';
22
22
  var AiAbilitySelectRoot = forwardRef(function (_a, ref) {
23
- var jobToken = _a.jobToken, thirdToken = _a.thirdToken;
24
- var _b = useAiAbilityListStore(), aiAbilityList = _b.aiAbilityList, setAiAbilityList = _b.setAiAbilityList;
23
+ var jobToken = _a.jobToken, thirdToken = _a.thirdToken, token = _a.token;
24
+ var _b = useAiAbilityListStore(), aiAbilityList = _b.aiAbilityList, setAiAbilityList = _b.setAiAbilityList, selctedAbilitys = _b.selctedAbilitys;
25
25
  var setEnterprise = useEnterpriseStore().setEnterprise;
26
26
  var data = useRequest(function () { return GetAiAbilityList({ jobToken: jobToken, thirdToken: thirdToken }); }, {
27
27
  refreshDeps: [jobToken, thirdToken],
28
28
  }).data;
29
29
  useEffect(function () {
30
- setAiAbilityList((data === null || data === void 0 ? void 0 : data.data.list) || []);
30
+ var _a;
31
+ setAiAbilityList(((_a = data === null || data === void 0 ? void 0 : data.data.list) === null || _a === void 0 ? void 0 : _a.filter(function (v) {
32
+ return !token || !v.isNew || selctedAbilitys.includes(v.token);
33
+ })) || []);
31
34
  // eslint-disable-next-line react-hooks/exhaustive-deps
32
- }, [data]);
35
+ }, [data, token, selctedAbilitys]);
33
36
  useEffect(function () {
34
37
  setEnterprise({ jobToken: jobToken, thirdToken: thirdToken });
35
38
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -39,14 +39,4 @@ var AiAbilityLable = function (_a) {
39
39
  return (_jsx(Popover, __assign({ content: _jsx(AiAbilityDetail, { detail: detail }), trigger: "hover", placement: "right" }, { children: _jsx(Typography, __assign({ noWrap: true, maxWidth: 180, variant: "body2", sx: { mt: 0.5 } }, { children: name })) })));
40
40
  return (_jsx(Typography, __assign({ noWrap: true, maxWidth: 180, variant: "body2" }, { children: name })));
41
41
  };
42
- // const AiAbilityItemWrapper: React.FC<AiAbilityItemProps> = props => {
43
- // const { detail } = props;
44
- // if (detail?.length > 0)
45
- // return (
46
- // <Popover content={<AiAbilityDetail detail={detail} />} trigger="hover" placement="right">
47
- // <AiAbilityItem {...props} />
48
- // </Popover>
49
- // );
50
- // return <AiAbilityItem {...props} />;
51
- // };
52
42
  export default AiAbilityItem;
@@ -2,6 +2,7 @@ export interface AiAbilitySelectProps {
2
2
  jobToken?: string;
3
3
  thirdToken?: string;
4
4
  selectedTokens?: string[];
5
+ token?: string;
5
6
  }
6
7
  interface AiAbilityDetailInfo {
7
8
  name: string;
@@ -12,10 +13,14 @@ export interface AiAbilityDetail {
12
13
  }
13
14
  export interface AiAbility extends AiAbilityDetail {
14
15
  name: string;
16
+ tag: string;
17
+ isWorkplace: boolean;
18
+ define: string;
15
19
  isNew?: boolean;
16
20
  isAI?: boolean;
17
21
  token: string;
18
22
  selected?: boolean;
23
+ type: number;
19
24
  }
20
25
  export declare type AiAbilityItemProps = AiAbility;
21
26
  export interface AiAbilityListData {
@@ -1,6 +1,5 @@
1
1
  import { AiEvaluationDataList } from '../QuestionTemplate/interface';
2
2
  export interface BaseAccordionProps extends AiEvaluationDataList {
3
- isNew?: boolean;
4
3
  index?: number;
5
4
  isShowOnlyAITest: boolean;
6
5
  isShowDesc?: boolean;
@@ -12,11 +12,12 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import BaseAccordion from '../BaseAccordion';
14
14
  import { defaultQuestionParams } from '../QuestionUpdate/const';
15
+ import { useAiAbilityListStore } from "../../../../store/ai-ability-select/question-ability-store";
15
16
  import SvgIcon from "../../../../components/SvgIcon";
16
17
  import { ADD_QUESTION_TYPE_LIST } from "../../../../constants/ai-question";
17
18
  import { ADD_QUESTION_TYPE } from "../../../../enum/ai-question";
18
19
  import { useAiQuestionStore } from "../../../../store/ai-question/global-store";
19
- import { useQuestionModelStore } from "../../../../store/ai-question/question-model-store";
20
+ import { getQuestionModelStore, useQuestionModelStore } from "../../../../store/ai-question/question-model-store";
20
21
  import { useQuestionTemplateStore } from "../../../../store/ai-question/question-template-store";
21
22
  import { useUpdateQuestionStore } from "../../../../store/ai-question/question-update-store";
22
23
  import { uniqueId } from "../../../../utils/utils";
@@ -28,6 +29,8 @@ var AiEvaluation = function () {
28
29
  var onOpenTemplate = useAiQuestionStore(function (store) { return [store.onOpenTemplate]; }).onOpenTemplate;
29
30
  var updateQuestionState = useUpdateQuestionStore(function (store) { return [store.updateQuestionState]; }).updateQuestionState;
30
31
  var questionModelData = useQuestionModelStore(function (store) { return [store.questionModelData]; }).questionModelData;
32
+ var isEdit = (getQuestionModelStore() || {}).isEdit;
33
+ var selctedAbilitys = useAiAbilityListStore().selctedAbilitys;
31
34
  var aiEvaluationData = useQuestionTemplateStore(function (store) { return [store.aiEvaluationData]; }).aiEvaluationData;
32
35
  var _a = useSetState({
33
36
  addQuestionOpen: false,
@@ -44,7 +47,9 @@ var AiEvaluation = function () {
44
47
  }) }));
45
48
  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) {
46
49
  var name = _a.name, list = _a.list;
47
- return (_jsxs(Box, { children: [_jsx(Typography, __assign({ fontSize: 12, lineHeight: 1.5, weight: "500", mb: 2 }, { children: name })), list.map(function (item, i) { return (_jsx(BaseAccordion, __assign({ index: i, isShowOnlyAITest: showOnlyAITest, isShowDesc: index !== 0, isShowSummaryAction: index !== 0, isShowConfirm: index !== 0 }, item), item.name + i)); })] }, name));
50
+ return (_jsxs(Box, { children: [_jsx(Typography, __assign({ fontSize: 12, lineHeight: 1.5, weight: "500", mb: 2 }, { children: name })), list
51
+ .filter(function (v) { return !isEdit || !v.isNew || selctedAbilitys.includes(v.token); })
52
+ .map(function (item, i) { return (_jsx(BaseAccordion, __assign({ index: i, isShowOnlyAITest: showOnlyAITest, isShowDesc: index !== 0, isShowSummaryAction: index !== 0, isShowConfirm: index !== 0 }, item), item.name + i)); })] }, name));
48
53
  })] }));
49
54
  };
50
55
  export default AiEvaluation;
@@ -35,6 +35,7 @@ export interface AiEvaluationDataList {
35
35
  name: string;
36
36
  token: string;
37
37
  positionName?: string;
38
+ isNew: boolean;
38
39
  list: AiEvaluationList[];
39
40
  }
40
41
  export interface AiEvaluationData {
@@ -59,9 +59,10 @@ import AiAnalysis from '../AiAnalysis';
59
59
  import { broadcastModeOptions, durationOptions, prepareTimeOptions } from './const';
60
60
  import RandomQuestion from './RandomQuestion';
61
61
  import VideoVoice from './VideoVoice';
62
- import { useQuestionCollectionListStore } from "../../../../store/ai-ability/question-ability-store";
62
+ import { useAiAbilityListStore } from "../../../../store/ai-ability-select/question-ability-store";
63
+ import { useEnterpriseStore } from "../../../../store/enterprise/enterprise-store";
63
64
  import { ADD_QUESTION_TYPE } from "../../../../enum/ai-question";
64
- import { PostQuestionCollectionList } from "../../../../services/ai-ability";
65
+ import { GetAiAbilityList } from "../../../../services/ai-ability";
65
66
  import { useRequest } from 'ahooks';
66
67
  import { Autocomplete, Box, CloseIcon, Form, FormItem, IconButton, Select, useForm } from 'fbm-ui';
67
68
  import { Stack } from 'fbm-ui/lib/mui';
@@ -69,8 +70,16 @@ import { FieldArray } from 'formik';
69
70
  import { forwardRef, memo, useEffect, useImperativeHandle } from 'react';
70
71
  var QuestionForm = forwardRef(function (props, ref) {
71
72
  var aiShowType = props.aiShowType, initialValues = props.initialValues, values = props.values, preview = props.preview, onValuesChange = props.onValuesChange, onSubmit = props.onSubmit, onCategoryChange = props.onCategoryChange;
72
- var _a = useQuestionCollectionListStore(function (store) { return [store.questionCollectionList]; }), questionCollectionList = _a.questionCollectionList, updateQuestionCollectionList = _a.updateQuestionCollectionList;
73
- var data = useRequest(PostQuestionCollectionList, { manual: preview }).data;
73
+ var _a = useAiAbilityListStore(), aiAbilityList = _a.aiAbilityList, setSpecialAiAbilityList = _a.setSpecialAiAbilityList;
74
+ var _b = useEnterpriseStore().enterprise, jobToken = _b.jobToken, thirdToken = _b.thirdToken;
75
+ var data = useRequest(function () { return GetAiAbilityList({ jobToken: jobToken, thirdToken: thirdToken }); }, {
76
+ refreshDeps: [jobToken, thirdToken],
77
+ manual: preview,
78
+ }).data;
79
+ useEffect(function () {
80
+ setSpecialAiAbilityList((data === null || data === void 0 ? void 0 : data.data.list) || []);
81
+ // eslint-disable-next-line react-hooks/exhaustive-deps
82
+ }, [data]);
74
83
  var form = useForm({
75
84
  initialValues: initialValues,
76
85
  onSubmit: function (values) { return __awaiter(void 0, void 0, void 0, function () {
@@ -111,14 +120,14 @@ var QuestionForm = forwardRef(function (props, ref) {
111
120
  }); });
112
121
  useEffect(function () {
113
122
  values && form.setValues(values);
114
- updateQuestionCollectionList((data === null || data === void 0 ? void 0 : data.data.list) || []);
123
+ // updateQuestionCollectionList(data?.data.list || []);
115
124
  // eslint-disable-next-line react-hooks/exhaustive-deps
116
125
  }, [values, data]);
117
126
  useEffect(function () {
118
127
  // console.log(form.values);
119
128
  onValuesChange === null || onValuesChange === void 0 ? void 0 : onValuesChange(form.values);
120
129
  }, [form.values, onValuesChange]);
121
- return (_jsxs(_Fragment, { children: [_jsxs(Form, __assign({}, form, { children: [_jsx(FormItem, { required: true, disabled: preview, name: "name", label: "\u6807\u9898", placeholder: "\u6807\u9898\uFF08\u7528\u4E8E\u7CFB\u7EDF\u7BA1\u7406\uFF09", max: 15 }), _jsxs(Box, __assign({ display: "flex" }, { children: [!preview && aiShowType === ADD_QUESTION_TYPE.FREE && (_jsx(FormItem, __assign({ sx: { flex: '1 0', mr: 1 }, required: true, disabled: preview, name: "broadcastType", label: "\u64AD\u62A5\u65B9\u5F0F" }, { children: _jsx(Select, { placeholder: "\u64AD\u62A5\u65B9\u5F0F", options: broadcastModeOptions }) }))), !preview && (_jsx(FormItem, __assign({ style: { flex: '1 0' }, disabled: preview, name: "category", label: "\u8003\u5BDF\u80FD\u529B" }, { children: _jsx(Autocomplete, { placeholder: "\u8003\u5BDF\u80FD\u529B", options: questionCollectionList.map(function (_a) {
130
+ return (_jsxs(_Fragment, { children: [_jsxs(Form, __assign({}, form, { children: [_jsx(FormItem, { required: true, disabled: preview, name: "name", label: "\u6807\u9898", placeholder: "\u6807\u9898\uFF08\u7528\u4E8E\u7CFB\u7EDF\u7BA1\u7406\uFF09", max: 15 }), _jsxs(Box, __assign({ display: "flex" }, { children: [!preview && aiShowType === ADD_QUESTION_TYPE.FREE && (_jsx(FormItem, __assign({ sx: { flex: '1 0', mr: 1 }, required: true, disabled: preview, name: "broadcastType", label: "\u64AD\u62A5\u65B9\u5F0F" }, { children: _jsx(Select, { placeholder: "\u64AD\u62A5\u65B9\u5F0F", options: broadcastModeOptions }) }))), !preview && (_jsx(FormItem, __assign({ style: { flex: '1 0' }, disabled: preview, name: "category", label: "\u8003\u5BDF\u80FD\u529B" }, { children: _jsx(Autocomplete, { placeholder: "\u8003\u5BDF\u80FD\u529B", options: aiAbilityList.map(function (_a) {
122
131
  var tag = _a.tag, token = _a.token, isWorkplace = _a.isWorkplace, define = _a.define, type = _a.type;
123
132
  return ({
124
133
  label: tag,
@@ -139,7 +148,7 @@ var QuestionForm = forwardRef(function (props, ref) {
139
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 () {
140
149
  form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray([], form.values.questions.filter(function (_, i) { return i !== index; }), true) }));
141
150
  } }, { children: _jsx(CloseIcon, {}) })) })))] }), index)); });
142
- } })) : (_jsx(VideoVoice, {})), !preview && aiShowType === ADD_QUESTION_TYPE.FREE && (_jsx(RandomQuestion, { category: questionCollectionList === null || questionCollectionList === void 0 ? void 0 : questionCollectionList.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 () {
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 () {
143
152
  form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray(__spreadArray([], form.values.questions, true), [{ content: '', videoUrl: '' }], false) }));
144
153
  }, onAddRandomQuestion: function (qs) {
145
154
  form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray(__spreadArray([], form.values.questions, true), qs.map(function (v) { return ({ content: v, videoUrl: '' }); }), true) }));
@@ -148,7 +157,7 @@ var QuestionForm = forwardRef(function (props, ref) {
148
157
  multiline: true,
149
158
  placeholder: '朗读内容(候选人将根据此内容进行朗读)',
150
159
  sx: { padding: 0 },
151
- } })), _jsxs(Box, __assign({ display: "flex" }, { children: [_jsx(FormItem, __assign({ sx: { height: 64, flex: '1 0', mr: 2 }, required: true, disabled: preview, name: "prepareTime", label: "\u51C6\u5907\u65F6\u957F" }, { children: _jsx(Select, { options: prepareTimeOptions }) })), _jsx(FormItem, __assign({ sx: { height: 64, flex: '1 0' }, required: true, disabled: preview, name: "duration", label: "\u56DE\u7B54\u65F6\u957F" }, { children: _jsx(Select, { options: durationOptions }) })), _jsx(FormItem, { sx: { height: 64, flex: '1 0', ml: 2 }, name: "minResponseDuration", label: "\u6700\u5C11\u56DE\u7B54\u65F6\u957F", type: "number",
160
+ } })), _jsxs(Box, __assign({ display: "flex" }, { children: [_jsx(FormItem, __assign({ sx: { height: 64, flex: '1 0', mr: 2 }, required: true, disabled: preview, name: "prepareTime", label: "\u51C6\u5907\u65F6\u957F" }, { children: _jsx(Select, { options: prepareTimeOptions }) })), _jsx(FormItem, __assign({ sx: { height: 64, flex: '1 0' }, required: true, disabled: preview, name: "duration", label: "\u56DE\u7B54\u65F6\u957F" }, { children: _jsx(Select, { options: durationOptions }) })), _jsx(FormItem, { sx: { height: 64, flex: '1 0', ml: 2 }, name: "minResponseDuration", label: "\u6700\u5C11\u56DE\u7B54\u65F6\u957F", type: "number", disabled: preview,
152
161
  // rules={[
153
162
  // e => {
154
163
  // if (!/^[1-9]\d*$/.test(e.value)) {
@@ -3,16 +3,19 @@ import { AiAbility } from '@/modules/ai-ability-select/interface';
3
3
  export declare const useAiAbilityListStore: (depsFn?: import("hox/es/types").DepsFn<{
4
4
  selctedAbilitys: string[];
5
5
  setSelctedAbilitys: import("react").Dispatch<import("react").SetStateAction<string[]>>;
6
+ setSpecialAiAbilityList: (list: AiAbility[]) => void;
6
7
  aiAbilityList: AiAbility[];
7
8
  setAiAbilityList: import("react").Dispatch<import("react").SetStateAction<AiAbility[]>>;
8
9
  }> | undefined) => {
9
10
  selctedAbilitys: string[];
10
11
  setSelctedAbilitys: import("react").Dispatch<import("react").SetStateAction<string[]>>;
12
+ setSpecialAiAbilityList: (list: AiAbility[]) => void;
11
13
  aiAbilityList: AiAbility[];
12
14
  setAiAbilityList: import("react").Dispatch<import("react").SetStateAction<AiAbility[]>>;
13
15
  }, getAiAbilityListStore: () => {
14
16
  selctedAbilitys: string[];
15
17
  setSelctedAbilitys: import("react").Dispatch<import("react").SetStateAction<string[]>>;
18
+ setSpecialAiAbilityList: (list: AiAbility[]) => void;
16
19
  aiAbilityList: AiAbility[];
17
20
  setAiAbilityList: import("react").Dispatch<import("react").SetStateAction<AiAbility[]>>;
18
21
  } | undefined;
@@ -1,12 +1,20 @@
1
1
  var _a;
2
+ import { getQuestionModelStore } from '../ai-question/question-model-store';
2
3
  import { createGlobalStore } from 'hox';
3
- import { useState } from 'react';
4
+ import { useCallback, useState } from 'react';
4
5
  export var useAiAbilityListStore = (_a = createGlobalStore(function () {
6
+ var isEdit = (getQuestionModelStore() || {}).isEdit;
5
7
  var _a = useState([]), aiAbilityList = _a[0], setAiAbilityList = _a[1];
6
8
  var _b = useState([]), selctedAbilitys = _b[0], setSelctedAbilitys = _b[1];
9
+ var setSpecialAiAbilityList = useCallback(function (list) {
10
+ setAiAbilityList((list === null || list === void 0 ? void 0 : list.filter(function (v) {
11
+ return !isEdit || !v.isNew || selctedAbilitys.includes(v.token);
12
+ })) || []);
13
+ }, [isEdit, selctedAbilitys]);
7
14
  return {
8
15
  selctedAbilitys: selctedAbilitys,
9
16
  setSelctedAbilitys: setSelctedAbilitys,
17
+ setSpecialAiAbilityList: setSpecialAiAbilityList,
10
18
  aiAbilityList: aiAbilityList,
11
19
  setAiAbilityList: setAiAbilityList,
12
20
  };
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { QuestionModelData, QuestionModelStep } from '@/modules/ai-question/components/QuestionModel/interface';
3
3
  export declare const useQuestionModelStore: (depsFn?: import("hox/es/types").DepsFn<{
4
+ isEdit: boolean;
4
5
  questionModelData: QuestionModelData | undefined;
5
6
  addModel: (modelStep: QuestionModelStep | QuestionModelStep[]) => void;
6
7
  editModel: (modelStep: QuestionModelStep, index: number) => void;
@@ -8,6 +9,7 @@ export declare const useQuestionModelStore: (depsFn?: import("hox/es/types").Dep
8
9
  updateModel: import("react").Dispatch<import("react").SetStateAction<QuestionModelData | undefined>>;
9
10
  updateModelWeight: (value: string, index: number) => void;
10
11
  }> | undefined) => {
12
+ isEdit: boolean;
11
13
  questionModelData: QuestionModelData | undefined;
12
14
  addModel: (modelStep: QuestionModelStep | QuestionModelStep[]) => void;
13
15
  editModel: (modelStep: QuestionModelStep, index: number) => void;
@@ -15,6 +17,7 @@ export declare const useQuestionModelStore: (depsFn?: import("hox/es/types").Dep
15
17
  updateModel: import("react").Dispatch<import("react").SetStateAction<QuestionModelData | undefined>>;
16
18
  updateModelWeight: (value: string, index: number) => void;
17
19
  }, getQuestionModelStore: () => {
20
+ isEdit: boolean;
18
21
  questionModelData: QuestionModelData | undefined;
19
22
  addModel: (modelStep: QuestionModelStep | QuestionModelStep[]) => void;
20
23
  editModel: (modelStep: QuestionModelStep, index: number) => void;
@@ -14,7 +14,7 @@ import { IS_AI_ANALYSIS } from "../../constants/ai-question";
14
14
  import { computeDecimalValue, formatNumberDecimal, uniqueId } from "../../utils/utils";
15
15
  import { createGlobalStore } from 'hox';
16
16
  import update from 'immutability-helper';
17
- import { useCallback, useState } from 'react';
17
+ import { useCallback, useMemo, useState } from 'react';
18
18
  export var useQuestionModelStore = (_a = createGlobalStore(function () {
19
19
  var _a = useState(), questionModelData = _a[0], updateModel = _a[1];
20
20
  var _b = (questionModelData || {}).steps, steps = _b === void 0 ? [] : _b;
@@ -125,7 +125,9 @@ export var useQuestionModelStore = (_a = createGlobalStore(function () {
125
125
  updateModel(__assign(__assign({}, questionModelData), { duration: 0, steps: newSteps }));
126
126
  }
127
127
  }, [computeWeight, questionModelData, steps]);
128
+ var isEdit = useMemo(function () { return !!(questionModelData === null || questionModelData === void 0 ? void 0 : questionModelData.token); }, [questionModelData]);
128
129
  return {
130
+ isEdit: isEdit,
129
131
  questionModelData: questionModelData,
130
132
  addModel: addModel,
131
133
  editModel: editModel,
@@ -25,16 +25,19 @@ var fbm_ui_1 = require("fbm-ui");
25
25
  var mui_1 = require("fbm-ui/lib/mui");
26
26
  var react_1 = require("react");
27
27
  var AiAbilitySelectRoot = (0, react_1.forwardRef)(function (_a, ref) {
28
- var jobToken = _a.jobToken, thirdToken = _a.thirdToken;
29
- var _b = (0, question_ability_store_1.useAiAbilityListStore)(), aiAbilityList = _b.aiAbilityList, setAiAbilityList = _b.setAiAbilityList;
28
+ var jobToken = _a.jobToken, thirdToken = _a.thirdToken, token = _a.token;
29
+ var _b = (0, question_ability_store_1.useAiAbilityListStore)(), aiAbilityList = _b.aiAbilityList, setAiAbilityList = _b.setAiAbilityList, selctedAbilitys = _b.selctedAbilitys;
30
30
  var setEnterprise = (0, enterprise_store_1.useEnterpriseStore)().setEnterprise;
31
31
  var data = (0, ahooks_1.useRequest)(function () { return (0, ai_ability_1.GetAiAbilityList)({ jobToken: jobToken, thirdToken: thirdToken }); }, {
32
32
  refreshDeps: [jobToken, thirdToken],
33
33
  }).data;
34
34
  (0, react_1.useEffect)(function () {
35
- setAiAbilityList((data === null || data === void 0 ? void 0 : data.data.list) || []);
35
+ var _a;
36
+ setAiAbilityList(((_a = data === null || data === void 0 ? void 0 : data.data.list) === null || _a === void 0 ? void 0 : _a.filter(function (v) {
37
+ return !token || !v.isNew || selctedAbilitys.includes(v.token);
38
+ })) || []);
36
39
  // eslint-disable-next-line react-hooks/exhaustive-deps
37
- }, [data]);
40
+ }, [data, token, selctedAbilitys]);
38
41
  (0, react_1.useEffect)(function () {
39
42
  setEnterprise({ jobToken: jobToken, thirdToken: thirdToken });
40
43
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -44,14 +44,4 @@ var AiAbilityLable = function (_a) {
44
44
  return ((0, jsx_runtime_1.jsx)(fbm_ui_1.Popover, __assign({ content: (0, jsx_runtime_1.jsx)(AiAbilityDetail_1.default, { detail: detail }), trigger: "hover", placement: "right" }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ noWrap: true, maxWidth: 180, variant: "body2", sx: { mt: 0.5 } }, { children: name })) })));
45
45
  return ((0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ noWrap: true, maxWidth: 180, variant: "body2" }, { children: name })));
46
46
  };
47
- // const AiAbilityItemWrapper: React.FC<AiAbilityItemProps> = props => {
48
- // const { detail } = props;
49
- // if (detail?.length > 0)
50
- // return (
51
- // <Popover content={<AiAbilityDetail detail={detail} />} trigger="hover" placement="right">
52
- // <AiAbilityItem {...props} />
53
- // </Popover>
54
- // );
55
- // return <AiAbilityItem {...props} />;
56
- // };
57
47
  exports.default = AiAbilityItem;
@@ -2,6 +2,7 @@ export interface AiAbilitySelectProps {
2
2
  jobToken?: string;
3
3
  thirdToken?: string;
4
4
  selectedTokens?: string[];
5
+ token?: string;
5
6
  }
6
7
  interface AiAbilityDetailInfo {
7
8
  name: string;
@@ -12,10 +13,14 @@ export interface AiAbilityDetail {
12
13
  }
13
14
  export interface AiAbility extends AiAbilityDetail {
14
15
  name: string;
16
+ tag: string;
17
+ isWorkplace: boolean;
18
+ define: string;
15
19
  isNew?: boolean;
16
20
  isAI?: boolean;
17
21
  token: string;
18
22
  selected?: boolean;
23
+ type: number;
19
24
  }
20
25
  export declare type AiAbilityItemProps = AiAbility;
21
26
  export interface AiAbilityListData {
@@ -1,6 +1,5 @@
1
1
  import { AiEvaluationDataList } from '../QuestionTemplate/interface';
2
2
  export interface BaseAccordionProps extends AiEvaluationDataList {
3
- isNew?: boolean;
4
3
  index?: number;
5
4
  isShowOnlyAITest: boolean;
6
5
  isShowDesc?: boolean;
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  var jsx_runtime_1 = require("react/jsx-runtime");
18
18
  var BaseAccordion_1 = __importDefault(require("../BaseAccordion"));
19
19
  var const_1 = require("../QuestionUpdate/const");
20
+ var question_ability_store_1 = require("../../../../store/ai-ability-select/question-ability-store");
20
21
  var SvgIcon_1 = __importDefault(require("../../../../components/SvgIcon"));
21
22
  var ai_question_1 = require("../../../../constants/ai-question");
22
23
  var ai_question_2 = require("../../../../enum/ai-question");
@@ -33,6 +34,8 @@ var AiEvaluation = function () {
33
34
  var onOpenTemplate = (0, global_store_1.useAiQuestionStore)(function (store) { return [store.onOpenTemplate]; }).onOpenTemplate;
34
35
  var updateQuestionState = (0, question_update_store_1.useUpdateQuestionStore)(function (store) { return [store.updateQuestionState]; }).updateQuestionState;
35
36
  var questionModelData = (0, question_model_store_1.useQuestionModelStore)(function (store) { return [store.questionModelData]; }).questionModelData;
37
+ var isEdit = ((0, question_model_store_1.getQuestionModelStore)() || {}).isEdit;
38
+ var selctedAbilitys = (0, question_ability_store_1.useAiAbilityListStore)().selctedAbilitys;
36
39
  var aiEvaluationData = (0, question_template_store_1.useQuestionTemplateStore)(function (store) { return [store.aiEvaluationData]; }).aiEvaluationData;
37
40
  var _a = (0, ahooks_1.useSetState)({
38
41
  addQuestionOpen: false,
@@ -49,7 +52,9 @@ var AiEvaluation = function () {
49
52
  }) }));
50
53
  return ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, { children: [(0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Button, __assign({ variant: "outlined", color: "inherit", icon: (0, jsx_runtime_1.jsx)(fbm_ui_1.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" })), (0, jsx_runtime_1.jsx)(fbm_ui_1.Popover, __assign({ open: addQuestionOpen, arrow: false, content: content, onClickAway: function () { return setState({ addQuestionOpen: false }); } }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Button, __assign({ variant: "outlined", icon: (0, jsx_runtime_1.jsx)(fbm_ui_1.AddIcon, {}), onClick: function () { return setState({ addQuestionOpen: true }); } }, { children: "\u81EA\u5B9A\u4E49\u9898\u76EE" })) }))] })), aiEvaluationData.map(function (_a, index) {
51
54
  var name = _a.name, list = _a.list;
52
- return ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ fontSize: 12, lineHeight: 1.5, weight: "500", mb: 2 }, { children: name })), list.map(function (item, i) { return ((0, jsx_runtime_1.jsx)(BaseAccordion_1.default, __assign({ index: i, isShowOnlyAITest: showOnlyAITest, isShowDesc: index !== 0, isShowSummaryAction: index !== 0, isShowConfirm: index !== 0 }, item), item.name + i)); })] }, name));
55
+ return ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ fontSize: 12, lineHeight: 1.5, weight: "500", mb: 2 }, { children: name })), list
56
+ .filter(function (v) { return !isEdit || !v.isNew || selctedAbilitys.includes(v.token); })
57
+ .map(function (item, i) { return ((0, jsx_runtime_1.jsx)(BaseAccordion_1.default, __assign({ index: i, isShowOnlyAITest: showOnlyAITest, isShowDesc: index !== 0, isShowSummaryAction: index !== 0, isShowConfirm: index !== 0 }, item), item.name + i)); })] }, name));
53
58
  })] }));
54
59
  };
55
60
  exports.default = AiEvaluation;
@@ -35,6 +35,7 @@ export interface AiEvaluationDataList {
35
35
  name: string;
36
36
  token: string;
37
37
  positionName?: string;
38
+ isNew: boolean;
38
39
  list: AiEvaluationList[];
39
40
  }
40
41
  export interface AiEvaluationData {
@@ -64,7 +64,8 @@ var AiAnalysis_1 = __importDefault(require("../AiAnalysis"));
64
64
  var const_1 = require("./const");
65
65
  var RandomQuestion_1 = __importDefault(require("./RandomQuestion"));
66
66
  var VideoVoice_1 = __importDefault(require("./VideoVoice"));
67
- var question_ability_store_1 = require("../../../../store/ai-ability/question-ability-store");
67
+ var question_ability_store_1 = require("../../../../store/ai-ability-select/question-ability-store");
68
+ var enterprise_store_1 = require("../../../../store/enterprise/enterprise-store");
68
69
  var ai_question_1 = require("../../../../enum/ai-question");
69
70
  var ai_ability_1 = require("../../../../services/ai-ability");
70
71
  var ahooks_1 = require("ahooks");
@@ -74,8 +75,16 @@ var formik_1 = require("formik");
74
75
  var react_1 = require("react");
75
76
  var QuestionForm = (0, react_1.forwardRef)(function (props, ref) {
76
77
  var aiShowType = props.aiShowType, initialValues = props.initialValues, values = props.values, preview = props.preview, onValuesChange = props.onValuesChange, onSubmit = props.onSubmit, onCategoryChange = props.onCategoryChange;
77
- var _a = (0, question_ability_store_1.useQuestionCollectionListStore)(function (store) { return [store.questionCollectionList]; }), questionCollectionList = _a.questionCollectionList, updateQuestionCollectionList = _a.updateQuestionCollectionList;
78
- var data = (0, ahooks_1.useRequest)(ai_ability_1.PostQuestionCollectionList, { manual: preview }).data;
78
+ var _a = (0, question_ability_store_1.useAiAbilityListStore)(), aiAbilityList = _a.aiAbilityList, setSpecialAiAbilityList = _a.setSpecialAiAbilityList;
79
+ var _b = (0, enterprise_store_1.useEnterpriseStore)().enterprise, jobToken = _b.jobToken, thirdToken = _b.thirdToken;
80
+ var data = (0, ahooks_1.useRequest)(function () { return (0, ai_ability_1.GetAiAbilityList)({ jobToken: jobToken, thirdToken: thirdToken }); }, {
81
+ refreshDeps: [jobToken, thirdToken],
82
+ manual: preview,
83
+ }).data;
84
+ (0, react_1.useEffect)(function () {
85
+ setSpecialAiAbilityList((data === null || data === void 0 ? void 0 : data.data.list) || []);
86
+ // eslint-disable-next-line react-hooks/exhaustive-deps
87
+ }, [data]);
79
88
  var form = (0, fbm_ui_1.useForm)({
80
89
  initialValues: initialValues,
81
90
  onSubmit: function (values) { return __awaiter(void 0, void 0, void 0, function () {
@@ -116,14 +125,14 @@ var QuestionForm = (0, react_1.forwardRef)(function (props, ref) {
116
125
  }); });
117
126
  (0, react_1.useEffect)(function () {
118
127
  values && form.setValues(values);
119
- updateQuestionCollectionList((data === null || data === void 0 ? void 0 : data.data.list) || []);
128
+ // updateQuestionCollectionList(data?.data.list || []);
120
129
  // eslint-disable-next-line react-hooks/exhaustive-deps
121
130
  }, [values, data]);
122
131
  (0, react_1.useEffect)(function () {
123
132
  // console.log(form.values);
124
133
  onValuesChange === null || onValuesChange === void 0 ? void 0 : onValuesChange(form.values);
125
134
  }, [form.values, onValuesChange]);
126
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(fbm_ui_1.Form, __assign({}, form, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, { required: true, disabled: preview, name: "name", label: "\u6807\u9898", placeholder: "\u6807\u9898\uFF08\u7528\u4E8E\u7CFB\u7EDF\u7BA1\u7406\uFF09", max: 15 }), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex" }, { children: [!preview && aiShowType === ai_question_1.ADD_QUESTION_TYPE.FREE && ((0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, __assign({ sx: { flex: '1 0', mr: 1 }, required: true, disabled: preview, name: "broadcastType", label: "\u64AD\u62A5\u65B9\u5F0F" }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Select, { placeholder: "\u64AD\u62A5\u65B9\u5F0F", options: const_1.broadcastModeOptions }) }))), !preview && ((0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, __assign({ style: { flex: '1 0' }, disabled: preview, name: "category", label: "\u8003\u5BDF\u80FD\u529B" }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Autocomplete, { placeholder: "\u8003\u5BDF\u80FD\u529B", options: questionCollectionList.map(function (_a) {
135
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(fbm_ui_1.Form, __assign({}, form, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, { required: true, disabled: preview, name: "name", label: "\u6807\u9898", placeholder: "\u6807\u9898\uFF08\u7528\u4E8E\u7CFB\u7EDF\u7BA1\u7406\uFF09", max: 15 }), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex" }, { children: [!preview && aiShowType === ai_question_1.ADD_QUESTION_TYPE.FREE && ((0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, __assign({ sx: { flex: '1 0', mr: 1 }, required: true, disabled: preview, name: "broadcastType", label: "\u64AD\u62A5\u65B9\u5F0F" }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Select, { placeholder: "\u64AD\u62A5\u65B9\u5F0F", options: const_1.broadcastModeOptions }) }))), !preview && ((0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, __assign({ style: { flex: '1 0' }, disabled: preview, name: "category", label: "\u8003\u5BDF\u80FD\u529B" }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Autocomplete, { placeholder: "\u8003\u5BDF\u80FD\u529B", options: aiAbilityList.map(function (_a) {
127
136
  var tag = _a.tag, token = _a.token, isWorkplace = _a.isWorkplace, define = _a.define, type = _a.type;
128
137
  return ({
129
138
  label: tag,
@@ -144,7 +153,7 @@ var QuestionForm = (0, react_1.forwardRef)(function (props, ref) {
144
153
  }, sx: { flexGrow: 1, height: 120 } }), form.values.questions.length > 1 && ((0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ height: 84, pt: 1 }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.IconButton, __assign({ size: "small", onClick: function () {
145
154
  form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray([], form.values.questions.filter(function (_, i) { return i !== index; }), true) }));
146
155
  } }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.CloseIcon, {}) })) })))] }), index)); });
147
- } })) : ((0, jsx_runtime_1.jsx)(VideoVoice_1.default, {})), !preview && aiShowType === ai_question_1.ADD_QUESTION_TYPE.FREE && ((0, jsx_runtime_1.jsx)(RandomQuestion_1.default, { category: questionCollectionList === null || questionCollectionList === void 0 ? void 0 : questionCollectionList.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 () {
156
+ } })) : ((0, jsx_runtime_1.jsx)(VideoVoice_1.default, {})), !preview && aiShowType === ai_question_1.ADD_QUESTION_TYPE.FREE && ((0, jsx_runtime_1.jsx)(RandomQuestion_1.default, { 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
157
  form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray(__spreadArray([], form.values.questions, true), [{ content: '', videoUrl: '' }], false) }));
149
158
  }, onAddRandomQuestion: function (qs) {
150
159
  form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray(__spreadArray([], form.values.questions, true), qs.map(function (v) { return ({ content: v, videoUrl: '' }); }), true) }));
@@ -153,7 +162,7 @@ var QuestionForm = (0, react_1.forwardRef)(function (props, ref) {
153
162
  multiline: true,
154
163
  placeholder: '朗读内容(候选人将根据此内容进行朗读)',
155
164
  sx: { padding: 0 },
156
- } })), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, __assign({ sx: { height: 64, flex: '1 0', mr: 2 }, required: true, disabled: preview, name: "prepareTime", label: "\u51C6\u5907\u65F6\u957F" }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Select, { options: const_1.prepareTimeOptions }) })), (0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, __assign({ sx: { height: 64, flex: '1 0' }, required: true, disabled: preview, name: "duration", label: "\u56DE\u7B54\u65F6\u957F" }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Select, { options: const_1.durationOptions }) })), (0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, { sx: { height: 64, flex: '1 0', ml: 2 }, name: "minResponseDuration", label: "\u6700\u5C11\u56DE\u7B54\u65F6\u957F", type: "number",
165
+ } })), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, __assign({ sx: { height: 64, flex: '1 0', mr: 2 }, required: true, disabled: preview, name: "prepareTime", label: "\u51C6\u5907\u65F6\u957F" }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Select, { options: const_1.prepareTimeOptions }) })), (0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, __assign({ sx: { height: 64, flex: '1 0' }, required: true, disabled: preview, name: "duration", label: "\u56DE\u7B54\u65F6\u957F" }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Select, { options: const_1.durationOptions }) })), (0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, { sx: { height: 64, flex: '1 0', ml: 2 }, name: "minResponseDuration", label: "\u6700\u5C11\u56DE\u7B54\u65F6\u957F", type: "number", disabled: preview,
157
166
  // rules={[
158
167
  // e => {
159
168
  // if (!/^[1-9]\d*$/.test(e.value)) {
@@ -3,16 +3,19 @@ import { AiAbility } from '@/modules/ai-ability-select/interface';
3
3
  export declare const useAiAbilityListStore: (depsFn?: import("hox/es/types").DepsFn<{
4
4
  selctedAbilitys: string[];
5
5
  setSelctedAbilitys: import("react").Dispatch<import("react").SetStateAction<string[]>>;
6
+ setSpecialAiAbilityList: (list: AiAbility[]) => void;
6
7
  aiAbilityList: AiAbility[];
7
8
  setAiAbilityList: import("react").Dispatch<import("react").SetStateAction<AiAbility[]>>;
8
9
  }> | undefined) => {
9
10
  selctedAbilitys: string[];
10
11
  setSelctedAbilitys: import("react").Dispatch<import("react").SetStateAction<string[]>>;
12
+ setSpecialAiAbilityList: (list: AiAbility[]) => void;
11
13
  aiAbilityList: AiAbility[];
12
14
  setAiAbilityList: import("react").Dispatch<import("react").SetStateAction<AiAbility[]>>;
13
15
  }, getAiAbilityListStore: () => {
14
16
  selctedAbilitys: string[];
15
17
  setSelctedAbilitys: import("react").Dispatch<import("react").SetStateAction<string[]>>;
18
+ setSpecialAiAbilityList: (list: AiAbility[]) => void;
16
19
  aiAbilityList: AiAbility[];
17
20
  setAiAbilityList: import("react").Dispatch<import("react").SetStateAction<AiAbility[]>>;
18
21
  } | undefined;
@@ -2,14 +2,22 @@
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.getAiAbilityListStore = exports.useAiAbilityListStore = void 0;
5
+ var question_model_store_1 = require("../ai-question/question-model-store");
5
6
  var hox_1 = require("hox");
6
7
  var react_1 = require("react");
7
8
  exports.useAiAbilityListStore = (_a = (0, hox_1.createGlobalStore)(function () {
9
+ var isEdit = ((0, question_model_store_1.getQuestionModelStore)() || {}).isEdit;
8
10
  var _a = (0, react_1.useState)([]), aiAbilityList = _a[0], setAiAbilityList = _a[1];
9
11
  var _b = (0, react_1.useState)([]), selctedAbilitys = _b[0], setSelctedAbilitys = _b[1];
12
+ var setSpecialAiAbilityList = (0, react_1.useCallback)(function (list) {
13
+ setAiAbilityList((list === null || list === void 0 ? void 0 : list.filter(function (v) {
14
+ return !isEdit || !v.isNew || selctedAbilitys.includes(v.token);
15
+ })) || []);
16
+ }, [isEdit, selctedAbilitys]);
10
17
  return {
11
18
  selctedAbilitys: selctedAbilitys,
12
19
  setSelctedAbilitys: setSelctedAbilitys,
20
+ setSpecialAiAbilityList: setSpecialAiAbilityList,
13
21
  aiAbilityList: aiAbilityList,
14
22
  setAiAbilityList: setAiAbilityList,
15
23
  };
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { QuestionModelData, QuestionModelStep } from '@/modules/ai-question/components/QuestionModel/interface';
3
3
  export declare const useQuestionModelStore: (depsFn?: import("hox/es/types").DepsFn<{
4
+ isEdit: boolean;
4
5
  questionModelData: QuestionModelData | undefined;
5
6
  addModel: (modelStep: QuestionModelStep | QuestionModelStep[]) => void;
6
7
  editModel: (modelStep: QuestionModelStep, index: number) => void;
@@ -8,6 +9,7 @@ export declare const useQuestionModelStore: (depsFn?: import("hox/es/types").Dep
8
9
  updateModel: import("react").Dispatch<import("react").SetStateAction<QuestionModelData | undefined>>;
9
10
  updateModelWeight: (value: string, index: number) => void;
10
11
  }> | undefined) => {
12
+ isEdit: boolean;
11
13
  questionModelData: QuestionModelData | undefined;
12
14
  addModel: (modelStep: QuestionModelStep | QuestionModelStep[]) => void;
13
15
  editModel: (modelStep: QuestionModelStep, index: number) => void;
@@ -15,6 +17,7 @@ export declare const useQuestionModelStore: (depsFn?: import("hox/es/types").Dep
15
17
  updateModel: import("react").Dispatch<import("react").SetStateAction<QuestionModelData | undefined>>;
16
18
  updateModelWeight: (value: string, index: number) => void;
17
19
  }, getQuestionModelStore: () => {
20
+ isEdit: boolean;
18
21
  questionModelData: QuestionModelData | undefined;
19
22
  addModel: (modelStep: QuestionModelStep | QuestionModelStep[]) => void;
20
23
  editModel: (modelStep: QuestionModelStep, index: number) => void;
@@ -131,7 +131,9 @@ exports.useQuestionModelStore = (_a = (0, hox_1.createGlobalStore)(function () {
131
131
  updateModel(__assign(__assign({}, questionModelData), { duration: 0, steps: newSteps }));
132
132
  }
133
133
  }, [computeWeight, questionModelData, steps]);
134
+ var isEdit = (0, react_1.useMemo)(function () { return !!(questionModelData === null || questionModelData === void 0 ? void 0 : questionModelData.token); }, [questionModelData]);
134
135
  return {
136
+ isEdit: isEdit,
135
137
  questionModelData: questionModelData,
136
138
  addModel: addModel,
137
139
  editModel: editModel,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eli-video-interview",
3
- "version": "1.2.35.alpha.10",
3
+ "version": "1.2.35.alpha.12",
4
4
  "description": "鳄梨科技 AI视频面试 React SDK",
5
5
  "author": "鳄梨科技",
6
6
  "license": "MIT",