Skip to content
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

fix: remove content_sent from StreamingSequences #1351

Merged
merged 2 commits into from
Jul 7, 2023
Merged
Changes from 1 commit
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
13 changes: 1 addition & 12 deletions server/services/sequence_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ type sequenceServerImpl struct {

streamingSequences sync.Map
streamingReports sync.Map
sentContent string
}

func (s *sequenceServerImpl) CreateSequence(ctx context.Context, in *pb.CreateSequenceRequest) (*pb.Sequence, error) {
Expand Down Expand Up @@ -236,12 +235,7 @@ func (s *sequenceServerImpl) AttemptStreamingSequence(in *pb.AttemptStreamingSeq
resp := responses[n]
delay = resp.GetDelay().AsDuration()
st = status.FromProto(resp.GetStatus())
respIndex = int(resp.ResponseIndex) - len(strings.Fields(s.sentContent))

if s.sentContent != "" {
wordsWritten := strings.Fields(s.sentContent)
content = content[len(wordsWritten):]
}
respIndex = int(resp.ResponseIndex)

} else if n > l {
st = status.New(codes.OutOfRange, "Attempt exceeded predefined responses")
Expand All @@ -251,7 +245,6 @@ func (s *sequenceServerImpl) AttemptStreamingSequence(in *pb.AttemptStreamingSeq
if idx >= respIndex {
break
}
s.sentContent += word + " "
err := stream.Send(&pb.AttemptStreamingSequenceResponse{Content: word})
if err != nil {
return err
Expand Down Expand Up @@ -288,12 +281,8 @@ func (s *sequenceServerImpl) AttemptStreamingSequence(in *pb.AttemptStreamingSeq
ResponseTime: rpb,
AttemptDelay: attDelay,
Status: st.Proto(),
ContentSent: s.sentContent,
galz10 marked this conversation as resolved.
Show resolved Hide resolved
})

if n+1 >= len(responses) {
s.sentContent = ""
}

return st.Err()

Expand Down
Loading