aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2024-03-30 12:39:20 -0400
committerXe Iaso <me@xeiaso.net>2024-03-30 12:41:43 -0400
commit0d01e3dc4b0b1cde1781a81e5671b8717301f07d (patch)
tree72bbe0e7ff02979f13250244fc2663b1570f248c
parentcce125615f0c04b7a102df5d2b9433afed30128b (diff)
downloadx-0d01e3dc4b0b1cde1781a81e5671b8717301f07d.tar.xz
x-0d01e3dc4b0b1cde1781a81e5671b8717301f07d.zip
cmd: add tourian
Signed-off-by: Xe Iaso <me@xeiaso.net>
-rw-r--r--.go.mod.sri2
-rw-r--r--cmd/mimi/modules/discord/flyio/flyio.go6
-rw-r--r--cmd/sanguisuga/tailwind.config.js2
-rw-r--r--cmd/tourian/.gitignore1
-rw-r--r--cmd/tourian/ent/chatmessage.go123
-rw-r--r--cmd/tourian/ent/chatmessage/chatmessage.go74
-rw-r--r--cmd/tourian/ent/chatmessage/where.go288
-rw-r--r--cmd/tourian/ent/chatmessage_create.go240
-rw-r--r--cmd/tourian/ent/chatmessage_delete.go88
-rw-r--r--cmd/tourian/ent/chatmessage_query.go526
-rw-r--r--cmd/tourian/ent/chatmessage_update.go323
-rw-r--r--cmd/tourian/ent/client.go340
-rw-r--r--cmd/tourian/ent/ent.go608
-rw-r--r--cmd/tourian/ent/enttest/enttest.go84
-rw-r--r--cmd/tourian/ent/generate.go3
-rw-r--r--cmd/tourian/ent/hook/hook.go199
-rw-r--r--cmd/tourian/ent/migrate/migrate.go64
-rw-r--r--cmd/tourian/ent/migrate/schema.go31
-rw-r--r--cmd/tourian/ent/mutation.go467
-rw-r--r--cmd/tourian/ent/predicate/predicate.go10
-rw-r--r--cmd/tourian/ent/runtime.go32
-rw-r--r--cmd/tourian/ent/runtime/runtime.go10
-rw-r--r--cmd/tourian/ent/schema/chatmessage.go26
-rw-r--r--cmd/tourian/ent/schema/conversation.go24
-rw-r--r--cmd/tourian/ent/tx.go210
-rw-r--r--cmd/tourian/main.go287
-rw-r--r--cmd/tourian/package-lock.json1554
-rw-r--r--cmd/tourian/package.json22
-rw-r--r--cmd/tourian/static/font/podkova.css7
-rw-r--r--cmd/tourian/static/font/podkova.woff2bin0 -> 60580 bytes
-rw-r--r--cmd/tourian/static/index.html44
-rw-r--r--cmd/tourian/static/js/htmx.min.js1
-rw-r--r--cmd/tourian/static/js/ws.js476
-rw-r--r--cmd/tourian/static/styles.css1
-rw-r--r--cmd/tourian/tailwind.config.js14
-rw-r--r--cmd/tourian/tmpl/bubble.html24
-rw-r--r--cmd/tourian/tmpl/convid.html3
-rw-r--r--cmd/tourian/tmpl/form-reset.html5
-rw-r--r--cmd/uploud/main.go22
-rw-r--r--cmd/xedn/imgoptimize.go11
-rw-r--r--cmd/xedn/uplodr/main.go3
-rw-r--r--flake.nix2
-rw-r--r--go.mod13
-rw-r--r--go.sum31
-rw-r--r--proto/sanguisuga/sanguisuga.pb.go2
-rw-r--r--proto/uplodr.proto8
-rw-r--r--proto/uplodr/uplodr.pb.go107
-rw-r--r--proto/uplodr/uplodr_grpc.pb.go74
-rw-r--r--proto/yeetfile.js1
49 files changed, 6418 insertions, 75 deletions
diff --git a/.go.mod.sri b/.go.mod.sri
index dec5c01..6f56a5d 100644
--- a/.go.mod.sri
+++ b/.go.mod.sri
@@ -1 +1 @@
-sha256-Kbj+XDPnSrzADZTvCp7A0bJPywJpkRXS5ev0jDtD56k=
+sha256-gHeO/wFngwaJKEj6C95+uOdY6zrYRwxosOA7SKQpb+I=
diff --git a/cmd/mimi/modules/discord/flyio/flyio.go b/cmd/mimi/modules/discord/flyio/flyio.go
index d994b7e..e9a8d23 100644
--- a/cmd/mimi/modules/discord/flyio/flyio.go
+++ b/cmd/mimi/modules/discord/flyio/flyio.go
@@ -8,7 +8,9 @@ import (
"log/slog"
"github.com/bwmarrin/discordgo"
+ "google.golang.org/protobuf/types/known/emptypb"
"within.website/x/cmd/mimi/internal"
+ "within.website/x/proto/mimi/statuspage"
"within.website/x/web/ollama"
)
@@ -188,3 +190,7 @@ func (m *Module) ReactionAddFlyIO(s *discordgo.Session, mra *discordgo.MessageRe
return
}
}
+
+func (m *Module) Poke(ctx context.Context, upd *statuspage.StatusUpdate) (*emptypb.Empty, error) {
+ return &emptypb.Empty{}, nil
+}
diff --git a/cmd/sanguisuga/tailwind.config.js b/cmd/sanguisuga/tailwind.config.js
index 12db0e0..87f96d2 100644
--- a/cmd/sanguisuga/tailwind.config.js
+++ b/cmd/sanguisuga/tailwind.config.js
@@ -6,7 +6,7 @@ module.exports = {
fontFamily: {
sans: ["Iosevka Aile Iaso", "sans-serif"],
mono: ["Iosevka Curly Iaso", "monospace"],
- serif: ["Iosevka Etoile Iaso", "serif"],
+ serif: ["Podkova", "serif"],
},
},
},
diff --git a/cmd/tourian/.gitignore b/cmd/tourian/.gitignore
new file mode 100644
index 0000000..b512c09
--- /dev/null
+++ b/cmd/tourian/.gitignore
@@ -0,0 +1 @@
+node_modules \ No newline at end of file
diff --git a/cmd/tourian/ent/chatmessage.go b/cmd/tourian/ent/chatmessage.go
new file mode 100644
index 0000000..9624749
--- /dev/null
+++ b/cmd/tourian/ent/chatmessage.go
@@ -0,0 +1,123 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "fmt"
+ "strings"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect/sql"
+ "within.website/x/cmd/tourian/ent/chatmessage"
+)
+
+// ChatMessage is the model entity for the ChatMessage schema.
+type ChatMessage struct {
+ config `json:"-"`
+ // ID of the ent.
+ ID string `json:"id,omitempty"`
+ // ConversationID holds the value of the "conversation_id" field.
+ ConversationID string `json:"conversation_id,omitempty"`
+ // Role holds the value of the "role" field.
+ Role string `json:"role,omitempty"`
+ // Content holds the value of the "content" field.
+ Content string `json:"content,omitempty"`
+ selectValues sql.SelectValues
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*ChatMessage) scanValues(columns []string) ([]any, error) {
+ values := make([]any, len(columns))
+ for i := range columns {
+ switch columns[i] {
+ case chatmessage.FieldID, chatmessage.FieldConversationID, chatmessage.FieldRole, chatmessage.FieldContent:
+ values[i] = new(sql.NullString)
+ default:
+ values[i] = new(sql.UnknownType)
+ }
+ }
+ return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the ChatMessage fields.
+func (cm *ChatMessage) assignValues(columns []string, values []any) error {
+ if m, n := len(values), len(columns); m < n {
+ return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+ }
+ for i := range columns {
+ switch columns[i] {
+ case chatmessage.FieldID:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field id", values[i])
+ } else if value.Valid {
+ cm.ID = value.String
+ }
+ case chatmessage.FieldConversationID:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field conversation_id", values[i])
+ } else if value.Valid {
+ cm.ConversationID = value.String
+ }
+ case chatmessage.FieldRole:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field role", values[i])
+ } else if value.Valid {
+ cm.Role = value.String
+ }
+ case chatmessage.FieldContent:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field content", values[i])
+ } else if value.Valid {
+ cm.Content = value.String
+ }
+ default:
+ cm.selectValues.Set(columns[i], values[i])
+ }
+ }
+ return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the ChatMessage.
+// This includes values selected through modifiers, order, etc.
+func (cm *ChatMessage) Value(name string) (ent.Value, error) {
+ return cm.selectValues.Get(name)
+}
+
+// Update returns a builder for updating this ChatMessage.
+// Note that you need to call ChatMessage.Unwrap() before calling this method if this ChatMessage
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (cm *ChatMessage) Update() *ChatMessageUpdateOne {
+ return NewChatMessageClient(cm.config).UpdateOne(cm)
+}
+
+// Unwrap unwraps the ChatMessage entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (cm *ChatMessage) Unwrap() *ChatMessage {
+ _tx, ok := cm.config.driver.(*txDriver)
+ if !ok {
+ panic("ent: ChatMessage is not a transactional entity")
+ }
+ cm.config.driver = _tx.drv
+ return cm
+}
+
+// String implements the fmt.Stringer.
+func (cm *ChatMessage) String() string {
+ var builder strings.Builder
+ builder.WriteString("ChatMessage(")
+ builder.WriteString(fmt.Sprintf("id=%v, ", cm.ID))
+ builder.WriteString("conversation_id=")
+ builder.WriteString(cm.ConversationID)
+ builder.WriteString(", ")
+ builder.WriteString("role=")
+ builder.WriteString(cm.Role)
+ builder.WriteString(", ")
+ builder.WriteString("content=")
+ builder.WriteString(cm.Content)
+ builder.WriteByte(')')
+ return builder.String()
+}
+
+// ChatMessages is a parsable slice of ChatMessage.
+type ChatMessages []*ChatMessage
diff --git a/cmd/tourian/ent/chatmessage/chatmessage.go b/cmd/tourian/ent/chatmessage/chatmessage.go
new file mode 100644
index 0000000..d86ace8
--- /dev/null
+++ b/cmd/tourian/ent/chatmessage/chatmessage.go
@@ -0,0 +1,74 @@
+// Code generated by ent, DO NOT EDIT.
+
+package chatmessage
+
+import (
+ "entgo.io/ent/dialect/sql"
+)
+
+const (
+ // Label holds the string label denoting the chatmessage type in the database.
+ Label = "chat_message"
+ // FieldID holds the string denoting the id field in the database.
+ FieldID = "id"
+ // FieldConversationID holds the string denoting the conversation_id field in the database.
+ FieldConversationID = "conversation_id"
+ // FieldRole holds the string denoting the role field in the database.
+ FieldRole = "role"
+ // FieldContent holds the string denoting the content field in the database.
+ FieldContent = "content"
+ // Table holds the table name of the chatmessage in the database.
+ Table = "chat_messages"
+)
+
+// Columns holds all SQL columns for chatmessage fields.
+var Columns = []string{
+ FieldID,
+ FieldConversationID,
+ FieldRole,
+ FieldContent,
+}
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+ for i := range Columns {
+ if column == Columns[i] {
+ return true
+ }
+ }
+ return false
+}
+
+var (
+ // ConversationIDValidator is a validator for the "conversation_id" field. It is called by the builders before save.
+ ConversationIDValidator func(string) error
+ // RoleValidator is a validator for the "role" field. It is called by the builders before save.
+ RoleValidator func(string) error
+ // ContentValidator is a validator for the "content" field. It is called by the builders before save.
+ ContentValidator func(string) error
+ // IDValidator is a validator for the "id" field. It is called by the builders before save.
+ IDValidator func(string) error
+)
+
+// OrderOption defines the ordering options for the ChatMessage queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByConversationID orders the results by the conversation_id field.
+func ByConversationID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldConversationID, opts...).ToFunc()
+}
+
+// ByRole orders the results by the role field.
+func ByRole(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldRole, opts...).ToFunc()
+}
+
+// ByContent orders the results by the content field.
+func ByContent(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldContent, opts...).ToFunc()
+}
diff --git a/cmd/tourian/ent/chatmessage/where.go b/cmd/tourian/ent/chatmessage/where.go
new file mode 100644
index 0000000..81cee23
--- /dev/null
+++ b/cmd/tourian/ent/chatmessage/where.go
@@ -0,0 +1,288 @@
+// Code generated by ent, DO NOT EDIT.
+
+package chatmessage
+
+import (
+ "entgo.io/ent/dialect/sql"
+ "within.website/x/cmd/tourian/ent/predicate"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldLTE(FieldID, id))
+}
+
+// IDEqualFold applies the EqualFold predicate on the ID field.
+func IDEqualFold(id string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldEqualFold(FieldID, id))
+}
+
+// IDContainsFold applies the ContainsFold predicate on the ID field.
+func IDContainsFold(id string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldContainsFold(FieldID, id))
+}
+
+// ConversationID applies equality check predicate on the "conversation_id" field. It's identical to ConversationIDEQ.
+func ConversationID(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldEQ(FieldConversationID, v))
+}
+
+// Role applies equality check predicate on the "role" field. It's identical to RoleEQ.
+func Role(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldEQ(FieldRole, v))
+}
+
+// Content applies equality check predicate on the "content" field. It's identical to ContentEQ.
+func Content(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldEQ(FieldContent, v))
+}
+
+// ConversationIDEQ applies the EQ predicate on the "conversation_id" field.
+func ConversationIDEQ(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldEQ(FieldConversationID, v))
+}
+
+// ConversationIDNEQ applies the NEQ predicate on the "conversation_id" field.
+func ConversationIDNEQ(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldNEQ(FieldConversationID, v))
+}
+
+// ConversationIDIn applies the In predicate on the "conversation_id" field.
+func ConversationIDIn(vs ...string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldIn(FieldConversationID, vs...))
+}
+
+// ConversationIDNotIn applies the NotIn predicate on the "conversation_id" field.
+func ConversationIDNotIn(vs ...string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldNotIn(FieldConversationID, vs...))
+}
+
+// ConversationIDGT applies the GT predicate on the "conversation_id" field.
+func ConversationIDGT(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldGT(FieldConversationID, v))
+}
+
+// ConversationIDGTE applies the GTE predicate on the "conversation_id" field.
+func ConversationIDGTE(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldGTE(FieldConversationID, v))
+}
+
+// ConversationIDLT applies the LT predicate on the "conversation_id" field.
+func ConversationIDLT(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldLT(FieldConversationID, v))
+}
+
+// ConversationIDLTE applies the LTE predicate on the "conversation_id" field.
+func ConversationIDLTE(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldLTE(FieldConversationID, v))
+}
+
+// ConversationIDContains applies the Contains predicate on the "conversation_id" field.
+func ConversationIDContains(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldContains(FieldConversationID, v))
+}
+
+// ConversationIDHasPrefix applies the HasPrefix predicate on the "conversation_id" field.
+func ConversationIDHasPrefix(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldHasPrefix(FieldConversationID, v))
+}
+
+// ConversationIDHasSuffix applies the HasSuffix predicate on the "conversation_id" field.
+func ConversationIDHasSuffix(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldHasSuffix(FieldConversationID, v))
+}
+
+// ConversationIDEqualFold applies the EqualFold predicate on the "conversation_id" field.
+func ConversationIDEqualFold(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldEqualFold(FieldConversationID, v))
+}
+
+// ConversationIDContainsFold applies the ContainsFold predicate on the "conversation_id" field.
+func ConversationIDContainsFold(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldContainsFold(FieldConversationID, v))
+}
+
+// RoleEQ applies the EQ predicate on the "role" field.
+func RoleEQ(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldEQ(FieldRole, v))
+}
+
+// RoleNEQ applies the NEQ predicate on the "role" field.
+func RoleNEQ(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldNEQ(FieldRole, v))
+}
+
+// RoleIn applies the In predicate on the "role" field.
+func RoleIn(vs ...string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldIn(FieldRole, vs...))
+}
+
+// RoleNotIn applies the NotIn predicate on the "role" field.
+func RoleNotIn(vs ...string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldNotIn(FieldRole, vs...))
+}
+
+// RoleGT applies the GT predicate on the "role" field.
+func RoleGT(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldGT(FieldRole, v))
+}
+
+// RoleGTE applies the GTE predicate on the "role" field.
+func RoleGTE(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldGTE(FieldRole, v))
+}
+
+// RoleLT applies the LT predicate on the "role" field.
+func RoleLT(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldLT(FieldRole, v))
+}
+
+// RoleLTE applies the LTE predicate on the "role" field.
+func RoleLTE(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldLTE(FieldRole, v))
+}
+
+// RoleContains applies the Contains predicate on the "role" field.
+func RoleContains(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldContains(FieldRole, v))
+}
+
+// RoleHasPrefix applies the HasPrefix predicate on the "role" field.
+func RoleHasPrefix(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldHasPrefix(FieldRole, v))
+}
+
+// RoleHasSuffix applies the HasSuffix predicate on the "role" field.
+func RoleHasSuffix(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldHasSuffix(FieldRole, v))
+}
+
+// RoleEqualFold applies the EqualFold predicate on the "role" field.
+func RoleEqualFold(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldEqualFold(FieldRole, v))
+}
+
+// RoleContainsFold applies the ContainsFold predicate on the "role" field.
+func RoleContainsFold(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldContainsFold(FieldRole, v))
+}
+
+// ContentEQ applies the EQ predicate on the "content" field.
+func ContentEQ(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldEQ(FieldContent, v))
+}
+
+// ContentNEQ applies the NEQ predicate on the "content" field.
+func ContentNEQ(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldNEQ(FieldContent, v))
+}
+
+// ContentIn applies the In predicate on the "content" field.
+func ContentIn(vs ...string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldIn(FieldContent, vs...))
+}
+
+// ContentNotIn applies the NotIn predicate on the "content" field.
+func ContentNotIn(vs ...string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldNotIn(FieldContent, vs...))
+}
+
+// ContentGT applies the GT predicate on the "content" field.
+func ContentGT(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldGT(FieldContent, v))
+}
+
+// ContentGTE applies the GTE predicate on the "content" field.
+func ContentGTE(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldGTE(FieldContent, v))
+}
+
+// ContentLT applies the LT predicate on the "content" field.
+func ContentLT(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldLT(FieldContent, v))
+}
+
+// ContentLTE applies the LTE predicate on the "content" field.
+func ContentLTE(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldLTE(FieldContent, v))
+}
+
+// ContentContains applies the Contains predicate on the "content" field.
+func ContentContains(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldContains(FieldContent, v))
+}
+
+// ContentHasPrefix applies the HasPrefix predicate on the "content" field.
+func ContentHasPrefix(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldHasPrefix(FieldContent, v))
+}
+
+// ContentHasSuffix applies the HasSuffix predicate on the "content" field.
+func ContentHasSuffix(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldHasSuffix(FieldContent, v))
+}
+
+// ContentEqualFold applies the EqualFold predicate on the "content" field.
+func ContentEqualFold(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldEqualFold(FieldContent, v))
+}
+
+// ContentContainsFold applies the ContainsFold predicate on the "content" field.
+func ContentContainsFold(v string) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.FieldContainsFold(FieldContent, v))
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.ChatMessage) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.ChatMessage) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.ChatMessage) predicate.ChatMessage {
+ return predicate.ChatMessage(sql.NotPredicates(p))
+}
diff --git a/cmd/tourian/ent/chatmessage_create.go b/cmd/tourian/ent/chatmessage_create.go
new file mode 100644
index 0000000..19fc72f
--- /dev/null
+++ b/cmd/tourian/ent/chatmessage_create.go
@@ -0,0 +1,240 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "within.website/x/cmd/tourian/ent/chatmessage"
+)
+
+// ChatMessageCreate is the builder for creating a ChatMessage entity.
+type ChatMessageCreate struct {
+ config
+ mutation *ChatMessageMutation
+ hooks []Hook
+}
+
+// SetConversationID sets the "conversation_id" field.
+func (cmc *ChatMessageCreate) SetConversationID(s string) *ChatMessageCreate {
+ cmc.mutation.SetConversationID(s)
+ return cmc
+}
+
+// SetRole sets the "role" field.
+func (cmc *ChatMessageCreate) SetRole(s string) *ChatMessageCreate {
+ cmc.mutation.SetRole(s)
+ return cmc
+}
+
+// SetContent sets the "content" field.
+func (cmc *ChatMessageCreate) SetContent(s string) *ChatMessageCreate {
+ cmc.mutation.SetContent(s)
+ return cmc
+}
+
+// SetID sets the "id" field.
+func (cmc *ChatMessageCreate) SetID(s string) *ChatMessageCreate {
+ cmc.mutation.SetID(s)
+ return cmc
+}
+
+// Mutation returns the ChatMessageMutation object of the builder.
+func (cmc *ChatMessageCreate) Mutation() *ChatMessageMutation {
+ return cmc.mutation
+}
+
+// Save creates the ChatMessage in the database.
+func (cmc *ChatMessageCreate) Save(ctx context.Context) (*ChatMessage, error) {
+ return withHooks(ctx, cmc.sqlSave, cmc.mutation, cmc.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (cmc *ChatMessageCreate) SaveX(ctx context.Context) *ChatMessage {
+ v, err := cmc.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (cmc *ChatMessageCreate) Exec(ctx context.Context) error {
+ _, err := cmc.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (cmc *ChatMessageCreate) ExecX(ctx context.Context) {
+ if err := cmc.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (cmc *ChatMessageCreate) check() error {
+ if _, ok := cmc.mutation.ConversationID(); !ok {
+ return &ValidationError{Name: "conversation_id", err: errors.New(`ent: missing required field "ChatMessage.conversation_id"`)}
+ }
+ if v, ok := cmc.mutation.ConversationID(); ok {
+ if err := chatmessage.ConversationIDValidator(v); err != nil {
+ return &ValidationError{Name: "conversation_id", err: fmt.Errorf(`ent: validator failed for field "ChatMessage.conversation_id": %w`, err)}
+ }
+ }
+ if _, ok := cmc.mutation.Role(); !ok {
+ return &ValidationError{Name: "role", err: errors.New(`ent: missing required field "ChatMessage.role"`)}
+ }
+ if v, ok := cmc.mutation.Role(); ok {
+ if err := chatmessage.RoleValidator(v); err != nil {
+ return &ValidationError{Name: "role", err: fmt.Errorf(`ent: validator failed for field "ChatMessage.role": %w`, err)}
+ }
+ }
+ if _, ok := cmc.mutation.Content(); !ok {
+ return &ValidationError{Name: "content", err: errors.New(`ent: missing required field "ChatMessage.content"`)}
+ }
+ if v, ok := cmc.mutation.Content(); ok {
+ if err := chatmessage.ContentValidator(v); err != nil {
+ return &ValidationError{Name: "content", err: fmt.Errorf(`ent: validator failed for field "ChatMessage.content": %w`, err)}
+ }
+ }
+ if v, ok := cmc.mutation.ID(); ok {
+ if err := chatmessage.IDValidator(v); err != nil {
+ return &ValidationError{Name: "id", err: fmt.Errorf(`ent: validator failed for field "ChatMessage.id": %w`, err)}
+ }
+ }
+ return nil
+}
+
+func (cmc *ChatMessageCreate) sqlSave(ctx context.Context) (*ChatMessage, error) {
+ if err := cmc.check(); err != nil {
+ return nil, err
+ }
+ _node, _spec := cmc.createSpec()
+ if err := sqlgraph.CreateNode(ctx, cmc.driver, _spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ if _spec.ID.Value != nil {
+ if id, ok := _s