Skip to content

Commit

Permalink
Add custom instruction support
Browse files Browse the repository at this point in the history
  • Loading branch information
anc95 committed Mar 14, 2023
1 parent 0979a4c commit 980141b
Show file tree
Hide file tree
Showing 8 changed files with 322 additions and 146 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@
"build": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=8192 tsup",
"postinstall": "patch-package"
}
}
}
2 changes: 1 addition & 1 deletion src/common/store/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ export const getSetting = async () => {
res.url = 'https://api.openai.com/v1';
}

return res;
return res as Settings;
};
45 changes: 45 additions & 0 deletions src/components/icon-btn.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { PropsWithChildren, useMemo } from 'react';
import cx from 'classnames';

export const IconBtn: React.FC<
PropsWithChildren<{
disabled?: boolean;
color?: 'green' | 'gray' | 'orange' | 'red' | 'blue';
className?: string;
onClick?: () => void;
}>
> = ({ color, className, onClick, children, disabled }) => {
const colorClass = useMemo(() => {
switch (color) {
case 'green':
return 'text-green-400 hover:text-green-500';
case 'gray':
return 'text-gray-400 hover:text-gray-500';
case 'orange':
return 'text-orange-400 hover:text-orange-500';
case 'red':
return 'text-red-400 hover:text-red-500';
case 'blue':
return 'text-blue-400 hover:text-blue-500';
default:
return '';
}
}, []);

if (disabled) {
return null;
}

return (
<div
className={cx(
colorClass,
'transition-all duration-500 p-1 flex items-center justify-center hover:bg-slate-200 rounded-none hover:rounded-md text-base bg-slate-100',
className
)}
onClick={onClick}
>
{children}
</div>
);
};
18 changes: 18 additions & 0 deletions src/components/icon/delete.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { SVGProps } from 'react';

export function IcBaselineDeleteOutline(props: SVGProps<SVGSVGElement>) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="1em"
height="1em"
viewBox="0 0 24 24"
{...props}
>
<path
fill="currentColor"
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM8 9h8v10H8V9zm7.5-5l-1-1h-5l-1 1H5v2h14V4z"
></path>
</svg>
);
}
Loading

0 comments on commit 980141b

Please sign in to comment.