-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] WebClient GPT API 호출 시, 예외 발생 #37
Comments
문제 해결 로그1.즐겨찾기 기능을 위해 구현한 favorite 패키지를 삭제했더니 정상적으로 작동한다. |
문제 해결 로그2.@Table(name = "FAVORITE")
@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@Builder(access = AccessLevel.PRIVATE)
@Getter
public class Favorite extends BaseEntity {
// ..생략
@Enumerated(EnumType.STRING)
@Column(name = "FUNCTION_TYPE", nullable = false, length = 30)
private GptFunction functionType;
// ..생략 Favorite 객체가 존재하면 위와 같은 문제가 발생한다. 이 객체가 왜 문제를 발생시키는 지 알아봐야겠다. |
문제 해결 로그3.문제 해결을 완료했다. package com.dongyang.core.domain.gpt.constant;
import static com.dongyang.core.global.config.gpt.GptConfig.GPT_ADD_COMMENT_MODEL;
import static com.dongyang.core.global.config.gpt.GptConfig.GPT_DEFAULT_MODEL;
import static com.dongyang.core.global.config.gpt.GptConfig.GPT_RECOMMEND_VARIABLE_NAME_MODEL;
import static com.dongyang.core.global.config.gpt.GptConfig.GPT_REFACTOR_CODE_MODEL;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public enum GptFunction {
RECOMMEND_VARIABLE_NAME(
"당신은 %s 언어 변수명 추천 전문가이다. 단어를 입력받으면 그 단어의 영어 변수명을 10개 생성하여 출력해라. 만약 %s 라는 언어가 존재하지 않는다면 X를 출력해라",
GPT_RECOMMEND_VARIABLE_NAME_MODEL, 0.2, 100),
ADD_COMMENT(
"당신은 %s 언어로 작성된 코드를 받으면 이를 분석하여 설명 주석을 달아주는 코드 전문가이다. 만약 받은 코드가 %s 언어의 문법이 아니면 X를 출력하고, 받은 코드가 %s 언어로 작성된 것이 맞다면 각 코드 라인의 윗줄에 코드 기능 설명을 언어 형식에 맞는 주석으로 달아라.",
GPT_ADD_COMMENT_MODEL, 0.4, 2000),
// .. 생략 @AllArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
public class GptRequest {
@Schema(description = "요청 기능 선택", examples = {"ADD_COMMENT", "RECOMMEND_VARIABLE_NAME", "REFACTOR_CODE"})
@NotNull(message = "{gpt.function.notNull}")
private GptFunction function;
// .. 생략 문제의 중심인 GptFunction Enum객체는 원래 DTO인 그러던 중 JPA Entity 객체에서 결국은 @entity의 @column으로 설정된 Enum 객체 GptFunction을 DTO에서 사용 시, 오류가 발생된 것으로 추정되는 문제인데, 해결법public enum FunctionType {
RECOMMEND_VARIABLE_NAME,
ADD_COMMENT,
REFACTOR_CODE,
SOLVE_ALGORITHM
} 우선은
|
Description 📝
GPT API KEY가 존재하는데, Key가 존재하지 않는다는 오류가 발생함
To-Do ☑️
openai-gpt3-java:client
라이브러리 사용버그 로그 🧾
스크린샷 📸
The text was updated successfully, but these errors were encountered: