Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
69d42ae9
Unverified
Commit
69d42ae9
authored
Jan 08, 2024
by
Bowen Liang
Committed by
GitHub
Jan 08, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: cover missed source paths for eslint (#1956)
parent
5ff701ca
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
297 additions
and
295 deletions
+297
-295
workspace-context.tsx
web/context/workspace-context.tsx
+5
-4
use-metadata.ts
web/hooks/use-metadata.ts
+232
-231
i18next-serverside-config.ts
web/i18n/i18next-serverside-config.ts
+3
-3
share.ts
web/models/share.ts
+3
-3
next.config.js
web/next.config.js
+1
-0
index.ts
web/test/factories/index.ts
+52
-52
test_util.ts
web/test/test_util.ts
+1
-2
No files found.
web/context/workspace-context.tsx
View file @
69d42ae9
...
@@ -10,20 +10,21 @@ export type WorkspacesContextValue = {
...
@@ -10,20 +10,21 @@ export type WorkspacesContextValue = {
}
}
const
WorkspacesContext
=
createContext
<
WorkspacesContextValue
>
({
const
WorkspacesContext
=
createContext
<
WorkspacesContextValue
>
({
workspaces
:
[]
workspaces
:
[]
,
})
})
interface
IWorkspaceProviderProps
{
type
IWorkspaceProviderProps
=
{
children
:
React
.
ReactNode
children
:
React
.
ReactNode
}
}
export
const
WorkspaceProvider
=
({
export
const
WorkspaceProvider
=
({
children
children
,
}:
IWorkspaceProviderProps
)
=>
{
}:
IWorkspaceProviderProps
)
=>
{
const
{
data
}
=
useSWR
({
url
:
'/workspaces'
},
fetchWorkspaces
)
const
{
data
}
=
useSWR
({
url
:
'/workspaces'
},
fetchWorkspaces
)
return
(
return
(
<
WorkspacesContext
.
Provider
value=
{
{
<
WorkspacesContext
.
Provider
value=
{
{
workspaces
:
data
?.
workspaces
||
[]
workspaces
:
data
?.
workspaces
||
[]
,
}
}
>
}
}
>
{
children
}
{
children
}
</
WorkspacesContext
.
Provider
>
</
WorkspacesContext
.
Provider
>
...
...
web/hooks/use-metadata.ts
View file @
69d42ae9
This diff is collapsed.
Click to expand it.
web/i18n/i18next-serverside-config.ts
View file @
69d42ae9
import
{
createInstance
}
from
'i18next'
import
{
createInstance
}
from
'i18next'
import
resourcesToBackend
from
'i18next-resources-to-backend'
import
resourcesToBackend
from
'i18next-resources-to-backend'
import
{
initReactI18next
}
from
'react-i18next/initReactI18next'
import
{
initReactI18next
}
from
'react-i18next/initReactI18next'
import
{
Locale
}
from
'.'
import
type
{
Locale
}
from
'.'
// https://locize.com/blog/next-13-app-dir-i18n/
// https://locize.com/blog/next-13-app-dir-i18n/
const
initI18next
=
async
(
lng
:
Locale
,
ns
:
string
)
=>
{
const
initI18next
=
async
(
lng
:
Locale
,
ns
:
string
)
=>
{
...
@@ -21,6 +21,6 @@ export async function useTranslation(lng: Locale, ns = '', options: Record<strin
...
@@ -21,6 +21,6 @@ export async function useTranslation(lng: Locale, ns = '', options: Record<strin
const
i18nextInstance
=
await
initI18next
(
lng
,
ns
)
const
i18nextInstance
=
await
initI18next
(
lng
,
ns
)
return
{
return
{
t
:
i18nextInstance
.
getFixedT
(
lng
,
ns
,
options
.
keyPrefix
),
t
:
i18nextInstance
.
getFixedT
(
lng
,
ns
,
options
.
keyPrefix
),
i18n
:
i18nextInstance
i18n
:
i18nextInstance
,
}
}
}
}
\ No newline at end of file
web/models/share.ts
View file @
69d42ae9
import
{
Locale
}
from
'@/i18n'
import
type
{
Locale
}
from
'@/i18n'
export
type
ResponseHolder
=
{}
export
type
ResponseHolder
=
{}
...
@@ -6,7 +6,7 @@ export type ConversationItem = {
...
@@ -6,7 +6,7 @@ export type ConversationItem = {
id
:
string
id
:
string
name
:
string
name
:
string
inputs
:
Record
<
string
,
any
>
|
null
inputs
:
Record
<
string
,
any
>
|
null
introduction
:
string
,
introduction
:
string
}
}
export
type
SiteInfo
=
{
export
type
SiteInfo
=
{
...
@@ -18,4 +18,4 @@ export type SiteInfo = {
...
@@ -18,4 +18,4 @@ export type SiteInfo = {
prompt_public
:
boolean
prompt_public
:
boolean
copyright
?:
string
copyright
?:
string
privacy_policy
?:
string
privacy_policy
?:
string
}
}
\ No newline at end of file
web/next.config.js
View file @
69d42ae9
...
@@ -24,6 +24,7 @@ const nextConfig = {
...
@@ -24,6 +24,7 @@ const nextConfig = {
// Warning: This allows production builds to successfully complete even if
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
// your project has ESLint errors.
ignoreDuringBuilds
:
true
,
ignoreDuringBuilds
:
true
,
dirs
:
[
'app'
,
'bin'
,
'config'
,
'context'
,
'hooks'
,
'i18n'
,
'models'
,
'service'
,
'test'
,
'types'
,
'utils'
],
},
},
typescript
:
{
typescript
:
{
// https://nextjs.org/docs/api-reference/next.config.js/ignoring-typescript-errors
// https://nextjs.org/docs/api-reference/next.config.js/ignoring-typescript-errors
...
...
web/test/factories/index.ts
View file @
69d42ae9
...
@@ -6,61 +6,61 @@ import type { User } from '@/models/user'
...
@@ -6,61 +6,61 @@ import type { User } from '@/models/user'
import
type
{
Log
}
from
'@/models/log'
import
type
{
Log
}
from
'@/models/log'
export
const
seedHistory
=
()
=>
{
export
const
seedHistory
=
()
=>
{
return
Factory
.
extend
<
Partial
<
History
>>
({
return
Factory
.
extend
<
Partial
<
History
>>
({
source
()
{
source
()
{
return
faker
.
address
.
streetAddress
()
return
faker
.
address
.
streetAddress
()
},
},
target
()
{
target
()
{
return
faker
.
address
.
streetAddress
()
return
faker
.
address
.
streetAddress
()
},
},
})
})
}
}
export
const
seedUser
=
()
=>
{
export
const
seedUser
=
()
=>
{
return
Factory
.
extend
<
Partial
<
User
>>
({
return
Factory
.
extend
<
Partial
<
User
>>
({
firstName
()
{
firstName
()
{
return
faker
.
name
.
firstName
()
return
faker
.
name
.
firstName
()
},
},
lastName
()
{
lastName
()
{
return
faker
.
name
.
lastName
()
return
faker
.
name
.
lastName
()
},
},
name
()
{
name
()
{
return
faker
.
address
.
streetAddress
()
return
faker
.
address
.
streetAddress
()
},
},
phone
()
{
phone
()
{
return
faker
.
phone
.
number
()
return
faker
.
phone
.
number
()
},
},
email
()
{
email
()
{
return
faker
.
internet
.
email
()
return
faker
.
internet
.
email
()
},
},
username
()
{
username
()
{
return
faker
.
internet
.
userName
()
return
faker
.
internet
.
userName
()
},
},
avatar
()
{
avatar
()
{
return
faker
.
internet
.
avatar
()
return
faker
.
internet
.
avatar
()
},
},
})
})
}
}
export
const
seedLog
=
()
=>
{
export
const
seedLog
=
()
=>
{
return
Factory
.
extend
<
Partial
<
Log
>>
({
return
Factory
.
extend
<
Partial
<
Log
>>
({
get
key
()
{
get
key
()
{
return
faker
.
datatype
.
uuid
()
return
faker
.
datatype
.
uuid
()
},
},
get
conversationId
()
{
get
conversationId
()
{
return
faker
.
datatype
.
uuid
()
return
faker
.
datatype
.
uuid
()
},
},
get
question
()
{
get
question
()
{
return
faker
.
lorem
.
sentence
()
return
faker
.
lorem
.
sentence
()
},
},
get
answer
()
{
get
answer
()
{
return
faker
.
lorem
.
sentence
()
return
faker
.
lorem
.
sentence
()
},
},
get
userRate
()
{
get
userRate
()
{
return
faker
.
datatype
.
number
(
5
)
return
faker
.
datatype
.
number
(
5
)
},
},
get
adminRate
()
{
get
adminRate
()
{
return
faker
.
datatype
.
number
(
5
)
return
faker
.
datatype
.
number
(
5
)
}
},
})
})
}
}
\ No newline at end of file
web/test/test_util.ts
View file @
69d42ae9
...
@@ -2,8 +2,7 @@ import { Model, createServer } from 'miragejs'
...
@@ -2,8 +2,7 @@ import { Model, createServer } from 'miragejs'
import
type
{
User
}
from
'@/models/user'
import
type
{
User
}
from
'@/models/user'
import
type
{
History
}
from
'@/models/history'
import
type
{
History
}
from
'@/models/history'
import
type
{
Log
}
from
'@/models/log'
import
type
{
Log
}
from
'@/models/log'
import
{
seedUser
,
seedHistory
,
seedLog
}
from
'@/test/factories'
import
{
seedHistory
,
seedLog
,
seedUser
}
from
'@/test/factories'
export
function
mockAPI
()
{
export
function
mockAPI
()
{
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment