Feat: save room even if llm failed to properly guess; fix prompt
This commit is contained in:
		| @@ -248,7 +248,6 @@ func listRooms(allRooms bool) []*models.Room { | ||||
| 				log.Warn("failed to unmarshal room", "error", err) | ||||
| 				continue | ||||
| 			} | ||||
| 			log.Debug("consider room for list", "room", room, "key", key) | ||||
| 			if room.IsPublic || allRooms { | ||||
| 				publicRooms = append(publicRooms, room) | ||||
| 			} | ||||
|   | ||||
| @@ -79,11 +79,11 @@ func HandleFrontLogin(w http.ResponseWriter, r *http.Request) { | ||||
| 		return | ||||
| 	} | ||||
| 	http.SetCookie(w, cookie) | ||||
| 	tmpl, err := template.ParseGlob("components/*.html") | ||||
| 	if err != nil { | ||||
| 		abortWithError(w, err.Error()) | ||||
| 		return | ||||
| 	} | ||||
| 	// tmpl, err := template.ParseGlob("components/*.html") | ||||
| 	// if err != nil { | ||||
| 	// 	abortWithError(w, err.Error()) | ||||
| 	// 	return | ||||
| 	// } | ||||
| 	// check if that user was already in db | ||||
| 	userstate, err := loadState(cleanName) | ||||
| 	if err != nil || userstate == nil { | ||||
| @@ -120,9 +120,10 @@ func HandleFrontLogin(w http.ResponseWriter, r *http.Request) { | ||||
| 			return | ||||
| 		} | ||||
| 	} | ||||
| 	if err := tmpl.ExecuteTemplate(w, "base", fi); err != nil { | ||||
| 		log.Error("failed to execute base template", "error", err) | ||||
| 	} | ||||
| 	// if err := tmpl.ExecuteTemplate(w, "base", fi); err != nil { | ||||
| 	// 	log.Error("failed to execute base template", "error", err) | ||||
| 	// } | ||||
| 	http.Redirect(w, r, "/", 302) | ||||
| } | ||||
|  | ||||
| func makeCookie(username string, remote string) (*http.Cookie, error) { | ||||
|   | ||||
| @@ -78,7 +78,7 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { | ||||
| 		Actor:      fi.State.Username, | ||||
| 		ActorColor: string(fi.State.Team), | ||||
| 		WordColor:  string(color), | ||||
| 		Action:     "guessed", | ||||
| 		Action:     models.ActionTypeGuess, | ||||
| 		Word:       word, | ||||
| 	} | ||||
| 	fi.Room.ActionHistory = append(fi.Room.ActionHistory, action) | ||||
| @@ -103,8 +103,8 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { | ||||
| 		action := models.Action{ | ||||
| 			Actor:      fi.State.Username, | ||||
| 			ActorColor: string(fi.State.Team), | ||||
| 			WordColor:  "black", | ||||
| 			Action:     "game over", | ||||
| 			WordColor:  models.WordColorBlack, | ||||
| 			Action:     models.ActionTypeGameOver, | ||||
| 		} | ||||
| 		fi.Room.OpenedThisTurn = 0 | ||||
| 		fi.Room.ThisTurnLimit = 0 | ||||
| @@ -124,8 +124,8 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { | ||||
| 			action := models.Action{ | ||||
| 				Actor:      fi.State.Username, | ||||
| 				ActorColor: string(fi.State.Team), | ||||
| 				WordColor:  "blue", | ||||
| 				Action:     "game over", | ||||
| 				WordColor:  models.WordColorBlue, | ||||
| 				Action:     models.ActionTypeGameOver, | ||||
| 			} | ||||
| 			fi.Room.OpenedThisTurn = 0 | ||||
| 			fi.Room.ThisTurnLimit = 0 | ||||
| @@ -139,8 +139,8 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { | ||||
| 			action := models.Action{ | ||||
| 				Actor:      fi.State.Username, | ||||
| 				ActorColor: string(fi.State.Team), | ||||
| 				WordColor:  "red", | ||||
| 				Action:     "game over", | ||||
| 				WordColor:  models.WordColorRed, | ||||
| 				Action:     models.ActionTypeGameOver, | ||||
| 			} | ||||
| 			fi.Room.OpenedThisTurn = 0 | ||||
| 			fi.Room.ThisTurnLimit = 0 | ||||
|   | ||||
| @@ -153,9 +153,7 @@ func HandleStartGame(w http.ResponseWriter, r *http.Request) { | ||||
| 		Actor:      fi.State.Username, | ||||
| 		ActorColor: string(fi.State.Team), | ||||
| 		WordColor:  string(fi.State.Team), | ||||
| 		Action:     "game started", | ||||
| 		// Word:       clue, | ||||
| 		// Number:     num, | ||||
| 		Action:     models.ActionTypeGameStarted, | ||||
| 	} | ||||
| 	fi.Room.ActionHistory = append(fi.Room.ActionHistory, action) | ||||
| 	if err := saveFullInfo(fi); err != nil { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder