Skip to content

Feat/#387 ai api 연동#394

Open
juri123123 wants to merge 7 commits intodevelopfrom
feat/#387-ai-api-연동

Hidden character warning

The head ref may contain hidden characters: "feat/#387-ai-api-\uc5f0\ub3d9"
Open

Feat/#387 ai api 연동#394
juri123123 wants to merge 7 commits intodevelopfrom
feat/#387-ai-api-연동

Conversation

@juri123123
Copy link
Collaborator

🔗 연결된 이슈

📄 작업 내용

  • AI API를 연결했습니다.
구현 내용 성공 실패
GIF

💻 주요 코드 설명

  • AI 답변을 받아오기까지 3~4초 정도 걸리더라구요 ! 로딩 중일 때와 결과가 나왔을 때 전환을 이런식으로 처리해줬습니다.
private func fetchAIAnswer() {
        Task {
            do {
                AILoadingSubject.send(true)
                
                let answer = try await fetchAIAnswerUseCase.execute(
                    questID: questID,
                    isAnswerExists: isAnswerExists
                ).AIAnswer
                AIResultSubject.send(.success(answer))
                
                AILoadingSubject.send(false)
            } catch {
                guard let error = error as? ByeBooError else {
                    return
                }
                AIResultSubject.send(.failure(error))
                AILoadingSubject.send(false)
            }
        }
    }

@juri123123 juri123123 requested review from dev-domo and y-eonee March 4, 2026 15:03
@juri123123 juri123123 self-assigned this Mar 4, 2026
@juri123123 juri123123 added 주리🐿️ feat 새로운 기능 구현 및 API 연결 labels Mar 4, 2026
@juri123123 juri123123 linked an issue Mar 4, 2026 that may be closed by this pull request
1 task
Copy link
Collaborator

@dev-domo dev-domo left a comment

Choose a reason for hiding this comment

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

수고하셨습니다:)

}

func fetchAIAnswer(questID: Int, isAnswerExists: Bool) async throws -> AIAnswerEntity {
try await Task.sleep(for: .seconds(2))
Copy link
Collaborator

Choose a reason for hiding this comment

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

의도적으로 Task.sleep을 실행하는 건가요?


extension AIAnswerEntity {
static func stub() -> Self {
return .init(AIAnswer: "어 나 AI인데 힘내라")
Copy link
Collaborator

Choose a reason for hiding this comment

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

어 힘낼게

Copy link
Collaborator

Choose a reason for hiding this comment

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

나 최주리인데 힘낼게


private var questID: Int = 1
private var isAIAnswerExists: Bool = false
private var answerState: AIAnswerState = .loading
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 answerState 변수는 언제 활용되나요?

.stub()
}

func createAIAnswer(questID: Int) async throws -> AIAnswerEntity {
Copy link
Collaborator

Choose a reason for hiding this comment

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

isAnswerExists에 따른 AI 답변 생성/조회를 하나의 유스케이스로 관리하시는거죠? createAIAnswer는 private 메서드로 바꿔도 될 것 같습니다!

do {
AILoadingSubject.send(true)

let answer = try await fetchAIAnswerUseCase.execute(
Copy link
Collaborator

Choose a reason for hiding this comment

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

오 이 .AIAnswer은 뭐예요?

Copy link
Collaborator

Choose a reason for hiding this comment

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

저도궁금해요

Copy link
Collaborator

@y-eonee y-eonee left a comment

Choose a reason for hiding this comment

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

고생하셨습니당 ! ! ! ! ! ! !!

switch self {
case .checkQuest, .recording, .active, .tip, .images, .answer, .progressingQuests, .fetchCompletedJourney,
.postJourney, .completedQuests, .editRecording, .editActive:
default:
Copy link
Collaborator

Choose a reason for hiding this comment

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

이거좋네유


extension AIAnswerEntity {
static func stub() -> Self {
return .init(AIAnswer: "어 나 AI인데 힘내라")
Copy link
Collaborator

Choose a reason for hiding this comment

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

나 최주리인데 힘낼게

private let photoBoxView: UIImageView?
private let feelView = FeelView(emotionType: "", descriptionText: "")
private let AIAnswerButton = ByeBooButton(
let AIAnswerButton = ByeBooButton(
Copy link
Collaborator

Choose a reason for hiding this comment

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

이거슨 왜 접근제어자가 intenral이 되었나용

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

Labels

feat 새로운 기능 구현 및 API 연결 주리🐿️

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] AI API 연동

3 participants