Browse Source

only gen summary if diffs

Dax Raad 2 months ago
parent
commit
651a10d6db
1 changed files with 4 additions and 7 deletions
  1. 4 7
      packages/opencode/src/session/summary.ts

+ 4 - 7
packages/opencode/src/session/summary.ts

@@ -130,10 +130,7 @@ export namespace SessionSummary {
           m.info.role === "assistant" && m.parts.some((p) => p.type === "step-finish" && p.reason !== "tool-calls"),
           m.info.role === "assistant" && m.parts.some((p) => p.type === "step-finish" && p.reason !== "tool-calls"),
       )
       )
     ) {
     ) {
-      let summary = messages
-        .findLast((m) => m.info.role === "assistant")
-        ?.parts.findLast((p) => p.type === "text")?.text
-      if (!summary || diffs.length > 0) {
+      if (diffs.length > 0) {
         for (const msg of messages) {
         for (const msg of messages) {
           for (const part of msg.parts) {
           for (const part of msg.parts) {
             if (part.type === "tool" && part.state.status === "completed") {
             if (part.type === "tool" && part.state.status === "completed") {
@@ -167,10 +164,10 @@ export namespace SessionSummary {
             },
             },
           },
           },
         }).catch(() => {})
         }).catch(() => {})
-        if (result) summary = result.text
+        if (result) {
+          userMsg.summary.body = result.text
+        }
       }
       }
-      userMsg.summary.body = summary
-      log.info("body", { body: summary })
       await Session.updateMessage(userMsg)
       await Session.updateMessage(userMsg)
     }
     }
   }
   }