This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git
The following commit(s) were added to refs/heads/main by this push:
new ce0583ca fix: when session id get faild created a new session instead
of return 400 (#822)
ce0583ca is described below
commit ce0583ca7762e0df9ac8bba744cad7aa14294107
Author: Alan <[email protected]>
AuthorDate: Fri Apr 4 14:55:29 2025 +0800
fix: when session id get faild created a new session instead of return 400
(#822)
---
llm/go-client/frontend/handlers/chat.go | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/llm/go-client/frontend/handlers/chat.go
b/llm/go-client/frontend/handlers/chat.go
index 79335849..5654506e 100644
--- a/llm/go-client/frontend/handlers/chat.go
+++ b/llm/go-client/frontend/handlers/chat.go
@@ -73,8 +73,12 @@ func (h *ChatHandler) Chat(c *gin.Context) {
session := sessions.Default(c)
ctxID, ok := session.Get("current_context").(string)
if !ok {
- c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid session
context"})
- return
+ h.NewContext(c)
+ ctxID, ok = session.Get("current_context").(string)
+ if !ok {
+ c.JSON(http.StatusInternalServerError, gin.H{"error":
"failed to get context"})
+ return
+ }
}
var req struct {