|
@@ -1759,9 +1759,15 @@ export namespace SessionPrompt {
|
|
|
.then((result) => {
|
|
.then((result) => {
|
|
|
if (result.text)
|
|
if (result.text)
|
|
|
return Session.update(input.session.id, (draft) => {
|
|
return Session.update(input.session.id, (draft) => {
|
|
|
- const cleaned = result.text.replace(/<think>[\s\S]*?<\/think>\s*/g, "").split("\n")[0]
|
|
|
|
|
|
|
+ const cleaned = result.text
|
|
|
|
|
+ .replace(/<think>[\s\S]*?<\/think>\s*/g, "")
|
|
|
|
|
+ .split("\n")
|
|
|
|
|
+ .map((line) => line.trim())
|
|
|
|
|
+ .find((line) => line.length > 0)
|
|
|
|
|
+ if (!cleaned) return
|
|
|
|
|
+
|
|
|
const title = cleaned.length > 100 ? cleaned.substring(0, 97) + "..." : cleaned
|
|
const title = cleaned.length > 100 ? cleaned.substring(0, 97) + "..." : cleaned
|
|
|
- draft.title = title.trim()
|
|
|
|
|
|
|
+ draft.title = title
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
.catch((error) => {
|
|
.catch((error) => {
|