Skip to content

Commit

Permalink
[FIX] internal proto field name and timeout (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
jyoo0515 authored Feb 20, 2024
1 parent 864142f commit 7e6cffc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
10 changes: 5 additions & 5 deletions ai/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def PronunciationFeedback(self, request, context):
print(feedback)

return internal_pb2.PronunciationFeedbackResponse(
transcript=feedback["transcript"],
wrong_idx_major=feedback["wrong_idx"]["major"],
wrong_idx_minor=feedback["wrong_idx"]["minor"],
transcript=feedback["transcription"],
wrong_idx_major=feedback["incorrect_indexes"]["major"],
wrong_idx_minor=feedback["incorrect_indexes"]["minor"],
pronunciation_score=feedback["pronunciation_score"],
decibel=feedback["decibel"],
speech_rate=feedback["speech_rate"],
Expand All @@ -41,8 +41,8 @@ def CommunicationFeedback(self, request, context):
"user-audio": request.audio_path,
"context": request.context,
"question": request.question,
"answer": request.answer,
"img": request.img
"answer": request.expected_answer,
"img": request.img_path,
}
feedback = self.ft.ComFeedback(com_input)
print(feedback)
Expand Down
7 changes: 7 additions & 0 deletions src/constant/grpc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package constant

import "time"

const (
GrpcDefaultTimeout = 10 * time.Second
)
5 changes: 2 additions & 3 deletions src/handler/feedback.handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"math"
"net/http"
"os"
"time"
)

type FeedbackHandler interface {
Expand Down Expand Up @@ -57,7 +56,7 @@ func (handler *FeedbackHandlerImpl) GetPronunciationFeedback(c echo.Context) err
//client 생성
client := pb.NewPronunciationFeedbackServiceClient(conn)

ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), constant.GrpcDefaultTimeout)
defer cancel()

grpcRequest := pb.PronunciationFeedbackRequest{
Expand Down Expand Up @@ -122,7 +121,7 @@ func (handler *FeedbackHandlerImpl) GetCommunicationFeedback(c echo.Context) err
//client 생성
client := pb.NewCommunicationFeedbackServiceClient(conn)

ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), constant.GrpcDefaultTimeout)
defer cancel()

grpcRequest := pb.CommunicationFeedbackRequest{
Expand Down

0 comments on commit 7e6cffc

Please sign in to comment.