Skip to content

[fix] AI 댓글 작곡가 정체성 명시 및 길이 제한 강화#121

Merged
k3vin7 merged 1 commit intomainfrom
fix/ai-comment-persona-identity
Mar 29, 2026
Merged

[fix] AI 댓글 작곡가 정체성 명시 및 길이 제한 강화#121
k3vin7 merged 1 commit intomainfrom
fix/ai-comment-persona-identity

Conversation

@k3vin7
Copy link
Copy Markdown
Contributor

@k3vin7 k3vin7 commented Mar 29, 2026

  • 시스템 프롬프트에 작곡가 이름 명시 (자기 자신을 3인칭으로 언급하는 문제 수정)
  • 150자 이내 제한 추가
  • maxOutputTokens 200 → 100으로 축소

@k3vin7 k3vin7 merged commit 0f74a90 into main Mar 29, 2026
1 check passed
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the AI system prompt to include specific composer names and personality traits, while also enforcing a 150-character limit and prohibiting third-person self-references. Additionally, the maximum output tokens for the Gemini API were reduced from 200 to 100. Review feedback suggests removing the hardcoded character limit from the prompt to avoid redundancy with existing persona constraints and recommends externalizing the token limit configuration to a properties file for better maintainability.

Composer composer = persona.getComposer();
return String.format(
"너는 %s를 가진 작곡가야. %s를 수행하고 %s를 반드시 지켜서 답해줘.",
"너는 작곡가 %s(%s)야. %s의 성격을 가지고 있어. %s를 수행하고 %s를 반드시 지켜서 답해줘. 절대로 자기 자신을 3인칭으로 언급하지 마. 반드시 150자 이내로 짧게 답해.",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

시스템 프롬프트에 글자 수 제한이 하드코딩되어 있습니다. ComposerPersonaconstraintsText 필드에 이미 "150자 이내"와 같은 제약 조건이 포함되어 있을 수 있습니다 (테스트 코드에서 확인됨). 중복을 피하고 유연성을 높이기 위해 프롬프트 문자열에서 반드시 150자 이내로 짧게 답해. 부분을 제거하는 것을 고려해 보세요. 이렇게 하면 글자 수 제한을 constraintsText를 통해 중앙에서 관리할 수 있습니다.

Suggested change
"너는 작곡가 %s(%s)야. %s의 성격을 가지고 있어. %s를 수행하고 %s를 반드시 지켜서 답해줘. 절대로 자기 자신을 3인칭으로 언급하지 마. 반드시 150자 이내로 짧게 답해.",
"너는 작곡가 %s(%s)야. %s의 성격을 가지고 있어. %s를 수행하고 %s를 반드시 지켜서 답해줘. 절대로 자기 자신을 3인칭으로 언급하지 마.",

),
"generationConfig", Map.of(
"maxOutputTokens", 200
"maxOutputTokens", 100
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

maxOutputTokens 값이 100으로 하드코딩되어 있습니다. 이 값을 @Value("${gemini.max-output-tokens:100}") 어노테이션을 사용하여 설정 파일에서 주입받도록 변경하면 유지보수성과 유연성을 높일 수 있습니다.

예시:

// GeminiClient.java
private final int maxOutputTokens;

public GeminiClient(@Value("${gemini.api-key:}") String apiKey,
                    @Value("${gemini.max-output-tokens:100}") int maxOutputTokens) {
    this.apiKey = apiKey;
    this.maxOutputTokens = maxOutputTokens;
    this.restClient = RestClient.create();
}

// ... in generateComment()
"generationConfig", Map.of("maxOutputTokens", this.maxOutputTokens)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant