Skip to content

Commit

Permalink
👕
Browse files Browse the repository at this point in the history
  • Loading branch information
flvndvd committed Jan 17, 2024
1 parent bfde1e1 commit 4020c66
Show file tree
Hide file tree
Showing 29 changed files with 104 additions and 130 deletions.
4 changes: 2 additions & 2 deletions front/components/app/blocks/Block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ export default function Block({
readOnly
? "border-white ring-0 focus:border-white focus:ring-0"
: nameError != ""
? "border-orange-400 focus:border-orange-400 focus:ring-0"
: "border-white focus:border-gray-300 focus:ring-0"
? "border-orange-400 focus:border-orange-400 focus:ring-0"
: "border-white focus:border-gray-300 focus:ring-0"
)}
readOnly={readOnly}
value={block.name}
Expand Down
4 changes: 2 additions & 2 deletions front/components/assistant/RenderMessageMarkdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ function MentionBlock({
!agentConfiguration || agentConfiguration?.status === "archived"
? "(This assistant was deleted)"
: agentConfiguration?.status === "active"
? ""
: "(This assistant is deactivated for this workspace)";
? ""
: "(This assistant is deactivated for this workspace)";
const tooltipLabel = agentConfiguration?.description || "" + " " + statusText;
return (
<span className="inline-block cursor-default font-medium text-brand">
Expand Down
11 changes: 4 additions & 7 deletions front/components/assistant/conversation/AgentMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,10 @@ export function AgentMessage({
agentMessageToRender.action.documents
) {
setReferences(
agentMessageToRender.action.documents.reduce(
(acc, d) => {
acc[d.reference] = d;
return acc;
},
{} as { [key: string]: RetrievalDocumentType }
)
agentMessageToRender.action.documents.reduce((acc, d) => {
acc[d.reference] = d;
return acc;
}, {} as { [key: string]: RetrievalDocumentType })
);
}
}, [agentMessageToRender.action]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,10 @@ function DataSourceResourceSelector({
}
const json: GetConnectorResourceParentsResponseBody = await res.json();
setParentsById(
json.resources.reduce(
(acc, r) => {
acc[r.internalId] = new Set(r.parents);
return acc;
},
{} as Record<string, Set<string>>
)
json.resources.reduce((acc, r) => {
acc[r.internalId] = new Set(r.parents);
return acc;
}, {} as Record<string, Set<string>>)
);
} catch (e) {
setParentsAreError(true);
Expand Down
4 changes: 2 additions & 2 deletions front/components/providers/AI21Setup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ export default function AI21Setup({
? "Updating..."
: "Update"
: enableRunning
? "Enabling..."
: "Enable"
? "Enabling..."
: "Enable"
}
/>
) : (
Expand Down
4 changes: 2 additions & 2 deletions front/components/providers/AnthropicSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ export default function AnthropicSetup({
? "Updating..."
: "Update"
: enableRunning
? "Enabling..."
: "Enable"
? "Enabling..."
: "Enable"
}
/>
) : (
Expand Down
4 changes: 2 additions & 2 deletions front/components/providers/AzureOpenAISetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ export default function AzureOpenAISetup({
? "Updating..."
: "Update"
: enableRunning
? "Enabling..."
: "Enable"
? "Enabling..."
: "Enable"
}
/>
) : (
Expand Down
4 changes: 2 additions & 2 deletions front/components/providers/BrowserlessAPISetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ export default function BrowserlessAPISetup({
? "Updating..."
: "Update"
: enableRunning
? "Enabling..."
: "Enable"
? "Enabling..."
: "Enable"
}
/>
) : (
Expand Down
4 changes: 2 additions & 2 deletions front/components/providers/CohereSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ export default function CohereSetup({
? "Updating..."
: "Update"
: enableRunning
? "Enabling..."
: "Enable"
? "Enabling..."
: "Enable"
}
/>
) : (
Expand Down
4 changes: 2 additions & 2 deletions front/components/providers/GoogleVertexAISetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ export default function GoogleVertexAISetup({
? "Updating..."
: "Update"
: enableRunning
? "Enabling..."
: "Enable"
? "Enabling..."
: "Enable"
}
/>
) : (
Expand Down
4 changes: 2 additions & 2 deletions front/components/providers/MistralAISetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ export default function MistralAISetup({
? "Updating..."
: "Update"
: enableRunning
? "Enabling..."
: "Enable"
? "Enabling..."
: "Enable"
}
/>
) : (
Expand Down
4 changes: 2 additions & 2 deletions front/components/providers/OpenAISetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ export default function OpenAISetup({
? "Updating..."
: "Update"
: enableRunning
? "Enabling..."
: "Enable"
? "Enabling..."
: "Enable"
}
/>
) : (
Expand Down
4 changes: 2 additions & 2 deletions front/components/providers/SerpAPISetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ export default function SerpAPISetup({
? "Updating..."
: "Update"
: enableRunning
? "Enabling..."
: "Enable"
? "Enabling..."
: "Enable"
}
/>
) : (
Expand Down
4 changes: 2 additions & 2 deletions front/components/providers/SerperSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ export default function SerperSetup({
? "Updating..."
: "Update"
: enableRunning
? "Enabling..."
: "Enable"
? "Enabling..."
: "Enable"
}
/>
) : (
Expand Down
4 changes: 2 additions & 2 deletions front/components/providers/TextSynthSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ export default function TextSynthSetup({
? "Updating..."
: "Update"
: enableRunning
? "Enabling..."
: "Enable"
? "Enabling..."
: "Enable"
}
/>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ export async function callDocTrackerRetrievalAction(
const action = DustProdActionRegistry["doc-tracker-retrieval"];
const config = cloneBaseConfig(action.config);

config.SEMANTIC_SEARCH.data_sources =
await getTrackableDataSources(workspaceId);
config.SEMANTIC_SEARCH.data_sources = await getTrackableDataSources(
workspaceId
);
config.SEMANTIC_SEARCH.target_document_tokens = targetDocumentTokens;

const res = await callAction({
Expand Down
11 changes: 4 additions & 7 deletions front/documents_post_process_hooks/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,10 @@ export const DOCUMENTS_POST_PROCESS_HOOKS = [
export const DOCUMENTS_POST_PROCESS_HOOK_BY_TYPE: Record<
DocumentsPostProcessHookType,
DocumentsPostProcessHook
> = DOCUMENTS_POST_PROCESS_HOOKS.reduce(
(acc, hook) => {
acc[hook.type] = hook;
return acc;
},
{} as Record<DocumentsPostProcessHookType, DocumentsPostProcessHook>
);
> = DOCUMENTS_POST_PROCESS_HOOKS.reduce((acc, hook) => {
acc[hook.type] = hook;
return acc;
}, {} as Record<DocumentsPostProcessHookType, DocumentsPostProcessHook>);

export async function getDocumentsPostUpsertHooksToRun(
params: DocumentsPostProcessHookOnUpsertParams
Expand Down
59 changes: 22 additions & 37 deletions front/lib/api/assistant/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,10 @@ export async function getAgentConfigurations<V extends "light" | "full">({
})();

function byId<T extends { id: number }>(list: T[]): Record<string, T> {
return list.reduce(
(acc, item) => {
acc[item.id] = item;
return acc;
},
{} as Record<number, T>
);
return list.reduce((acc, item) => {
acc[item.id] = item;
return acc;
}, {} as Record<number, T>);
}

const configurationIds = agentConfigurations.map((a) => a.id);
Expand Down Expand Up @@ -270,13 +267,10 @@ export async function getAgentConfigurations<V extends "light" | "full">({
userId: user.id,
},
}).then((relations) =>
relations.reduce(
(acc, relation) => {
acc[relation.agentConfiguration] = relation;
return acc;
},
{} as Record<string, AgentUserRelation>
)
relations.reduce((acc, relation) => {
acc[relation.agentConfiguration] = relation;
return acc;
}, {} as Record<string, AgentUserRelation>)
)
: Promise.resolve({} as Record<string, AgentUserRelation>),
]);
Expand All @@ -291,15 +285,12 @@ export async function getAgentConfigurations<V extends "light" | "full">({
},
})
: []
).reduce(
(acc, dsConfig) => {
acc[dsConfig.retrievalConfigurationId] =
acc[dsConfig.retrievalConfigurationId] || [];
acc[dsConfig.retrievalConfigurationId].push(dsConfig);
return acc;
},
{} as Record<number, AgentDataSourceConfiguration[]>
);
).reduce((acc, dsConfig) => {
acc[dsConfig.retrievalConfigurationId] =
acc[dsConfig.retrievalConfigurationId] || [];
acc[dsConfig.retrievalConfigurationId].push(dsConfig);
return acc;
}, {} as Record<number, AgentDataSourceConfiguration[]>);

const dataSourceIds = Object.values(agentDatasourceConfigurations)
.flat()
Expand All @@ -314,13 +305,10 @@ export async function getAgentConfigurations<V extends "light" | "full">({
},
})
: []
).reduce(
(acc, ds) => {
acc[ds.id] = ds;
return acc;
},
{} as Record<number, DataSource>
);
).reduce((acc, ds) => {
acc[ds.id] = ds;
return acc;
}, {} as Record<number, DataSource>);

const workspaceIds = Object.values(dataSources).map((ds) => ds.workspaceId);
const dataSourceWorkspaces = (
Expand All @@ -333,13 +321,10 @@ export async function getAgentConfigurations<V extends "light" | "full">({
},
})
: []
).reduce(
(acc, ws) => {
acc[ws.id] = ws;
return acc;
},
{} as Record<number, Workspace>
);
).reduce((acc, ws) => {
acc[ws.id] = ws;
return acc;
}, {} as Record<number, Workspace>);

let agentConfigurationTypes: AgentConfigurationType[] = [];
for (const agent of agentConfigurations) {
Expand Down
5 changes: 3 additions & 2 deletions front/lib/api/assistant/recent_authors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ async function populateAuthorIdsFromDb({
agentId: string;
workspaceId: string;
}) {
const recentAuthorIdsWithVersion =
await fetchRecentAuthorIdsWithVersion(agentId);
const recentAuthorIdsWithVersion = await fetchRecentAuthorIdsWithVersion(
agentId
);

if (recentAuthorIdsWithVersion.length === 0) {
return [];
Expand Down
8 changes: 4 additions & 4 deletions front/migrations/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ type InferArgs<T> = {
[P in keyof T]: T[P] extends { type: "number" }
? number
: T[P] extends { type: "boolean" }
? boolean
: T[P] extends { type: "string" }
? string
: never;
? boolean
: T[P] extends { type: "string" }
? string
: never;
} & { execute?: boolean };

const defaultArgumentSpecs: ArgumentSpecs = {
Expand Down
11 changes: 4 additions & 7 deletions front/pages/api/poke/plans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,10 @@ async function handler(
await Promise.all(
stripeProductIds.map((stripeProductId) => getProduct(stripeProductId))
)
).reduce(
(acc, product) => {
acc[product.id] = product;
return acc;
},
{} as { [key: string]: Stripe.Product }
);
).reduce((acc, product) => {
acc[product.id] = product;
return acc;
}, {} as { [key: string]: Stripe.Product });

res.status(200).json({
plans: plans.map((plan) => ({
Expand Down
5 changes: 3 additions & 2 deletions front/pages/api/stripe/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,9 @@ async function handler(
endDate: new Date(),
});
const workspaceId = activeSubscription.workspace.sId;
const auth =
await Authenticator.internalAdminForWorkspace(workspaceId);
const auth = await Authenticator.internalAdminForWorkspace(
workspaceId
);
await revokeUsersForDowngrade(auth);
await archiveConnectedAgents(auth);
await deleteConnectedDatasources(auth);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ async function handler(
const viewParam = view
? view
: conversationId
? { conversationId }
: "all";
? { conversationId }
: "all";
if (viewParam === "admin_internal" && !auth.isDustSuperUser()) {
return apiError(req, res, {
status_code: 404,
Expand Down
Loading

0 comments on commit 4020c66

Please sign in to comment.