ide-assi 0.558.0 → 0.561.0
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/dist/bundle.cjs.js +39 -30
- package/dist/bundle.esm.js +39 -30
- package/dist/components/ideAssi.js +2 -3
- package/dist/components/ideLoadingTips.js +37 -27
- package/package.json +1 -1
- package/src/components/ideAssi.js +2 -3
- package/src/components/ideLoadingTips.js +37 -27
package/dist/bundle.cjs.js
CHANGED
|
@@ -202703,9 +202703,8 @@ class IdeAssi extends HTMLElement
|
|
|
202703
202703
|
elAiChat.add("me", userPrompt);
|
|
202704
202704
|
elAiChat.add("ing", "...");
|
|
202705
202705
|
|
|
202706
|
-
this.shadowRoot.querySelector("ide-tip-popup").popup();
|
|
202706
|
+
//this.shadowRoot.querySelector("ide-tip-popup").popup();
|
|
202707
202707
|
|
|
202708
|
-
/**
|
|
202709
202708
|
try {
|
|
202710
202709
|
const changedSource = await this.#ai.generateSourceClient(userPrompt, apply);
|
|
202711
202710
|
if (changedSource) {
|
|
@@ -202714,7 +202713,7 @@ class IdeAssi extends HTMLElement
|
|
|
202714
202713
|
} catch (error) {
|
|
202715
202714
|
console.error(error);
|
|
202716
202715
|
elAiChat.add("ai", String(error).replace("Error:", ""));
|
|
202717
|
-
}
|
|
202716
|
+
}
|
|
202718
202717
|
|
|
202719
202718
|
this.#ing = false;
|
|
202720
202719
|
}
|
|
@@ -202994,11 +202993,11 @@ class IdeLoadingTips extends HTMLElement {
|
|
|
202994
202993
|
this.#currentTipIndex = Math.floor(Math.random() * this.#tips.length);
|
|
202995
202994
|
this.stopTips(); // Stop any existing intervals before starting new ones
|
|
202996
202995
|
|
|
202997
|
-
this.
|
|
202996
|
+
this.showRandomTip(); // Display the first tip immediately
|
|
202998
202997
|
|
|
202999
202998
|
// Start interval for cycling through tips
|
|
203000
202999
|
this.#tipIntervalId = setInterval(() => {
|
|
203001
|
-
this.
|
|
203000
|
+
this.showRandomTip();
|
|
203002
203001
|
}, this.#tipDisplayDuration);
|
|
203003
203002
|
|
|
203004
203003
|
//this.loadingAnimation.style.display = 'block'; // Show the loading spinner
|
|
@@ -203031,59 +203030,69 @@ class IdeLoadingTips extends HTMLElement {
|
|
|
203031
203030
|
}
|
|
203032
203031
|
|
|
203033
203032
|
/**
|
|
203034
|
-
*
|
|
203033
|
+
* Displays the current tip's text and manages its associated images.
|
|
203034
|
+
*/
|
|
203035
|
+
// aiLoadingTips.js (showCurrentTip 메서드 내부)
|
|
203036
|
+
|
|
203037
|
+
/**
|
|
203038
|
+
* Displays a randomly selected tip (excluding the currently displayed one if possible)
|
|
203039
|
+
* and manages its associated images.
|
|
203035
203040
|
*/
|
|
203036
|
-
|
|
203037
|
-
if (this.#tips.length
|
|
203038
|
-
|
|
203039
|
-
this.
|
|
203041
|
+
showRandomTip() {
|
|
203042
|
+
if (this.#tips.length === 0) {
|
|
203043
|
+
this.tipElement.textContent = "";
|
|
203044
|
+
this.tipImageElement.style.display = 'none';
|
|
203045
|
+
this.tipImageContainer.style.display = 'none';
|
|
203040
203046
|
return;
|
|
203041
203047
|
}
|
|
203042
203048
|
|
|
203043
|
-
let nextIndex;
|
|
203044
|
-
|
|
203045
|
-
nextIndex = Math.floor(Math.random() * this.#tips.length);
|
|
203046
|
-
} while (nextIndex === this.#currentTipIndex); // 현재 인덱스와 같으면 다시 뽑기
|
|
203049
|
+
let nextIndex = this.#currentTipIndex; // 초기값을 현재 인덱스로 설정
|
|
203050
|
+
const maxAttempts = 3; // 최대 시도 횟수
|
|
203047
203051
|
|
|
203048
|
-
|
|
203049
|
-
|
|
203050
|
-
|
|
203052
|
+
// 팁이 1개 초과인 경우에만 다른 팁을 찾으려고 시도합니다.
|
|
203053
|
+
// 팁이 하나뿐이거나 없으면 아래 루프에 들어가지 않으므로,
|
|
203054
|
+
// nextIndex는 초기값인 currentTipIndex (0이 될 가능성 높음)를 유지합니다.
|
|
203055
|
+
if (this.#tips.length > 1) {
|
|
203056
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
203057
|
+
const potentialNextIndex = Math.floor(Math.random() * this.#tips.length);
|
|
203058
|
+
if (potentialNextIndex !== this.#currentTipIndex) {
|
|
203059
|
+
nextIndex = potentialNextIndex;
|
|
203060
|
+
break; // 다른 팁을 찾으면 루프 종료
|
|
203061
|
+
}
|
|
203062
|
+
}
|
|
203063
|
+
}
|
|
203064
|
+
// 이전에 있던 'else { nextIndex = 0; }' 블록이 제거되었습니다.
|
|
203065
|
+
// 팁이 1개일 경우, if (this.#tips.length > 1) 조건에 걸리지 않고
|
|
203066
|
+
// nextIndex는 그대로 this.#currentTipIndex (대부분 0)를 유지하게 됩니다.
|
|
203067
|
+
|
|
203068
|
+
this.#currentTipIndex = nextIndex; // 최종 결정된 인덱스를 currentTipIndex에 할당
|
|
203051
203069
|
|
|
203052
|
-
/**
|
|
203053
|
-
* Displays the current tip's text and manages its associated images.
|
|
203054
|
-
*/
|
|
203055
|
-
showCurrentTip() {
|
|
203056
203070
|
const currentTip = this.#tips[this.#currentTipIndex];
|
|
203057
203071
|
|
|
203058
203072
|
if (this.tipElement && currentTip) {
|
|
203059
|
-
//this.tipElement.textContent = currentTip.text;
|
|
203060
203073
|
this.tipElement.innerHTML = currentTip.text;
|
|
203061
203074
|
|
|
203062
|
-
// Clear any existing image cycling interval for the previous tip
|
|
203063
203075
|
if (this.#imageIntervalId) {
|
|
203064
203076
|
clearInterval(this.#imageIntervalId);
|
|
203065
203077
|
this.#imageIntervalId = null;
|
|
203066
203078
|
}
|
|
203067
203079
|
|
|
203068
|
-
// Image handling logic
|
|
203069
203080
|
if (currentTip.images && currentTip.images.length > 0) {
|
|
203070
|
-
this.#currentImageIndex = 0;
|
|
203081
|
+
this.#currentImageIndex = 0;
|
|
203071
203082
|
this.showCurrentImage(currentTip.images[this.#currentImageIndex]);
|
|
203072
|
-
this.tipImageElement.style.display = 'block';
|
|
203073
|
-
this.tipImageContainer.style.display = 'flex';
|
|
203083
|
+
this.tipImageElement.style.display = 'block';
|
|
203084
|
+
this.tipImageContainer.style.display = 'flex';
|
|
203074
203085
|
|
|
203075
203086
|
if (currentTip.images.length > 1) {
|
|
203076
|
-
// If there's more than one image, start cycling through them
|
|
203077
203087
|
this.#imageIntervalId = setInterval(() => {
|
|
203078
203088
|
this.#currentImageIndex = (this.#currentImageIndex + 1) % currentTip.images.length;
|
|
203079
203089
|
this.showCurrentImage(currentTip.images[this.#currentImageIndex]);
|
|
203080
203090
|
}, this.#imageDisplayDuration);
|
|
203081
203091
|
}
|
|
203082
203092
|
} else {
|
|
203083
|
-
// If no images are provided for this tip, hide the image elements
|
|
203084
203093
|
this.tipImageElement.style.display = 'none';
|
|
203085
203094
|
this.tipImageContainer.style.display = 'none';
|
|
203086
|
-
this.tipImageElement.src = '';
|
|
203095
|
+
this.tipImageElement.src = '';
|
|
203087
203096
|
}
|
|
203088
203097
|
}
|
|
203089
203098
|
}
|
package/dist/bundle.esm.js
CHANGED
|
@@ -202699,9 +202699,8 @@ class IdeAssi extends HTMLElement
|
|
|
202699
202699
|
elAiChat.add("me", userPrompt);
|
|
202700
202700
|
elAiChat.add("ing", "...");
|
|
202701
202701
|
|
|
202702
|
-
this.shadowRoot.querySelector("ide-tip-popup").popup();
|
|
202702
|
+
//this.shadowRoot.querySelector("ide-tip-popup").popup();
|
|
202703
202703
|
|
|
202704
|
-
/**
|
|
202705
202704
|
try {
|
|
202706
202705
|
const changedSource = await this.#ai.generateSourceClient(userPrompt, apply);
|
|
202707
202706
|
if (changedSource) {
|
|
@@ -202710,7 +202709,7 @@ class IdeAssi extends HTMLElement
|
|
|
202710
202709
|
} catch (error) {
|
|
202711
202710
|
console.error(error);
|
|
202712
202711
|
elAiChat.add("ai", String(error).replace("Error:", ""));
|
|
202713
|
-
}
|
|
202712
|
+
}
|
|
202714
202713
|
|
|
202715
202714
|
this.#ing = false;
|
|
202716
202715
|
}
|
|
@@ -202990,11 +202989,11 @@ class IdeLoadingTips extends HTMLElement {
|
|
|
202990
202989
|
this.#currentTipIndex = Math.floor(Math.random() * this.#tips.length);
|
|
202991
202990
|
this.stopTips(); // Stop any existing intervals before starting new ones
|
|
202992
202991
|
|
|
202993
|
-
this.
|
|
202992
|
+
this.showRandomTip(); // Display the first tip immediately
|
|
202994
202993
|
|
|
202995
202994
|
// Start interval for cycling through tips
|
|
202996
202995
|
this.#tipIntervalId = setInterval(() => {
|
|
202997
|
-
this.
|
|
202996
|
+
this.showRandomTip();
|
|
202998
202997
|
}, this.#tipDisplayDuration);
|
|
202999
202998
|
|
|
203000
202999
|
//this.loadingAnimation.style.display = 'block'; // Show the loading spinner
|
|
@@ -203027,59 +203026,69 @@ class IdeLoadingTips extends HTMLElement {
|
|
|
203027
203026
|
}
|
|
203028
203027
|
|
|
203029
203028
|
/**
|
|
203030
|
-
*
|
|
203029
|
+
* Displays the current tip's text and manages its associated images.
|
|
203030
|
+
*/
|
|
203031
|
+
// aiLoadingTips.js (showCurrentTip 메서드 내부)
|
|
203032
|
+
|
|
203033
|
+
/**
|
|
203034
|
+
* Displays a randomly selected tip (excluding the currently displayed one if possible)
|
|
203035
|
+
* and manages its associated images.
|
|
203031
203036
|
*/
|
|
203032
|
-
|
|
203033
|
-
if (this.#tips.length
|
|
203034
|
-
|
|
203035
|
-
this.
|
|
203037
|
+
showRandomTip() {
|
|
203038
|
+
if (this.#tips.length === 0) {
|
|
203039
|
+
this.tipElement.textContent = "";
|
|
203040
|
+
this.tipImageElement.style.display = 'none';
|
|
203041
|
+
this.tipImageContainer.style.display = 'none';
|
|
203036
203042
|
return;
|
|
203037
203043
|
}
|
|
203038
203044
|
|
|
203039
|
-
let nextIndex;
|
|
203040
|
-
|
|
203041
|
-
nextIndex = Math.floor(Math.random() * this.#tips.length);
|
|
203042
|
-
} while (nextIndex === this.#currentTipIndex); // 현재 인덱스와 같으면 다시 뽑기
|
|
203045
|
+
let nextIndex = this.#currentTipIndex; // 초기값을 현재 인덱스로 설정
|
|
203046
|
+
const maxAttempts = 3; // 최대 시도 횟수
|
|
203043
203047
|
|
|
203044
|
-
|
|
203045
|
-
|
|
203046
|
-
|
|
203048
|
+
// 팁이 1개 초과인 경우에만 다른 팁을 찾으려고 시도합니다.
|
|
203049
|
+
// 팁이 하나뿐이거나 없으면 아래 루프에 들어가지 않으므로,
|
|
203050
|
+
// nextIndex는 초기값인 currentTipIndex (0이 될 가능성 높음)를 유지합니다.
|
|
203051
|
+
if (this.#tips.length > 1) {
|
|
203052
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
203053
|
+
const potentialNextIndex = Math.floor(Math.random() * this.#tips.length);
|
|
203054
|
+
if (potentialNextIndex !== this.#currentTipIndex) {
|
|
203055
|
+
nextIndex = potentialNextIndex;
|
|
203056
|
+
break; // 다른 팁을 찾으면 루프 종료
|
|
203057
|
+
}
|
|
203058
|
+
}
|
|
203059
|
+
}
|
|
203060
|
+
// 이전에 있던 'else { nextIndex = 0; }' 블록이 제거되었습니다.
|
|
203061
|
+
// 팁이 1개일 경우, if (this.#tips.length > 1) 조건에 걸리지 않고
|
|
203062
|
+
// nextIndex는 그대로 this.#currentTipIndex (대부분 0)를 유지하게 됩니다.
|
|
203063
|
+
|
|
203064
|
+
this.#currentTipIndex = nextIndex; // 최종 결정된 인덱스를 currentTipIndex에 할당
|
|
203047
203065
|
|
|
203048
|
-
/**
|
|
203049
|
-
* Displays the current tip's text and manages its associated images.
|
|
203050
|
-
*/
|
|
203051
|
-
showCurrentTip() {
|
|
203052
203066
|
const currentTip = this.#tips[this.#currentTipIndex];
|
|
203053
203067
|
|
|
203054
203068
|
if (this.tipElement && currentTip) {
|
|
203055
|
-
//this.tipElement.textContent = currentTip.text;
|
|
203056
203069
|
this.tipElement.innerHTML = currentTip.text;
|
|
203057
203070
|
|
|
203058
|
-
// Clear any existing image cycling interval for the previous tip
|
|
203059
203071
|
if (this.#imageIntervalId) {
|
|
203060
203072
|
clearInterval(this.#imageIntervalId);
|
|
203061
203073
|
this.#imageIntervalId = null;
|
|
203062
203074
|
}
|
|
203063
203075
|
|
|
203064
|
-
// Image handling logic
|
|
203065
203076
|
if (currentTip.images && currentTip.images.length > 0) {
|
|
203066
|
-
this.#currentImageIndex = 0;
|
|
203077
|
+
this.#currentImageIndex = 0;
|
|
203067
203078
|
this.showCurrentImage(currentTip.images[this.#currentImageIndex]);
|
|
203068
|
-
this.tipImageElement.style.display = 'block';
|
|
203069
|
-
this.tipImageContainer.style.display = 'flex';
|
|
203079
|
+
this.tipImageElement.style.display = 'block';
|
|
203080
|
+
this.tipImageContainer.style.display = 'flex';
|
|
203070
203081
|
|
|
203071
203082
|
if (currentTip.images.length > 1) {
|
|
203072
|
-
// If there's more than one image, start cycling through them
|
|
203073
203083
|
this.#imageIntervalId = setInterval(() => {
|
|
203074
203084
|
this.#currentImageIndex = (this.#currentImageIndex + 1) % currentTip.images.length;
|
|
203075
203085
|
this.showCurrentImage(currentTip.images[this.#currentImageIndex]);
|
|
203076
203086
|
}, this.#imageDisplayDuration);
|
|
203077
203087
|
}
|
|
203078
203088
|
} else {
|
|
203079
|
-
// If no images are provided for this tip, hide the image elements
|
|
203080
203089
|
this.tipImageElement.style.display = 'none';
|
|
203081
203090
|
this.tipImageContainer.style.display = 'none';
|
|
203082
|
-
this.tipImageElement.src = '';
|
|
203091
|
+
this.tipImageElement.src = '';
|
|
203083
203092
|
}
|
|
203084
203093
|
}
|
|
203085
203094
|
}
|
|
@@ -164,9 +164,8 @@ export class IdeAssi extends HTMLElement
|
|
|
164
164
|
elAiChat.add("me", userPrompt);
|
|
165
165
|
elAiChat.add("ing", "...");
|
|
166
166
|
|
|
167
|
-
this.shadowRoot.querySelector("ide-tip-popup").popup();
|
|
167
|
+
//this.shadowRoot.querySelector("ide-tip-popup").popup();
|
|
168
168
|
|
|
169
|
-
/**
|
|
170
169
|
try {
|
|
171
170
|
const changedSource = await this.#ai.generateSourceClient(userPrompt, apply);
|
|
172
171
|
if (changedSource) {
|
|
@@ -175,7 +174,7 @@ export class IdeAssi extends HTMLElement
|
|
|
175
174
|
} catch (error) {
|
|
176
175
|
console.error(error);
|
|
177
176
|
elAiChat.add("ai", String(error).replace("Error:", ""));
|
|
178
|
-
}
|
|
177
|
+
}
|
|
179
178
|
|
|
180
179
|
this.#ing = false;
|
|
181
180
|
}
|
|
@@ -99,11 +99,11 @@ class IdeLoadingTips extends HTMLElement {
|
|
|
99
99
|
this.#currentTipIndex = Math.floor(Math.random() * this.#tips.length);
|
|
100
100
|
this.stopTips(); // Stop any existing intervals before starting new ones
|
|
101
101
|
|
|
102
|
-
this.
|
|
102
|
+
this.showRandomTip(); // Display the first tip immediately
|
|
103
103
|
|
|
104
104
|
// Start interval for cycling through tips
|
|
105
105
|
this.#tipIntervalId = setInterval(() => {
|
|
106
|
-
this.
|
|
106
|
+
this.showRandomTip();
|
|
107
107
|
}, this.#tipDisplayDuration);
|
|
108
108
|
|
|
109
109
|
//this.loadingAnimation.style.display = 'block'; // Show the loading spinner
|
|
@@ -136,59 +136,69 @@ class IdeLoadingTips extends HTMLElement {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
|
-
*
|
|
139
|
+
* Displays the current tip's text and manages its associated images.
|
|
140
|
+
*/
|
|
141
|
+
// aiLoadingTips.js (showCurrentTip 메서드 내부)
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Displays a randomly selected tip (excluding the currently displayed one if possible)
|
|
145
|
+
* and manages its associated images.
|
|
140
146
|
*/
|
|
141
|
-
|
|
142
|
-
if (this.#tips.length
|
|
143
|
-
|
|
144
|
-
this.
|
|
147
|
+
showRandomTip() {
|
|
148
|
+
if (this.#tips.length === 0) {
|
|
149
|
+
this.tipElement.textContent = "";
|
|
150
|
+
this.tipImageElement.style.display = 'none';
|
|
151
|
+
this.tipImageContainer.style.display = 'none';
|
|
145
152
|
return;
|
|
146
153
|
}
|
|
147
154
|
|
|
148
|
-
let nextIndex;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
155
|
+
let nextIndex = this.#currentTipIndex; // 초기값을 현재 인덱스로 설정
|
|
156
|
+
const maxAttempts = 3; // 최대 시도 횟수
|
|
157
|
+
|
|
158
|
+
// 팁이 1개 초과인 경우에만 다른 팁을 찾으려고 시도합니다.
|
|
159
|
+
// 팁이 하나뿐이거나 없으면 아래 루프에 들어가지 않으므로,
|
|
160
|
+
// nextIndex는 초기값인 currentTipIndex (0이 될 가능성 높음)를 유지합니다.
|
|
161
|
+
if (this.#tips.length > 1) {
|
|
162
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
163
|
+
const potentialNextIndex = Math.floor(Math.random() * this.#tips.length);
|
|
164
|
+
if (potentialNextIndex !== this.#currentTipIndex) {
|
|
165
|
+
nextIndex = potentialNextIndex;
|
|
166
|
+
break; // 다른 팁을 찾으면 루프 종료
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// 이전에 있던 'else { nextIndex = 0; }' 블록이 제거되었습니다.
|
|
171
|
+
// 팁이 1개일 경우, if (this.#tips.length > 1) 조건에 걸리지 않고
|
|
172
|
+
// nextIndex는 그대로 this.#currentTipIndex (대부분 0)를 유지하게 됩니다.
|
|
152
173
|
|
|
153
|
-
this.#currentTipIndex = nextIndex;
|
|
154
|
-
this.showCurrentTip();
|
|
155
|
-
}
|
|
174
|
+
this.#currentTipIndex = nextIndex; // 최종 결정된 인덱스를 currentTipIndex에 할당
|
|
156
175
|
|
|
157
|
-
/**
|
|
158
|
-
* Displays the current tip's text and manages its associated images.
|
|
159
|
-
*/
|
|
160
|
-
showCurrentTip() {
|
|
161
176
|
const currentTip = this.#tips[this.#currentTipIndex];
|
|
162
177
|
|
|
163
178
|
if (this.tipElement && currentTip) {
|
|
164
|
-
//this.tipElement.textContent = currentTip.text;
|
|
165
179
|
this.tipElement.innerHTML = currentTip.text;
|
|
166
180
|
|
|
167
|
-
// Clear any existing image cycling interval for the previous tip
|
|
168
181
|
if (this.#imageIntervalId) {
|
|
169
182
|
clearInterval(this.#imageIntervalId);
|
|
170
183
|
this.#imageIntervalId = null;
|
|
171
184
|
}
|
|
172
185
|
|
|
173
|
-
// Image handling logic
|
|
174
186
|
if (currentTip.images && currentTip.images.length > 0) {
|
|
175
|
-
this.#currentImageIndex = 0;
|
|
187
|
+
this.#currentImageIndex = 0;
|
|
176
188
|
this.showCurrentImage(currentTip.images[this.#currentImageIndex]);
|
|
177
|
-
this.tipImageElement.style.display = 'block';
|
|
178
|
-
this.tipImageContainer.style.display = 'flex';
|
|
189
|
+
this.tipImageElement.style.display = 'block';
|
|
190
|
+
this.tipImageContainer.style.display = 'flex';
|
|
179
191
|
|
|
180
192
|
if (currentTip.images.length > 1) {
|
|
181
|
-
// If there's more than one image, start cycling through them
|
|
182
193
|
this.#imageIntervalId = setInterval(() => {
|
|
183
194
|
this.#currentImageIndex = (this.#currentImageIndex + 1) % currentTip.images.length;
|
|
184
195
|
this.showCurrentImage(currentTip.images[this.#currentImageIndex]);
|
|
185
196
|
}, this.#imageDisplayDuration);
|
|
186
197
|
}
|
|
187
198
|
} else {
|
|
188
|
-
// If no images are provided for this tip, hide the image elements
|
|
189
199
|
this.tipImageElement.style.display = 'none';
|
|
190
200
|
this.tipImageContainer.style.display = 'none';
|
|
191
|
-
this.tipImageElement.src = '';
|
|
201
|
+
this.tipImageElement.src = '';
|
|
192
202
|
}
|
|
193
203
|
}
|
|
194
204
|
}
|
package/package.json
CHANGED
|
@@ -164,9 +164,8 @@ export class IdeAssi extends HTMLElement
|
|
|
164
164
|
elAiChat.add("me", userPrompt);
|
|
165
165
|
elAiChat.add("ing", "...");
|
|
166
166
|
|
|
167
|
-
this.shadowRoot.querySelector("ide-tip-popup").popup();
|
|
167
|
+
//this.shadowRoot.querySelector("ide-tip-popup").popup();
|
|
168
168
|
|
|
169
|
-
/**
|
|
170
169
|
try {
|
|
171
170
|
const changedSource = await this.#ai.generateSourceClient(userPrompt, apply);
|
|
172
171
|
if (changedSource) {
|
|
@@ -175,7 +174,7 @@ export class IdeAssi extends HTMLElement
|
|
|
175
174
|
} catch (error) {
|
|
176
175
|
console.error(error);
|
|
177
176
|
elAiChat.add("ai", String(error).replace("Error:", ""));
|
|
178
|
-
}
|
|
177
|
+
}
|
|
179
178
|
|
|
180
179
|
this.#ing = false;
|
|
181
180
|
}
|
|
@@ -99,11 +99,11 @@ class IdeLoadingTips extends HTMLElement {
|
|
|
99
99
|
this.#currentTipIndex = Math.floor(Math.random() * this.#tips.length);
|
|
100
100
|
this.stopTips(); // Stop any existing intervals before starting new ones
|
|
101
101
|
|
|
102
|
-
this.
|
|
102
|
+
this.showRandomTip(); // Display the first tip immediately
|
|
103
103
|
|
|
104
104
|
// Start interval for cycling through tips
|
|
105
105
|
this.#tipIntervalId = setInterval(() => {
|
|
106
|
-
this.
|
|
106
|
+
this.showRandomTip();
|
|
107
107
|
}, this.#tipDisplayDuration);
|
|
108
108
|
|
|
109
109
|
//this.loadingAnimation.style.display = 'block'; // Show the loading spinner
|
|
@@ -136,59 +136,69 @@ class IdeLoadingTips extends HTMLElement {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
|
-
*
|
|
139
|
+
* Displays the current tip's text and manages its associated images.
|
|
140
|
+
*/
|
|
141
|
+
// aiLoadingTips.js (showCurrentTip 메서드 내부)
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Displays a randomly selected tip (excluding the currently displayed one if possible)
|
|
145
|
+
* and manages its associated images.
|
|
140
146
|
*/
|
|
141
|
-
|
|
142
|
-
if (this.#tips.length
|
|
143
|
-
|
|
144
|
-
this.
|
|
147
|
+
showRandomTip() {
|
|
148
|
+
if (this.#tips.length === 0) {
|
|
149
|
+
this.tipElement.textContent = "";
|
|
150
|
+
this.tipImageElement.style.display = 'none';
|
|
151
|
+
this.tipImageContainer.style.display = 'none';
|
|
145
152
|
return;
|
|
146
153
|
}
|
|
147
154
|
|
|
148
|
-
let nextIndex;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
155
|
+
let nextIndex = this.#currentTipIndex; // 초기값을 현재 인덱스로 설정
|
|
156
|
+
const maxAttempts = 3; // 최대 시도 횟수
|
|
157
|
+
|
|
158
|
+
// 팁이 1개 초과인 경우에만 다른 팁을 찾으려고 시도합니다.
|
|
159
|
+
// 팁이 하나뿐이거나 없으면 아래 루프에 들어가지 않으므로,
|
|
160
|
+
// nextIndex는 초기값인 currentTipIndex (0이 될 가능성 높음)를 유지합니다.
|
|
161
|
+
if (this.#tips.length > 1) {
|
|
162
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
163
|
+
const potentialNextIndex = Math.floor(Math.random() * this.#tips.length);
|
|
164
|
+
if (potentialNextIndex !== this.#currentTipIndex) {
|
|
165
|
+
nextIndex = potentialNextIndex;
|
|
166
|
+
break; // 다른 팁을 찾으면 루프 종료
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// 이전에 있던 'else { nextIndex = 0; }' 블록이 제거되었습니다.
|
|
171
|
+
// 팁이 1개일 경우, if (this.#tips.length > 1) 조건에 걸리지 않고
|
|
172
|
+
// nextIndex는 그대로 this.#currentTipIndex (대부분 0)를 유지하게 됩니다.
|
|
152
173
|
|
|
153
|
-
this.#currentTipIndex = nextIndex;
|
|
154
|
-
this.showCurrentTip();
|
|
155
|
-
}
|
|
174
|
+
this.#currentTipIndex = nextIndex; // 최종 결정된 인덱스를 currentTipIndex에 할당
|
|
156
175
|
|
|
157
|
-
/**
|
|
158
|
-
* Displays the current tip's text and manages its associated images.
|
|
159
|
-
*/
|
|
160
|
-
showCurrentTip() {
|
|
161
176
|
const currentTip = this.#tips[this.#currentTipIndex];
|
|
162
177
|
|
|
163
178
|
if (this.tipElement && currentTip) {
|
|
164
|
-
//this.tipElement.textContent = currentTip.text;
|
|
165
179
|
this.tipElement.innerHTML = currentTip.text;
|
|
166
180
|
|
|
167
|
-
// Clear any existing image cycling interval for the previous tip
|
|
168
181
|
if (this.#imageIntervalId) {
|
|
169
182
|
clearInterval(this.#imageIntervalId);
|
|
170
183
|
this.#imageIntervalId = null;
|
|
171
184
|
}
|
|
172
185
|
|
|
173
|
-
// Image handling logic
|
|
174
186
|
if (currentTip.images && currentTip.images.length > 0) {
|
|
175
|
-
this.#currentImageIndex = 0;
|
|
187
|
+
this.#currentImageIndex = 0;
|
|
176
188
|
this.showCurrentImage(currentTip.images[this.#currentImageIndex]);
|
|
177
|
-
this.tipImageElement.style.display = 'block';
|
|
178
|
-
this.tipImageContainer.style.display = 'flex';
|
|
189
|
+
this.tipImageElement.style.display = 'block';
|
|
190
|
+
this.tipImageContainer.style.display = 'flex';
|
|
179
191
|
|
|
180
192
|
if (currentTip.images.length > 1) {
|
|
181
|
-
// If there's more than one image, start cycling through them
|
|
182
193
|
this.#imageIntervalId = setInterval(() => {
|
|
183
194
|
this.#currentImageIndex = (this.#currentImageIndex + 1) % currentTip.images.length;
|
|
184
195
|
this.showCurrentImage(currentTip.images[this.#currentImageIndex]);
|
|
185
196
|
}, this.#imageDisplayDuration);
|
|
186
197
|
}
|
|
187
198
|
} else {
|
|
188
|
-
// If no images are provided for this tip, hide the image elements
|
|
189
199
|
this.tipImageElement.style.display = 'none';
|
|
190
200
|
this.tipImageContainer.style.display = 'none';
|
|
191
|
-
this.tipImageElement.src = '';
|
|
201
|
+
this.tipImageElement.src = '';
|
|
192
202
|
}
|
|
193
203
|
}
|
|
194
204
|
}
|