web: Add style CI workflow to enforce eslint checks on web module (#1910)
This commit is contained in:
@@ -257,7 +257,7 @@ const CodeGroupContext = createContext(false)
|
||||
|
||||
export function CodeGroup({ children, title, inputs, targetCode, ...props }: IChildrenProps) {
|
||||
const languages = Children.map(children, child =>
|
||||
getPanelTitle(child.props.children.props)
|
||||
getPanelTitle(child.props.children.props),
|
||||
)
|
||||
const tabGroupProps = useTabGroupProps(languages)
|
||||
const hasTabs = Children.count(children) > 1
|
||||
|
@@ -1,9 +1,9 @@
|
||||
'use client'
|
||||
import { useContext } from 'use-context-selector'
|
||||
import TemplateEn from './template/template.en.mdx'
|
||||
import TemplateZh from './template/template.zh.mdx'
|
||||
import TemplateChatEn from './template/template_chat.en.mdx'
|
||||
import TemplateChatZh from './template/template_chat.zh.mdx'
|
||||
import { useContext } from 'use-context-selector'
|
||||
import I18n from '@/context/i18n'
|
||||
|
||||
type IDocProps = {
|
||||
@@ -14,20 +14,21 @@ const Doc = ({ appDetail }: IDocProps) => {
|
||||
const { locale } = useContext(I18n)
|
||||
const variables = appDetail?.model_config?.configs?.prompt_variables || []
|
||||
const inputs = variables.reduce((res: any, variable: any) => {
|
||||
res[variable.key] = variable.name || '';
|
||||
res[variable.key] = variable.name || ''
|
||||
return res
|
||||
}, {})
|
||||
|
||||
return (
|
||||
<article className="prose prose-xl" >
|
||||
{appDetail?.mode === 'completion' ? (
|
||||
locale === 'en' ? <TemplateEn appDetail={appDetail} variables={variables} inputs={inputs} /> : <TemplateZh appDetail={appDetail} variables={variables} inputs={inputs} />
|
||||
) : (
|
||||
locale === 'en' ? <TemplateChatEn appDetail={appDetail} variables={variables} inputs={inputs} /> : <TemplateChatZh appDetail={appDetail} variables={variables} inputs={inputs} />
|
||||
)}
|
||||
{appDetail?.mode === 'completion'
|
||||
? (
|
||||
locale === 'en' ? <TemplateEn appDetail={appDetail} variables={variables} inputs={inputs} /> : <TemplateZh appDetail={appDetail} variables={variables} inputs={inputs} />
|
||||
)
|
||||
: (
|
||||
locale === 'en' ? <TemplateChatEn appDetail={appDetail} variables={variables} inputs={inputs} /> : <TemplateChatZh appDetail={appDetail} variables={variables} inputs={inputs} />
|
||||
)}
|
||||
</article>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
export default Doc
|
||||
|
@@ -22,20 +22,20 @@ export const Heading = function H2({
|
||||
title,
|
||||
name,
|
||||
}: IHeaderingProps) {
|
||||
let style = '';
|
||||
let style = ''
|
||||
switch (method) {
|
||||
case 'PUT':
|
||||
style = 'ring-amber-300 bg-amber-400/10 text-amber-500 dark:ring-amber-400/30 dark:bg-amber-400/10 dark:text-amber-400';
|
||||
break;
|
||||
style = 'ring-amber-300 bg-amber-400/10 text-amber-500 dark:ring-amber-400/30 dark:bg-amber-400/10 dark:text-amber-400'
|
||||
break
|
||||
case 'DELETE':
|
||||
style = 'ring-rose-200 bg-rose-50 text-red-500 dark:ring-rose-500/20 dark:bg-rose-400/10 dark:text-rose-400';
|
||||
break;
|
||||
style = 'ring-rose-200 bg-rose-50 text-red-500 dark:ring-rose-500/20 dark:bg-rose-400/10 dark:text-rose-400'
|
||||
break
|
||||
case 'POST':
|
||||
style = 'ring-sky-300 bg-sky-400/10 text-sky-500 dark:ring-sky-400/30 dark:bg-sky-400/10 dark:text-sky-400';
|
||||
break;
|
||||
style = 'ring-sky-300 bg-sky-400/10 text-sky-500 dark:ring-sky-400/30 dark:bg-sky-400/10 dark:text-sky-400'
|
||||
break
|
||||
default:
|
||||
style = 'ring-emerald-300 dark:ring-emerald-400/30 bg-emerald-400/10 text-emerald-500 dark:text-emerald-400';
|
||||
break;
|
||||
style = 'ring-emerald-300 dark:ring-emerald-400/30 bg-emerald-400/10 text-emerald-500 dark:text-emerald-400'
|
||||
break
|
||||
}
|
||||
return (
|
||||
<>
|
||||
|
Reference in New Issue
Block a user