hydro-ai-helper 1.9.0 → 1.10.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.
@@ -44,12 +44,17 @@ jobs:
44
44
  - name: Check if release exists on Gitee
45
45
  id: check
46
46
  run: |
47
- RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" \
47
+ # 获取 release 信息,如果不存在会返回错误信息
48
+ RESPONSE=$(curl -s \
48
49
  "https://gitee.com/api/v5/repos/alture/hydro-ai-helper/releases/tags/${{ steps.release.outputs.tag_name }}?access_token=${{ secrets.GITEE_ACCESS_TOKEN }}")
49
50
 
50
- if [ "$RESPONSE" = "200" ]; then
51
+ # 检查返回的 JSON 是否包含 id 字段(存在)或 message 字段(不存在)
52
+ RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id // empty')
53
+
54
+ if [ -n "$RELEASE_ID" ]; then
51
55
  echo "exists=true" >> $GITHUB_OUTPUT
52
- echo "Release already exists on Gitee, will update"
56
+ echo "release_id=${RELEASE_ID}" >> $GITHUB_OUTPUT
57
+ echo "Release already exists on Gitee (ID: ${RELEASE_ID}), will update"
53
58
  else
54
59
  echo "exists=false" >> $GITHUB_OUTPUT
55
60
  echo "Release does not exist on Gitee, will create"
@@ -70,13 +75,10 @@ jobs:
70
75
  fi
71
76
 
72
77
  if [ "${{ steps.check.outputs.exists }}" = "true" ]; then
73
- # Get existing release ID
74
- RELEASE_ID=$(curl -s \
75
- "https://gitee.com/api/v5/repos/alture/hydro-ai-helper/releases/tags/${TAG_NAME}?access_token=${{ secrets.GITEE_ACCESS_TOKEN }}" \
76
- | jq -r '.id')
78
+ # Update existing release using the ID from check step
79
+ RELEASE_ID="${{ steps.check.outputs.release_id }}"
77
80
 
78
- # Update existing release
79
- curl -X PATCH \
81
+ RESPONSE=$(curl -s -w "\n%{http_code}" -X PATCH \
80
82
  "https://gitee.com/api/v5/repos/alture/hydro-ai-helper/releases/${RELEASE_ID}" \
81
83
  -H "Content-Type: application/json" \
82
84
  -d "$(jq -n \
@@ -91,12 +93,21 @@ jobs:
91
93
  name: $name,
92
94
  body: $body,
93
95
  prerelease: $prerelease
94
- }')"
96
+ }')")
97
+
98
+ HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
99
+ BODY=$(echo "$RESPONSE" | sed '$d')
95
100
 
96
- echo "Release updated on Gitee"
101
+ if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "201" ]; then
102
+ echo "✅ Release updated on Gitee successfully"
103
+ else
104
+ echo "❌ Failed to update release on Gitee (HTTP $HTTP_CODE)"
105
+ echo "Response: $BODY"
106
+ exit 1
107
+ fi
97
108
  else
98
109
  # Create new release
99
- curl -X POST \
110
+ RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
100
111
  "https://gitee.com/api/v5/repos/alture/hydro-ai-helper/releases" \
101
112
  -H "Content-Type: application/json" \
102
113
  -d "$(jq -n \
@@ -113,7 +124,16 @@ jobs:
113
124
  body: $body,
114
125
  target_commitish: $branch,
115
126
  prerelease: $prerelease
116
- }')"
127
+ }')")
128
+
129
+ HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
130
+ BODY=$(echo "$RESPONSE" | sed '$d')
117
131
 
118
- echo "Release created on Gitee"
132
+ if [ "$HTTP_CODE" = "201" ] || [ "$HTTP_CODE" = "200" ]; then
133
+ echo "✅ Release created on Gitee successfully"
134
+ else
135
+ echo "❌ Failed to create release on Gitee (HTTP $HTTP_CODE)"
136
+ echo "Response: $BODY"
137
+ exit 1
138
+ fi
119
139
  fi
@@ -208,32 +208,6 @@ export const ConversationList: React.FC<ConversationListProps> = ({ embedded = f
208
208
  <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '20px' }}>
209
209
  <h3 style={{ margin: 0, fontSize: '16px', fontWeight: 600, color: '#1f2937' }}>筛选条件</h3>
210
210
  <div style={{ display: 'flex', gap: '12px' }}>
211
- <button
212
- type="button"
213
- onClick={() => {
214
- const params = new URLSearchParams();
215
- if (filters.startDate) params.append('startDate', filters.startDate);
216
- if (filters.endDate) params.append('endDate', filters.endDate);
217
- if (filters.classId) params.append('classId', filters.classId);
218
- if (filters.problemId) params.append('problemId', filters.problemId);
219
- if (filters.userId) params.append('userId', filters.userId);
220
- const queryString = params.toString();
221
- window.location.href = buildPageUrl(`/ai-helper/analytics${queryString ? `?${queryString}` : ''}`);
222
- }}
223
- style={{
224
- padding: '10px 20px',
225
- fontSize: '14px',
226
- fontWeight: 600,
227
- color: '#ffffff',
228
- background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
229
- border: 'none',
230
- borderRadius: '8px',
231
- cursor: 'pointer',
232
- boxShadow: '0 2px 8px rgba(102, 126, 234, 0.3)'
233
- }}
234
- >
235
- 📊 查看统计
236
- </button>
237
211
  <button
238
212
  type="button"
239
213
  onClick={() => setExportDialogOpen(true)}
@@ -3,6 +3,8 @@
3
3
  * 在题目详情页显示一个最小提示,验证前端集成链路
4
4
  */
5
5
 
6
+ import pkg from '../package.json';
7
+
6
8
  /**
7
9
  * 简易页面就绪逻辑:
8
10
  * HydroOJ 默认的 NamedPage 工具位于 ui-default 主题中,
@@ -21,11 +23,12 @@ const initAiHelperBanner = () => {
21
23
  position: fixed;
22
24
  bottom: 20px;
23
25
  right: 20px;
24
- background: #4CAF50;
25
- color: white;
26
+ background: #f5f3ff;
27
+ color: #5b21b6;
26
28
  padding: 15px 20px;
27
- border-radius: 5px;
28
- box-shadow: 0 2px 10px rgba(0,0,0,0.2);
29
+ border-radius: 8px;
30
+ border: 1px solid #e0ddff;
31
+ box-shadow: 0 2px 8px rgba(0,0,0,0.1);
29
32
  z-index: 9999;
30
33
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
31
34
  font-size: 14px;
@@ -36,8 +39,8 @@ const initAiHelperBanner = () => {
36
39
  <div style="font-weight: bold; margin-bottom: 5px;">
37
40
  ✓ AI 助手插件已加载
38
41
  </div>
39
- <div style="font-size: 12px; opacity: 0.5;">
40
- 版本: 1.1.0
42
+ <div style="font-size: 12px; opacity: 0.7;">
43
+ 版本: ${pkg.version}
41
44
  </div>
42
45
  `;
43
46
 
@@ -53,7 +56,7 @@ const initAiHelperBanner = () => {
53
56
  backendStatus.style.cssText = `
54
57
  margin-top: 8px;
55
58
  padding-top: 8px;
56
- border-top: 1px solid rgba(255,255,255,0.3);
59
+ border-top: 1px solid #e0ddff;
57
60
  font-size: 12px;
58
61
  `;
59
62
  backendStatus.textContent = '✓ 后端连接正常';
@@ -65,9 +68,9 @@ const initAiHelperBanner = () => {
65
68
  errorStatus.style.cssText = `
66
69
  margin-top: 8px;
67
70
  padding-top: 8px;
68
- border-top: 1px solid rgba(255,255,255,0.3);
71
+ border-top: 1px solid #e0ddff;
69
72
  font-size: 12px;
70
- color: #ffeb3b;
73
+ color: #dc2626;
71
74
  `;
72
75
  errorStatus.textContent = '⚠ 后端连接失败';
73
76
  notification.appendChild(errorStatus);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hydro-ai-helper",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "HydroOJ AI Learning Assistant - 一个教学优先的 AI 辅助学习插件",
5
5
  "main": "dist/index.js",
6
6
  "author": "Alture",