mirror of
https://github.com/langgenius/webapp-conversation.git
synced 2025-12-23 15:56:41 +08:00
feat: migrate ESLint to v9 flat config
- Replace .eslintrc.json with eslint.config.mjs - Simplify configuration using @antfu/eslint-config - Add necessary ESLint plugin dependencies - Disable overly strict style rules - Set package.json type to module for ESM support - Fix ESLint disable comment format 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -14,7 +14,7 @@ import { DEFAULT_VALUE_MAX_LEN } from '@/config'
|
||||
// regex to match the {{}} and replace it with a span
|
||||
const regex = /\{\{([^}]+)\}\}/g
|
||||
|
||||
export type IWelcomeProps = {
|
||||
export interface IWelcomeProps {
|
||||
conversationName: string
|
||||
hasSetInputs: boolean
|
||||
isPublicVersion: boolean
|
||||
@ -42,8 +42,7 @@ const Welcome: FC<IWelcomeProps> = ({
|
||||
const hasVar = promptConfig.prompt_variables.length > 0
|
||||
const [isFold, setIsFold] = useState<boolean>(true)
|
||||
const [inputs, setInputs] = useState<Record<string, any>>((() => {
|
||||
if (hasSetInputs)
|
||||
return savedInputs
|
||||
if (hasSetInputs) { return savedInputs }
|
||||
|
||||
const res: Record<string, any> = {}
|
||||
if (promptConfig) {
|
||||
@ -69,8 +68,7 @@ const Welcome: FC<IWelcomeProps> = ({
|
||||
}, [savedInputs])
|
||||
|
||||
const highLightPromoptTemplate = (() => {
|
||||
if (!promptConfig)
|
||||
return ''
|
||||
if (!promptConfig) { return '' }
|
||||
const res = promptConfig.prompt_template.replace(regex, (match, p1) => {
|
||||
return `<span class='text-gray-800 font-bold'>${inputs?.[p1] ? inputs?.[p1] : match}</span>`
|
||||
})
|
||||
@ -189,8 +187,7 @@ const Welcome: FC<IWelcomeProps> = ({
|
||||
}
|
||||
|
||||
const handleChat = () => {
|
||||
if (!canChat())
|
||||
return
|
||||
if (!canChat()) { return }
|
||||
|
||||
onStartChat(inputs)
|
||||
}
|
||||
@ -251,8 +248,7 @@ const Welcome: FC<IWelcomeProps> = ({
|
||||
return (
|
||||
<VarOpBtnGroup
|
||||
onConfirm={() => {
|
||||
if (!canChat())
|
||||
return
|
||||
if (!canChat()) { return }
|
||||
|
||||
onInputsChange(inputs)
|
||||
setIsFold(true)
|
||||
@ -309,8 +305,7 @@ const Welcome: FC<IWelcomeProps> = ({
|
||||
}
|
||||
|
||||
const renderHasSetInputsPrivate = () => {
|
||||
if (!canEditInputs || !hasVar)
|
||||
return null
|
||||
if (!canEditInputs || !hasVar) { return null }
|
||||
|
||||
return (
|
||||
<TemplateVarPanel
|
||||
@ -333,8 +328,7 @@ const Welcome: FC<IWelcomeProps> = ({
|
||||
}
|
||||
|
||||
const renderHasSetInputs = () => {
|
||||
if ((!isPublicVersion && !canEditInputs) || !hasVar)
|
||||
return null
|
||||
if ((!isPublicVersion && !canEditInputs) || !hasVar) { return null }
|
||||
|
||||
return (
|
||||
<div
|
||||
@ -375,7 +369,8 @@ const Welcome: FC<IWelcomeProps> = ({
|
||||
<a
|
||||
className='text-gray-500'
|
||||
href={siteInfo.privacy_policy}
|
||||
target='_blank'>{t('app.chat.privacyPolicyMiddle')}</a>
|
||||
target='_blank'
|
||||
>{t('app.chat.privacyPolicyMiddle')}</a>
|
||||
{t('app.chat.privacyPolicyRight')}
|
||||
</div>
|
||||
: <div>
|
||||
|
||||
Reference in New Issue
Block a user