Skip to content

Commit

Permalink
Fix wrong query (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
swuecho authored Apr 6, 2023
1 parent eb80446 commit 54fda76
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion api/chat_session_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (s *ChatSessionService) GetSimpleChatSessionsByUserID(ctx context.Context,
TopP: float64(session.TopP),
MaxTokens: session.MaxTokens,
Debug: session.Debug,
Model: session.Model,
Model: session.Model,
}
})
return simple_sessions, nil
Expand Down
2 changes: 1 addition & 1 deletion api/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type SimpleChatSession struct {
TopP float64 `json:"topP"`
MaxTokens int32 `json:"maxTokens"`
Debug bool `json:"debug"`
Model string `json:"model"`
Model string `json:"model"`
}

type ChatMessageResponse struct {
Expand Down
8 changes: 4 additions & 4 deletions api/sqlc/queries/chat_message.sql
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ WHERE cm.id = $1 AND (cs.user_id = $2 OR au.is_superuser) and cs.active = true;
-- name: GetLatestMessagesBySessionUUID :many
SELECT *
FROM chat_message
Where chat_session_uuid in
Where chat_message.id in
(
SELECT chat_session_uuid
SELECT chat_message.id
FROM chat_message
WHERE chat_message.chat_session_uuid = $1
ORDER BY created_at DESC
LIMIT $2
LIMIT $2
)
ORDER BY created_at ;
ORDER BY created_at;


-- name: GetFirstMessageBySessionUUID :one
Expand Down
6 changes: 3 additions & 3 deletions api/sqlc_queries/chat_message.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 54fda76

Please sign in to comment.