Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aaa #785

Closed
wants to merge 61 commits into from
Closed

aaa #785

Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
ef45e66
feat: 更新了@babel包中的多个依赖包版本,包括@babel/helper-create-class-features-plugi…
zyh320888 Oct 11, 2024
4baf31d
feat: 添加对新特性(API)的修改;
zyh320888 Oct 11, 2024
08fc526
feat: 添加OpenAI模型API
zyh320888 Oct 11, 2024
228567b
增加 cn readme
zyh320888 Oct 14, 2024
7538898
Merge branch 'stackblitz:main' into main
zyh320888 Oct 18, 2024
19cf6de
feat(chat): 更新聊天组件,支持模板选择和更本地化的体验
zyh320888 Oct 19, 2024
8bd3f9f
docs
zyh320888 Oct 19, 2024
2413963
feat(docs): 添加上下文提供模块文档
zyh320888 Oct 19, 2024
b961c34
feat(docs): 更新开发者指南中的错误和过时信息
zyh320888 Oct 19, 2024
410295c
feat(docs): 更新任务执行模块文档,添加使用示例和注意事项
zyh320888 Oct 19, 2024
8c227d0
feat(docs): 添加任务执行与终端交互文档
zyh320888 Oct 19, 2024
e739938
feat(docs): 更新开发者指南,简化上下文提供模块描述
zyh320888 Oct 19, 2024
5b64cc4
docs: 更新了文档《如何使用 ContextProvider》
zyh320888 Oct 19, 2024
884d546
docs
zyh320888 Oct 19, 2024
bea2de3
u
zyh320888 Oct 19, 2024
6d23441
docs
zyh320888 Oct 19, 2024
81d6d05
feat(chat): 更新聊天组件和头部标题
zyh320888 Oct 21, 2024
ebb227f
feat: 更新了@types/react-dom和@radix-ui下的多个依赖包的版本,使其与react和react-dom的版本一致
zyh320888 Oct 21, 2024
c550e6b
feat(api): 添加使用模拟数据的功能
zyh320888 Oct 22, 2024
f15f693
feat(api): 重构API以支持模拟数据和AI服务
zyh320888 Oct 22, 2024
052bc6e
feat: 更新了包的依赖关系和版本
zyh320888 Oct 22, 2024
fd34ac2
feat: 修改数据库迁移脚本和模型,创建用户表并定义User模型
zyh320888 Oct 22, 2024
e565160
feat: 更新数据库配置
zyh320888 Oct 22, 2024
f9368b7
db
zyh320888 Oct 22, 2024
663bc4c
db
zyh320888 Oct 22, 2024
cd5b624
feat: 更新了部分依赖包的开发状态标记
zyh320888 Oct 22, 2024
b2b4df1
feat: 添加登录和注册按钮功能
zyh320888 Oct 22, 2024
a88c5f0
feat: 更新登录和注册对话框组件
zyh320888 Oct 22, 2024
2da57de
feat: 更新登录和注册表单以支持手机号登录
zyh320888 Oct 22, 2024
a7a7bf7
feat: 移除手机号验证功能
zyh320888 Oct 22, 2024
21b1d92
feat: 添加新的依赖包和更新部分依赖
zyh320888 Oct 22, 2024
2ffa0b6
feat(auth): 优化注册头像上传及用户注册流程
zyh320888 Oct 22, 2024
f51a635
feat: 添加头像预览功能
zyh320888 Oct 22, 2024
7c74732
feat: 增加注册表单错误处理和加载状态
zyh320888 Oct 22, 2024
e9ed7c9
feat: 增加用户头像和昵称显示功能
zyh320888 Oct 22, 2024
b3afb9c
feat(ui): 增加头像组件错误处理功能
zyh320888 Oct 22, 2024
484d65c
feat: 修改了Avatar组件的默认头像路径和uploadToOSS函数返回的文件URL格式。
zyh320888 Oct 22, 2024
8ae3280
feat(Avatar): 优化Avatar组件图片加载逻辑,增强用户体验
zyh320888 Oct 22, 2024
3955a13
feat(Avatar): 更新Avatar组件以使用环境变量
zyh320888 Oct 22, 2024
2cd653b
feat: 修改登录功能以支持手机号登录
zyh320888 Oct 22, 2024
7dad0ed
feat(auth): 优化注册登录功能,调整头像组件
zyh320888 Oct 22, 2024
3515ead
feat(auth): 添加登录组件关闭功能
zyh320888 Oct 22, 2024
0cef032
feat: 移除了登录导航功能
zyh320888 Oct 22, 2024
7018ede
feat: 修改服务器响应头设置
zyh320888 Oct 22, 2024
df93f0d
feat(header): 重构用户头像展示为用户菜单
zyh320888 Oct 22, 2024
26fa196
feat: 重构用户菜单组件,引入新的对话框组件以替代链接跳转方式,优化用户交互体验。
zyh320888 Oct 22, 2024
375a302
feat(auth): 添加订阅对话框组件
zyh320888 Oct 22, 2024
b0bae22
feat(auth): 添加订阅管理功能,包括订阅计划和订阅购买
zyh320888 Oct 22, 2024
7c0932e
feat: 添加订阅购买API功能
zyh320888 Oct 22, 2024
2c38701
feat: 修改订阅对话框组件和订阅API,优化了订阅流程
zyh320888 Oct 22, 2024
4bb2c08
feat: 更新订阅对话框组件以支持用户登录状态和订阅信息获取
zyh320888 Oct 22, 2024
c40589c
feat: 更新认证组件以支持登录注册成功后的回调功能
zyh320888 Oct 22, 2024
f070ec2
feat(auth): 添加代币充值功能
zyh320888 Oct 22, 2024
9c3fe2a
feat: 实现聊天功能并优化支付通知处理
zyh320888 Oct 22, 2024
70bbed7
feat(config): 修改数据库端口配置
zyh320888 Oct 22, 2024
fa87bd7
feat(chat): 添加代币余额不足错误提示与订阅对话框
zyh320888 Oct 22, 2024
f8c0f5e
feat(auth): 登录注册对话框增加登录成功和注册成功后的回调函数
zyh320888 Oct 22, 2024
4064317
feat: 增加会话ID和消息记录功能
zyh320888 Oct 22, 2024
68cccbb
feat: 更新用户订阅API以获取用户订阅信息和余额
zyh320888 Oct 22, 2024
cd3a79e
feat: 更新支付modal和订阅对话框的逻辑和接口
zyh320888 Oct 22, 2024
bf1d6cb
feat: 增加认证机制以安全地查询支付状态
zyh320888 Oct 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(Avatar): 优化Avatar组件图片加载逻辑,增强用户体验
zyh320888 committed Oct 22, 2024
commit 8ae3280bbd5d6708ca6e8c4c41fb32c2081fecbc
6 changes: 3 additions & 3 deletions app/components/ui/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import { useState } from 'react';

interface AvatarProps {
src: string;
@@ -7,13 +7,13 @@ interface AvatarProps {
}

export function Avatar({ src, alt, className = '' }: AvatarProps) {
const [imgSrc, setImgSrc] = useState(src);
const [imgSrc, setImgSrc] = useState(src.startsWith('http') ? src : `${window.ENV.OSS_HOST}${src}`);
const [error, setError] = useState(false);

const handleError = () => {
setError(true);
// 设置一个默认的头像 URL
setImgSrc('/avatars/default-avatar.png');
setImgSrc(`${window.ENV.OSS_HOST}/avatars/default-avatar.png`);
};

return (
21 changes: 18 additions & 3 deletions app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { useStore } from '@nanostores/react';
import type { LinksFunction } from '@remix-run/cloudflare';
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from '@remix-run/react';
import type { LinksFunction, LoaderFunction } from '@remix-run/cloudflare';
import { json } from '@remix-run/cloudflare';
import { Links, Meta, Outlet, Scripts, ScrollRestoration, useLoaderData } from '@remix-run/react';
import tailwindReset from '@unocss/reset/tailwind-compat.css?url';
import { themeStore } from './lib/stores/theme';
import { stripIndents } from './utils/stripIndent';
import { createHead } from 'remix-island';
import { useEffect } from 'react';
import { env } from 'node:process';

import reactToastifyStyles from 'react-toastify/dist/ReactToastify.css?url';
import globalStyles from './styles/index.scss?url';
@@ -62,9 +64,17 @@ export const Head = createHead(() => (
</>
));

export const loader: LoaderFunction = async () => {
return json({
ENV: {
OSS_HOST: env.VITE_OSS_BASE_URL,
},
});
};

export function Layout({ children }: { children: React.ReactNode }) {
const theme = useStore(themeStore);

const data = useLoaderData<typeof loader>() as { ENV: { OSS_HOST: string } };
useEffect(() => {
document.querySelector('html')?.setAttribute('data-theme', theme);
}, [theme]);
@@ -73,6 +83,11 @@ export function Layout({ children }: { children: React.ReactNode }) {
<>
{children}
<ScrollRestoration />
<script
dangerouslySetInnerHTML={{
__html: `window.ENV = ${JSON.stringify(data.ENV)}`,
}}
/>
<Scripts />
</>
);