mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-09 12:30:49 +02:00
Lowercase slack channels automatically (#2254)
* Improve slack channel selection * Lowercasing slack channels
This commit is contained in:
parent
e4e67c61ef
commit
57491ceaae
@ -167,6 +167,28 @@ export default function AddConnector({
|
||||
} = formValues;
|
||||
const { pruneFreq, indexingStart, refreshFreq } = advancedSettings;
|
||||
|
||||
// Apply transforms from connectors.ts configuration
|
||||
const transformedConnectorSpecificConfig = Object.entries(
|
||||
connector_specific_config
|
||||
).reduce(
|
||||
(acc, [key, value]) => {
|
||||
const matchingConfigValue = configuration.values.find(
|
||||
(configValue) => configValue.name === key
|
||||
);
|
||||
if (
|
||||
matchingConfigValue &&
|
||||
"transform" in matchingConfigValue &&
|
||||
matchingConfigValue.transform
|
||||
) {
|
||||
acc[key] = matchingConfigValue.transform(value as string[]);
|
||||
} else {
|
||||
acc[key] = value;
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, any>
|
||||
);
|
||||
|
||||
const AdvancedConfig: AdvancedConfigFinal = {
|
||||
pruneFreq: advancedSettings.pruneFreq * 60 * 60 * 24,
|
||||
indexingStart: convertStringToDateTime(indexingStart),
|
||||
@ -211,7 +233,7 @@ export default function AddConnector({
|
||||
|
||||
const { message, isSuccess, response } = await submitConnector<any>(
|
||||
{
|
||||
connector_specific_config: connector_specific_config,
|
||||
connector_specific_config: transformedConnectorSpecificConfig,
|
||||
input_type: connector == "web" ? "load_state" : "poll", // single case
|
||||
name: name,
|
||||
source: connector,
|
||||
@ -468,7 +490,6 @@ export default function AddConnector({
|
||||
>
|
||||
{(formikProps) => {
|
||||
setFormValues(formikProps.values);
|
||||
console.log(formikProps.values);
|
||||
handleFormStatusChange(
|
||||
formikProps.isValid && isFormSubmittable(formikProps.values)
|
||||
);
|
||||
|
@ -33,6 +33,7 @@ export interface SelectOption extends Option {
|
||||
export interface ListOption extends Option {
|
||||
type: "list";
|
||||
default?: string[];
|
||||
transform?: (values: string[]) => string[];
|
||||
}
|
||||
|
||||
export interface TextOption extends Option {
|
||||
@ -363,6 +364,8 @@ Hint: Use the singular form of the object name (e.g., 'Opportunity' instead of '
|
||||
name: "channels",
|
||||
description: `Specify 0 or more channels to index. For example, specifying the channel "support" will cause us to only index all content within the "#support" channel. If no channels are specified, all channels in your workspace will be indexed.`,
|
||||
optional: true,
|
||||
// Slack channels can only be lowercase
|
||||
transform: (values) => values.map((value) => value.toLowerCase()),
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
|
Loading…
x
Reference in New Issue
Block a user