Skip to content

Commit 3a53acc

Browse files
github-actions[bot]ItsnotakaMarfuen
authored
[dev] [Itsnotaka] daniel/ai-policy-editor-improv (#1939)
* feat(ai): enhance policy assistant prompts for user guidance * chore(db): update package.json exports to include types for modules * fix(app): change overflow style in PolicyDetails component * fix(app): enable AI assistant by default in PolicyDetails component --------- Co-authored-by: Daniel Fu <[email protected]> Co-authored-by: Mariano Fuentes <[email protected]>
1 parent 1712189 commit 3a53acc

File tree

3 files changed

+33
-23
lines changed

3 files changed

+33
-23
lines changed

apps/app/src/app/(app)/[orgId]/policies/[policyId]/editor/components/PolicyDetails.tsx

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export function PolicyContentManager({
9090
displayFormat = 'EDITOR',
9191
pdfUrl,
9292
}: PolicyContentManagerProps) {
93-
const [showAiAssistant, setShowAiAssistant] = useState(false);
93+
const [showAiAssistant, setShowAiAssistant] = useState(true);
9494
const [editorKey, setEditorKey] = useState(0);
9595
const [currentContent, setCurrentContent] = useState<Array<JSONContent>>(() => {
9696
const formattedContent = Array.isArray(policyContent)
@@ -104,7 +104,6 @@ export function PolicyContentManager({
104104
const [chatErrorMessage, setChatErrorMessage] = useState<string | null>(null);
105105
const diffViewerRef = useRef<HTMLDivElement>(null);
106106

107-
const isAiPolicyAssistantEnabled = true;
108107
const scrollToDiffViewer = useCallback(() => {
109108
diffViewerRef.current?.scrollIntoView({ behavior: 'smooth', block: 'start' });
110109
}, []);
@@ -189,7 +188,7 @@ export function PolicyContentManager({
189188
<Card>
190189
<CardContent className="p-4">
191190
<div className="flex gap-4 h-[60vh]">
192-
<div className="flex-1 min-w-0 h-full overflow-y-auto">
191+
<div className="flex-1 min-w-0 h-full overflow-hidden">
193192
<Tabs
194193
defaultValue={displayFormat}
195194
onValueChange={(format) =>
@@ -206,19 +205,17 @@ export function PolicyContentManager({
206205
PDF View
207206
</TabsTrigger>
208207
</TabsList>
209-
{!isPendingApproval &&
210-
displayFormat === 'EDITOR' &&
211-
isAiPolicyAssistantEnabled && (
212-
<Button
213-
variant={showAiAssistant ? 'default' : 'outline'}
214-
size="sm"
215-
onClick={() => setShowAiAssistant((prev) => !prev)}
216-
className="gap-2"
217-
>
218-
<Sparkles className="h-4 w-4" />
219-
AI Assistant
220-
</Button>
221-
)}
208+
{!isPendingApproval && (
209+
<Button
210+
variant={showAiAssistant ? 'default' : 'outline'}
211+
size="sm"
212+
onClick={() => setShowAiAssistant((prev) => !prev)}
213+
className="gap-2"
214+
>
215+
<Sparkles className="h-4 w-4" />
216+
AI Assistant
217+
</Button>
218+
)}
222219
</div>
223220
<TabsContent value="EDITOR" className="mt-4">
224221
<PolicyEditorWrapper
@@ -239,7 +236,7 @@ export function PolicyContentManager({
239236
</Tabs>
240237
</div>
241238

242-
{showAiAssistant && isAiPolicyAssistantEnabled && (
239+
{showAiAssistant && (
243240
<div className="w-80 shrink-0 self-stretch flex flex-col overflow-hidden">
244241
<PolicyAiAssistant
245242
messages={messages}

apps/app/src/app/(app)/[orgId]/policies/[policyId]/editor/components/ai/policy-ai-assistant.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,16 @@ export function PolicyAiAssistant({
8383
<ConversationContent className="gap-3 p-3">
8484
{messages.length === 0 ? (
8585
<div className="text-sm text-muted-foreground py-4">
86-
<p>Ask me to help edit this policy.</p>
86+
<p>
87+
I can help you edit, adapt, or check this policy for compliance. Try asking me
88+
things like:
89+
</p>
8790
<ul className="mt-2 space-y-1 text-xs">
88-
<li>"Add a data retention section"</li>
89-
<li>"Make this more SOC 2 compliant"</li>
90-
<li>"Simplify the language"</li>
91+
<li>"Adapt this for a fully remote, distributed team."</li>
92+
<li>
93+
"Can I shorten the data retention timeframe and still meet SOC 2 standards?"
94+
</li>
95+
<li>"Modify the access control section to include contractors."</li>
9196
</ul>
9297
</div>
9398
) : (

packages/db/package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,16 @@
1414
"typescript": "^5.9.2"
1515
},
1616
"exports": {
17-
".": "./dist/index.js",
18-
"./postinstall": "./dist/postinstall.js"
17+
".": {
18+
"import": "./dist/index.js",
19+
"types": "./src/index.ts",
20+
"default": "./dist/index.js"
21+
},
22+
"./postinstall": {
23+
"import": "./dist/postinstall.js",
24+
"types": "./src/postinstall.ts",
25+
"default": "./dist/postinstall.js"
26+
}
1927
},
2028
"bin": {
2129
"comp-prisma-postinstall": "./dist/postinstall.js"

0 commit comments

Comments
 (0)