Ask Petal answers in both languages, with room to read
The tutor prompt said "never mix languages in a single response" and mirrored the language of the question, so asking in English — which she does, because she is practising — returned the one explanation surface that gives nothing in her own language. It now answers in both, pair language first, halves separated by a blank line. Which half is the safety net and which is the lesson depends on who is writing: the pair is (English + X) and Petal is used from both ends, so the prompt asks for both and says it doesn't know which way round. The split is a rendering nicety, never a parse the reply depends on: a half-streamed reply is all one half, a model that ignores the instruction renders as one block, and nothing is ever dropped. For the height, the first attempt clamped the box to the room left below the anchored card so it could never overhang — measured, that gave 176px against a 442px answer, worse than the 220px it replaced. The card's own chrome spends ~290px of an 810px window, so "fits below the word" and "room to read" are not both available. The ceiling is now a flat 50vh and the overhang is made navigable instead, per item 4: the card reports its reach like the rail already does, the column grows, and the page can scroll to the actions below it.
This commit is contained in:
+29
-4
@@ -144,6 +144,25 @@ func CollocationMessages(contentText, tone string, lang Lang) []Message {
|
||||
// askPetalSystemTemplate is the Ask Petal tutor prompt. The suggestion context
|
||||
// is interpolated in; the user's own messages are appended after this system
|
||||
// turn by the caller.
|
||||
//
|
||||
// The reply is bilingual, the pair language first. Until UX item 6 it mirrored
|
||||
// the language of the question instead — self-consistent, but it meant asking in
|
||||
// one language cost you the other, and the writer doesn't always know which one
|
||||
// the answer will be clearer in. Which half is the safety net and which is the
|
||||
// lesson depends on who is writing: the pair is (English + X) either way, and an
|
||||
// English speaker learning French wants the French half for the same reason a
|
||||
// Mandarin speaker learning English wants the English one. Petal cannot tell
|
||||
// them apart from a chat message, and doesn't need to — every other explanation
|
||||
// surface already gives both (the card's English body, the seeded bubble in the
|
||||
// pair language). The answer that goes deepest into the "why" was the one place
|
||||
// that didn't.
|
||||
//
|
||||
// The blank line between the halves is a contract with the client: AskPetal.tsx
|
||||
// splits on the first one to render her language prominently and the English
|
||||
// beneath it, mirroring the companion's bubble. A model that ignores the
|
||||
// instruction and writes one language degrades to a single plain block — the
|
||||
// answer is still readable, which is why the split is a rendering nicety and
|
||||
// never a parse the reply depends on.
|
||||
const askPetalSystemTemplate = `You are Petal, a warm and patient English writing tutor helping someone who is learning English ` +
|
||||
`as a second language. You are currently discussing a specific writing suggestion.
|
||||
|
||||
@@ -154,15 +173,21 @@ Suggestion context:
|
||||
- Initial explanation: "%[4]s"
|
||||
- Surrounding paragraph: "%[5]s"
|
||||
|
||||
The user wants to understand this suggestion better. Detect the language of the user's message ` +
|
||||
`and respond in that same language. If they write in %[6]s, respond entirely in ` +
|
||||
`%[6]s. If they write in English, respond in English. Never mix languages in a single response.
|
||||
The user wants to understand this suggestion better. Answer in BOTH languages, every time, ` +
|
||||
`whichever language they asked their question in: first the whole answer in %[6]s, then the ` +
|
||||
`same answer again in English. Separate the two with a single blank line. Do not label them, ` +
|
||||
`do not use a blank line anywhere else, and do not mix the two languages within one half — ` +
|
||||
`each half is complete on its own.
|
||||
|
||||
One of those two languages is the one they are surest in and the other is the one they are ` +
|
||||
`working in — you do not know which way round, so give both and let them choose. Both halves ` +
|
||||
`say the same thing: do not put a point in one that is missing from the other.
|
||||
|
||||
Explain clearly and kindly. Use simple language appropriate to the user's message. Give examples ` +
|
||||
`when helpful. If they ask "why" (or "%[7]s"), explain the grammar rule or idiom behind it. ` +
|
||||
`If they suggest an alternative phrasing, evaluate it honestly.
|
||||
|
||||
Keep responses concise (2-4 sentences). This is a chat, not an essay. Be encouraging — ` +
|
||||
Keep each half concise (2-3 sentences). This is a chat, not an essay. Be encouraging — ` +
|
||||
`learning a language is hard and they're doing great.`
|
||||
|
||||
// AskPetalSystemPrompt fills the tutor prompt with one suggestion's context and
|
||||
|
||||
Reference in New Issue
Block a user