( t *testing.T, db database.Store, provider string, baseURL string, apiKey string, centralAPIKeyEnabled bool, allowUserAPIKey bool, allowCentralAPIKeyFallback bool, )
| 6089 | } |
| 6090 | |
| 6091 | func seedChatDependenciesWithProviderPolicy( |
| 6092 | t *testing.T, |
| 6093 | db database.Store, |
| 6094 | provider string, |
| 6095 | baseURL string, |
| 6096 | apiKey string, |
| 6097 | centralAPIKeyEnabled bool, |
| 6098 | allowUserAPIKey bool, |
| 6099 | allowCentralAPIKeyFallback bool, |
| 6100 | ) (database.User, database.Organization, database.ChatProvider, database.ChatModelConfig) { |
| 6101 | t.Helper() |
| 6102 | |
| 6103 | user := dbgen.User(t, db, database.User{}) |
| 6104 | org := dbgen.Organization(t, db, database.Organization{}) |
| 6105 | dbgen.OrganizationMember(t, db, database.OrganizationMember{ |
| 6106 | UserID: user.ID, |
| 6107 | OrganizationID: org.ID, |
| 6108 | }) |
| 6109 | providerConfig := dbgen.ChatProvider(t, db, database.ChatProvider{ |
| 6110 | Provider: provider, |
| 6111 | DisplayName: provider, |
| 6112 | BaseUrl: baseURL, |
| 6113 | CreatedBy: uuid.NullUUID{UUID: user.ID, Valid: true}, |
| 6114 | Enabled: true, |
| 6115 | }, func(p *database.InsertChatProviderParams) { |
| 6116 | p.APIKey = apiKey |
| 6117 | p.CentralApiKeyEnabled = centralAPIKeyEnabled |
| 6118 | p.AllowUserApiKey = allowUserAPIKey |
| 6119 | p.AllowCentralApiKeyFallback = allowCentralAPIKeyFallback |
| 6120 | }) |
| 6121 | |
| 6122 | model := dbgen.ChatModelConfig(t, db, database.ChatModelConfig{ |
| 6123 | Provider: provider, |
| 6124 | IsDefault: true, |
| 6125 | }) |
| 6126 | |
| 6127 | return user, org, providerConfig, model |
| 6128 | } |
| 6129 | |
| 6130 | func seedLastTurnSummary( |
| 6131 | ctx context.Context, |
no test coverage detected