diff --git a/.env.development b/.env.development index c77c0df..885391e 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,4 @@ # VITE_APP_URL = http://192.168.31.82:8771 # VITE_APP_URL = http://18.167.251.121:10095 -VITE_APP_URL = https://www.lc-api.aida.com.hk +VITE_APP_URL = http://192.168.31.118:8080 VITE_GOOGLE_CLIENT_ID = 216037134725-7q8vqp0ohtmohlosltkfg7bd2v29rm5a.apps.googleusercontent.com diff --git a/src/App.vue b/src/App.vue index 5c66772..c595bc0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,5 +1,6 @@ diff --git a/src/api/agent.ts b/src/api/agent.ts new file mode 100644 index 0000000..535248d --- /dev/null +++ b/src/api/agent.ts @@ -0,0 +1,79 @@ +import request from '@/utils/request' + +// 对话 +export interface AgentParamsType { + message: string // 消息 + threadId: string // 对话ID + checkpointId?: string // 检查点ID + imageUrlList?: string[] // 图片URL列表 + configParams: Record // 其他配置参数 + token: string +} +export const fetchAgentReply = (data: AgentParamsType): Promise => { + return request({ + url: '/api/ai-design/chat', + method: 'post', + data, + meta: { responseAll: true } + }) +} + +// 流式对话 +export const fetchAgentReplyStream = async ( + data: AgentParamsType, + onMessage: (chunk: string) => void, + onEnd: () => void +) => { + try { + const params = new URLSearchParams({ + message: data.message, + threadId: data.threadId, + token: data.token, + configParams: JSON.stringify(data.configParams) + }) + + const response = await fetch(`/api/ai-design/chat?${params.toString()}`, { + method: 'GET' + }) + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`) + } + + const reader = response.body?.getReader() + if (!reader) { + throw new Error('Response body is not readable') + } + + const decoder = new TextDecoder() + let buffer = '' + + while (true) { + const { done, value } = await reader.read() + if (done) break + + buffer += decoder.decode(value, { stream: true }) + const lines = buffer.split('\n') + buffer = lines.pop() || '' // 保留不完整的行 + + for (const line of lines) { + console.log('line---', line) + + const trimmedLine = line.trim() + if (trimmedLine.startsWith('data: ')) { + const chunk = trimmedLine.slice(6) + if (chunk === '[DONE]') { + onEnd() + return + } else { + onMessage(chunk) + } + } + } + } + onEnd() + } catch (error) { + console.error('Stream error:', error) + onEnd() + } +} diff --git a/src/assets/css/style.css b/src/assets/css/style.css index 93df8f9..68fce22 100644 --- a/src/assets/css/style.css +++ b/src/assets/css/style.css @@ -29,8 +29,44 @@ body, transform: rotate(360deg); } } -.background-pink { - background-color: #f8f7f5; - background-image: url('@/assets/images/home-bg.png'); - background-size: 100% 100%; +@keyframes opacity-in { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +@keyframes z-index-10to-1 { + 0% { + z-index: 10; + } + 100% { + z-index: -1; + } +} +.flex { + display: flex; +} +.flex-center { + justify-content: center; + align-items: center; +} +.flex-1 { + flex: 1; +} +.flex-col { + flex-direction: column; +} +.align-center { + align-items: center; +} +.space-between { + justify-content: space-between; +} +.justify-center { + justify-content: center; +} +.relative { + position: relative; } diff --git a/src/assets/css/style.less b/src/assets/css/style.less index ea5effa..af9a014 100644 --- a/src/assets/css/style.less +++ b/src/assets/css/style.less @@ -34,41 +34,55 @@ body, } } -.background-pink { - background-color: rgba(248, 247, 245, 1); - background-image: url('@/assets/images/home-bg.png'); - background-size: 100% 100%; +@keyframes opacity-in { + 0% { + opacity: 0; + } + + 100% { + opacity: 1; + } } -.flex{ +@keyframes z-index-10to-1 { + 0% { + z-index: 10; + } + + 100% { + z-index: -1; + } +} + +.flex { display: flex; } -.flex-center{ +.flex-center { justify-content: center; align-items: center; } -.flex-1{ +.flex-1 { flex: 1; } -.flex-col{ +.flex-col { flex-direction: column; } -.align-center{ +.align-center { align-items: center; } -.space-between{ +.space-between { justify-content: space-between; } -.justify-center{ +.justify-center { justify-content: center; } -.relative{ +.relative { position: relative; } \ No newline at end of file diff --git a/src/assets/images/arrow-top-right.png b/src/assets/images/arrow-top-right.png new file mode 100644 index 0000000..b181e81 Binary files /dev/null and b/src/assets/images/arrow-top-right.png differ diff --git a/src/assets/images/home-bg.png b/src/assets/images/home-bg.png deleted file mode 100644 index 2437377..0000000 Binary files a/src/assets/images/home-bg.png and /dev/null differ diff --git a/src/assets/images/nuic/loading.png b/src/assets/images/nuic/loading.png deleted file mode 100644 index 2dfc479..0000000 Binary files a/src/assets/images/nuic/loading.png and /dev/null differ diff --git a/src/assets/images/nuic/xiang.png b/src/assets/images/nuic/xiang.png new file mode 100644 index 0000000..0e42e4a Binary files /dev/null and b/src/assets/images/nuic/xiang.png differ diff --git a/src/lang/en.ts b/src/lang/en.ts index 83fd58e..35681f3 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -1,8 +1,9 @@ export default { + AlphaVersion: '2026 Alpha Version', Login: { - Login: 'Log in', - SignUp: 'Sign up', - LoginTo: 'Log on to', + login: 'Log in', + register: 'Register', + loginTo: 'Log on to FiDA', LoginTitle: 'A multi-agent canvas for rapid, trend driven design iteration.', name: 'Name', email: 'Email', @@ -21,7 +22,7 @@ export default { agreeTermsPolicy: 'I agree to the Terms, Policy and Fees.', noAccountToSignUp: `Don't have an account? Sign up`, - registerFor: 'Register for', + signUpFor: 'Sign up for FiDA', registerTip: 'A multi-agent canvas for rapid, trend driven design iteration.', havenAccountToLogin: `Already have an account? Log in`, verifyEmail: 'Verify your email address', @@ -31,21 +32,23 @@ export default { resendCodeIn: 'Resend Code in {time}', orContinueWith: 'or continue with', googleLogin: 'Sign in with Google', - wechatLogin: 'Sign in with Wechat' + wechatLogin: 'Sign in with Wechat', + indexTip: 'A multi-agent canvas for rapid, trend driven design iteration.', }, Nuic: { - hiName: 'Hi, {name}.', - nuic1Title: `Help Fiphant discover the 'YOU' in your space.`, + hiName: 'Hi, {name}. This is Fiphant.', + nuic1Title: `Help him discover the "YOU" in your space.`, nuic1Tip: `Let's set up your profile. A few quick details will help Fiphant understand
your needs and find exactly what you're looking for.`, letsGo: 'Let’s go, Fiphant!', skip: 'Skip', next: 'Next', - nuic2Title: `What's your dream home vibe ?`, + nuic2Title: `What vibe do you usually go for?`, loadMore: 'Load more', - nuic3Title: `Where are you based? What do you do ?`, + nuic3Title: `Where are you based? What do you do?`, basedIn: 'Based in', role: 'Role', - allSet: 'All set!' + allSet: 'All set!', + loadingTip: 'We’re customizing your dashboard.', }, Home: { creditsNum: 'Credits: {num}', diff --git a/src/stores/userInfo.ts b/src/stores/userInfo.ts index 3ce85a0..096377e 100644 --- a/src/stores/userInfo.ts +++ b/src/stores/userInfo.ts @@ -5,13 +5,13 @@ import { removeLocal, setLocal } from '@/utils/local' import MyEvent from '@/utils/myEvent' export const useUserInfoStore = defineStore('userInfo', () => { const state = ref({ - userInfo: {}, - token: '', - generateParams: { - stylist: '', - sex: '', - stylistImage: '' - } + userInfo: {}, + token: '', + generateParams: { + stylist: '', + sex: '', + stylistImage: '' + } }) // getters diff --git a/src/views/404.vue b/src/views/404.vue index 58f3a8c..aece768 100644 --- a/src/views/404.vue +++ b/src/views/404.vue @@ -1,6 +1,12 @@ @@ -10,6 +16,8 @@ diff --git a/src/views/canvas/components/cards/index.vue b/src/views/canvas/components/cards/index.vue index 5bbe685..a82e11f 100644 --- a/src/views/canvas/components/cards/index.vue +++ b/src/views/canvas/components/cards/index.vue @@ -26,7 +26,6 @@ import To3DModel from './to-3d-model.vue' import AddPrint from './add-print.vue' import ToCAD from './to-cad.vue' - import EditMaterial from './edit-material.vue' const components = [ { diff --git a/src/views/home/agent/components/Agent.vue b/src/views/home/agent/components/Agent.vue index d71e631..0667d73 100644 --- a/src/views/home/agent/components/Agent.vue +++ b/src/views/home/agent/components/Agent.vue @@ -8,16 +8,21 @@
- - + +
@@ -60,6 +236,8 @@ } .agent-body { padding: 3.2rem; + overflow: hidden; + row-gap: 2.4rem; .assist-input-wrapper { width: 100%; height: 14.4rem; diff --git a/src/views/home/agent/components/Item.vue b/src/views/home/agent/components/Item.vue index 6a08846..a1e221d 100644 --- a/src/views/home/agent/components/Item.vue +++ b/src/views/home/agent/components/Item.vue @@ -1,11 +1,16 @@ diff --git a/src/views/home/agent/components/List.vue b/src/views/home/agent/components/List.vue index 50bbddd..ca579e4 100644 --- a/src/views/home/agent/components/List.vue +++ b/src/views/home/agent/components/List.vue @@ -1,29 +1,41 @@ diff --git a/src/views/home/agent/components/Menu.vue b/src/views/home/agent/components/Menu.vue new file mode 100644 index 0000000..254871d --- /dev/null +++ b/src/views/home/agent/components/Menu.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/src/views/home/agent/components/Preview.vue b/src/views/home/agent/components/Preview.vue new file mode 100644 index 0000000..e33b305 --- /dev/null +++ b/src/views/home/agent/components/Preview.vue @@ -0,0 +1,83 @@ + + + + + diff --git a/src/views/home/agent/index.vue b/src/views/home/agent/index.vue index f92a8b9..cdd17ae 100644 --- a/src/views/home/agent/index.vue +++ b/src/views/home/agent/index.vue @@ -1,14 +1,19 @@ diff --git a/src/views/home/components/Input.vue b/src/views/home/components/Input.vue index 4d37ea8..652e783 100644 --- a/src/views/home/components/Input.vue +++ b/src/views/home/components/Input.vue @@ -22,6 +22,7 @@ :placeholder="$t('Input.placeholder')" @input="handleEditorInput" @paste="handleEditorPaste" + @keypress="handleKeyPress" >
{ - emits('send', inputValue.value) - // 发送后清空输入框 - if(editorRef.value){ - editorRef.value.innerHTML = '' - } - inputValue.value = '' - } + const handleKeyPress = (e) => { + // 检测回车 + if (e.key === 'Enter' && !e.shiftKey) { + e.preventDefault() + handleSendAgent() + } + } + + const handleSendAgent = () => { + if (!inputValue.value.trim()) return + emits('send', { text: inputValue.value.trim(), images: uploadedImages.value }) + // 发送后清空输入框 + if (editorRef.value) { + editorRef.value.innerHTML = '' + } + inputValue.value = '' + } // 监听 inputValue 外部变化 watch(inputValue, () => { nextTick(() => { @@ -314,7 +324,6 @@ onMounted(() => { autoResizeEditor() }) - const typeValue = ref('') const areaValue = ref('') @@ -598,7 +607,7 @@ .agent { padding: 1.2rem; box-shadow: none; - border-radius: 1.5rem; + border-radius: 1.5rem; border: 0.1rem solid #0000001a; .scroll-content { padding: 0; @@ -611,7 +620,7 @@ min-height: initial; max-height: initial; padding: 0; - height: 100%; + height: 100%; } } .operate { diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 7577dbf..86057fc 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -1,5 +1,14 @@