fix: minor bugs

This commit is contained in:
2025-10-05 16:25:00 +01:00
parent 9e60a41f0a
commit 0e42c9002b
2 changed files with 9 additions and 4 deletions

View File

@ -7,6 +7,7 @@ import (
"screenmark/screenmark/.gen/haystack/haystack/model"
"screenmark/screenmark/agents/client"
"screenmark/screenmark/models"
"strings"
"github.com/charmbracelet/log"
"github.com/google/uuid"
@ -109,12 +110,14 @@ func (agent *CreateListAgent) CreateList(log *log.Logger, userID uuid.UUID, stac
content := resp.Choices[0].Message.Content
structuredOutput := content[len("```json") : len(content)-3]
if strings.HasPrefix(content, "```json") {
content = content[len("```json") : len(content)-3]
}
log.Info("", "res", structuredOutput)
log.Info("", "res", content)
var createListArgs createNewListArguments
err = json.Unmarshal([]byte(structuredOutput), &createListArgs)
err = json.Unmarshal([]byte(content), &createListArgs)
if err != nil {
return err
}

View File

@ -45,7 +45,9 @@ CREATE TABLE haystack.image_stacks (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
image_id UUID NOT NULL REFERENCES haystack.image (id) ON DELETE CASCADE,
stack_id UUID NOT NULL REFERENCES haystack.stacks (id) ON DELETE CASCADE
stack_id UUID NOT NULL REFERENCES haystack.stacks (id) ON DELETE CASCADE,
UNIQUE(image_id, stack_id)
);
CREATE TABLE haystack.schema_items (