@aiyiran/myclaw 1.1.204 → 1.1.205
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.
- package/assets/myclaw-artifacts.js +87 -32
- package/package.json +1 -1
|
@@ -720,7 +720,9 @@
|
|
|
720
720
|
problem: values.problem,
|
|
721
721
|
goal: values.goal,
|
|
722
722
|
plan: values.plan,
|
|
723
|
-
acceptance: values.acceptance
|
|
723
|
+
acceptance: values.acceptance,
|
|
724
|
+
acceptanceChoice: values.acceptanceChoice,
|
|
725
|
+
acceptanceNote: values.acceptanceNote
|
|
724
726
|
};
|
|
725
727
|
}
|
|
726
728
|
|
|
@@ -761,7 +763,9 @@
|
|
|
761
763
|
problem: values.problem,
|
|
762
764
|
goal: values.goal,
|
|
763
765
|
plan: values.plan,
|
|
764
|
-
acceptance: values.acceptance
|
|
766
|
+
acceptance: values.acceptance,
|
|
767
|
+
acceptanceChoice: values.acceptanceChoice,
|
|
768
|
+
acceptanceNote: values.acceptanceNote
|
|
765
769
|
});
|
|
766
770
|
records[recordIndex] = record;
|
|
767
771
|
} else {
|
|
@@ -912,12 +916,32 @@
|
|
|
912
916
|
|
|
913
917
|
var acceptanceFields = document.createElement('div');
|
|
914
918
|
acceptanceFields.className = 'myclaw-training-card__fields myclaw-training-card__acceptance';
|
|
919
|
+
var acceptanceChoice = '';
|
|
920
|
+
var acceptanceChoiceButtons = [];
|
|
915
921
|
var acceptanceInput = makeField(
|
|
916
922
|
'4', '验收',
|
|
917
923
|
'验收',
|
|
918
|
-
|
|
924
|
+
null,
|
|
919
925
|
acceptanceFields
|
|
920
926
|
);
|
|
927
|
+
var acceptanceHeader = acceptanceFields.querySelector('.myclaw-training-card__field-header');
|
|
928
|
+
var acceptanceChoices = document.createElement('span');
|
|
929
|
+
acceptanceChoices.className = 'myclaw-training-card__acceptance-choices';
|
|
930
|
+
['符合预期', '一部分符合', '不符合预期'].forEach(function (choice) {
|
|
931
|
+
var choiceBtn = document.createElement('button');
|
|
932
|
+
choiceBtn.type = 'button';
|
|
933
|
+
choiceBtn.className = 'myclaw-training-card__choice';
|
|
934
|
+
choiceBtn.textContent = choice;
|
|
935
|
+
choiceBtn.setAttribute('aria-label', choice);
|
|
936
|
+
choiceBtn.setAttribute('aria-pressed', 'false');
|
|
937
|
+
choiceBtn.addEventListener('click', function () {
|
|
938
|
+
setAcceptanceChoice(choice);
|
|
939
|
+
updateActionButtonStates();
|
|
940
|
+
});
|
|
941
|
+
acceptanceChoiceButtons.push(choiceBtn);
|
|
942
|
+
acceptanceChoices.appendChild(choiceBtn);
|
|
943
|
+
});
|
|
944
|
+
acceptanceHeader.appendChild(acceptanceChoices);
|
|
921
945
|
section.appendChild(acceptanceFields);
|
|
922
946
|
section.appendChild(cardActions);
|
|
923
947
|
section.appendChild(history);
|
|
@@ -925,11 +949,14 @@
|
|
|
925
949
|
var editingRecordId = '';
|
|
926
950
|
|
|
927
951
|
function readValues() {
|
|
952
|
+
var acceptanceNote = acceptanceInput.value.trim();
|
|
928
953
|
return {
|
|
929
954
|
problem: problemInput.value.trim(),
|
|
930
955
|
goal: goalInput.value.trim(),
|
|
931
956
|
plan: planInput.value.trim(),
|
|
932
|
-
acceptance:
|
|
957
|
+
acceptance: [acceptanceChoice, acceptanceNote].filter(Boolean).join(';'),
|
|
958
|
+
acceptanceChoice: acceptanceChoice,
|
|
959
|
+
acceptanceNote: acceptanceNote
|
|
933
960
|
};
|
|
934
961
|
}
|
|
935
962
|
|
|
@@ -947,11 +974,23 @@
|
|
|
947
974
|
return true;
|
|
948
975
|
}
|
|
949
976
|
|
|
950
|
-
function
|
|
977
|
+
function setAcceptanceChoice(choice) {
|
|
978
|
+
acceptanceChoice = choice || '';
|
|
979
|
+
acceptanceChoiceButtons.forEach(function (button) {
|
|
980
|
+
var selected = button.textContent === acceptanceChoice;
|
|
981
|
+
button.classList.toggle('myclaw-training-card__choice--active', selected);
|
|
982
|
+
button.setAttribute('aria-pressed', selected ? 'true' : 'false');
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
function updateActionButtonStates() {
|
|
951
987
|
var values = readValues();
|
|
952
|
-
var
|
|
953
|
-
|
|
954
|
-
|
|
988
|
+
var aiReady = !!(values.problem && values.goal);
|
|
989
|
+
var cardReady = !!(values.problem && values.goal && values.plan && values.acceptance);
|
|
990
|
+
aiBtn.disabled = !aiReady;
|
|
991
|
+
aiBtn.title = aiReady ? '把已填写的内容提交给 AI' : '填写问题和目标后即可提交 AI';
|
|
992
|
+
cardBtn.disabled = !cardReady;
|
|
993
|
+
cardBtn.title = cardReady ? '保存这张卡片' : '填写问题、目标、方案,并完成验收后即可提交';
|
|
955
994
|
}
|
|
956
995
|
|
|
957
996
|
function clearInputs() {
|
|
@@ -959,8 +998,9 @@
|
|
|
959
998
|
goalInput.value = '';
|
|
960
999
|
planInput.value = '';
|
|
961
1000
|
acceptanceInput.value = '';
|
|
1001
|
+
setAcceptanceChoice('');
|
|
962
1002
|
editingRecordId = '';
|
|
963
|
-
|
|
1003
|
+
updateActionButtonStates();
|
|
964
1004
|
}
|
|
965
1005
|
|
|
966
1006
|
function renderHistory() {
|
|
@@ -991,14 +1031,17 @@
|
|
|
991
1031
|
problemInput.value = record.problem || '';
|
|
992
1032
|
goalInput.value = record.goal || '';
|
|
993
1033
|
planInput.value = record.plan || '';
|
|
994
|
-
acceptanceInput.value = record.
|
|
1034
|
+
acceptanceInput.value = record.acceptanceNote != null
|
|
1035
|
+
? record.acceptanceNote
|
|
1036
|
+
: (record.acceptance || '');
|
|
1037
|
+
setAcceptanceChoice(record.acceptanceChoice || '');
|
|
995
1038
|
editingRecordId = record.recordId || '';
|
|
996
1039
|
status.className = 'myclaw-training-card__status';
|
|
997
1040
|
status.textContent = record.acceptance
|
|
998
1041
|
? '正在编辑' + cardName + ',再次提交会更新原卡片。'
|
|
999
1042
|
: '正在编辑' + cardName + ',请补充验收后更新。';
|
|
1000
1043
|
renderHistory();
|
|
1001
|
-
|
|
1044
|
+
updateActionButtonStates();
|
|
1002
1045
|
problemInput.focus();
|
|
1003
1046
|
});
|
|
1004
1047
|
historyList.appendChild(item);
|
|
@@ -1007,9 +1050,9 @@
|
|
|
1007
1050
|
|
|
1008
1051
|
aiBtn.addEventListener('click', function () {
|
|
1009
1052
|
var values = readValues();
|
|
1010
|
-
if (!(values.problem
|
|
1053
|
+
if (!(values.problem && values.goal)) {
|
|
1011
1054
|
status.className = 'myclaw-training-card__status myclaw-training-card__status--error';
|
|
1012
|
-
status.textContent = '
|
|
1055
|
+
status.textContent = '请先填写问题和目标。';
|
|
1013
1056
|
return;
|
|
1014
1057
|
}
|
|
1015
1058
|
if (typeof window.myclawSendPrompt !== 'function') {
|
|
@@ -1019,7 +1062,7 @@
|
|
|
1019
1062
|
}
|
|
1020
1063
|
aiBtn.disabled = true;
|
|
1021
1064
|
var sent = window.myclawSendPrompt(buildTrainingCardPrompt(values));
|
|
1022
|
-
|
|
1065
|
+
updateActionButtonStates();
|
|
1023
1066
|
if (sent) {
|
|
1024
1067
|
status.className = 'myclaw-training-card__status myclaw-training-card__status--success';
|
|
1025
1068
|
status.textContent = '已提交 AI。可以关闭作品窗口查看回复。';
|
|
@@ -1045,13 +1088,13 @@
|
|
|
1045
1088
|
status.className = 'myclaw-training-card__status myclaw-training-card__status--error';
|
|
1046
1089
|
status.textContent = '提交失败,填写内容仍然保留,请重试。';
|
|
1047
1090
|
}
|
|
1048
|
-
|
|
1091
|
+
updateActionButtonStates();
|
|
1049
1092
|
});
|
|
1050
1093
|
|
|
1051
1094
|
[problemInput, goalInput, planInput, acceptanceInput].forEach(function (input) {
|
|
1052
|
-
input.addEventListener('input',
|
|
1095
|
+
input.addEventListener('input', updateActionButtonStates);
|
|
1053
1096
|
});
|
|
1054
|
-
|
|
1097
|
+
updateActionButtonStates();
|
|
1055
1098
|
renderHistory();
|
|
1056
1099
|
|
|
1057
1100
|
section._destroyVoiceInputs = function () {
|
|
@@ -3465,12 +3508,14 @@
|
|
|
3465
3508
|
'}',
|
|
3466
3509
|
'.myclaw-training-card {',
|
|
3467
3510
|
' box-sizing: border-box; width: 100%; padding: 5px 10px;',
|
|
3468
|
-
' color: #
|
|
3511
|
+
' color: #eceaf3; background: linear-gradient(180deg, #2b2942 0%, #242238 100%);',
|
|
3512
|
+
' border-top: 2px solid #74629a; border-radius: 10px 0 0 0;',
|
|
3513
|
+
' box-shadow: inset 0 1px 0 rgba(255,255,255,.05);',
|
|
3469
3514
|
' font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;',
|
|
3470
3515
|
'}',
|
|
3471
3516
|
'.myclaw-artifacts-work-section {',
|
|
3472
3517
|
' box-sizing: border-box; min-height: 0; flex: 1 1 0;',
|
|
3473
|
-
' display: flex; flex-direction: column; overflow: hidden;',
|
|
3518
|
+
' display: flex; flex-direction: column; overflow: hidden; background: #1b1b29;',
|
|
3474
3519
|
'}',
|
|
3475
3520
|
'.myclaw-artifacts-work-section > #myclaw-artifacts-content { min-height: 0; }',
|
|
3476
3521
|
'#myclaw-artifacts-panel > .myclaw-training-card {',
|
|
@@ -3486,7 +3531,7 @@
|
|
|
3486
3531
|
' min-width: 0; display: flex; align-items: center; justify-content: flex-start; gap: 6px;',
|
|
3487
3532
|
'}',
|
|
3488
3533
|
'.myclaw-training-card__field-title {',
|
|
3489
|
-
' min-width: 0; font-size: 12px; line-height: 1.3; font-weight: 700; color: #
|
|
3534
|
+
' min-width: 0; font-size: 12px; line-height: 1.3; font-weight: 700; color: #f2eff8;',
|
|
3490
3535
|
' white-space: nowrap;',
|
|
3491
3536
|
'}',
|
|
3492
3537
|
'.myclaw-training-card__hints { display: flex; align-items: center; gap: 3px; flex: 0 0 auto; }',
|
|
@@ -3496,26 +3541,36 @@
|
|
|
3496
3541
|
' line-height: 1.35; white-space: nowrap;',
|
|
3497
3542
|
'}',
|
|
3498
3543
|
'.myclaw-training-card__acceptance {',
|
|
3499
|
-
' margin-top: 4px; padding-top: 4px; border-top: 1px solid #
|
|
3544
|
+
' margin-top: 4px; padding-top: 4px; border-top: 1px solid #4a4663;',
|
|
3545
|
+
'}',
|
|
3546
|
+
'.myclaw-training-card__acceptance-choices { display: flex; align-items: center; gap: 3px; }',
|
|
3547
|
+
'.myclaw-training-card__choice {',
|
|
3548
|
+
' padding: 1px 5px; border: 1px solid #55556f; border-radius: 999px;',
|
|
3549
|
+
' color: #d0cddd; background: rgba(255,255,255,.045); font-size: 9px; font-weight: 650;',
|
|
3550
|
+
' line-height: 1.25; white-space: nowrap; cursor: pointer;',
|
|
3551
|
+
'}',
|
|
3552
|
+
'.myclaw-training-card__choice:hover { color: #eee8ff; border-color: #8066b3; }',
|
|
3553
|
+
'.myclaw-training-card__choice--active {',
|
|
3554
|
+
' color: #fff; border-color: #8b5cf6; background: #6d3bd1;',
|
|
3500
3555
|
'}',
|
|
3501
3556
|
'.myclaw-training-card__input-wrap {',
|
|
3502
3557
|
' min-width: 0; width: 100%; display: flex; align-items: center; gap: 6px;',
|
|
3503
3558
|
'}',
|
|
3504
3559
|
'.myclaw-training-card__field textarea {',
|
|
3505
3560
|
' box-sizing: border-box; flex: 1; min-width: 0; width: auto; height: 32px; min-height: 32px; max-height: 32px;',
|
|
3506
|
-
' resize: none; padding: 3px 7px; border: 1px solid #
|
|
3507
|
-
' outline: none; color: #
|
|
3561
|
+
' resize: none; padding: 3px 7px; border: 1px solid #565171; border-radius: 6px;',
|
|
3562
|
+
' outline: none; color: #faf9ff; background: #343149;',
|
|
3508
3563
|
' overflow-y: auto; scrollbar-width: none;',
|
|
3509
3564
|
' font: 13px/1.25 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;',
|
|
3510
3565
|
'}',
|
|
3511
3566
|
'.myclaw-training-card__field textarea::-webkit-scrollbar { display: none; }',
|
|
3512
|
-
'.myclaw-training-card__field textarea:focus { border-color: #
|
|
3567
|
+
'.myclaw-training-card__field textarea:focus { border-color: #a78bfa; background: #3a3652; }',
|
|
3513
3568
|
'.myclaw-training-card__mic {',
|
|
3514
3569
|
' width: 28px; height: 28px; flex: 0 0 28px; padding: 0; border-radius: 50%;',
|
|
3515
|
-
' border: 1px solid #
|
|
3570
|
+
' border: 1px solid #5c5778; background: #343149; color: #bbb6cc; cursor: pointer;',
|
|
3516
3571
|
' display: inline-flex; align-items: center; justify-content: center; transition: all .15s ease;',
|
|
3517
3572
|
'}',
|
|
3518
|
-
'.myclaw-training-card__mic:hover { color: #
|
|
3573
|
+
'.myclaw-training-card__mic:hover { color: #fff; border-color: #a78bfa; background: #403a5d; }',
|
|
3519
3574
|
'.myclaw-training-card__mic:disabled { cursor: not-allowed; opacity: .4; }',
|
|
3520
3575
|
'.myclaw-training-card__footer {',
|
|
3521
3576
|
' margin: 4px 0 0; display: flex; flex-direction: column; gap: 2px;',
|
|
@@ -3536,11 +3591,11 @@
|
|
|
3536
3591
|
' transition: transform .15s ease, opacity .15s ease, filter .15s ease;',
|
|
3537
3592
|
'}',
|
|
3538
3593
|
'.myclaw-training-card__button:hover { transform: translateY(-1px); filter: brightness(1.08); }',
|
|
3539
|
-
'.myclaw-training-card__button:disabled { cursor:
|
|
3594
|
+
'.myclaw-training-card__button:disabled { cursor: not-allowed; opacity: .55; transform: none; }',
|
|
3540
3595
|
'.myclaw-training-card__button--ai { background: #7c3aed; }',
|
|
3541
3596
|
'.myclaw-training-card__button--teacher { background: #2563eb; }',
|
|
3542
3597
|
'.myclaw-training-card__history {',
|
|
3543
|
-
' min-width: 0; margin-top: 4px; padding-top: 4px; border-top: 1px solid #
|
|
3598
|
+
' min-width: 0; margin-top: 4px; padding-top: 4px; border-top: 1px solid #4a4663;',
|
|
3544
3599
|
'}',
|
|
3545
3600
|
'.myclaw-training-card__history[hidden] { display: none; }',
|
|
3546
3601
|
'.myclaw-training-card__history-list {',
|
|
@@ -3551,11 +3606,11 @@
|
|
|
3551
3606
|
'.myclaw-training-card__history-item {',
|
|
3552
3607
|
' box-sizing: border-box; min-width: 78px; max-width: 155px; flex: 0 0 auto;',
|
|
3553
3608
|
' display: flex; align-items: center; gap: 6px;',
|
|
3554
|
-
' padding: 3px 7px; border: 1px solid #
|
|
3555
|
-
' color: #
|
|
3609
|
+
' padding: 3px 7px; border: 1px solid #514c6c; border-radius: 6px;',
|
|
3610
|
+
' color: #e4e1ec; background: #302d45; cursor: pointer; text-align: left;',
|
|
3556
3611
|
'}',
|
|
3557
|
-
'.myclaw-training-card__history-item:hover { border-color: #
|
|
3558
|
-
'.myclaw-training-card__history-item--active { border-color: #
|
|
3612
|
+
'.myclaw-training-card__history-item:hover { border-color: #8976b0; background: #3a3552; }',
|
|
3613
|
+
'.myclaw-training-card__history-item--active { border-color: #a78bfa; background: #43375f; }',
|
|
3559
3614
|
'.myclaw-training-card__history-name { color: #c4b5fd; font-size: 11px; font-weight: 700; }',
|
|
3560
3615
|
'.myclaw-training-card__history-preview {',
|
|
3561
3616
|
' min-width: 0; flex: 1; overflow: hidden; color: #9293a7; font-size: 10px;',
|