Skip to content

Commit

Permalink
style: format code with Prettier and StandardJS
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in d5f5909 according to the output
from Prettier and StandardJS.

Details: None
  • Loading branch information
deepsource-autofix[bot] authored Oct 8, 2023
1 parent d5f5909 commit ecc6e1c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
44 changes: 22 additions & 22 deletions src/pages/chatgpt/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,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 @@ -125,7 +125,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 @@ -151,35 +151,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 @@ -197,15 +197,15 @@ const ChatGpt = () => {
items: [
{
key: '1',
label: '复制文本',
label: '复制文本'
},
{
key: '2',
label: '复制Markdown',
},
],
label: '复制Markdown'
}
]
}}
placement="bottom"
placement='bottom'
arrow
>
<Button>
Expand All @@ -227,7 +227,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 @@ -240,18 +240,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/utils/aidFn.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const getImgsUrl = (html) => {
export const customizeTimer = {
intervalTimer: null,
timeoutTimer: null,
setTimeout(cb, interval) {
setTimeout (cb, interval) {
const { now } = Date
const stime = now()
let etime = stime
Expand All @@ -80,10 +80,10 @@ export const customizeTimer = {
this.timeoutTimer = requestAnimationFrame(loop)
return this.timeoutTimer
},
clearTimeout() {
clearTimeout () {
cancelAnimationFrame(this.timeoutTimer)
},
setInterval(cb, interval) {
setInterval (cb, interval) {
const { now } = Date
let stime = now()
let etime = stime
Expand All @@ -99,9 +99,9 @@ export const customizeTimer = {
this.intervalTimer = requestAnimationFrame(loop)
return this.intervalTimer
},
clearInterval() {
clearInterval () {
cancelAnimationFrame(this.intervalTimer)
},
}
}

export const isDecimal = (value) => {
Expand Down Expand Up @@ -208,7 +208,7 @@ export const hasFocus = (element) => element === document.activeElement
export const isEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b)
export const randomString = () => Math.random().toString(36).slice(2)
export const escape = (str) =>
str.replace(/[&<>"']/g, (m) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[m]))
str.replace(/[&<>"']/g, (m) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[m])
export const toCamelCase = (str) => str.trim().replace(/[-_\s]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''))
export const random = (min, max) => Math.floor(Math.random() * (max - min + 1) + min)
export const randomColor = () => `#${Math.random().toString(16).slice(2, 8).padEnd(6, '0')}`
Expand Down

0 comments on commit ecc6e1c

Please sign in to comment.