@douyinfe/semi-foundation 2.90.0 → 2.90.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,70 @@
1
+ @import './variables.scss';
2
+
3
+ $module: #{$prefix}-client-ai;
4
+
5
+ .#{$module} {
6
+ &-wrapper {
7
+ padding: $spacing-clientAI-wrapper-padding;
8
+ max-width: $width-clientAI-wrapper-max;
9
+ margin: 0 auto;
10
+ min-height: $height-clientAI-wrapper-min;
11
+ height: $height-clientAI-wrapper-min;
12
+ display: flex;
13
+ flex-direction: column;
14
+ }
15
+
16
+ &-loading {
17
+ padding: $spacing-clientAI-loading-paddingY $spacing-clientAI-loading-paddingX !important;
18
+ display: flex !important;
19
+ flex-direction: column !important;
20
+ justify-content: center !important;
21
+ align-items: center !important;
22
+ min-height: $height-clientAI-loading-min !important;
23
+ gap: $spacing-clientAI-loading-gap;
24
+ }
25
+
26
+ &-loading-content {
27
+ width: 100%;
28
+ max-width: $width-clientAI-loading-content-max;
29
+ display: flex;
30
+ flex-direction: column;
31
+ gap: $spacing-clientAI-loading-content-gap;
32
+ }
33
+
34
+ &-loading-text {
35
+ text-align: center;
36
+ font-size: $font-clientAI-loading-text-fontSize;
37
+ color: var(--semi-color-text-0);
38
+ }
39
+
40
+ &-error {
41
+ padding: $spacing-clientAI-error-padding;
42
+ }
43
+
44
+ &-content {
45
+ flex: 1;
46
+ display: flex;
47
+ flex-direction: column;
48
+ min-height: 0;
49
+ overflow: hidden;
50
+ }
51
+
52
+ &-dialogue-wrapper {
53
+ flex: 1;
54
+ overflow: auto;
55
+ }
56
+
57
+ &-input-wrapper {
58
+ margin: $spacing-clientAI-input-wrapper-margin;
59
+ min-height: $height-clientAI-input-wrapper-min;
60
+ max-height: $height-clientAI-input-wrapper-max;
61
+ flex-shrink: 0;
62
+ }
63
+
64
+ &-input-edit {
65
+ margin: $spacing-clientAI-input-edit-marginY $spacing-clientAI-input-edit-marginX;
66
+ max-height: $height-clientAI-input-edit-max;
67
+ flex-shrink: 0;
68
+ }
69
+ }
70
+
@@ -0,0 +1,109 @@
1
+ import { BASE_CLASS_PREFIX } from '../base/constants';
2
+ import type { AppConfig, MLCEngineConfig } from './interface';
3
+
4
+ const cssClasses = {
5
+ PREFIX: `${BASE_CLASS_PREFIX}-client-ai`,
6
+ WRAPPER: `${BASE_CLASS_PREFIX}-client-ai-wrapper`,
7
+ LOADING: `${BASE_CLASS_PREFIX}-client-ai-loading`,
8
+ LOADING_CONTENT: `${BASE_CLASS_PREFIX}-client-ai-loading-content`,
9
+ LOADING_TEXT: `${BASE_CLASS_PREFIX}-client-ai-loading-text`,
10
+ ERROR: `${BASE_CLASS_PREFIX}-client-ai-error`,
11
+ CONTENT: `${BASE_CLASS_PREFIX}-client-ai-content`,
12
+ DIALOGUE_WRAPPER: `${BASE_CLASS_PREFIX}-client-ai-dialogue-wrapper`,
13
+ INPUT_WRAPPER: `${BASE_CLASS_PREFIX}-client-ai-input-wrapper`,
14
+ INPUT_EDIT: `${BASE_CLASS_PREFIX}-client-ai-input-edit`,
15
+ } as const;
16
+
17
+ const strings = {} as const;
18
+
19
+ const numbers = {} as const;
20
+
21
+ // ============================================
22
+ // 国外配置(使用 Hugging Face + GitHub Raw)
23
+ // ============================================
24
+
25
+ // Qwen3-1.7B 模型配置 - 国外
26
+ export const Qwen3_1_7B_RECORD = {
27
+ model: 'https://huggingface.co/mlc-ai/Qwen3-1.7B-q4f32_1-MLC',
28
+ model_id: 'Qwen3-1.7B-q4f32_1-MLC',
29
+ model_lib: 'https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/web-llm-models/v0_2_80/Qwen3-1.7B-q4f32_1-ctx4k_cs1k-webgpu.wasm',
30
+ vram_required_MB: 2635.44,
31
+ low_resource_required: true,
32
+ overrides: {
33
+ context_window_size: 40960,
34
+ },
35
+ };
36
+
37
+ // Qwen3-1.7B 引擎配置 - 国外
38
+ export const Qwen3_1_7B_ENGINE_CONFIG: MLCEngineConfig = {
39
+ appConfig: {
40
+ useIndexedDBCache: true,
41
+ model_list: [Qwen3_1_7B_RECORD],
42
+ } as AppConfig,
43
+ };
44
+
45
+ // Qwen3-4B 模型配置 - 国外
46
+ export const Qwen3_4B_RECORD = {
47
+ model: 'https://huggingface.co/mlc-ai/Qwen3-4B-q4f32_1-MLC',
48
+ model_id: 'Qwen3-4B-q4f32_1-MLC',
49
+ model_lib: 'https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/web-llm-models/v0_2_80/Qwen3-4B-q4f32_1-ctx4k_cs1k-webgpu.wasm',
50
+ vram_required_MB: 6000,
51
+ low_resource_required: false,
52
+ overrides: {
53
+ context_window_size: 40960,
54
+ },
55
+ };
56
+
57
+ // Qwen3-4B 引擎配置 - 国外
58
+ export const Qwen3_4B_ENGINE_CONFIG: MLCEngineConfig = {
59
+ appConfig: {
60
+ useIndexedDBCache: true,
61
+ model_list: [Qwen3_4B_RECORD],
62
+ } as AppConfig,
63
+ };
64
+
65
+ // ============================================
66
+ // 中国配置(使用 ModelScope + jsDelivr CDN)
67
+ // ============================================
68
+
69
+ // Qwen3-1.7B 模型配置 - 中国
70
+ export const Qwen3_1_7B_RECORD_CN = {
71
+ model: 'https://modelscope.cn/models/mlc-ai/Qwen3-1.7B-q4f32_1-MLC',
72
+ model_id: 'Qwen3-1.7B-q4f32_1-MLC',
73
+ model_lib: 'https://cdn.jsdelivr.net/gh/mlc-ai/binary-mlc-llm-libs@main/web-llm-models/v0_2_80/Qwen3-1.7B-q4f32_1-ctx4k_cs1k-webgpu.wasm',
74
+ vram_required_MB: 2635.44,
75
+ low_resource_required: true,
76
+ overrides: {
77
+ context_window_size: 40960,
78
+ },
79
+ };
80
+
81
+ // Qwen3-1.7B 引擎配置 - 中国
82
+ export const Qwen3_1_7B_ENGINE_CONFIG_CN: MLCEngineConfig = {
83
+ appConfig: {
84
+ useIndexedDBCache: true,
85
+ model_list: [Qwen3_1_7B_RECORD_CN],
86
+ } as AppConfig,
87
+ };
88
+
89
+ // Qwen3-4B 模型配置 - 中国
90
+ export const Qwen3_4B_RECORD_CN = {
91
+ model: 'https://modelscope.cn/models/mlc-ai/Qwen3-4B-q4f32_1-MLC',
92
+ model_id: 'Qwen3-4B-q4f32_1-MLC',
93
+ model_lib: 'https://cdn.jsdelivr.net/gh/mlc-ai/binary-mlc-llm-libs@main/web-llm-models/v0_2_80/Qwen3-4B-q4f32_1-ctx4k_cs1k-webgpu.wasm',
94
+ vram_required_MB: 6000,
95
+ low_resource_required: false,
96
+ overrides: {
97
+ context_window_size: 40960,
98
+ },
99
+ };
100
+
101
+ // Qwen3-4B 引擎配置 - 中国
102
+ export const Qwen3_4B_ENGINE_CONFIG_CN: MLCEngineConfig = {
103
+ appConfig: {
104
+ useIndexedDBCache: true,
105
+ model_list: [Qwen3_4B_RECORD_CN],
106
+ } as AppConfig,
107
+ };
108
+
109
+ export { cssClasses, strings, numbers };