Skip to content

Commit eddcf87

Browse files
committed
Replace U+202F with U+00A0.
Signed-off-by: Katharine Berry <[email protected]>
1 parent 07e71af commit eddcf87

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

service/assistant/session.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func (ps *PromptSession) Run(ctx context.Context) {
183183
ourContent := ""
184184
for _, c := range choice.Content.Parts {
185185
if c.Text != "" {
186-
ourContent += c.Text
186+
ourContent += fixUnsupportedCharacters(c.Text)
187187
}
188188
if c.FunctionCall != nil {
189189
fc := *c.FunctionCall
@@ -383,6 +383,11 @@ func (ps *PromptSession) Run(ctx context.Context) {
383383
_ = ps.conn.Close(websocket.StatusNormalClosure, "")
384384
}
385385

386+
func fixUnsupportedCharacters(s string) string {
387+
// Replace the narrow non-breaking space with a regular non-breaking space.
388+
return strings.ReplaceAll(s, "\u202f", "\u00a0")
389+
}
390+
386391
func (ps *PromptSession) storeThread(ctx context.Context, messages []*genai.Content) error {
387392
ctx, span := beeline.StartSpan(ctx, "store_thread")
388393
defer span.Send()

0 commit comments

Comments
 (0)