Skip to content

Commit

Permalink
chore: improve pipe conf rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
louis030195 committed Sep 27, 2024
1 parent aef3426 commit d36d289
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
"name": "notionApiKey",
"type": "string",
"default": "<fill your notion api key here>",
"description": "notion api key for authentication"
"description": "notion api key for authentication https://www.notion.so/my-integrations"
},
{
"name": "notionDatabaseId",
"type": "string",
"default": "<fill your notion database id here>",
"description": "id of the notion database to sync conversations to"
"description": "id of the notion database to sync conversations to eg https://www.notion.so/your-workspace/database-id?v=..."
},
{
"name": "customSummaryPrompt",
Expand Down
12 changes: 6 additions & 6 deletions examples/typescript/pipe-phi3.5-engineering-team-logs/pipe.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
"description": "Interval in seconds to stream data"
},
{
"name": "notionDatabaseId",
"name": "notionApiKey",
"type": "string",
"default": "<fill your notion database id here>",
"description": "Notion Database ID"
"default": "<fill your notion api key here>",
"description": "notion api key for authentication https://www.notion.so/my-integrations"
},
{
"name": "notionApiKey",
"name": "notionDatabaseId",
"type": "string",
"default": "<fill your notion api key here>",
"description": "Notion API Key"
"default": "<fill your notion database id here>",
"description": "id of the notion database to sync conversations to eg https://www.notion.so/your-workspace/database-id?v=..."
},
{
"name": "ollamaApiUrl",
Expand Down
12 changes: 6 additions & 6 deletions examples/typescript/pipe-screen-to-crm/pipe.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
"description": "Interval in seconds to stream data"
},
{
"name": "notionDatabaseId",
"name": "notionApiKey",
"type": "string",
"default": "<fill your notion database id here>",
"description": "Notion Database ID"
"default": "<fill your notion api key here>",
"description": "notion api key for authentication https://www.notion.so/my-integrations"
},
{
"name": "notionApiKey",
"name": "notionDatabaseId",
"type": "string",
"default": "<fill your notion api key here>",
"description": "Notion API Key"
"default": "<fill your notion database id here>",
"description": "id of the notion database to sync conversations to eg https://www.notion.so/your-workspace/database-id?v=..."
},
{
"name": "ollamaApiUrl",
Expand Down
52 changes: 51 additions & 1 deletion screenpipe-app-tauri/components/pipe-config-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ import {
SelectValue,
} from "./ui/select";
import { HelpCircle } from "lucide-react";
import { MemoizedReactMarkdown } from "./markdown";
import { CodeBlock } from "./ui/codeblock";
import remarkGfm from "remark-gfm";
import remarkMath from "remark-math";

type PipeConfigFormProps = {
pipe: Pipe;
Expand Down Expand Up @@ -305,7 +309,53 @@ export const PipeConfigForm: React.FC<PipeConfigFormProps> = ({
{field.name} ({field.type})
</Label>
{renderConfigInput(field)}
<p className="text-sm text-gray-500">{field.description}</p>
<MemoizedReactMarkdown
className="prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 w-full"
remarkPlugins={[remarkGfm, remarkMath]}
components={{
p({ children }) {
return <p className="mb-2 last:mb-0">{children}</p>;
},
a({ node, href, children, ...props }) {
return (
<a
href={href}
target="_blank"
rel="noopener noreferrer"
{...props}
>
{children}
</a>
);
},
code({ node, className, children, ...props }) {
const content = String(children).replace(/\n$/, "");
const match = /language-(\w+)/.exec(className || "");

if (!match) {
return (
<code
className="px-1 py-0.5 rounded-sm font-mono text-sm"
{...props}
>
{content}
</code>
);
}

return (
<CodeBlock
key={Math.random()}
language={(match && match[1]) || ""}
value={content}
{...props}
/>
);
},
}}
>
{field.description}
</MemoizedReactMarkdown>
</div>
))}
<Button type="submit">save configuration</Button>
Expand Down

0 comments on commit d36d289

Please sign in to comment.