Просмотр исходного кода

💄 style(ui): hide scrollbars across chat interface and request editor

Hide y-axis scrollbars to provide a cleaner UI experience while maintaining
scroll functionality through mouse wheel and keyboard navigation.

Changes include:
- Hide scrollbars in CustomRequestEditor TextArea component
- Hide scrollbars in chat container and all related chat components
- Hide scrollbars in thinking content areas
- Add cross-browser compatibility for scrollbar hiding
- Maintain scroll functionality while improving visual aesthetics

Components affected:
- CustomRequestEditor.js: Added custom-request-textarea class
- index.css: Updated scrollbar styles for chat, thinking, and editor areas

The interface now provides a more streamlined appearance consistent with
modern UI design patterns while preserving all interactive capabilities.
Apple\Apple 9 месяцев назад
Родитель
Сommit
9fb9dfb905

+ 1 - 1
web/src/components/playground/ChatArea.js

@@ -39,7 +39,7 @@ const ChatArea = ({
   return (
   return (
     <Card
     <Card
       className="!rounded-2xl h-full"
       className="!rounded-2xl h-full"
-      bodyStyle={{ padding: 0, height: 'calc(100vh - 101px)', display: 'flex', flexDirection: 'column', overflow: 'hidden' }}
+      bodyStyle={{ padding: 0, height: 'calc(100vh - 108px)', display: 'flex', flexDirection: 'column', overflow: 'hidden' }}
     >
     >
       {/* 聊天头部 */}
       {/* 聊天头部 */}
       {styleState.isMobile ? (
       {styleState.isMobile ? (

+ 1 - 8
web/src/components/playground/CustomRequestEditor.js

@@ -1,12 +1,10 @@
 import React, { useState, useEffect } from 'react';
 import React, { useState, useEffect } from 'react';
 import {
 import {
-  Card,
   TextArea,
   TextArea,
   Typography,
   Typography,
   Button,
   Button,
   Switch,
   Switch,
   Banner,
   Banner,
-  Tag,
 } from '@douyinfe/semi-ui';
 } from '@douyinfe/semi-ui';
 import {
 import {
   Code,
   Code,
@@ -104,11 +102,6 @@ const CustomRequestEditor = ({
           <Typography.Text strong className="text-sm">
           <Typography.Text strong className="text-sm">
             自定义请求体模式
             自定义请求体模式
           </Typography.Text>
           </Typography.Text>
-          {customRequestMode && (
-            <Tag color="green" size="small" shape='circle'>
-              已启用
-            </Tag>
-          )}
         </div>
         </div>
         <Switch
         <Switch
           checked={customRequestMode}
           checked={customRequestMode}
@@ -171,7 +164,7 @@ const CustomRequestEditor = ({
               onChange={handleValueChange}
               onChange={handleValueChange}
               placeholder='{"model": "gpt-4o", "messages": [...], ...}'
               placeholder='{"model": "gpt-4o", "messages": [...], ...}'
               autosize={{ minRows: 8, maxRows: 20 }}
               autosize={{ minRows: 8, maxRows: 20 }}
-              className={`!rounded-lg font-mono text-sm ${!isValid ? '!border-red-500' : ''}`}
+              className={`custom-request-textarea !rounded-lg font-mono text-sm ${!isValid ? '!border-red-500' : ''}`}
               style={{
               style={{
                 fontFamily: 'Consolas, Monaco, "Courier New", monospace',
                 fontFamily: 'Consolas, Monaco, "Courier New", monospace',
                 lineHeight: '1.5',
                 lineHeight: '1.5',

+ 40 - 23
web/src/index.css

@@ -183,25 +183,37 @@ code {
   overflow-x: hidden !important;
   overflow-x: hidden !important;
 }
 }
 
 
-.semi-chat-container {
-  overflow-x: hidden !important;
+/* 隐藏所有聊天相关区域的滚动条 */
+.semi-chat::-webkit-scrollbar,
+.semi-chat-chatBox::-webkit-scrollbar,
+.semi-chat-chatBox-wrap::-webkit-scrollbar,
+.semi-chat-chatBox-content::-webkit-scrollbar,
+.semi-chat-content::-webkit-scrollbar,
+.semi-chat-list::-webkit-scrollbar {
+  display: none;
 }
 }
 
 
-.semi-chat-container::-webkit-scrollbar {
-  width: 4px;
+.semi-chat,
+.semi-chat-chatBox,
+.semi-chat-chatBox-wrap,
+.semi-chat-chatBox-content,
+.semi-chat-content,
+.semi-chat-list {
+  -ms-overflow-style: none;
+  scrollbar-width: none;
 }
 }
 
 
-.semi-chat-container::-webkit-scrollbar-thumb {
-  background: rgba(0, 0, 0, 0.1);
-  border-radius: 2px;
+.semi-chat-container {
+  overflow-x: hidden !important;
 }
 }
 
 
-.semi-chat-container::-webkit-scrollbar-thumb:hover {
-  background: rgba(0, 0, 0, 0.15);
+.semi-chat-container::-webkit-scrollbar {
+  display: none;
 }
 }
 
 
-.semi-chat-container::-webkit-scrollbar-track {
-  background: transparent;
+.semi-chat-container {
+  -ms-overflow-style: none;
+  scrollbar-width: none;
 }
 }
 
 
 /* 隐藏模型设置区域的滚动条 */
 /* 隐藏模型设置区域的滚动条 */
@@ -216,26 +228,31 @@ code {
 
 
 /* 思考内容区域滚动条样式 */
 /* 思考内容区域滚动条样式 */
 .thinking-content-scroll::-webkit-scrollbar {
 .thinking-content-scroll::-webkit-scrollbar {
-  width: 6px;
-  height: 6px;
+  display: none;
 }
 }
 
 
-.thinking-content-scroll::-webkit-scrollbar-thumb {
-  background: rgba(0, 0, 0, 0.2);
-  border-radius: 3px;
+.thinking-content-scroll {
+  -ms-overflow-style: none;
+  scrollbar-width: none;
 }
 }
 
 
-.thinking-content-scroll::-webkit-scrollbar-thumb:hover {
-  background: rgba(0, 0, 0, 0.3);
+/* 隐藏请求体 JSON TextArea 的滚动条 */
+.custom-request-textarea .semi-input::-webkit-scrollbar {
+  display: none;
 }
 }
 
 
-.thinking-content-scroll::-webkit-scrollbar-track {
-  background: transparent;
+.custom-request-textarea .semi-input {
+  -ms-overflow-style: none;
+  scrollbar-width: none;
 }
 }
 
 
-.thinking-content-scroll {
-  scrollbar-width: thin;
-  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
+.custom-request-textarea textarea::-webkit-scrollbar {
+  display: none;
+}
+
+.custom-request-textarea textarea {
+  -ms-overflow-style: none;
+  scrollbar-width: none;
 }
 }
 
 
 /* 调试面板标签样式 */
 /* 调试面板标签样式 */

+ 2 - 2
web/src/pages/Playground/index.js

@@ -363,7 +363,7 @@ const Playground = () => {
               flexShrink: 0,
               flexShrink: 0,
               minWidth: styleState.isMobile ? '100%' : 320,
               minWidth: styleState.isMobile ? '100%' : 320,
               maxWidth: styleState.isMobile ? '100%' : 320,
               maxWidth: styleState.isMobile ? '100%' : 320,
-              height: styleState.isMobile ? 'auto' : 'calc(100vh - 100px)',
+              height: styleState.isMobile ? 'auto' : 'calc(100vh - 106px)',
               overflow: 'auto',
               overflow: 'auto',
               position: styleState.isMobile ? 'fixed' : 'relative',
               position: styleState.isMobile ? 'fixed' : 'relative',
               zIndex: styleState.isMobile ? 1000 : 1,
               zIndex: styleState.isMobile ? 1000 : 1,
@@ -400,7 +400,7 @@ const Playground = () => {
         )}
         )}
 
 
         <Layout.Content className="relative flex-1 overflow-hidden">
         <Layout.Content className="relative flex-1 overflow-hidden">
-          <div className="sm:px-4 overflow-hidden flex flex-col lg:flex-row gap-2 sm:gap-4 h-[calc(100vh-100px)]">
+          <div className="sm:px-4 overflow-hidden flex flex-col lg:flex-row gap-2 sm:gap-4 h-[calc(100vh-106px)]">
             <div className="flex-1 flex flex-col">
             <div className="flex-1 flex flex-col">
               <ChatArea
               <ChatArea
                 chatRef={chatRef}
                 chatRef={chatRef}