diff --git a/cmd/root_test.go b/cmd/root_test.go index 09ef33d..8e74b04 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -102,7 +102,6 @@ func TestUnmarshalConfig(t *testing.T) { envPrefix, ): "Content-Type Authorization", - fmt.Sprintf("%s_OPENAI_VECTOR_STORE_ID", envPrefix): "vs-foo", fmt.Sprintf("%s_API_SECRET", envPrefix): "somesecret", fmt.Sprintf("%s_API_MAX_MULTIPART_MEMORY", envPrefix): "256", @@ -138,8 +137,7 @@ func TestUnmarshalConfig(t *testing.T) { assert.Equal(t, 200, viper.GetInt("queue.size")) assert.Equal(t, "5m", viper.GetString("queue.max_age")) assert.Equal(t, "test-token", viper.GetString("openai.token")) - assert.Equal(t, "assistant-id", viper.GetString("openai.assistant.id")) - assert.Equal(t, "vs-foo", viper.GetString("openai.vector_store_id")) + assert.Equal(t, "assistant-id", viper.GetString("openai.assistant_id")) assert.Equal(t, "discord-token", viper.GetString("discord.token")) assert.Equal(t, "somesecret", viper.GetString("api.secret")) assert.ElementsMatch( @@ -296,7 +294,6 @@ openai: token: your_openai_token_here log_level: INFO assistant_id: your_assistant_id_here - vector_store_id: your_vector_store_id_here discord: token: your_discord_token_here application_id: your_discord_application_id_here @@ -330,6 +327,7 @@ api: secret: your_api_secret_here log_level: INFO cors: + max_age: 12h allow_origins: [] allow_methods: - GET @@ -359,8 +357,6 @@ api: - Authorization - Last-Modified allow_credentials: true - max_age: 12h - max_multipart_memory: 33554432 read_timeout: 5s read_header_timeout: 5s write_timeout: 10s diff --git a/disconcierge/api.go b/disconcierge/api.go index 67fc491..a8c0f9f 100644 --- a/disconcierge/api.go +++ b/disconcierge/api.go @@ -730,7 +730,6 @@ func (h *APIHandlers) reloadUsers(c *gin.Context) { // - 400 Bad Request: If the query parameters are invalid. // - 500 Internal Server Error: If there is an error retrieving the users. func (h *APIHandlers) getUsers(c *gin.Context) { - // TODO: Paginate this on the backend and frontend var pagination GetUsersQuery if c.ShouldBindQuery(&pagination) != nil { c.JSON(http.StatusBadRequest, httpError{Error: "invalid pagination"}) diff --git a/disconcierge/api_test.go b/disconcierge/api_test.go index 79fc812..7ec73d7 100644 --- a/disconcierge/api_test.go +++ b/disconcierge/api_test.go @@ -2149,6 +2149,7 @@ func TestAPI_UpdateConfig_DiscordGateway(t *testing.T) { expectedCalls: []string{"SetIdentify", "Open"}, }, { + // FIXME This test is flaky (fails intermittently) name: "Update Custom Status", initialState: func() RuntimeConfig { cfg := baseConfig diff --git a/disconcierge/command_chat.go b/disconcierge/command_chat.go index be76741..6cb9a51 100644 --- a/disconcierge/command_chat.go +++ b/disconcierge/command_chat.go @@ -857,7 +857,6 @@ func (c *ChatCommand) newDMReport( // any non-nil buttons. Nil buttons indicate the button should not be included in the // final message components. func (c *ChatCommand) discordUserFeedbackComponents() []discordgo.MessageComponent { - // TODO check if BOT_DM or home guild buttons := make([]discordgo.MessageComponent, 0, discordMaxButtonsPerActionRow) goodButton := c.GoodButton() @@ -1992,9 +1991,7 @@ func (c *ChatCommand) finalizeExpiredButtons(ctx context.Context, db DBI) { } else { if err := c.setExpiredButtonStatesFromDB(ctx, db.DB()); err != nil { logger.ErrorContext( - ctx, - "error setting expired buttons", - tint.Err(err), + ctx, "error setting expired buttons", tint.Err(err), ) return } diff --git a/disconcierge/database.go b/disconcierge/database.go index 588f0cc..2f41fad 100644 --- a/disconcierge/database.go +++ b/disconcierge/database.go @@ -216,13 +216,8 @@ func (d *database) GetOrCreateUser( } if user, cachedUser := d.userCache[u.ID]; cachedUser { - // FIXME this is fine for a single bot instance, but if multiple - // instances are running, this can result in multiple updates - // to the same user record as instances find their cached user - // details are out of date. This also isn't particularly - // concurrency-safe, as the cached record may be read by another - // goroutine while we're updating it. - + // FIXME This isn't particularly concurrency-safe, as the cached + // record may be read by another goroutine while we're updating it. log.InfoContext(ctx, "found existing user", "user", user) user.LastSeen = time.Now().UTC().UnixMilli() updates := map[string]any{columnUserLastSeen: user.LastSeen} diff --git a/disconcierge/disconcierge.go b/disconcierge/disconcierge.go index 2a8dc04..5473c31 100644 --- a/disconcierge/disconcierge.go +++ b/disconcierge/disconcierge.go @@ -988,8 +988,6 @@ func (d *DisConcierge) discordInit( } func (d *DisConcierge) startWebhookServer(ctx context.Context, runtimeWG *sync.WaitGroup) { - // TODO set up a run mode where only the API and database - // are enabled (ex: for 'offline' bot config) runtimeWG.Add(1) go func() { defer runtimeWG.Done() diff --git a/disconcierge/openai_test.go b/disconcierge/openai_test.go index 9ee9d97..f4b367c 100644 --- a/disconcierge/openai_test.go +++ b/disconcierge/openai_test.go @@ -639,22 +639,6 @@ func (m *mockOpenAIPollingClient) RetrieveRun( // // - ListRunStepsError: Map of run IDs to errors for ListRunSteps calls. // -// - RetrieveVectorStoreFileResponse: Map of file IDs to mock VectorStoreFile responses. -// -// - RetrieveVectorStoreFileError: Map of file IDs to errors for RetrieveVectorStoreFile calls. -// -// - DeleteVectorStoreFileResponse: Map of file IDs to errors for DeleteVectorStoreFile calls. -// -// - DeleteFileResponse: Map of file IDs to errors for DeleteFile calls. -// -// - CreateVectorStoreFileResponse: Map of file IDs to mock VectorStoreFile responses. -// -// - CreateVectorStoreFileError: Map of file IDs to errors for CreateVectorStoreFile calls. -// -// - RetrieveVectorStoreResponse: Map of vector store IDs to mock VectorStore responses. -// -// - RetrieveVectorStoreError: Map of vector store IDs to errors for RetrieveVectorStore calls. -// // - PromptResponses: Map of prompts to predefined responses. // // - ids: Pointer to commandData for generating unique IDs. @@ -1440,75 +1424,6 @@ func (m *mockOpenAIClientServer) newRun( return run } -func (*mockOpenAIClientServer) CreateFileBytes( - _ context.Context, - _ openai.FileBytesRequest, -) (file openai.File, err error) { - return file, err -} - -func (*mockOpenAIClientServer) CreateVectorStoreFile( - _ context.Context, - _ string, - _ openai.VectorStoreFileRequest, -) (response openai.VectorStoreFile, err error) { - return response, err -} - -func (*mockOpenAIClientServer) DeleteVectorStoreFile( - _ context.Context, - _ string, - _ string, -) (err error) { - return err -} - -func (*mockOpenAIClientServer) ListVectorStoreFiles( - _ context.Context, - _ string, - _ openai.Pagination, -) (response openai.VectorStoreFilesList, err error) { - return response, err -} - -func (*mockOpenAIClientServer) ListVectorStores( - _ context.Context, - _ openai.Pagination, -) (response openai.VectorStoresList, err error) { - return response, err -} - -func (*mockOpenAIClientServer) DeleteFile( - _ context.Context, - _ string, -) (err error) { - // TODO implement me - return err -} - -func (*mockOpenAIClientServer) RetrieveVectorStoreFile( - _ context.Context, - _ string, - _ string, -) (response openai.VectorStoreFile, err error) { - return response, err -} - -func (*mockOpenAIClientServer) RetrieveVectorStore( - _ context.Context, - _ string, -) (response openai.VectorStore, err error) { - // TODO implement me - panic("implement me") -} - -func (*mockOpenAIClientServer) CreateFile( - _ context.Context, - _ openai.FileRequest, -) (file openai.File, err error) { - return file, err -} - func newOpenAIMessageList( t testing.TB, text string, diff --git a/disconcierge/runtime_config.go b/disconcierge/runtime_config.go index 0f7dc67..02a65fe 100644 --- a/disconcierge/runtime_config.go +++ b/disconcierge/runtime_config.go @@ -71,7 +71,7 @@ type RuntimeConfig struct { // OpenAIMaxRequestsPerSecond is the rate limit for how many OpenAI "Create Run" // API requests can be made per second - // TODO give this a clearer name + // TODO give this a clearer name, as it only applies to 'Create Run' requests OpenAIMaxRequestsPerSecond int `gorm:"column:openai_max_requests_per_second;default:1" json:"openai_max_requests_per_second" binding:"min=1"` // Limits the number of ChatCommands requests per user per 6-hour window