Handle scalar TG extracted payloads
This commit is contained in:
@@ -300,7 +300,12 @@ func (c *classifier) resolvePrompt(ctx context.Context, vertical, departmentID,
|
||||
func (c *classifier) saveVerdict(ctx context.Context, id int64, key string, verdict json.RawMessage) error {
|
||||
_, err := c.db.Exec(ctx, `
|
||||
UPDATE messages
|
||||
SET extracted = jsonb_set(COALESCE(extracted, '{}'::jsonb), ARRAY[$2], $3::jsonb, true)
|
||||
SET extracted = jsonb_set(
|
||||
CASE WHEN jsonb_typeof(extracted) = 'object' THEN extracted ELSE '{}'::jsonb END,
|
||||
ARRAY[$2],
|
||||
$3::jsonb,
|
||||
true
|
||||
)
|
||||
WHERE id = $1
|
||||
`, id, key, string(verdict))
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user