mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-10-28 17:13:50 +08:00
精简动作审查输入并支持审批来源定位 (#125)
* fix: 精简审查背景并区分人工消息与调度输入 * fix: 模型审查仅提交当前调用与选定背景 * feat: 审批来源定位原会话并移除 Worker 审查背景
This commit is contained in:
1 parent
0d6fa880b8
commit
04d25eb133
30 files changed
+1143
-465
No files matched your search
@@ -8,6 +8,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/Autumn-27/artex/db"
|
||||
@@ -478,3 +479,48 @@ func (s *Server) interceptDetail(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
writeJSON(w, 200, detail)
|
||||
}
|
||||
|
||||
// The navigation endpoint returns only the original call and its paired result.
|
||||
func (s *Server) interceptExecution(w http.ResponseWriter, r *http.Request) {
|
||||
pg := s.pg(w)
|
||||
if pg == nil {
|
||||
return
|
||||
}
|
||||
id, ok := pathInt(r, "id")
|
||||
if !ok || id <= 0 {
|
||||
writeErr(w, 400, "bad approval id")
|
||||
return
|
||||
}
|
||||
target, err := pg.GetInterceptExecution(id)
|
||||
if errors.Is(err, db.ErrInterceptTaskDeleted) || errors.Is(err, db.ErrInterceptSessionDeleted) {
|
||||
writeErr(w, http.StatusGone, err.Error())
|
||||
return
|
||||
}
|
||||
if errors.Is(err, db.ErrInterceptExecutionUnavailable) {
|
||||
writeErr(w, 409, err.Error())
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
writeErr(w, 500, err.Error())
|
||||
return
|
||||
}
|
||||
if target == nil {
|
||||
// Conversation deletion cascades approval rows. A stale source link still
|
||||
// carries its conversation ID, allowing a precise message without retaining
|
||||
// deleted conversations or changing their deletion semantics.
|
||||
if convID, parseErr := strconv.ParseInt(r.URL.Query().Get("conversation"), 10, 64); parseErr == nil && convID > 0 {
|
||||
conv, getErr := pg.GetConversation(convID)
|
||||
if getErr != nil {
|
||||
writeErr(w, 500, getErr.Error())
|
||||
return
|
||||
}
|
||||
if conv == nil {
|
||||
writeErr(w, http.StatusGone, "对话已被删除")
|
||||
return
|
||||
}
|
||||
}
|
||||
writeErr(w, 404, "审批记录已被删除或不存在")
|
||||
return
|
||||
}
|
||||
writeJSON(w, 200, map[string]any{"conversation_id": target.ConversationID, "task_id": target.TaskID, "session": target.Session, "seq": target.Seq, "items": activityDTOs(target.Items)})
|
||||
}
|
||||
Reference in new issue
Block a user