This commit is contained in:
James Ketr 2025-05-22 17:01:46 -07:00
parent 2355c1dfa5
commit a6ff43af1d
2 changed files with 15 additions and 12 deletions

View File

@ -123,7 +123,7 @@ const GenerateCandidate = (props: BackstoryElementProps) => {
} else { } else {
setTimestamp(Date.now()) setTimestamp(Date.now())
} }
if (data.message) { if (data.message !== '') {
setStatus(data.message); setStatus(data.message);
} }
break; break;
@ -296,7 +296,7 @@ const GenerateCandidate = (props: BackstoryElementProps) => {
} else { } else {
setTimestamp(Date.now()) setTimestamp(Date.now())
} }
if (data.message) { if (data.message !== '') {
setStatus(data.message); setStatus(data.message);
} }
break; break;
@ -366,6 +366,7 @@ const GenerateCandidate = (props: BackstoryElementProps) => {
} }
<Box sx={{display: "flex", flexDirection: "column"}}> <Box sx={{display: "flex", flexDirection: "column"}}>
<Box sx={{ display: "flex", flexDirection: "row", position: "relative" }}> <Box sx={{ display: "flex", flexDirection: "row", position: "relative" }}>
<Box sx={{ display: "flex", position: "relative" }}>
<Avatar <Avatar
src={hasProfile ? `/api/u/${user.username}/profile/${sessionId}` : ''} src={hasProfile ? `/api/u/${user.username}/profile/${sessionId}` : ''}
alt={`${user.full_name}'s profile`} alt={`${user.full_name}'s profile`}
@ -375,15 +376,16 @@ const GenerateCandidate = (props: BackstoryElementProps) => {
border: '2px solid #e0e0e0', border: '2px solid #e0e0e0',
}} }}
/> />
{processing && <Pulse sx={{ position: "relative", left: "-80px" }} timestamp={timestamp} />} {processing && <Pulse sx={{ position: "relative", left: "-80px", top: "0px" }} timestamp={timestamp} />}
<Tooltip title={"Generate Profile Picture"}> </Box>
<Tooltip title={"Generate Picture"}>
<span style={{ display: "flex", flexGrow: 1 }}> <span style={{ display: "flex", flexGrow: 1 }}>
<Button <Button
sx={{ m: 1, gap: 1, flexGrow: 1 }} sx={{ m: 1, gap: 1, flexGrow: 1 }}
variant="contained" variant="contained"
disabled={sessionId === undefined || processing || !canGenImage} disabled={sessionId === undefined || processing || !canGenImage}
onClick={() => { generateProfile() }}> onClick={() => { generateProfile() }}>
Generate Profile Picture<SendIcon /> Generate Picture<SendIcon />
</Button> </Button>
</span> </span>
</Tooltip> </Tooltip>

View File

@ -218,6 +218,7 @@ class PersonaGenerator(Agent):
self.username = persona.get("username", None) self.username = persona.get("username", None)
if not self.username: if not self.username:
raise ValueError("LLM did not generate a username") raise ValueError("LLM did not generate a username")
self.username = re.sub(r'\s+', '.', g)
user_dir = os.path.join(defines.user_dir, persona["username"]) user_dir = os.path.join(defines.user_dir, persona["username"])
while os.path.exists(user_dir): while os.path.exists(user_dir):
match = re.match(r"^(.*?)(\d*)$", persona["username"]) match = re.match(r"^(.*?)(\d*)$", persona["username"])