fix: persist ai task user ids consistently
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -114,7 +115,7 @@ func (a *API) aiDocumentGenerate(w http.ResponseWriter, r *http.Request, p *auth
|
||||
taskID := "aitask_" + randomToken(12)
|
||||
started := time.Now().UTC().Round(time.Millisecond)
|
||||
if err := st.CreateAITask(r.Context(), store.AITask{
|
||||
TaskID: taskID, TenantCode: p.TenantCode, UserID: formatUserID(p.UserID), Feature: "smart_document",
|
||||
TaskID: taskID, TenantCode: p.TenantCode, UserID: strconv.FormatInt(p.UserID, 10), Feature: "smart_document",
|
||||
Status: "processing", Progress: 10, SourceType: "text", InputHash: hashText(source),
|
||||
PromptVersion: "smart_document_v1", Model: "",
|
||||
StartedAt: &started,
|
||||
@@ -366,7 +367,7 @@ func (a *API) aiTableAnalysisCreate(w http.ResponseWriter, r *http.Request, p *a
|
||||
recordID := "airec_tbl_" + randomToken(10)
|
||||
started := time.Now().UTC().Round(time.Millisecond)
|
||||
if err := st.CreateAITask(r.Context(), store.AITask{
|
||||
TaskID: taskID, TenantCode: p.TenantCode, UserID: formatUserID(p.UserID), Feature: "smart_table",
|
||||
TaskID: taskID, TenantCode: p.TenantCode, UserID: strconv.FormatInt(p.UserID, 10), Feature: "smart_table",
|
||||
Status: "processing", Progress: 20, SourceType: "file", SourceRefID: fileID, InputHash: hashText(fileID + ":" + topic),
|
||||
PromptVersion: "smart_table_v1", StartedAt: &started,
|
||||
}, nil); err != nil {
|
||||
@@ -496,7 +497,7 @@ func (a *API) aiMeetingSummaryCreate(w http.ResponseWriter, r *http.Request, p *
|
||||
summaryID := "aisum_" + randomToken(10)
|
||||
started := time.Now().UTC().Round(time.Millisecond)
|
||||
if err := st.CreateAITask(r.Context(), store.AITask{
|
||||
TaskID: taskID, TenantCode: p.TenantCode, UserID: formatUserID(p.UserID), Feature: "meeting_summary",
|
||||
TaskID: taskID, TenantCode: p.TenantCode, UserID: strconv.FormatInt(p.UserID, 10), Feature: "meeting_summary",
|
||||
Status: "processing", Progress: 20, SourceType: "meeting", SourceRefID: meetingID, InputHash: hashText(meetingID + strings.Join(fileIDs, ",")),
|
||||
PromptVersion: "meeting_summary_v1", StartedAt: &started,
|
||||
}, nil); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user