Conversation
k3vin7
commented
Mar 29, 2026
- 시스템 프롬프트에 작곡가 이름 명시 (자기 자신을 3인칭으로 언급하는 문제 수정)
- 150자 이내 제한 추가
- maxOutputTokens 200 → 100으로 축소
There was a problem hiding this comment.
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자 이내로 짧게 답해.", |
There was a problem hiding this comment.
시스템 프롬프트에 글자 수 제한이 하드코딩되어 있습니다. ComposerPersona의 constraintsText 필드에 이미 "150자 이내"와 같은 제약 조건이 포함되어 있을 수 있습니다 (테스트 코드에서 확인됨). 중복을 피하고 유연성을 높이기 위해 프롬프트 문자열에서 반드시 150자 이내로 짧게 답해. 부분을 제거하는 것을 고려해 보세요. 이렇게 하면 글자 수 제한을 constraintsText를 통해 중앙에서 관리할 수 있습니다.
| "너는 작곡가 %s(%s)야. %s의 성격을 가지고 있어. %s를 수행하고 %s를 반드시 지켜서 답해줘. 절대로 자기 자신을 3인칭으로 언급하지 마. 반드시 150자 이내로 짧게 답해.", | |
| "너는 작곡가 %s(%s)야. %s의 성격을 가지고 있어. %s를 수행하고 %s를 반드시 지켜서 답해줘. 절대로 자기 자신을 3인칭으로 언급하지 마.", |
| ), | ||
| "generationConfig", Map.of( | ||
| "maxOutputTokens", 200 | ||
| "maxOutputTokens", 100 |
There was a problem hiding this comment.
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)