fix: minor bugs
This commit is contained in:
@ -7,6 +7,7 @@ import (
|
|||||||
"screenmark/screenmark/.gen/haystack/haystack/model"
|
"screenmark/screenmark/.gen/haystack/haystack/model"
|
||||||
"screenmark/screenmark/agents/client"
|
"screenmark/screenmark/agents/client"
|
||||||
"screenmark/screenmark/models"
|
"screenmark/screenmark/models"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/charmbracelet/log"
|
"github.com/charmbracelet/log"
|
||||||
"github.com/google/uuid"
|
"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
|
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
|
var createListArgs createNewListArguments
|
||||||
err = json.Unmarshal([]byte(structuredOutput), &createListArgs)
|
err = json.Unmarshal([]byte(content), &createListArgs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,9 @@ CREATE TABLE haystack.image_stacks (
|
|||||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
|
||||||
image_id UUID NOT NULL REFERENCES haystack.image (id) ON DELETE CASCADE,
|
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 (
|
CREATE TABLE haystack.schema_items (
|
||||||
|
Reference in New Issue
Block a user