def body(self, master): for iid, chapter in self.data_dict.items(): create_side_label(master, chapter['title']) create_label(master, 'is a chapter', row=master.grid_size()[1] - 1, col=1, padx=15)
def body(self, master): for label_text, data_text in self.data_dict.items(): create_side_label(master, label_text) create_label(master, data_text, row=master.grid_size()[1] - 1, col=1, padx=15)
def body(self, master): create_side_label(master, 'Current Chapter') chapter_name = "None" if 'chapter_id' not in self.node else self.state.chapter_title( self.node) create_label(master, chapter_name, row=master.grid_size()[1] - 1, col=1, padx=15) self.new_chapter_title = Entry(master, master.grid_size()[1], "Enter new chapter title", "", None) self.new_chapter_title.controls.focus_set()
def body(self, master): create_label(master, "Memory entries associated with this node") self.master = master self.refresh()
def body(self, master): create_label(master, "Memory (prepended to AI input)") self.master = master self.refresh()
def body(self, master): create_side_label(master, "id") create_label(master, self.node["id"], row=master.grid_size()[1] - 1, col=1, padx=15) create_side_label(master, "bookmarked") create_label(master, "true" if self.node.get("bookmark", False) else "false", row=master.grid_size()[1] - 1, col=1, padx=15) create_side_label(master, "visited") create_label(master, "true" if self.node.get("visited", False) else "false", row=master.grid_size()[1] - 1, col=1, padx=15) create_side_label(master, "canonical") create_label(master, "true" if self.node["id"] in self.state.calc_canonical_set() else "false", row=master.grid_size()[1] - 1, col=1, padx=15) if "meta" in self.node: meta = self.node["meta"] create_side_label(master, "origin") if "origin" in meta: create_label(master, meta["origin"], row=master.grid_size()[1] - 1, col=1, padx=15) else: create_label(master, "unknown", row=master.grid_size()[1] - 1, col=1, padx=15) if "generation" in meta: create_side_label(master, "prompt") prompt_text = tk.Text(master, height=15) prompt_text.grid(row=master.grid_size()[1] - 1, column=1) prompt_text.insert(tk.INSERT, meta["generation"]["prompt"]) prompt_text.configure( state='disabled', spacing1=8, foreground=text_color(), background=bg_color(), wrap="word", ) # makes text copyable prompt_text.bind("<Button>", lambda event: prompt_text.focus_set()) create_side_label(master, "original generated text") gen_text = tk.Text(master, height=5) gen_text.grid(row=master.grid_size()[1] - 1, column=1) gen_text.insert(tk.INSERT, meta["generation"]["text"]) gen_text.tag_config("prob_1", background=PROB_1) gen_text.tag_config("prob_2", background=PROB_2) gen_text.tag_config("prob_3", background=PROB_3) gen_text.tag_config("prob_4", background=PROB_4) gen_text.tag_config("prob_5", background=PROB_5) gen_text.tag_config("prob_6", background=PROB_6) # TODO continuous coloration for i, position in enumerate( meta["generation"]["logprobs"]["text_offset"]): prob = math.exp( meta["generation"]["logprobs"]["token_logprobs"][i]) #index_offset = position - len(meta["generation"]["prompt"]) token_length = len( meta["generation"]["logprobs"]["tokens"][i]) if prob >= 0.8: gen_text.tag_add( "prob_1", f"1.0 + {position} chars", f"1.0 + {position + token_length} chars") elif prob >= 0.6: gen_text.tag_add( "prob_2", f"1.0 + {position} chars", f"1.0 + {position + token_length} chars") elif prob >= 0.4: gen_text.tag_add( "prob_3", f"1.0 + {position} chars", f"1.0 + {position + token_length} chars") elif prob >= 0.2: gen_text.tag_add( "prob_4", f"1.0 + {position} chars", f"1.0 + {position + token_length} chars") elif prob >= 0.05: gen_text.tag_add( "prob_5", f"1.0 + {position} chars", f"1.0 + {position + token_length} chars") else: gen_text.tag_add( "prob_6", f"1.0 + {position} chars", f"1.0 + {position + token_length} chars") gen_text.configure(state='disabled') # gen_text.configure( # state='disabled', # font=readable_font, # spacing1=10, # foreground=text_color(), # background=bg_color(), # wrap="word", # ) # makes text copyable gen_text.bind("<Button>", lambda event: gen_text.focus_set()) create_side_label(master, "model") create_label(master, meta["generation"]["model"], row=master.grid_size()[1] - 1, col=1, padx=15)