返回 DeepSeek-Reasonix
session_composer_receipt.go
根目录 / desktop / session_composer_receipt.go
1 package main
2
3 import (
4 "encoding/json"
5 "reasonix/internal/sessioninbox"
6 )
7
8 // A queued follow-up has an inbox receipt before it has any user-message row.
9 // Missing/expired receipts remain unknown, and this lookup never enqueues work.
10 func (a *App) composerGuidanceAccepted(view SessionComposerState) (bool, error) {
11 var request struct {
12 Kind string `json:"kind"`
13 }
14 if err := json.Unmarshal([]byte(view.SubmissionRequest), &request); err != nil {
15 return false, err
16 }
17 if request.Kind != "guidance" {
18 return false, nil
19 }
20 meta := a.metaForDraftSession(view.Ref.SessionID)
21 if meta == nil {
22 return false, nil
23 }
24 _, ctrl := a.tabAndCtrlByID(meta.ID)
25 reader, ok := ctrl.(interface {
26 LookupInboxReceiptForSession(string, string) (sessioninbox.InboxReceipt, bool, error)
27 })
28 if !ok {
29 return false, nil
30 }
31 receipt, found, err := reader.LookupInboxReceiptForSession(sessionRoute(view.Ref.SessionID), view.SubmissionID)
32 return found && receipt.ItemID != "", err
33 }
34
34 lines GO