Enha: guesser prompt
This commit is contained in:
		| @@ -21,8 +21,9 @@ var ( | |||||||
| 	SignalChanMap = make(map[string]chan bool) | 	SignalChanMap = make(map[string]chan bool) | ||||||
| 	DoneChanMap   = make(map[string]chan bool) | 	DoneChanMap   = make(map[string]chan bool) | ||||||
| 	// got prompt: control character (\\u0000-\\u001F) found while parsing a string at line 4 column 0 | 	// got prompt: control character (\\u0000-\\u001F) found while parsing a string at line 4 column 0 | ||||||
| 	MimePrompt    = `we are playing alias;\nyou are a mime (player who gives a clue of one noun word and number of cards you expect them to open) of the %s team (people who would guess by your clue want open the %s cards);\nplease return your clue, number of cards to open and what words you mean them to find using that clue in json like:\n{\n\"clue\": \"one-word-noun\",\n\"number\": \"number-from-0-to-9\",\n\"words_I_mean_my_team_to_open\": [\"this\", \"that\", ...]\n}\nthe team who openes all their cards first wins.\nplease return json only.\nunopen Blue cards left: %d;\nunopen Red cards left: %d;\nhere is the game info in json:\n%s` | 	MimePrompt = `we are playing alias;\nyou are a mime (player who gives a clue of one noun word and number of cards you expect them to open) of the %s team (people who would guess by your clue want open the %s cards);\nplease return your clue, number of cards to open and what words you mean them to find using that clue in json like:\n{\n\"clue\": \"one-word-noun\",\n\"number\": \"number-from-0-to-9\",\n\"words_I_mean_my_team_to_open\": [\"this\", \"that\", ...]\n}\nthe team who openes all their cards first wins.\nplease return json only.\nunopen Blue cards left: %d;\nunopen Red cards left: %d;\nhere is the game info in json:\n%s` | ||||||
| 	GuesserPrompt = `we are playing alias;\nyou are to guess words of the %s team (you want open %s cards) by given clue and a number of meant guesses;\nplease return your guesses and words that could be meant by the clue, but you do not wish to open yet, in json like:\n{\n\"guesses\": [\"word1\", \"word2\", ...],\n\"could_be\": [\"this\", \"that\", ...]\n}\nthe team who openes all their cards first wins.\nplease return json only.\nunopen Blue cards left: %d;\nunopen Red cards left: %d;\nhere is the game info in json:\n%s` | 	// TODO: simplify; bot gets confused; so show it only unrevealed cards and last clue (maybe older clues as well); | ||||||
|  | 	GuesserPrompt = `we are playing alias;\nyou are to guess words of the %s team (you want open %s cards) by given clue and a number of meant guesses;\nplease return your guesses and words that could be meant by the clue, but you do not wish to open yet, in json like:\n{\n\"guesses\": [\"word1\", \"word2\", ...],\n\"could_be\": [\"this\", \"that\", ...]\n}\nthe team who openes all their cards first wins.\nplease return json only.\nunopen Blue cards left: %d;\nunopen Red cards left: %d;\nhere is the cards (and other info), you need to choose revealed==false words:\n%s` | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type DSResp struct { | type DSResp struct { | ||||||
| @@ -125,7 +126,7 @@ func (b *Bot) StartBot() { | |||||||
| 			room, err := getRoomByID(b.RoomID) | 			room, err := getRoomByID(b.RoomID) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				b.log.Error("bot loop", "error", err) | 				b.log.Error("bot loop", "error", err) | ||||||
| 				return | 				continue | ||||||
| 			} | 			} | ||||||
| 			// form prompt | 			// form prompt | ||||||
| 			prompt := b.BuildPrompt(room) | 			prompt := b.BuildPrompt(room) | ||||||
| @@ -134,11 +135,11 @@ func (b *Bot) StartBot() { | |||||||
| 			llmResp, err := b.CallLLM(prompt) | 			llmResp, err := b.CallLLM(prompt) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				b.log.Error("bot loop", "error", err) | 				b.log.Error("bot loop", "error", err) | ||||||
| 				return | 				continue | ||||||
| 			} | 			} | ||||||
| 			tempMap, err := b.LLMParser.ParseBytes(llmResp) | 			tempMap, err := b.LLMParser.ParseBytes(llmResp) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				b.log.Error("bot loop", "error", err) | 				b.log.Error("bot loop", "error", err, "resp", string(llmResp)) | ||||||
| 				continue | 				continue | ||||||
| 			} | 			} | ||||||
| 			eventName := models.NotifyBacklogPrefix + room.ID | 			eventName := models.NotifyBacklogPrefix + room.ID | ||||||
| @@ -176,7 +177,7 @@ func (b *Bot) StartBot() { | |||||||
| 					b.log.Debug("bot trying to open card", "word", word, "color", | 					b.log.Debug("bot trying to open card", "word", word, "color", | ||||||
| 						color, "exists", exists) | 						color, "exists", exists) | ||||||
| 					if !exists { | 					if !exists { | ||||||
| 						return | 						continue | ||||||
| 					} | 					} | ||||||
| 					room.RevealSpecificWord(word) | 					room.RevealSpecificWord(word) | ||||||
| 					room.UpdateCounter() | 					room.UpdateCounter() | ||||||
| @@ -216,7 +217,7 @@ func (b *Bot) StartBot() { | |||||||
| 					} | 					} | ||||||
| 					if err := saveRoom(room); err != nil { | 					if err := saveRoom(room); err != nil { | ||||||
| 						b.log.Error("failed to save room", "room", room) | 						b.log.Error("failed to save room", "room", room) | ||||||
| 						return | 						continue | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 				b.log.Info("mime resp log", "guesserResp", tempMap) | 				b.log.Info("mime resp log", "guesserResp", tempMap) | ||||||
| @@ -224,12 +225,12 @@ func (b *Bot) StartBot() { | |||||||
| 				eventPayload = "" | 				eventPayload = "" | ||||||
| 			default: | 			default: | ||||||
| 				b.log.Error("unexpected role", "role", b.Role, "resp-map", tempMap) | 				b.log.Error("unexpected role", "role", b.Role, "resp-map", tempMap) | ||||||
| 				return | 				continue | ||||||
| 			} | 			} | ||||||
| 			// save room | 			// save room | ||||||
| 			if err := saveRoom(room); err != nil { | 			if err := saveRoom(room); err != nil { | ||||||
| 				b.log.Error("failed to save room", "error", err) | 				b.log.Error("failed to save room", "error", err) | ||||||
| 				return | 				continue | ||||||
| 			} | 			} | ||||||
| 			if botName := room.WhichBotToMove(); botName != "" { | 			if botName := room.WhichBotToMove(); botName != "" { | ||||||
| 				SignalChanMap[botName] <- true | 				SignalChanMap[botName] <- true | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								todos.md
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								todos.md
									
									
									
									
									
								
							| @@ -41,3 +41,4 @@ | |||||||
| - guesser did not have same number of guesses (move ended after 1 guess); show how much guesses left on the page (red after blue); | - guesser did not have same number of guesses (move ended after 1 guess); show how much guesses left on the page (red after blue); | ||||||
| - guesser bot no request after game restart; | - guesser bot no request after game restart; | ||||||
| - if mime joins another role, he stays as mime (before game start); | - if mime joins another role, he stays as mime (before game start); | ||||||
|  | - guesser llm makes up words, likely the prompt should be more clear; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder