Commit e2d1d9c1 by 杨明

Merge branch 'hotfix_remove_excess_files' of http://192.168.3.233:8090/h5/glsk-a…

…i-assistant into hotfix_remove_excess_files
2 parents d37b7124 94cf6c53
/*
* @Author: liimin 17653212@qq.com
* @Date: 2025-05-12 09:37:54
* @LastEditors: liimin 17653212@qq.com
* @LastEditTime: 2025-05-12 10:27:29
* @FilePath: \ai-assistant\.eslintrc.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
module.exports = {
root: true,
env: {
node: true,
},
extends: ['plugin:vue/essential', 'eslint:recommended', '@vue/prettier'],
parserOptions: {
parser: 'babel-eslint',
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'comma-dangle': ['error', 'always-multiline'],
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
},
}
/*
* @Author: liimin 17653212@qq.com
* @Date: 2025-04-16 18:17:38
* @LastEditors: yangming@didihu.com.cn yangming@didihu.com.cn
* @LastEditTime: 2025-05-14 14:02:55
* @FilePath: \ai-assistant\app\components\base\chat\chat\index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import type { FC, ReactNode } from 'react'
import { memo, useCallback, useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
......@@ -115,30 +123,37 @@ const Chat: FC<ChatProps> = ({ appData, config, onSend, onClear, inputs, inputsF
}, [handleWindowResize])
useEffect(() => {
if (chatFooterRef.current && chatContainerRef.current) {
// container padding bottom
const resizeContainerObserver = new ResizeObserver(entries => {
for (const entry of entries) {
const { blockSize } = entry.borderBoxSize[0]
chatContainerRef.current!.style.paddingBottom = `${blockSize}px`
const container = chatContainerRef.current
const footer = chatFooterRef.current
if (!container || !footer) return
// container padding bottom
const resizeContainerObserver = new ResizeObserver(entries => {
for (const entry of entries) {
const { blockSize } = entry.borderBoxSize[0]
if (container) {
container.style.paddingBottom = `${blockSize}px`
handleScrollToBottom()
}
})
resizeContainerObserver.observe(chatFooterRef.current)
}
})
resizeContainerObserver.observe(footer)
// footer width
const resizeFooterObserver = new ResizeObserver(entries => {
for (const entry of entries) {
const { inlineSize } = entry.borderBoxSize[0]
chatFooterRef.current!.style.width = `${inlineSize}px`
// footer width
const resizeFooterObserver = new ResizeObserver(entries => {
for (const entry of entries) {
const { inlineSize } = entry.borderBoxSize[0]
if (footer) {
footer.style.width = `${inlineSize}px`
}
})
resizeFooterObserver.observe(chatContainerRef.current)
return () => {
resizeContainerObserver.disconnect()
resizeFooterObserver.disconnect()
}
})
resizeFooterObserver.observe(container)
return () => {
resizeContainerObserver.disconnect()
resizeFooterObserver.disconnect()
}
}, [handleScrollToBottom])
......
export type Emoji = {
background: string
content: string
}
import { InputVarType } from '@/app/components/workflow/types'
import { AgentStrategy } from '@/types/app'
import { PromptRole } from '@/models/debug'
export let apiPrefix = ''
export let publicApiPrefix = ''
export const MARKETPLACE_API_PREFIX = ''
// // NEXT_PUBLIC_API_PREFIX=/console/api NEXT_PUBLIC_PUBLIC_API_PREFIX=/api npm run start
// if (
// process.env.NEXT_PUBLIC_API_PREFIX &&
// process.env.NEXT_PUBLIC_PUBLIC_API_PREFIX
// ) {
// apiPrefix = process.env.NEXT_PUBLIC_API_PREFIX;
// publicApiPrefix = process.env.NEXT_PUBLIC_PUBLIC_API_PREFIX;
// } else if (
// globalThis.document?.body?.getAttribute("data-api-prefix") &&
// globalThis.document?.body?.getAttribute("data-pubic-api-prefix")
// ) {
// // Not build can not get env from process.env.NEXT_PUBLIC_ in browser https://nextjs.org/docs/basic-features/environment-variables#exposing-environment-variables-to-the-browser
// apiPrefix = globalThis.document.body.getAttribute(
// "data-api-prefix"
// ) as string;
// publicApiPrefix = globalThis.document.body.getAttribute(
// "data-pubic-api-prefix"
// ) as string;
// } else {
// // const domainParts = globalThis.location?.host?.split('.');
// // in production env, the host is dify.app . In other env, the host is [dev].dify.app
// // const env = domainParts.length === 2 ? 'ai' : domainParts?.[0];
// apiPrefix = "http://192.168.3.241//console/api";
// publicApiPrefix = "http://192.168.3.241/api"; // avoid browser private mode api cross origin
// marketplaceApiPrefix = "http://192.168.3.241/api";
// }
/*
* @Author: liimin 17653212@qq.com
* @Date: 2025-04-16 18:17:52
* @LastEditors: liimin 17653212@qq.com
* @LastEditTime: 2025-05-14 11:46:39
* @FilePath: \ai-assistant\config\index.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
// 解析 URL 参数
const urlParams = new URLSearchParams(globalThis.location?.search)
// 从 URL 参数中获取 apiPrefix
const domain = urlParams.get('domain')
apiPrefix = `${domain}/console/api`
publicApiPrefix = `${domain}/api` // avoid browser private mode api cross origin
export const apiPrefix = `${domain}/console/api`
export const publicApiPrefix = `${domain}/api` // avoid browser private mode api cross origin
export const API_PREFIX: string = apiPrefix
export const PUBLIC_API_PREFIX: string = publicApiPrefix
const EDITION = process.env.NEXT_PUBLIC_EDITION || globalThis.document?.body?.getAttribute('data-public-edition') || 'SELF_HOSTED'
export const IS_CE_EDITION = EDITION === 'SELF_HOSTED'
export const IS_CLOUD_EDITION = EDITION === 'CLOUD'
export const SUPPORT_MAIL_LOGIN = !!(process.env.NEXT_PUBLIC_SUPPORT_MAIL_LOGIN || globalThis.document?.body?.getAttribute('data-public-support-mail-login'))
export const TONE_LIST = [
]
export const DEFAULT_CHAT_PROMPT_CONFIG = {
prompt: [
{
role: PromptRole.system,
text: '',
},
],
}
export const DEFAULT_COMPLETION_PROMPT_CONFIG = {
prompt: {
text: '',
},
conversation_histories_role: {
user_prefix: '',
assistant_prefix: '',
},
}
export const LOCALE_COOKIE_NAME = 'locale'
export const DEFAULT_VALUE_MAX_LEN = 48
export const DEFAULT_PARAGRAPH_VALUE_MAX_LEN = 1000
export const zhRegex = /^[\u4E00-\u9FA5]$/m
export const emojiRegex = /^[\uD800-\uDBFF][\uDC00-\uDFFF]$/m
export const emailRegex = /^[\w.!#$%&'*+\-/=?^{|}~]+@([\w-]+\.)+[\w-]{2,}$/m
const MAX_ZN_VAR_NAME_LENGTH = 8
const MAX_EN_VAR_VALUE_LENGTH = 30
export const getMaxVarNameLength = (value: string) => {
if (zhRegex.test(value)) return MAX_ZN_VAR_NAME_LENGTH
return MAX_EN_VAR_VALUE_LENGTH
}
export const MAX_VAR_KEY_LENGTH = 30
export const MAX_PROMPT_MESSAGE_LENGTH = 10
export const VAR_ITEM_TEMPLATE = {
key: '',
name: '',
type: 'string',
max_length: DEFAULT_VALUE_MAX_LEN,
required: true,
}
export const VAR_ITEM_TEMPLATE_IN_WORKFLOW = {
variable: '',
label: '',
type: InputVarType.textInput,
max_length: DEFAULT_VALUE_MAX_LEN,
required: true,
options: [],
}
export const appDefaultIconBackground = '#D5F5F6'
export const NEED_REFRESH_APP_LIST_KEY = 'needRefreshAppList'
export const DATASET_DEFAULT = {
top_k: 4,
score_threshold: 0.8,
}
export const APP_PAGE_LIMIT = 10
export const ANNOTATION_DEFAULT = {
score_threshold: 0.9,
}
export let maxToolsNum = 10
if (process.env.NEXT_PUBLIC_MAX_TOOLS_NUM && process.env.NEXT_PUBLIC_MAX_TOOLS_NUM !== '') maxToolsNum = Number.parseInt(process.env.NEXT_PUBLIC_MAX_TOOLS_NUM)
else if (globalThis.document?.body?.getAttribute('data-public-max-tools-num') && globalThis.document.body.getAttribute('data-public-max-tools-num') !== '') maxToolsNum = Number.parseInt(globalThis.document.body.getAttribute('data-public-max-tools-num') as string)
export const MAX_TOOLS_NUM = maxToolsNum
export const DEFAULT_AGENT_SETTING = {
enabled: false,
max_iteration: 5,
strategy: AgentStrategy.functionCall,
tools: [],
}
export const DEFAULT_AGENT_PROMPT = {
chat: '',
completion: '',
}
export const VAR_REGEX = /\{\{(#[a-zA-Z0-9_-]{1,50}(\.[a-zA-Z_][a-zA-Z0-9_]{0,29}){1,10}#)\}\}/gi
export const resetReg = () => (VAR_REGEX.lastIndex = 0)
export let textGenerationTimeoutMs = 60000
if (process.env.NEXT_PUBLIC_TEXT_GENERATION_TIMEOUT_MS && process.env.NEXT_PUBLIC_TEXT_GENERATION_TIMEOUT_MS !== '') textGenerationTimeoutMs = Number.parseInt(process.env.NEXT_PUBLIC_TEXT_GENERATION_TIMEOUT_MS)
else if (globalThis.document?.body?.getAttribute('data-public-text-generation-timeout-ms') && globalThis.document.body.getAttribute('data-public-text-generation-timeout-ms') !== '') textGenerationTimeoutMs = Number.parseInt(globalThis.document.body.getAttribute('data-public-text-generation-timeout-ms') as string)
export const TEXT_GENERATION_TIMEOUT_MS = textGenerationTimeoutMs
export const DISABLE_UPLOAD_IMAGE_AS_ICON = process.env.NEXT_PUBLIC_DISABLE_UPLOAD_IMAGE_AS_ICON === 'true'
export const GITHUB_ACCESS_TOKEN = process.env.NEXT_PUBLIC_GITHUB_ACCESS_TOKEN || ''
export const SUPPORT_INSTALL_LOCAL_FILE_EXTENSIONS = '.difypkg,.difybndl'
export const FULL_DOC_PREVIEW_LENGTH = 50
let loopNodeMaxCount = 100
if (process.env.NEXT_PUBLIC_LOOP_NODE_MAX_COUNT && process.env.NEXT_PUBLIC_LOOP_NODE_MAX_COUNT !== '') loopNodeMaxCount = Number.parseInt(process.env.NEXT_PUBLIC_LOOP_NODE_MAX_COUNT)
else if (globalThis.document?.body?.getAttribute('data-public-loop-node-max-count') && globalThis.document.body.getAttribute('data-public-loop-node-max-count') !== '') loopNodeMaxCount = Number.parseInt(globalThis.document.body.getAttribute('data-public-loop-node-max-count') as string)
export const LOOP_NODE_MAX_COUNT = loopNodeMaxCount
let maxIterationsNum = 5
if (process.env.NEXT_PUBLIC_MAX_ITERATIONS_NUM && process.env.NEXT_PUBLIC_MAX_ITERATIONS_NUM !== '') maxIterationsNum = Number.parseInt(process.env.NEXT_PUBLIC_MAX_ITERATIONS_NUM)
else if (globalThis.document?.body?.getAttribute('data-public-max-iterations-num') && globalThis.document.body.getAttribute('data-public-max-iterations-num') !== '') maxIterationsNum = Number.parseInt(globalThis.document.body.getAttribute('data-public-max-iterations-num') as string)
export const MAX_ITERATIONS_NUM = maxIterationsNum
export const MARKETPLACE_API_PREFIX = ''
......@@ -15,7 +15,9 @@ const withMDX = require('@next/mdx')({
/** @type {import('next').NextConfig} */
const nextConfig = {
webpack: (config, { dev, isServer }) => {
config.plugins.push(codeInspectorPlugin({ bundler: 'webpack' }))
if (!dev) {
config.plugins.push(codeInspectorPlugin({ bundler: 'webpack' }))
}
return config
},
productionBrowserSourceMaps: false, // enable browser source map generation during the production build
......
......@@ -25,173 +25,111 @@
"preinstall": "npx only-allow pnpm"
},
"dependencies": {
"@babel/runtime": "^7.22.3",
"@dagrejs/dagre": "^1.1.4",
"@emoji-mart/data": "^1.2.1",
"@eslint/compat": "^1.2.4",
"@floating-ui/react": "^0.26.25",
"@floating-ui/react": "^0.26.27",
"@formatjs/intl-localematcher": "^0.5.6",
"@headlessui/react": "^2.2.0",
"@heroicons/react": "^2.0.16",
"@hookform/resolvers": "^3.9.0",
"@heroicons/react": "^2.1.5",
"@lexical/code": "^0.18.0",
"@lexical/link": "^0.18.0",
"@lexical/list": "^0.18.0",
"@lexical/react": "^0.18.0",
"@lexical/selection": "^0.18.0",
"@lexical/text": "^0.18.0",
"@lexical/utils": "^0.18.0",
"@mdx-js/loader": "^3.1.0",
"@mdx-js/react": "^3.1.0",
"@monaco-editor/react": "^4.6.0",
"@next/mdx": "15.2.3",
"@octokit/core": "^6.1.2",
"@octokit/request-error": "^6.1.5",
"@remixicon/react": "^4.5.0",
"@sentry/react": "^8.54.0",
"@sentry/utils": "^8.54.0",
"@sentry/react": "^8.55.0",
"@svgdotjs/svg.js": "^3.2.4",
"@tailwindcss/typography": "^0.5.15",
"@tanstack/react-query": "^5.60.5",
"@tanstack/react-query-devtools": "^5.60.5",
"@tanstack/react-query": "^5.61.0",
"@tanstack/react-query-devtools": "^5.61.0",
"ahooks": "^3.8.4",
"class-variance-authority": "^0.7.0",
"classnames": "^2.5.1",
"copy-to-clipboard": "^3.3.3",
"crypto-js": "^4.2.0",
"dayjs": "^1.11.13",
"decimal.js": "^10.4.3",
"dompurify": "^3.2.4",
"echarts": "^5.5.1",
"echarts-for-react": "^3.0.2",
"elkjs": "^0.9.3",
"emoji-mart": "^5.5.2",
"fast-deep-equal": "^3.1.3",
"globals": "^15.11.0",
"emoji-mart": "^5.6.0",
"i18next": "^23.16.4",
"i18next-resources-to-backend": "^1.2.1",
"immer": "^9.0.19",
"immer": "^9.0.21",
"js-audio-recorder": "^1.0.7",
"js-cookie": "^3.0.5",
"jwt-decode": "^4.0.0",
"katex": "^0.16.21",
"ky": "^1.7.2",
"lamejs": "^1.2.1",
"lexical": "^0.18.0",
"line-clamp": "^1.0.0",
"lodash-es": "^4.17.21",
"mermaid": "11.4.1",
"mime": "^4.0.4",
"mitt": "^3.0.1",
"negotiator": "^0.6.3",
"next": "15.2.3",
"next-themes": "^0.4.3",
"pinyin-pro": "^3.25.0",
"negotiator": "^0.6.4",
"next": "15.3.2",
"next-themes": "^0.4.4",
"qrcode.react": "^4.2.0",
"qs": "^6.13.0",
"react": "19.0.0",
"react-18-input-autosize": "^3.0.0",
"react-dom": "19.0.0",
"react-easy-crop": "^5.1.0",
"react-error-boundary": "^4.1.2",
"react-headless-pagination": "^1.1.6",
"react-hook-form": "^7.53.1",
"react-hotkeys-hook": "^4.6.1",
"react-i18next": "^15.1.0",
"react-infinite-scroll-component": "^6.1.0",
"react-markdown": "^9.0.1",
"react-multi-email": "^1.0.25",
"react-papaparse": "^4.4.0",
"react-pdf-highlighter": "^8.0.0-rc.0",
"react-pdf-highlighter": "8.0.0-rc.0",
"react-slider": "^2.0.6",
"react-sortablejs": "^6.1.4",
"react-syntax-highlighter": "^15.6.1",
"react-textarea-autosize": "^8.5.8",
"react-tooltip": "5.8.3",
"react-window": "^1.8.10",
"react-window-infinite-loader": "^1.0.9",
"reactflow": "^11.11.3",
"recordrtc": "^5.6.2",
"reactflow": "^11.11.4",
"rehype-katex": "^7.0.1",
"rehype-raw": "^7.0.0",
"remark-breaks": "^4.0.0",
"remark-gfm": "^4.0.0",
"remark-math": "^6.0.0",
"scheduler": "^0.23.0",
"semver": "^7.6.3",
"server-only": "^0.0.1",
"sharp": "^0.33.2",
"shave": "^5.0.4",
"sortablejs": "^1.15.0",
"swr": "^2.3.0",
"sharp": "^0.33.5",
"sortablejs": "^1.15.3",
"swr": "^2.3.3",
"tailwind-merge": "^2.5.4",
"use-context-selector": "^2.0.0",
"uuid": "^10.0.0",
"zod": "^3.23.8",
"zundo": "^2.1.0",
"zustand": "^4.5.2"
"zustand": "^4.5.5"
},
"devDependencies": {
"@antfu/eslint-config": "^4.1.1",
"@chromatic-com/storybook": "^3.1.0",
"@eslint-react/eslint-plugin": "^1.15.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.20.0",
"@faker-js/faker": "^9.0.3",
"@happy-dom/jest-environment": "^17.4.4",
"@next/eslint-plugin-next": "^15.2.3",
"@rgrove/parse-xml": "^4.1.0",
"@storybook/addon-essentials": "8.5.0",
"@storybook/addon-interactions": "8.5.0",
"@storybook/addon-links": "8.5.0",
"@storybook/addon-onboarding": "8.5.0",
"@storybook/addon-themes": "8.5.0",
"@storybook/blocks": "8.5.0",
"@storybook/nextjs": "8.5.0",
"@storybook/react": "8.5.0",
"@storybook/test": "8.5.0",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.2",
"@testing-library/react": "^16.0.1",
"@types/crypto-js": "^4.2.2",
"@types/dagre": "^0.7.52",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.2.0",
"@types/jest": "^29.5.13",
"@types/js-cookie": "^3.0.6",
"@types/lodash-es": "^4.17.12",
"@types/negotiator": "^0.6.3",
"@types/node": "18.15.0",
"@types/qs": "^6.9.16",
"@types/react": "19.0.11",
"@types/react-dom": "19.0.4",
"@types/react": "~18.2.79",
"@types/react-dom": "~18.2.25",
"@types/react-slider": "^1.3.6",
"@types/react-syntax-highlighter": "^15.5.13",
"@types/react-window": "^1.8.8",
"@types/react-window-infinite-loader": "^1.0.9",
"@types/recordrtc": "^5.6.14",
"@types/semver": "^7.5.8",
"@types/sortablejs": "^1.15.1",
"@types/sortablejs": "^1.15.8",
"@types/uuid": "^10.0.0",
"autoprefixer": "^10.4.20",
"autoprefixer": "^10.4.21",
"bing-translate-api": "^4.0.2",
"code-inspector-plugin": "^0.18.1",
"code-inspector-plugin": "^0.18.3",
"cross-env": "^7.0.3",
"eslint": "^9.20.1",
"eslint-config-next": "^15.0.0",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-react-refresh": "^0.4.19",
"eslint-plugin-storybook": "^0.11.2",
"eslint-plugin-tailwindcss": "^3.18.0",
"eslint": "^9.22.0",
"husky": "^9.1.6",
"jest": "^29.7.0",
"lint-staged": "^15.2.10",
"magicast": "^0.3.4",
"postcss": "^8.4.47",
"magicast": "^0.3.5",
"sass": "^1.80.3",
"storybook": "8.5.0",
"tailwindcss": "^3.4.14",
"ts-node": "^10.9.2",
"typescript": "4.9.5",
"typescript-eslint": "^8.23.0",
"uglify-js": "^3.19.3"
},
"resolutions": {
......
This diff could not be displayed because it is too large.
ignoredBuiltDependencies:
- canvas
- core-js-pure
- esbuild
- sharp
......@@ -492,18 +492,18 @@ export const getPublic = <T>(url: string, options = {}, otherOptions?: IOtherOpt
}
// For Marketplace API
export const getMarketplace = <T>(url: string, options = {}, otherOptions?: IOtherOptions) => {
return get<T>(url, options, { ...otherOptions, isMarketplaceAPI: true })
}
// export const getMarketplace = <T>(url: string, options = {}, otherOptions?: IOtherOptions) => {
// return get<T>(url, options, { ...otherOptions, isMarketplaceAPI: true })
// }
export const post = <T>(url: string, options = {}, otherOptions?: IOtherOptions) => {
return request<T>(url, Object.assign({}, options, { method: 'POST' }), otherOptions)
}
// For Marketplace API
export const postMarketplace = <T>(url: string, options = {}, otherOptions?: IOtherOptions) => {
return post<T>(url, options, { ...otherOptions, isMarketplaceAPI: true })
}
// export const postMarketplace = <T>(url: string, options = {}, otherOptions?: IOtherOptions) => {
// return post<T>(url, options, { ...otherOptions, isMarketplaceAPI: true })
// }
export const postPublic = <T>(url: string, options = {}, otherOptions?: IOtherOptions) => {
return post<T>(url, options, { ...otherOptions, isPublicAPI: true })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!