fix: title not generated if first msg is shell invocation (#2451)
This commit is contained in:
@@ -691,8 +691,10 @@ export namespace Session {
|
|||||||
|
|
||||||
const lastSummary = msgs.findLast((msg) => msg.info.role === "assistant" && msg.info.summary === true)
|
const lastSummary = msgs.findLast((msg) => msg.info.role === "assistant" && msg.info.summary === true)
|
||||||
if (lastSummary) msgs = msgs.filter((msg) => msg.info.id >= lastSummary.info.id)
|
if (lastSummary) msgs = msgs.filter((msg) => msg.info.id >= lastSummary.info.id)
|
||||||
|
const numRealUserMsgs = msgs.filter(
|
||||||
if (msgs.filter((m) => m.info.role === "user").length === 1 && !session.parentID && isDefaultTitle(session.title)) {
|
(m) => m.info.role === "user" && !m.parts.every((p) => "synthetic" in p && p.synthetic),
|
||||||
|
).length
|
||||||
|
if (numRealUserMsgs === 1 && !session.parentID && isDefaultTitle(session.title)) {
|
||||||
const small = (await Provider.getSmallModel(model.providerID)) ?? model
|
const small = (await Provider.getSmallModel(model.providerID)) ?? model
|
||||||
generateText({
|
generateText({
|
||||||
maxOutputTokens: small.info.reasoning ? 1024 : 20,
|
maxOutputTokens: small.info.reasoning ? 1024 : 20,
|
||||||
|
|||||||
Reference in New Issue
Block a user