Changeset 0.29.0 (#195)
This commit is contained in:
@@ -4,11 +4,9 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"git.gobha.me/xcaliber/chat-switchboard/database"
|
||||
"git.gobha.me/xcaliber/chat-switchboard/models"
|
||||
"git.gobha.me/xcaliber/chat-switchboard/store"
|
||||
)
|
||||
@@ -77,20 +75,15 @@ func (h *WorkflowEntryHandler) StartVisitor(c *gin.Context) {
|
||||
}
|
||||
|
||||
// Set workflow columns
|
||||
allowAnonVal := interface{}(true)
|
||||
if database.CurrentDialect == database.DialectSQLite {
|
||||
allowAnonVal = 1
|
||||
}
|
||||
_, err = database.DB.ExecContext(ctx, database.Q(`
|
||||
UPDATE channels
|
||||
SET workflow_id = $1, workflow_version = $2, current_stage = 0,
|
||||
stage_data = '{}', workflow_status = 'active',
|
||||
last_activity_at = $3, allow_anonymous = $4, ai_mode = 'auto'
|
||||
WHERE id = $5
|
||||
`), wf.ID, ver.VersionNumber, time.Now().UTC(), allowAnonVal, ch.ID)
|
||||
err = h.stores.Channels.SetWorkflowInstance(ctx, ch.ID, wf.ID, ver.VersionNumber, []byte("{}"), "active")
|
||||
if err != nil {
|
||||
log.Printf("Failed to set workflow columns: %v", err)
|
||||
}
|
||||
// Enable anonymous access + auto AI mode for visitor entry
|
||||
_ = h.stores.Channels.Update(ctx, ch.ID, map[string]interface{}{
|
||||
"allow_anonymous": true,
|
||||
"ai_mode": "auto",
|
||||
})
|
||||
|
||||
// Create anonymous session
|
||||
sessionToken := store.NewID()
|
||||
|
||||
Reference in New Issue
Block a user