Enhance assistant table structure by adding 'files' field

- Introduced a new 'files' field in the assistant table within the Xun implementation, allowing for better management of associated files.
- Updated the fields array to include the new 'files' field, ensuring it is recognized as a required attribute in the assistant structure.
This commit is contained in:
Max 2024-12-20 16:21:53 +08:00
parent 76e7156dac
commit 6f6c0b3d6f

View file

@ -215,6 +215,7 @@ func (conv *Xun) initAssistantTable() error {
table.JSON("option").Null()
table.JSON("prompts").Null()
table.JSON("flows").Null()
table.JSON("files").Null()
table.Boolean("mentionable").SetDefault(true).Index() // Whether this assistant can appear in @ mention list
table.TimestampTz("created_at").SetDefaultRaw("NOW()").Index()
table.TimestampTz("updated_at").Null().Index()
@ -232,7 +233,7 @@ func (conv *Xun) initAssistantTable() error {
return err
}
fields := []string{"id", "assistant_id", "type", "name", "avatar", "connector", "description", "option", "prompts", "flows", "mentionable", "created_at", "updated_at"}
fields := []string{"id", "assistant_id", "type", "name", "avatar", "connector", "description", "option", "prompts", "flows", "files", "mentionable", "created_at", "updated_at"}
for _, field := range fields {
if !tab.HasColumn(field) {
return fmt.Errorf("%s is required", field)