Skip to content

Commit

Permalink
Merge pull request #2910 from entrylabs/issue/9097
Browse files Browse the repository at this point in the history
issue/9097
  • Loading branch information
leunge authored Feb 12, 2025
2 parents 86aaf70 + fb48c06 commit 385ba16
Show file tree
Hide file tree
Showing 21 changed files with 175 additions and 3 deletions.
20 changes: 20 additions & 0 deletions src/class/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ class EntryBlockHelper {
this._elementsContainer.addClass('entryBlockHelperContent textModeElem selectAble');
blockHelperContent.appendChild(this._elementsContainer);

const blockHelperLink = Entry.createElement(
'div',
'entryBlockHelperLinkWorkspace'
);
blockHelperLink.addClass('blockHelperLink');
const helperLink = Entry.createElement('a', 'entryBlockHelperLink');
helperLink.addClass('linkTextElem');
helperLink.setAttribute('target' ,'_blank');
blockHelperLink.appendChild(helperLink);
blockHelperContent.appendChild(blockHelperLink);
this.blockHelperLink_ = helperLink;

if (typeof CodeMirror !== 'undefined') {
const codeMirrorTitle = Entry.createElement('div');
codeMirrorTitle.addClass('entryBlockHelperTitle textModeElem');
Expand Down Expand Up @@ -189,6 +201,14 @@ class EntryBlockHelper {
} else {
this._contentView.removeClass('textMode');
this.blockHelperDescription_.textContent = description;
const category = Entry.block[type].wikiClass || Entry.Utils.getBlockCategory(type);
if (category) {
this.blockHelperLink_.textContent = Lang.Helper.link_to_entry_wiki;
this.blockHelperLink_.href = Lang.Helper[`wiki_link_${category}`];
} else {
this.blockHelperLink_.textContent = '';
this.blockHelperLink_.href = '';
}
}

code.createThread([def]);
Expand Down
18 changes: 15 additions & 3 deletions src/css/components/helper.less
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,26 @@
line-height: 20px;
width: 100%;
font-size: 14px;
font-weight: bold;
font-stretch: normal;
font-style: normal;
line-height: 18px;
letter-spacing: -0.33px;
padding: 0 40px;
padding: 0 20px;
color: #555555;
text-align: center;
text-align: left;
margin-top: 24px;
}

.blockHelperLink {
width: 100%;
font-size: 14px;
font-stretch: normal;
font-style: normal;
line-height: 18px;
letter-spacing: -.33px;
padding: 0 20px;
color: #555;
text-align: left;
margin-top: 24px;
}

Expand Down
5 changes: 5 additions & 0 deletions src/playground/blocks/block_ai_learning.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ module.exports = {
class: 'ai_learning',
isNotFor: ['ai_learning_image'],
events: {},
wikiClass: 'ai_image',
},
learning_title_speech: {
skeleton: 'basic_text',
Expand All @@ -164,6 +165,7 @@ module.exports = {
class: 'ai_learning',
isNotFor: ['ai_learning_speech'],
events: {},
wikiClass: 'ai_speech',
},
learning_title_text: {
skeleton: 'basic_text',
Expand All @@ -182,6 +184,7 @@ module.exports = {
class: 'ai_learning',
isNotFor: ['ai_learning_text'],
events: {},
wikiClass: 'ai_text',
},
insert_data_for_test: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand Down Expand Up @@ -274,6 +277,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_image',
},
insert_text_block_for_test: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand Down Expand Up @@ -320,6 +324,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_text',
},
test_result: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand Down
10 changes: 10 additions & 0 deletions src/playground/blocks/block_ai_learning_cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_cluster',
},
set_cluster_option_centroids: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand Down Expand Up @@ -107,6 +108,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_cluster',
},
get_cluster_centriod_count: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand Down Expand Up @@ -134,6 +136,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_cluster',
},
get_cluster_centriod_value: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand Down Expand Up @@ -187,6 +190,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_cluster',
},
get_cluster_centriod_index_1: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand Down Expand Up @@ -236,6 +240,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_cluster',
},
get_cluster_centriod_index_2: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand Down Expand Up @@ -306,6 +311,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_cluster',
},
get_cluster_centriod_index_3: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand Down Expand Up @@ -397,6 +403,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_cluster',
},
get_cluster_centriod_index_4: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand Down Expand Up @@ -509,6 +516,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_cluster',
},
get_cluster_centriod_index_5: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand Down Expand Up @@ -642,6 +650,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_cluster',
},
get_cluster_centriod_index_6: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand Down Expand Up @@ -797,6 +806,7 @@ module.exports = {
py: [],
},
},
wikiClass: 'ai_cluster',
};
},
};
8 changes: 8 additions & 0 deletions src/playground/blocks/block_ai_learning_regression.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_regression',
},
get_regression_predict_1: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand Down Expand Up @@ -120,6 +121,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_regression',
},
get_regression_predict_2: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand Down Expand Up @@ -190,6 +192,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_regression',
},
get_regression_predict_3: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand Down Expand Up @@ -281,6 +284,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_regression',
},
get_regression_predict_4: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand Down Expand Up @@ -393,6 +397,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_regression',
},
get_regression_predict_5: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand Down Expand Up @@ -526,6 +531,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_regression',
},
get_regression_predict_6: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand Down Expand Up @@ -680,6 +686,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_regression',
},
get_regression_accuracy: {
color: EntryStatic.colorSet.block.default.AI_LEARNING,
Expand All @@ -705,6 +712,7 @@ module.exports = {
js: [],
py: [],
},
wikiClass: 'ai_regression',
},
};
},
Expand Down
6 changes: 6 additions & 0 deletions src/playground/blocks/block_ai_utilize_audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Entry.AI_UTILIZE_BLOCK.audio.getBlocks = function() {
js: [],
py: [],
},
wikiClass: 'ai_utilize_stt',
},
get_microphone_volume: {
color: EntryStatic.colorSet.block.default.AI_UTILIZE,
Expand All @@ -98,6 +99,7 @@ Entry.AI_UTILIZE_BLOCK.audio.getBlocks = function() {
js: [],
py: [],
},
wikiClass: 'ai_utilize_stt',
},
speech_to_text_title: {
skeleton: 'basic_text',
Expand Down Expand Up @@ -202,6 +204,7 @@ Entry.AI_UTILIZE_BLOCK.audio.getBlocks = function() {
js: [],
py: [],
},
wikiClass: 'ai_utilize_stt',
},
timed_speech_to_text_convert: {
color: EntryStatic.colorSet.block.default.AI_UTILIZE,
Expand Down Expand Up @@ -297,6 +300,7 @@ Entry.AI_UTILIZE_BLOCK.audio.getBlocks = function() {
js: [],
py: [],
},
wikiClass: 'ai_utilize_stt',
},
set_visible_speech_to_text: {
color: EntryStatic.colorSet.block.default.AI_UTILIZE,
Expand Down Expand Up @@ -363,6 +367,7 @@ Entry.AI_UTILIZE_BLOCK.audio.getBlocks = function() {
js: [],
py: [],
},
wikiClass: 'ai_utilize_stt',
},
speech_to_text_get_value: {
color: EntryStatic.colorSet.block.default.AI_UTILIZE,
Expand Down Expand Up @@ -401,6 +406,7 @@ Entry.AI_UTILIZE_BLOCK.audio.getBlocks = function() {
js: [],
py: [],
},
wikiClass: 'ai_utilize_stt',
},
};
};
12 changes: 12 additions & 0 deletions src/playground/blocks/block_ai_utilize_face_landmarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ Entry.AI_UTILIZE_BLOCK.faceLandmarker.getBlocks = function() {
func(sprite, script) {
return script.callReturn();
},
wikiClass: 'ai_utilize_face',
},
face_landmarker: {
color: EntryStatic.colorSet.block.default.AI_UTILIZE,
Expand Down Expand Up @@ -246,6 +247,7 @@ Entry.AI_UTILIZE_BLOCK.faceLandmarker.getBlocks = function() {
}
return script.callReturn();
},
wikiClass: 'ai_utilize_face',
},
draw_detected_face: {
color: EntryStatic.colorSet.block.default.AI_UTILIZE,
Expand Down Expand Up @@ -274,6 +276,7 @@ Entry.AI_UTILIZE_BLOCK.faceLandmarker.getBlocks = function() {
}
return script.callReturn();
},
wikiClass: 'ai_utilize_face',
},
check_detected_face: {
color: EntryStatic.colorSet.block.default.AI_UTILIZE,
Expand All @@ -293,6 +296,7 @@ Entry.AI_UTILIZE_BLOCK.faceLandmarker.getBlocks = function() {
func(sprite, script) {
return mediaPipeUtils.isPrevFaceLandmarker;
},
wikiClass: 'ai_utilize_face',
},
count_detected_face: {
color: EntryStatic.colorSet.block.default.AI_UTILIZE,
Expand All @@ -312,6 +316,7 @@ Entry.AI_UTILIZE_BLOCK.faceLandmarker.getBlocks = function() {
func(sprite, script) {
return mediaPipeUtils.countDetectedFace || 0;
},
wikiClass: 'ai_utilize_face',
},
locate_to_face: {
color: EntryStatic.colorSet.block.default.AI_UTILIZE,
Expand Down Expand Up @@ -342,6 +347,7 @@ Entry.AI_UTILIZE_BLOCK.faceLandmarker.getBlocks = function() {
}
return script.callReturn();
},
wikiClass: 'ai_utilize_face',
},
locate_time_to_face: {
color: EntryStatic.colorSet.block.default.AI_UTILIZE,
Expand Down Expand Up @@ -418,6 +424,7 @@ Entry.AI_UTILIZE_BLOCK.faceLandmarker.getBlocks = function() {
return script.callReturn();
}
},
wikiClass: 'ai_utilize_face',
},
check_detected_gender: {
color: EntryStatic.colorSet.block.default.AI_UTILIZE,
Expand Down Expand Up @@ -445,6 +452,7 @@ Entry.AI_UTILIZE_BLOCK.faceLandmarker.getBlocks = function() {
const result = mediaPipeUtils.getFaceGender(face);
return result === gender;
},
wikiClass: 'ai_utilize_face',
},
check_compare_age: {
color: EntryStatic.colorSet.block.default.AI_UTILIZE,
Expand Down Expand Up @@ -500,6 +508,7 @@ Entry.AI_UTILIZE_BLOCK.faceLandmarker.getBlocks = function() {
return result <= age;
}
},
wikiClass: 'ai_utilize_face',
},
check_detected_emotion: {
color: EntryStatic.colorSet.block.default.AI_UTILIZE,
Expand Down Expand Up @@ -527,6 +536,7 @@ Entry.AI_UTILIZE_BLOCK.faceLandmarker.getBlocks = function() {
const result = mediaPipeUtils.getFaceEmotion(face);
return result === emotion;
},
wikiClass: 'ai_utilize_face',
},
axis_detected_face: {
color: EntryStatic.colorSet.block.default.AI_UTILIZE,
Expand Down Expand Up @@ -560,6 +570,7 @@ Entry.AI_UTILIZE_BLOCK.faceLandmarker.getBlocks = function() {
}
return 0;
},
wikiClass: 'ai_utilize_face',
},
get_detected_face_value: {
color: EntryStatic.colorSet.block.default.AI_UTILIZE,
Expand Down Expand Up @@ -608,6 +619,7 @@ Entry.AI_UTILIZE_BLOCK.faceLandmarker.getBlocks = function() {
);
}
},
wikiClass: 'ai_utilize_face',
},
};
};
Loading

0 comments on commit 385ba16

Please sign in to comment.