diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index cb5ed218d..423af5943 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,32 +1,29 @@ -This software is licensed under the **Apache License 2.0**. In addition to the terms of the Apache License 2.0, the following additional terms apply to the use of Cherry Studio: +# Code of Conduct -**I. Commercial Use License** +## Our Pledge -1. **Free Commercial Use**: Users can use the software for commercial purposes without modifying the code. -2. **Commercial License Required**: A commercial license is required if any of the following conditions are met: - 1. You modify, develop, or alter the software, including but not limited to changes to the application name, logo, code, or functionality. - 2. You provide multi-tenant services to enterprise customers with 10 or more users. - 3. You pre-install or integrate the software into hardware devices or products and bundle it for sale. - 4. You are engaging in large-scale procurement for government or educational institutions, especially involving security, data privacy, or other sensitive requirements. +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. -**II. Contributor Agreement** +## Our Standards -As a contributor to Cherry Studio, you agree to the following: +Examples of behavior that contributes to creating a positive environment include: -1. **License Adjustment**: The producer reserves the right to adjust the open-source license as needed, making it stricter or more lenient. -2. **Commercial Use**: Any code you contribute may be used for commercial purposes, including but not limited to cloud business operations. +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members -**III. Other Terms** +Examples of unacceptable behavior by participants include: -1. The interpretation of these terms is subject to the discretion of Cherry Studio developers. -2. These terms may be updated, and users will be notified through the software when changes occur. +- The use of sexualized language or imagery and unwelcome sexual attention or advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting -For any questions or to request a commercial license, please contact the Cherry Studio development team. +## Our Responsibilities -Apart from the specific conditions mentioned above, all other rights and restrictions follow the Apache License 2.0. Detailed information about the Apache License 2.0 can be found at http://www.apache.org/licenses/LICENSE-2.0. +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. ---- - -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. \ No newline at end of file +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. diff --git a/README.md b/README.md index 4a5af6d6b..5ca86429d 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@
- English | 中文 | 日本語 + English | 中文 | 日本語
# 🍒 Cherry Studio diff --git a/README.ja.md b/docs/README.ja.md similarity index 100% rename from README.ja.md rename to docs/README.ja.md diff --git a/README.zh.md b/docs/README.zh.md similarity index 100% rename from README.zh.md rename to docs/README.zh.md diff --git a/docs/dev/faq.md b/docs/dev/faq.md deleted file mode 100644 index 05b254a37..000000000 --- a/docs/dev/faq.md +++ /dev/null @@ -1,95 +0,0 @@ -# FAQ 文档 -本文档适用于:产品手册、官网页面、课程测验、现场 Q&A。 - -## 问题1:Cherry Studio 支持哪些操作系统? -- **答案**:Cherry Studio 支持 Windows、Mac 和 Linux 操作系统。 - -## 问题2:Cherry Studio 的主要功能有哪些? -- **答案**:Cherry Studio 的主要功能包括: - 1. 支持多个 LLM 提供商 - 2. 允许创建多个助手 - 3. 支持创建多个主题 - 4. 允许在同一对话中使用多个模型来回答问题 - 5. 支持拖放排序 - 6. 代码高亮 - 7. Mermaid 图表支持 - -## 问题3:Cherry Studio 的主要目录结构是怎样的? -- **答案**:Cherry Studio 的主要目录结构如下: - - `/src`: 主要源代码目录 - - `/build`: 构建相关文件 - - `/docs`: 文档目录 - - `/resources`: 资源文件目录 - - `/scripts`: 脚本文件目录 - -## 问题4:如何在 Windows 环境下 fork Cherry Studio 并修改部分功能? -- **答案**:在 Windows 环境下 fork Cherry Studio 并修改部分功能的步骤如下: - 1. 在 GitHub 上 fork Cherry Studio 仓库 - 2. 克隆 fork 的仓库到本地:`git clone https://github.com/your-username/cherry-studio.git` - 3. 进入项目目录:`cd cherry-studio` - 4. 安装依赖:`yarn install` - 5. 修改所需的功能代码 - 6. 测试修改:`yarn dev` - 7. 提交修改:`git add .` 和 `git commit -m "描述你的修改"` - 8. 推送到你的 fork 仓库:`git push origin main` - -## 问题5:Cherry Studio 使用了哪些主要技术栈? -- **答案**:Cherry Studio 主要使用了以下技术栈: - - TypeScript - - SCSS - - Electron - - Vite - - Sequelize - -## 问题6:如何贡献代码到 Cherry Studio 项目? -- **答案**:贡献代码到 Cherry Studio 项目的步骤如下: - 1. Fork 项目仓库 - 2. 创建你的特性分支:`git checkout -b feature/AmazingFeature` - 3. 提交你的修改:`git commit -m 'Add some AmazingFeature'` - 4. 推送到分支:`git push origin feature/AmazingFeature` - 5. 打开一个 Pull Request - -## 问题7:Cherry Studio 的 `/src` 目录主要包含哪些内容? -- **答案**:Cherry Studio 的 `/src` 目录主要包含以下内容: - - 主进程代码(Electron 主进程) - - 渲染进程代码(用户界面) - - 组件 - - 工具函数 - - 状态管理 - - 样式文件 - -## 问题8:如何在 Cherry Studio 中添加新的 LLM 提供商? -- **答案**:要在 Cherry Studio 中添加新的 LLM 提供商,你需要: - 1. 在 `/src/services` 或类似目录下创建新的服务文件 - 2. 实现与新 LLM 提供商 API 的集成 - 3. 在用户界面中添加新提供商的选项 - 4. 更新配置和状态管理以支持新提供商 - -## 问题9:Cherry Studio 的构建过程是怎样的? -- **答案**:Cherry Studio 的构建过程主要包括: - 1. 使用 Vite 构建前端资源 - 2. 使用 Electron Builder 打包桌面应用 - 3. 根据不同平台(Windows、Mac、Linux)生成相应的安装包 - -## 问题10:如何在 Cherry Studio 中实现新的 UI 主题? -- **答案**:在 Cherry Studio 中实现新的 UI 主题的步骤: - 1. 在 `/src/styles` 目录下创建新的主题 SCSS 文件 - 2. 定义新主题的颜色变量和样式 - 3. 在主样式文件中导入新主题 - 4. 更新主题切换逻辑以包含新主题 - 5. 在用户界面中添加新主题的选项 - -## 问题11:Cherry Studio 如何处理多语言支持? -- **答案**:Cherry Studio 可能通过以下方式处理多语言支持: - 1. 使用 i18n 库进行国际化 - 2. 在 `/src/locales` 或类似目录下存储不同语言的翻译文件 - 3. 实现语言切换功能 - 4. 在组件中使用翻译函数或组件来显示多语言文本 - -## 问题12:如何为 Cherry Studio 编写单元测试? -- **答案**:为 Cherry Studio 编写单元测试的步骤: - 1. 在 `/tests` 目录下创建测试文件 - 2. 使用测试框架(如 Jest)编写测试用例 - 3. 模拟 Electron 环境和其他依赖 - 4. 运行测试命令:`yarn test` - 5. 确保测试覆盖主要功能和组件 diff --git a/docs/dev/structure.md b/docs/dev/structure.md deleted file mode 100644 index ee5eea7d8..000000000 --- a/docs/dev/structure.md +++ /dev/null @@ -1,72 +0,0 @@ -## Cherry Studio目录结构和功能 - -### 1. `/src`: 主要源代码目录 - - ** `/main`**: Electron主进程相关代码 - - 负责应用的生命周期管理、窗口创建、IPC通信等 - - ** `/renderer`**: Electron渲染进程相关代码 - - 包含用户界面的实现,使用TypeScript和SCSS - - ** `/preload`**: 预加载脚本 - - 用于在渲染进程中安全地暴露主进程功能 - - ** `/components`**: React组件 - - 可复用的UI组件,如对话框、输入框等 - - ** `/pages`**: 应用的主要页面 - - 如聊天界面、设置页面等 - - ** `/store`**: 状态管理 - - 可能使用Redux或MobX来管理应用状态 - - ** `/utils`**: 工具函数 - - 包含各种辅助函数和工具类 - - ** `/styles`**: 全局样式文件 - - 包含SCSS文件,定义全局样式和主题 - -### 2. `/public`: 静态资源目录 - - 包含图标、字体等静态文件 - -### 3. `/electron`: Electron相关配置 - - 包含Electron的构建和打包配置 - -### 4. `/scripts`: 构建和开发脚本 - - 包含npm脚本,用于开发、构建和部署 - -### 5. `/types`: TypeScript类型定义 - - 包含自定义的类型定义文件 - -### 6. `/tests`: 测试文件目录 - - 包含单元测试和集成测试 - -### 7. `/docs`: 文档目录 - - 包含项目文档、API文档等 - -### 8. `/config`: 配置文件目录 - - 包含各种配置文件,如webpack配置、环境变量等 - -### 9. `/migrations`: 数据库迁移文件 - - 由于使用了Sequelize,这里可能包含数据库结构的变更记录 - -### 10. `/models`: 数据模型 - - 定义Sequelize的数据模型,对应数据库表结构 - -## 主要功能实现 - -### 1. LLM提供商集成 - - 可能在`/src/utils`或`/src/services`中实现与不同LLM API的集成 - -### 2. 多助手和多主题支持 - - 在`/src/store`中管理助手和主题的状态 - - 在`/src/components`中实现相关的UI组件 - -### 3. 多模型对话 - - 在`/src/pages`的聊天界面中实现 - - 可能使用`/src/store`来管理对话状态 - -### 4. 拖放排序 - - 在`/src/components`中实现相关的可拖拽组件 - -### 5. 代码高亮 - - 可能使用第三方库,如Prism.js,集成在`/src/components`中 - -### 6. Mermaid图表支持 - - 在`/src/components`中集成Mermaid库 - -### 7. 数据持久化 - - 使用Sequelize在`/models`中定义数据模型 - - 在`/migrations`中管理数据库结构变更 diff --git a/electron-builder.yml b/electron-builder.yml index f12e99ae3..f078642fe 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -63,6 +63,6 @@ electronDownload: afterSign: scripts/notarize.js releaseInfo: releaseNotes: | + 修复滚动条显示问题 增加数学公式渲染引擎切换 - 多个系统滚动条样式统一 修复添加默认助手会添加两个 diff --git a/src/renderer/src/assets/styles/index.scss b/src/renderer/src/assets/styles/index.scss index 77232fda2..5236949a0 100644 --- a/src/renderer/src/assets/styles/index.scss +++ b/src/renderer/src/assets/styles/index.scss @@ -136,6 +136,7 @@ html, body, #root { height: 100%; + width: 100%; margin: 0; } diff --git a/src/renderer/src/pages/home/HomePage.tsx b/src/renderer/src/pages/home/HomePage.tsx index 63cc6c006..fd15acab7 100644 --- a/src/renderer/src/pages/home/HomePage.tsx +++ b/src/renderer/src/pages/home/HomePage.tsx @@ -52,6 +52,7 @@ const Container = styled.div` display: flex; flex: 1; flex-direction: column; + max-width: calc(100vw - var(--sidebar-width)); ` const ContentContainer = styled.div` diff --git a/src/renderer/src/pages/home/Messages/Messages.tsx b/src/renderer/src/pages/home/Messages/Messages.tsx index 9227f585d..1c4c00234 100644 --- a/src/renderer/src/pages/home/Messages/Messages.tsx +++ b/src/renderer/src/pages/home/Messages/Messages.tsx @@ -36,7 +36,7 @@ const Messages: FC = ({ assistant, topic, setActiveTopic }) => { const showRightTopics = showTopics && topicPosition === 'right' const minusAssistantsWidth = showAssistants ? '- var(--assistants-width)' : '' const minusRightTopicsWidth = showRightTopics ? '- var(--assistants-width)' : '' - return `calc(100vw - var(--sidebar-width) ${minusAssistantsWidth} ${minusRightTopicsWidth}` + return `calc(100vw - var(--sidebar-width) ${minusAssistantsWidth} ${minusRightTopicsWidth} - 5px)` }, [showAssistants, showTopics, topicPosition]) const onSendMessage = useCallback( @@ -220,7 +220,12 @@ const Messages: FC = ({ assistant, topic, setActiveTopic }) => { }, [assistant, messages]) return ( - + {lastMessage && } {reverse([...messages]).map((message, index) => ( @@ -245,7 +250,6 @@ const Container = styled(Scrollbar)` background-color: var(--color-background); padding-bottom: 20px; overflow-x: hidden; - margin-right: 3px; ` export default Messages diff --git a/src/renderer/src/pages/home/Tabs/Topics.tsx b/src/renderer/src/pages/home/Tabs/Topics.tsx index 755187360..5e1227f5f 100644 --- a/src/renderer/src/pages/home/Tabs/Topics.tsx +++ b/src/renderer/src/pages/home/Tabs/Topics.tsx @@ -36,7 +36,7 @@ const Topics: FC = ({ assistant: _assistant, activeTopic, setActiveTopic const { assistant, removeTopic, moveTopic, updateTopic, updateTopics } = useAssistant(_assistant.id) const { t } = useTranslation() const generating = useAppSelector((state) => state.runtime.generating) - const { showTopicTime } = useSettings() + const { showTopicTime, topicPosition } = useSettings() const borderRadius = showTopicTime ? 12 : 17 @@ -178,7 +178,7 @@ const Topics: FC = ({ assistant: _assistant, activeTopic, setActiveTopic ) return ( - + {(topic) => { const isActive = topic.id === activeTopic?.id diff --git a/src/renderer/src/pages/home/Tabs/index.tsx b/src/renderer/src/pages/home/Tabs/index.tsx index 598be651e..50532b7db 100644 --- a/src/renderer/src/pages/home/Tabs/index.tsx +++ b/src/renderer/src/pages/home/Tabs/index.tsx @@ -147,7 +147,8 @@ const HomeTabs: FC = ({ activeAssistant, activeTopic, setActiveAssistant, const Container = styled.div` display: flex; flex-direction: column; - width: var(--assistants-width); + max-width: var(--assistants-width); + min-width: var(--assistants-width); height: calc(100vh - var(--navbar-height)); overflow: hidden; .collapsed {