eli-video-interview 1.2.3-5.alpha.1 → 1.2.3-5.alpha.2

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.
@@ -13,6 +13,7 @@ export interface AiAbilityDetail {
13
13
  export interface AiAbility extends AiAbilityDetail {
14
14
  name: string;
15
15
  isNew?: boolean;
16
+ isAI?: boolean;
16
17
  token: string;
17
18
  selected?: boolean;
18
19
  }
@@ -148,7 +148,7 @@ var AiQuestionRoot = forwardRef(function (props, ref) {
148
148
  width: '256px',
149
149
  height: '100%',
150
150
  overflow: 'auto',
151
- } }, { children: _jsx(QuestionTemplate, { extraAbilityTokens: selctedAbilitys }) }))] })));
151
+ } }, { children: _jsx(QuestionTemplate, {}) }))] })));
152
152
  });
153
153
  AiQuestionRoot.displayName = 'AiQuestionRoot';
154
154
  export default memo(AiQuestionRoot);
@@ -13,7 +13,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { defaultQuestionParams } from '../QuestionUpdate/const';
14
14
  import AutoCombine from './AutoCombine';
15
15
  import QuestionModelListItem from './Item';
16
- import { useAiQuestionStore } from "../../../../store/ai-question/global-store";
16
+ import { useAiAbilityListStore } from "../../../../store/ai-ability-select/question-ability-store";
17
17
  import { useQuestionTemplateStore } from "../../../../store/ai-question/question-template-store";
18
18
  import { uniqueId } from "../../../../utils/utils";
19
19
  import { IS_AI_ANALYSIS } from "../../../../constants/ai-question";
@@ -28,9 +28,9 @@ var QuestionModelList = function () {
28
28
  var ref = useRef();
29
29
  var sortable = useRef();
30
30
  var _a = useQuestionModelStore(), questionModelData = _a.questionModelData, updateModel = _a.updateModel, addModel = _a.addModel;
31
- var extraAbilityTokens = useAiQuestionStore().extraAbilityTokens;
31
+ var _b = useAiAbilityListStore(), selctedAbilitys = _b.selctedAbilitys, aiAbilityList = _b.aiAbilityList;
32
32
  var aiEvaluationData = useQuestionTemplateStore(function (store) { return [store.aiEvaluationData]; }).aiEvaluationData;
33
- var _b = (questionModelData || {}).steps, steps = _b === void 0 ? [] : _b;
33
+ var _c = (questionModelData || {}).steps, steps = _c === void 0 ? [] : _c;
34
34
  var lastAiTestIndex = 0;
35
35
  steps.forEach(function (step, i) {
36
36
  if (IS_AI_ANALYSIS(step))
@@ -43,6 +43,12 @@ var QuestionModelList = function () {
43
43
  var handleUseQuestion = useCallback(function (items) {
44
44
  addModel(items.map(getQuestionStep));
45
45
  }, [addModel]);
46
+ var handleAutoCombine = useCallback(function () {
47
+ var combineTokens = selctedAbilitys.length > 0 ? selctedAbilitys : aiAbilityList.filter(function (v) { return v.isAI; }).map(function (item) { return item.token; });
48
+ console.log(combineTokens);
49
+ var random = aiEvaluationData[0].list.filter(function (item) { return combineTokens === null || combineTokens === void 0 ? void 0 : combineTokens.includes(item === null || item === void 0 ? void 0 : item.token); }).map(function (v) { return v.list; }) || [];
50
+ handleUseQuestion(random.map(function (item) { return item[Math.floor(Math.random() * item.length)]; }));
51
+ }, [aiAbilityList, aiEvaluationData, handleUseQuestion, selctedAbilitys]);
46
52
  useEffect(function () {
47
53
  if (steps) {
48
54
  sortable.current && sortable.current.destroy();
@@ -58,9 +64,6 @@ var QuestionModelList = function () {
58
64
  }, [questionModelData, updateModel, steps]);
59
65
  return (_jsx(Box, __assign({ width: "100%", sx: steps.length > 0 ? {} : { height: 'calc(100% - 100px)', display: 'flex', alignItems: 'center', justifyContent: 'center' }, ref: ref }, { children: steps.length > 0 ? (steps.map(function (item, index) {
60
66
  return (_jsx(QuestionModelListItem, __assign({ steps: steps, index: index, disabledWeight: index === lastAiTestIndex }, item), item.uniqueId || item.token));
61
- })) : (_jsx(AutoCombine, { onAutoCombine: function () {
62
- var random = aiEvaluationData[0].list.filter(function (item) { return extraAbilityTokens === null || extraAbilityTokens === void 0 ? void 0 : extraAbilityTokens.includes(item === null || item === void 0 ? void 0 : item.token); }).map(function (v) { return v.list; }) || [];
63
- handleUseQuestion(random.map(function (item) { return item[Math.floor(Math.random() * item.length)]; }));
64
- } })) })));
67
+ })) : (_jsx(AutoCombine, { onAutoCombine: handleAutoCombine })) })));
65
68
  };
66
69
  export default QuestionModelList;
@@ -12,15 +12,17 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import AiEvaluation from './AiEvaluation';
14
14
  import Skeleton from './Skeleton';
15
+ import { useAiAbilityListStore } from "../../../../store/ai-ability-select/question-ability-store";
15
16
  import { PostAiModelQuestions } from "../../../../services/ai-question";
16
17
  import { useQuestionTemplateStore } from "../../../../store/ai-question/question-template-store";
17
18
  import { useRequest } from 'ahooks';
18
19
  import { Box } from 'fbm-ui';
19
- var QuestionTemplate = function (_a) {
20
- var _b = _a.extraAbilityTokens, extraAbilityTokens = _b === void 0 ? [] : _b;
20
+ var QuestionTemplate = function () {
21
21
  var updateAiEvaluationData = useQuestionTemplateStore().updateAiEvaluationData;
22
- var loading = useRequest(function () { return PostAiModelQuestions({ extraAbilityTokens: extraAbilityTokens }); }, {
22
+ var selctedAbilitys = useAiAbilityListStore().selctedAbilitys;
23
+ var loading = useRequest(function () { return PostAiModelQuestions({ extraAbilityTokens: selctedAbilitys }); }, {
23
24
  manual: false,
25
+ refreshDeps: [selctedAbilitys],
24
26
  onSuccess: function (_a) {
25
27
  var data = _a.data;
26
28
  return updateAiEvaluationData(data);
@@ -48,6 +48,5 @@ export interface AiEvaluationState {
48
48
  showOnlyAITest: boolean;
49
49
  }
50
50
  export interface QuestionTemplateProps {
51
- extraAbilityTokens?: string[];
52
51
  }
53
52
  export {};
@@ -13,6 +13,7 @@ export interface AiAbilityDetail {
13
13
  export interface AiAbility extends AiAbilityDetail {
14
14
  name: string;
15
15
  isNew?: boolean;
16
+ isAI?: boolean;
16
17
  token: string;
17
18
  selected?: boolean;
18
19
  }
@@ -153,7 +153,7 @@ var AiQuestionRoot = (0, react_1.forwardRef)(function (props, ref) {
153
153
  width: '256px',
154
154
  height: '100%',
155
155
  overflow: 'auto',
156
- } }, { children: (0, jsx_runtime_1.jsx)(QuestionTemplate_1.default, { extraAbilityTokens: selctedAbilitys }) }))] })));
156
+ } }, { children: (0, jsx_runtime_1.jsx)(QuestionTemplate_1.default, {}) }))] })));
157
157
  });
158
158
  AiQuestionRoot.displayName = 'AiQuestionRoot';
159
159
  exports.default = (0, react_1.memo)(AiQuestionRoot);
@@ -18,7 +18,7 @@ var jsx_runtime_1 = require("react/jsx-runtime");
18
18
  var const_1 = require("../QuestionUpdate/const");
19
19
  var AutoCombine_1 = __importDefault(require("./AutoCombine"));
20
20
  var Item_1 = __importDefault(require("./Item"));
21
- var global_store_1 = require("../../../../store/ai-question/global-store");
21
+ var question_ability_store_1 = require("../../../../store/ai-ability-select/question-ability-store");
22
22
  var question_template_store_1 = require("../../../../store/ai-question/question-template-store");
23
23
  var utils_1 = require("../../../../utils/utils");
24
24
  var ai_question_1 = require("../../../../constants/ai-question");
@@ -33,9 +33,9 @@ var QuestionModelList = function () {
33
33
  var ref = (0, react_1.useRef)();
34
34
  var sortable = (0, react_1.useRef)();
35
35
  var _a = (0, question_model_store_1.useQuestionModelStore)(), questionModelData = _a.questionModelData, updateModel = _a.updateModel, addModel = _a.addModel;
36
- var extraAbilityTokens = (0, global_store_1.useAiQuestionStore)().extraAbilityTokens;
36
+ var _b = (0, question_ability_store_1.useAiAbilityListStore)(), selctedAbilitys = _b.selctedAbilitys, aiAbilityList = _b.aiAbilityList;
37
37
  var aiEvaluationData = (0, question_template_store_1.useQuestionTemplateStore)(function (store) { return [store.aiEvaluationData]; }).aiEvaluationData;
38
- var _b = (questionModelData || {}).steps, steps = _b === void 0 ? [] : _b;
38
+ var _c = (questionModelData || {}).steps, steps = _c === void 0 ? [] : _c;
39
39
  var lastAiTestIndex = 0;
40
40
  steps.forEach(function (step, i) {
41
41
  if ((0, ai_question_1.IS_AI_ANALYSIS)(step))
@@ -48,6 +48,12 @@ var QuestionModelList = function () {
48
48
  var handleUseQuestion = (0, react_1.useCallback)(function (items) {
49
49
  addModel(items.map(getQuestionStep));
50
50
  }, [addModel]);
51
+ var handleAutoCombine = (0, react_1.useCallback)(function () {
52
+ var combineTokens = selctedAbilitys.length > 0 ? selctedAbilitys : aiAbilityList.filter(function (v) { return v.isAI; }).map(function (item) { return item.token; });
53
+ console.log(combineTokens);
54
+ var random = aiEvaluationData[0].list.filter(function (item) { return combineTokens === null || combineTokens === void 0 ? void 0 : combineTokens.includes(item === null || item === void 0 ? void 0 : item.token); }).map(function (v) { return v.list; }) || [];
55
+ handleUseQuestion(random.map(function (item) { return item[Math.floor(Math.random() * item.length)]; }));
56
+ }, [aiAbilityList, aiEvaluationData, handleUseQuestion, selctedAbilitys]);
51
57
  (0, react_1.useEffect)(function () {
52
58
  if (steps) {
53
59
  sortable.current && sortable.current.destroy();
@@ -63,9 +69,6 @@ var QuestionModelList = function () {
63
69
  }, [questionModelData, updateModel, steps]);
64
70
  return ((0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ width: "100%", sx: steps.length > 0 ? {} : { height: 'calc(100% - 100px)', display: 'flex', alignItems: 'center', justifyContent: 'center' }, ref: ref }, { children: steps.length > 0 ? (steps.map(function (item, index) {
65
71
  return ((0, jsx_runtime_1.jsx)(Item_1.default, __assign({ steps: steps, index: index, disabledWeight: index === lastAiTestIndex }, item), item.uniqueId || item.token));
66
- })) : ((0, jsx_runtime_1.jsx)(AutoCombine_1.default, { onAutoCombine: function () {
67
- var random = aiEvaluationData[0].list.filter(function (item) { return extraAbilityTokens === null || extraAbilityTokens === void 0 ? void 0 : extraAbilityTokens.includes(item === null || item === void 0 ? void 0 : item.token); }).map(function (v) { return v.list; }) || [];
68
- handleUseQuestion(random.map(function (item) { return item[Math.floor(Math.random() * item.length)]; }));
69
- } })) })));
72
+ })) : ((0, jsx_runtime_1.jsx)(AutoCombine_1.default, { onAutoCombine: handleAutoCombine })) })));
70
73
  };
71
74
  exports.default = QuestionModelList;
@@ -17,15 +17,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  var jsx_runtime_1 = require("react/jsx-runtime");
18
18
  var AiEvaluation_1 = __importDefault(require("./AiEvaluation"));
19
19
  var Skeleton_1 = __importDefault(require("./Skeleton"));
20
+ var question_ability_store_1 = require("../../../../store/ai-ability-select/question-ability-store");
20
21
  var ai_question_1 = require("../../../../services/ai-question");
21
22
  var question_template_store_1 = require("../../../../store/ai-question/question-template-store");
22
23
  var ahooks_1 = require("ahooks");
23
24
  var fbm_ui_1 = require("fbm-ui");
24
- var QuestionTemplate = function (_a) {
25
- var _b = _a.extraAbilityTokens, extraAbilityTokens = _b === void 0 ? [] : _b;
25
+ var QuestionTemplate = function () {
26
26
  var updateAiEvaluationData = (0, question_template_store_1.useQuestionTemplateStore)().updateAiEvaluationData;
27
- var loading = (0, ahooks_1.useRequest)(function () { return (0, ai_question_1.PostAiModelQuestions)({ extraAbilityTokens: extraAbilityTokens }); }, {
27
+ var selctedAbilitys = (0, question_ability_store_1.useAiAbilityListStore)().selctedAbilitys;
28
+ var loading = (0, ahooks_1.useRequest)(function () { return (0, ai_question_1.PostAiModelQuestions)({ extraAbilityTokens: selctedAbilitys }); }, {
28
29
  manual: false,
30
+ refreshDeps: [selctedAbilitys],
29
31
  onSuccess: function (_a) {
30
32
  var data = _a.data;
31
33
  return updateAiEvaluationData(data);
@@ -48,6 +48,5 @@ export interface AiEvaluationState {
48
48
  showOnlyAITest: boolean;
49
49
  }
50
50
  export interface QuestionTemplateProps {
51
- extraAbilityTokens?: string[];
52
51
  }
53
52
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eli-video-interview",
3
- "version": "1.2.35.alpha.1",
3
+ "version": "1.2.35.alpha.2",
4
4
  "description": "鳄梨科技 AI视频面试 React SDK",
5
5
  "author": "鳄梨科技",
6
6
  "license": "MIT",