@@ -178,7 +322,7 @@ export function ConnectionPickerCard({
size="sm"
className="shrink-0 gap-1.5"
disabled={isPieceLoading}
- onClick={() => setConnectDialogOpen(true)}
+ onClick={handleNewConnection}
>
{t('Connect')}
@@ -201,11 +345,12 @@ export function ConnectionPickerCard({
project: '',
externalId: createdConnection.externalId,
projectId: '',
+ status: AppConnectionStatus.ACTIVE,
});
onSelect(`Connected ${createdConnection.displayName}`);
}
}}
- reconnectConnection={null}
+ reconnectConnection={reconnectConnection}
isGlobalConnection={false}
/>
)}
diff --git a/packages/web/src/app/routes/chat-with-ai/lib/message-parsers.ts b/packages/web/src/app/routes/chat-with-ai/lib/message-parsers.ts
index 1005f38ec05..546e1360e89 100644
--- a/packages/web/src/app/routes/chat-with-ai/lib/message-parsers.ts
+++ b/packages/web/src/app/routes/chat-with-ai/lib/message-parsers.ts
@@ -1,7 +1,20 @@
+import { AppConnectionStatus } from '@activepieces/shared';
+
import { ChatUIMessage } from '@/features/chat/lib/chat-types';
import { ProposalStep, stepVisuals } from './step-visuals';
+const CONNECTION_STATUS_VALUES: ReadonlySet
= new Set(
+ Object.values(AppConnectionStatus),
+);
+
+function toConnectionStatus(value: string): AppConnectionStatus {
+ if (CONNECTION_STATUS_VALUES.has(value)) {
+ return value as AppConnectionStatus;
+ }
+ return AppConnectionStatus.ACTIVE;
+}
+
export function normalizePieceName(piece: string): string {
const shortName = piece.replace(/[^a-z0-9-]/gi, '');
return piece.startsWith('@activepieces/')
@@ -266,6 +279,7 @@ export function parseConnectionPicker(content: string): {
const projectMatch = /^\s+project:\s*(.+)$/m.exec(connBlock);
const externalIdMatch = /^\s+externalId:\s*(.+)$/m.exec(connBlock);
const projectIdMatch = /^\s+projectId:\s*(.+)$/m.exec(connBlock);
+ const statusMatch = /^\s+status:\s*(.+)$/m.exec(connBlock);
const externalId = externalIdMatch?.[1].trim() ?? '';
const projectId = projectIdMatch?.[1].trim() ?? '';
@@ -276,6 +290,7 @@ export function parseConnectionPicker(content: string): {
project: projectMatch?.[1].trim() ?? '',
externalId,
projectId,
+ status: toConnectionStatus(statusMatch?.[1].trim() ?? ''),
});
}
@@ -297,5 +312,6 @@ export type ConnectionPickerData = {
project: string;
externalId: string;
projectId: string;
+ status: AppConnectionStatus;
}>;
};
diff --git a/packages/web/src/components/prompt-kit/markdown.tsx b/packages/web/src/components/prompt-kit/markdown.tsx
index a378a4c9d62..5b36067c62d 100644
--- a/packages/web/src/components/prompt-kit/markdown.tsx
+++ b/packages/web/src/components/prompt-kit/markdown.tsx
@@ -19,8 +19,9 @@ export type MarkdownProps = {
function normalizeMarkdownSpacing(markdown: string): string {
let text = markdown;
- // Ensure headings have a newline before them (fixes "text.## Heading" streaming artifact)
- text = text.replace(/([^\n])(#{1,6}\s)/g, '$1\n\n$2');
+ // Ensure headings have a blank line before them (fixes "text\n## Heading" streaming artifact).
+ // Uses multiline flag so ^ matches after every \n; only touches lines that start with #.
+ text = text.replace(/^(#{1,6}\s)/gm, '\n$1');
// Ensure blank lines between non-empty content lines (except inside tables/code/lists)
const lines = text.split('\n');
diff --git a/packages/web/src/features/agents/ai-model/hooks.ts b/packages/web/src/features/agents/ai-model/hooks.ts
index 8a7719a5baf..8cffba459e8 100644
--- a/packages/web/src/features/agents/ai-model/hooks.ts
+++ b/packages/web/src/features/agents/ai-model/hooks.ts
@@ -26,7 +26,14 @@ function getAllowedModelsForProvider(
return allowedIds.includes(model.id);
})
- .sort((a, b) => a.name.localeCompare(b.name));
+ .sort((a, b) => {
+ if (isNil(allowedIds)) {
+ return a.name.localeCompare(b.name);
+ }
+ const aIndex = allowedIds.indexOf(a.id);
+ const bIndex = allowedIds.indexOf(b.id);
+ return aIndex - bIndex;
+ });
}
export const aiModelHooks = {
diff --git a/packages/web/src/lib/route-utils.ts b/packages/web/src/lib/route-utils.ts
index 83737df8fd0..95440cd3659 100644
--- a/packages/web/src/lib/route-utils.ts
+++ b/packages/web/src/lib/route-utils.ts
@@ -23,9 +23,6 @@ export const determineDefaultRoute = (
if (checkAccess(Permission.READ_FLOW) || checkAccess(Permission.READ_TABLE)) {
return authenticationSession.appendProjectRoutePrefix('/automations');
}
- if (checkAccess(Permission.READ_CHAT)) {
- return '/chat';
- }
if (checkAccess(Permission.READ_RUN)) {
return authenticationSession.appendProjectRoutePrefix('/runs');
}