refactor: TKQC AI 기능 재배치
- 현황판: AI 시맨틱 검색/Q&A 제거 (AI 어시스턴트로 이관) - 관리함 진행중 카드: AI 해결방안 제안 버튼 추가 - aiSuggestSolutionInline() 인라인 카드용 함수 추가 - applyAiSuggestion() AI 제안 → textarea 적용 기능 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -456,6 +456,18 @@ function createInProgressRow(issue, project) {
|
||||
<i class="fas fa-lightbulb text-yellow-500 mr-1"></i>해결방안 (확정)
|
||||
</label>
|
||||
<textarea id="management_comment_${issue.id}" rows="3" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 resize-none ${isPendingCompletion ? 'bg-gray-100 cursor-not-allowed' : ''}" placeholder="확정된 해결 방안을 입력하세요..." ${isPendingCompletion ? 'readonly' : ''}>${cleanManagementComment(issue.management_comment)}</textarea>
|
||||
${!isPendingCompletion ? `
|
||||
<button onclick="aiSuggestSolutionInline(${issue.id})" class="mt-2 w-full px-3 py-2 bg-gradient-to-r from-purple-500 to-indigo-500 text-white text-sm rounded-lg hover:from-purple-600 hover:to-indigo-600 transition-all">
|
||||
<i class="fas fa-lightbulb mr-2"></i>AI 해결방안 제안 (과거 사례 기반)
|
||||
</button>
|
||||
<div id="aiSuggestResult_${issue.id}" class="hidden mt-2 p-3 bg-purple-50 border border-purple-200 rounded-lg">
|
||||
<p id="aiSuggestContent_${issue.id}" class="text-sm text-gray-800 whitespace-pre-wrap"></p>
|
||||
<p id="aiSuggestSources_${issue.id}" class="text-xs text-purple-600 mt-2"></p>
|
||||
<button onclick="applyAiSuggestion(${issue.id})" class="mt-2 text-xs px-2 py-1 bg-purple-600 text-white rounded hover:bg-purple-700 transition-colors">
|
||||
<i class="fas fa-paste mr-1"></i>해결방안에 적용
|
||||
</button>
|
||||
</div>
|
||||
` : ''}
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
@@ -984,6 +996,48 @@ async function aiSuggestSolution() {
|
||||
if (result) result.classList.remove('hidden');
|
||||
}
|
||||
|
||||
// RAG: AI 해결방안 제안 (인라인 카드용)
|
||||
async function aiSuggestSolutionInline(issueId) {
|
||||
if (typeof AiAPI === 'undefined') return;
|
||||
const btn = event.target.closest('button');
|
||||
const result = document.getElementById(`aiSuggestResult_${issueId}`);
|
||||
const content = document.getElementById(`aiSuggestContent_${issueId}`);
|
||||
const sources = document.getElementById(`aiSuggestSources_${issueId}`);
|
||||
|
||||
if (btn) { btn.disabled = true; btn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i>AI 분석 중...'; }
|
||||
if (result) result.classList.add('hidden');
|
||||
|
||||
const data = await AiAPI.suggestSolution(issueId);
|
||||
|
||||
if (btn) { btn.disabled = false; btn.innerHTML = '<i class="fas fa-lightbulb mr-2"></i>AI 해결방안 제안 (과거 사례 기반)'; }
|
||||
|
||||
if (!data.available) {
|
||||
if (content) content.textContent = 'AI 서비스를 사용할 수 없습니다';
|
||||
if (result) result.classList.remove('hidden');
|
||||
return;
|
||||
}
|
||||
|
||||
if (content) content.textContent = data.suggestion || '';
|
||||
if (sources && data.referenced_issues) {
|
||||
const refs = data.referenced_issues
|
||||
.filter(r => r.has_solution)
|
||||
.map(r => `No.${r.id}(${r.similarity}%)`)
|
||||
.join(', ');
|
||||
sources.textContent = refs ? `참고 사례: ${refs}` : '';
|
||||
}
|
||||
if (result) result.classList.remove('hidden');
|
||||
}
|
||||
|
||||
// AI 제안 → 해결방안 textarea에 적용
|
||||
function applyAiSuggestion(issueId) {
|
||||
const content = document.getElementById(`aiSuggestContent_${issueId}`);
|
||||
const textarea = document.getElementById(`management_comment_${issueId}`);
|
||||
if (content && textarea) {
|
||||
textarea.value = content.textContent;
|
||||
textarea.focus();
|
||||
}
|
||||
}
|
||||
|
||||
// AI 유사 부적합 검색
|
||||
async function loadSimilarIssues() {
|
||||
if (!currentModalIssueId || typeof AiAPI === 'undefined') return;
|
||||
|
||||
Reference in New Issue
Block a user