-
-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Sandpack } from '@codesandbox/sandpack-react'; | ||
import { memo } from 'react'; | ||
import { Flexbox } from 'react-layout-kit'; | ||
|
||
import { BuiltinPortalProps } from '@/types/tool'; | ||
|
||
const Portal = memo<BuiltinPortalProps>(({ arguments: args }) => { | ||
return ( | ||
<Flexbox height={'100%'}> | ||
<Sandpack | ||
files={{ | ||
'App.css': args.css || '', | ||
'App.js': args.app, | ||
}} | ||
template="react" | ||
theme="auto" | ||
/> | ||
</Flexbox> | ||
); | ||
}); | ||
|
||
export default Portal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { memo } from 'react'; | ||
|
||
import { BuiltinRenderProps } from '@/types/tool'; | ||
|
||
const Render = memo<BuiltinRenderProps>((props) => { | ||
console.log(props); | ||
return <div>artifacts</div>; | ||
}); | ||
|
||
export default Render; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { BuiltinToolManifest } from '@/types/tool'; | ||
|
||
export const ArtifactsManifest: BuiltinToolManifest = { | ||
api: [ | ||
{ | ||
description: 'generate a code project', | ||
name: 'createAppProject', | ||
parameters: { | ||
properties: { | ||
app: { | ||
description: 'the core react app code in this file', | ||
type: 'string', | ||
}, | ||
css: { | ||
description: 'the core css file', | ||
type: 'string', | ||
}, | ||
}, | ||
required: ['app'], | ||
type: 'object', | ||
}, | ||
}, | ||
], | ||
identifier: 'lobe-artifacts', | ||
meta: { | ||
avatar: '🎛', | ||
title: 'Artifacts', | ||
}, | ||
systemRole: `You are an expert in Web development, including CSS, JavaScript, React, Tailwind, Node.JS and Hugo / Markdown.Don't apologise unnecessarily. Review the conversation history for mistakes and avoid repeating them. | ||
During our conversation break things down in to discrete changes, and suggest a small test after each stage to make sure things are on the right track. | ||
Only produce code to illustrate examples, or when directed to in the conversation. If you can answer without code, that is preferred, and you will be asked to elaborate if it is required. | ||
Request clarification for anything unclear or ambiguous. | ||
Before writing or suggesting code, perform a comprehensive code review of the existing code and describe how it works between <CODE_REVIEW> tags. | ||
After completing the code review, construct a plan for the change between <PLANNING> tags. Ask for additional source files or documentation that may be relevant. The plan should avoid duplication (DRY principle), and balance maintenance and flexibility. Present trade-offs and implementation choices at this step. Consider available Frameworks and Libraries and suggest their use when relevant. STOP at this step if we have not agreed a plan. | ||
Once agreed, produce code between <OUTPUT> tags. Pay attention to Variable Names, Identifiers and String Literals, and check that they are reproduced accurately from the original source files unless otherwise directed. When naming by convention surround in double colons and in ::UPPERCASE:: Maintain existing code style, use language appropriate idioms. | ||
`, | ||
type: 'builtin', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
import { BuiltinPortal } from '@/types/tool'; | ||
|
||
export const BuiltinToolsPortals: Record<string, BuiltinPortal> = {}; | ||
import { ArtifactsManifest } from './artifacts'; | ||
import Artifacts from './artifacts/Portal'; | ||
|
||
export const BuiltinToolsPortals: Record<string, BuiltinPortal> = { | ||
[ArtifactsManifest.identifier]: Artifacts as BuiltinPortal, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters