Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format code with prettier and standardjs #153

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions src/pages/chatgpt/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const ChatGpt = () => {
if (e.data !== '[DONE]') {
const payload = JSON.parse(e.data)
const {
delta: { content },
delta: { content }
} = payload.choices[0]
if (content) {
apiResultRef.current += content
Expand Down Expand Up @@ -118,7 +118,7 @@ const ChatGpt = () => {
if (e.data !== '[DONE]') {
const payload = JSON.parse(e.data)
const {
delta: { content },
delta: { content }
} = payload.choices[0]
if (content) {
structureResultRef.current += content
Expand All @@ -144,35 +144,35 @@ const ChatGpt = () => {
<section style={{ width: 600 }}>
<Form
form={form}
layout="vertical"
layout='vertical'
initialValues={{
apiKey: '',
text: '作为产品经理,帮我生成一份PRD文档,功能是公园入园人数大屏展示功能,采用 markdown 格式区分标题和正文,标题加上序号',
text: '作为产品经理,帮我生成一份PRD文档,功能是公园入园人数大屏展示功能,采用 markdown 格式区分标题和正文,标题加上序号'
}}
onFinish={onFinish}
requiredMark={false}
autoComplete="off"
autoComplete='off'
>
<Form.Item name="apiKey" label="OPEN AI KEY" rules={[{ required: true, message: '请输入open ai key' }]}>
<Form.Item name='apiKey' label='OPEN AI KEY' rules={[{ required: true, message: '请输入open ai key' }]}>
<Input.TextArea
onChange={onChange}
rows={1}
style={{ resize: 'none', padding: 2 }}
placeholder="open ai key"
placeholder='open ai key'
/>
</Form.Item>
<Form.Item name="text" label="您的输入" rules={[{ required: true, message: '请输您的需求' }]}>
<Form.Item name='text' label='您的输入' rules={[{ required: true, message: '请输您的需求' }]}>
<Input.TextArea
rows={4}
showCount
maxLength={1000}
style={{ resize: 'none', padding: 2 }}
placeholder=""
placeholder=''
/>
</Form.Item>

<Form.Item wrapperCol={{ offset: 4, span: 16 }}>
<Button block type="primary" htmlType="submit" disabled={[0, 1].includes(readyState)}>
<Button block type='primary' htmlType='submit' disabled={[0, 1].includes(readyState)}>
{apiResult && readyState === 2 ? '再来一次' : 'ChatGPT'}
</Button>
</Form.Item>
Expand All @@ -190,11 +190,11 @@ const ChatGpt = () => {
items: [
{
key: '1',
label: '复制Markdown',
},
],
label: '复制Markdown'
}
]
}}
placement="bottom"
placement='bottom'
arrow
>
<Button>
Expand All @@ -216,7 +216,7 @@ const ChatGpt = () => {
<section>
{apiResult && readyState === 2 && (
<Space>
<Button type="primary" disabled={[0, 1].includes(structureReadyState)} onClick={buildStructure}>
<Button type='primary' disabled={[0, 1].includes(structureReadyState)} onClick={buildStructure}>
{structureResult && structureReadyState === 2 ? '重新生成' : '生成页面结构'}
</Button>

Expand All @@ -229,18 +229,18 @@ const ChatGpt = () => {
items: [
{
key: '1',
label: '导出png格式',
label: '导出png格式'
},
{
key: '2',
label: '导出svg格式',
},
],
label: '导出svg格式'
}
]
}}
placement="bottom"
placement='bottom'
arrow
>
<Button type="primary">
<Button type='primary'>
<DownloadOutlined />
导出
</Button>
Expand Down
12 changes: 6 additions & 6 deletions src/pages/chatgpt/sse.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { SSE } from 'sse'

const initSSE = (apiKey, apiContent) => {
const source = new SSE(`https://api.openai.com/v1/chat/completions`, {
const source = new SSE('https://api.openai.com/v1/chat/completions', {
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${apiKey}`,
Authorization: `Bearer ${apiKey}`
},
method: 'POST',
payload: JSON.stringify({
Expand All @@ -13,10 +13,10 @@ const initSSE = (apiKey, apiContent) => {
messages: [
{
role: 'assistant',
content: apiContent,
},
],
}),
content: apiContent
}
]
})
})
return source
}
Expand Down
6 changes: 3 additions & 3 deletions src/pages/three/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as random from 'maath/random/dist/maath-random.esm'

import styles from './index.module.less'

export default function ReactThree() {
export default function ReactThree () {
return (
<div style={{ width: '100%', height: 'calc(100vh - 232px)', background: '#12071f' }}>
<h2 className={styles.liner}>React Three Fiber</h2>
Expand All @@ -16,7 +16,7 @@ export default function ReactThree() {
)
}

function Stars(props) {
function Stars (props) {
const ref = useRef()
const [sphere] = useState(() => random.inSphere(new Float32Array(5000), { radius: 1.5 }))
useFrame((state, delta) => {
Expand All @@ -26,7 +26,7 @@ function Stars(props) {
return (
<group>
<Points ref={ref} positions={sphere} stride={3} frustumCulled={false} {...props}>
<PointMaterial transparent color="#ffa0e0" size={0.005} sizeAttenuation={true} depthWrite={false} />
<PointMaterial transparent color='#ffa0e0' size={0.005} sizeAttenuation depthWrite={false} />
</Points>
</group>
)
Expand Down