Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,11 @@ private List<Composer> detectComposersFromContent(String text) {
}

private String buildSystemInstruction(ComposerPersona persona) {
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

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

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

composer.getKoreanName(),
composer.getEnglishName(),
persona.getIdentity(),
persona.getMission(),
persona.getConstraintsText()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public String generateComment(String systemInstruction, String userPrompt) {
Map.of("parts", List.of(Map.of("text", userPrompt)))
),
"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)

)
);

Expand Down
Loading