feat: AI 채팅 다듬기 — 저장소 컨텍스트·표시제목·마크다운 렌더·말투
- 컨텍스트에 저장소 목록 추가(RepoService.findAll), slug 빼고 표시 제목만 노출 - AI 응답 마크다운 렌더링: shared/utils/markdown.ts (escapeHtml 후 신뢰 태그만 조립, 의존성 0, XSS 안전 — 굵게/목록/코드/제목/링크) - 시스템 프롬프트: 간결·이모지/사과 남발 금지·과도한 존칭 지양·마크다운 사용·저장소는 표시제목으로 안내 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import { nextTick, ref, watch } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useAiStore } from '@/stores/ai.store'
|
||||
import { relativeTimeKo } from '@/shared/utils/format'
|
||||
import { renderMarkdown } from '@/shared/utils/markdown'
|
||||
|
||||
interface Props {
|
||||
open: boolean
|
||||
@@ -235,7 +236,18 @@ async function removeConv(id: string) {
|
||||
v-if="m.role === 'assistant'"
|
||||
class="ac-ava"
|
||||
>AI</span>
|
||||
<div class="ac-bubble">
|
||||
<!-- AI 응답은 마크다운 렌더(renderMarkdown 가 escapeHtml 후 신뢰 태그만 조립 → XSS 안전) -->
|
||||
<!-- eslint-disable vue/no-v-html -->
|
||||
<div
|
||||
v-if="m.role === 'assistant'"
|
||||
class="ac-bubble ac-md"
|
||||
v-html="renderMarkdown(m.content)"
|
||||
/>
|
||||
<!-- eslint-enable vue/no-v-html -->
|
||||
<div
|
||||
v-else
|
||||
class="ac-bubble"
|
||||
>
|
||||
{{ m.content }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -465,6 +477,65 @@ async function removeConv(id: string) {
|
||||
background: #f4f5f7;
|
||||
border-top-left-radius: 0.25rem;
|
||||
}
|
||||
|
||||
/* 마크다운 렌더 영역 — v-html 내부라 :deep() 로 타겟 */
|
||||
.ac-bubble.ac-md {
|
||||
white-space: normal;
|
||||
}
|
||||
.ac-md :deep(p) {
|
||||
margin: 0 0 0.5em;
|
||||
}
|
||||
.ac-md :deep(p:last-child) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.ac-md :deep(ul),
|
||||
.ac-md :deep(ol) {
|
||||
margin: 0.25em 0 0.5em;
|
||||
padding-left: 1.25em;
|
||||
}
|
||||
.ac-md :deep(li) {
|
||||
margin: 0.15em 0;
|
||||
}
|
||||
.ac-md :deep(strong) {
|
||||
font-weight: 700;
|
||||
}
|
||||
.ac-md :deep(code) {
|
||||
background: rgba(0, 0, 0, 0.06);
|
||||
padding: 0.05em 0.3em;
|
||||
border-radius: 0.25rem;
|
||||
font-size: 0.85em;
|
||||
font-family: ui-monospace, 'SFMono-Regular', monospace;
|
||||
}
|
||||
.ac-md :deep(pre.md-pre) {
|
||||
background: #1f2430;
|
||||
color: #e6e8ec;
|
||||
padding: 0.6rem 0.75rem;
|
||||
border-radius: 0.5rem;
|
||||
overflow-x: auto;
|
||||
margin: 0.4em 0;
|
||||
}
|
||||
.ac-md :deep(pre.md-pre code) {
|
||||
background: none;
|
||||
padding: 0;
|
||||
color: inherit;
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
.ac-md :deep(.md-h) {
|
||||
font-weight: 700;
|
||||
margin: 0.4em 0 0.25em;
|
||||
}
|
||||
.ac-md :deep(.md-h1) {
|
||||
font-size: 1.05em;
|
||||
}
|
||||
.ac-md :deep(hr) {
|
||||
border: none;
|
||||
border-top: 1px solid var(--border-strong);
|
||||
margin: 0.6em 0;
|
||||
}
|
||||
.ac-md :deep(a) {
|
||||
color: var(--accent);
|
||||
text-decoration: underline;
|
||||
}
|
||||
.ac-msg.user .ac-bubble {
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user