Phase 25: RAG sources in collapsible box + Korean thinking enforcement
- agent_service: yield {"__sources": [...]} token instead of __meta for sources
- agent_service: inject Korean-only rule at top of system message before date
- config.py: strengthen Korean thinking instruction in system prompt
- ROADMAP: add Phase 25 entry
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -79,7 +79,12 @@ class AgentService:
|
||||
|
||||
async def call_model(state: MessagesState, config: RunnableConfig) -> dict:
|
||||
from datetime import date
|
||||
system_content = f"오늘 날짜: {date.today().isoformat()}\n\n" + self._system_prompt
|
||||
system_content = (
|
||||
"【언어 규칙】모든 사고 과정(thinking)과 답변을 반드시 한국어로 작성하세요. "
|
||||
"영어 사용 금지. Think in Korean only.\n\n"
|
||||
f"오늘 날짜: {date.today().isoformat()}\n\n"
|
||||
+ self._system_prompt
|
||||
)
|
||||
if self._profile_repo:
|
||||
profile = self._profile_repo.get_all(self._user_id)
|
||||
if profile:
|
||||
@@ -367,11 +372,13 @@ class AgentService:
|
||||
print(f"[Agent] 대화 저장 실패: {e}")
|
||||
|
||||
if self._rag_show_sources and self._source_buffer:
|
||||
yield {"__meta": "\n\n[참고 문서]\n"}
|
||||
sources = []
|
||||
for src in self._source_buffer:
|
||||
filename = os.path.basename(src["source"])
|
||||
page = f" {src['page']}페이지" if "page" in src else ""
|
||||
yield {"__meta": f"- {filename}{page}\n"}
|
||||
entry = {"filename": os.path.basename(src["source"])}
|
||||
if "page" in src:
|
||||
entry["page"] = src["page"]
|
||||
sources.append(entry)
|
||||
yield {"__sources": sources}
|
||||
|
||||
def reset(self) -> None:
|
||||
"""새 thread_id로 대화 히스토리를 초기화한다."""
|
||||
|
||||
Reference in New Issue
Block a user