-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Integrated Alibaba Cloud's BaiLian model (#67) * fix upload pnpm lock file * fix: 修复打包不成功的问题 * fix: 修复pnpm lock文件的样式问题 * fix: 修复pnpm lock文件的样式问题 --------- Co-authored-by: 周欣愉 <[email protected]>
- Loading branch information
1 parent
4a97823
commit 83a0bb9
Showing
16 changed files
with
428 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
MODEL_API_BASE_URL=https://dashscope.aliyuncs.com/api/v1/apps/ | ||
|
||
QWEN_APP_ID= | ||
QWEN_AUTH= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
MODEL_API_BASE_URL=https://dashscope.aliyuncs.com/api/v1/apps/ | ||
|
||
QWEN_APP_ID= | ||
QWEN_AUTH= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,4 @@ yarn-error.log* | |
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
*storybook.log | ||
*storybook.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
import React from 'react'; | ||
|
||
import { ChatLayout } from '@/components/ai/chat/chat-layout'; | ||
|
||
const AI = () => { | ||
return <div>AI</div>; | ||
return ( | ||
<div className="h-full pb-2"> | ||
<ChatLayout /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default AI; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { FileImage, Paperclip, Send } from 'lucide-react'; | ||
import React, { useRef, useState } from 'react'; | ||
import { AnimatePresence, motion } from 'framer-motion'; | ||
|
||
import { Message, loggedInUserData } from './data'; | ||
import { Textarea } from './textarea'; | ||
|
||
interface ChatBottombarProps { | ||
sendMessage: (newMessage: Message) => void; | ||
} | ||
|
||
export const BottombarIcons = [{ icon: FileImage }, { icon: Paperclip }]; | ||
|
||
export default function ChatBottombar({ sendMessage }: ChatBottombarProps) { | ||
const [message, setMessage] = useState(''); | ||
const inputRef = useRef<HTMLTextAreaElement>(null); | ||
|
||
const handleInputChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => { | ||
setMessage(event.target.value); | ||
}; | ||
|
||
const handleSend = () => { | ||
if (message.trim()) { | ||
const newMessage: Message = { | ||
id: Date.now(), | ||
name: loggedInUserData.name, | ||
avatar: loggedInUserData.avatar, | ||
sessionId: loggedInUserData.sessionId, | ||
message: message.trim(), | ||
}; | ||
sendMessage(newMessage); | ||
setMessage(''); | ||
|
||
if (inputRef.current) { | ||
inputRef.current.focus(); | ||
} | ||
} | ||
}; | ||
|
||
const handleKeyPress = (event: React.KeyboardEvent<HTMLTextAreaElement>) => { | ||
if (event.key === 'Enter' && !event.shiftKey) { | ||
event.preventDefault(); | ||
handleSend(); | ||
} | ||
|
||
if (event.key === 'Enter' && event.shiftKey) { | ||
event.preventDefault(); | ||
setMessage((prev) => prev + '\n'); | ||
} | ||
}; | ||
|
||
return ( | ||
<div className="p-2 flex justify-between w-full items-center gap-2"> | ||
<AnimatePresence initial={false}> | ||
<motion.div | ||
key="input" | ||
className="flex items-center justify-around gap-2 w-full relative" | ||
layout | ||
initial={{ opacity: 0, scale: 1 }} | ||
animate={{ opacity: 1, scale: 1 }} | ||
exit={{ opacity: 0, scale: 1 }} | ||
transition={{ | ||
opacity: { duration: 0.05 }, | ||
layout: { | ||
type: 'spring', | ||
bounce: 0.15, | ||
}, | ||
}} | ||
> | ||
<Textarea | ||
autoComplete="off" | ||
value={message} | ||
ref={inputRef} | ||
onKeyDown={handleKeyPress} | ||
onChange={handleInputChange} | ||
name="message" | ||
placeholder="Aa" | ||
className="w-full border rounded-full flex items-center h-9 resize-none overflow-hidden bg-background" | ||
></Textarea> | ||
<Send onClick={handleSend} /> | ||
</motion.div> | ||
</AnimatePresence> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.