整个课程和数据UI重新设计版本

This commit is contained in:
shenlei
2026-09-18 17:55:44 +09:00
parent febfd30f49
commit 0a4f97d105
154 changed files with 12366 additions and 4784 deletions
+31 -22
View File
@@ -50,9 +50,7 @@ void main() {
_env('KOUYU_AI_ENDPOINT') ?? 'https://codex.slcydia.fun/v1/responses',
);
final model = _env('KOUYU_AI_MODEL') ?? 'gemini-3.7-flash-high';
final skipReason = apiKey == null
? '未设置 KOUYU_AI_API_KEY,跳过联网测试。'
: null;
final skipReason = apiKey == null ? '未设置 KOUYU_AI_API_KEY,跳过联网测试。' : null;
if (apiKey != null) {
AiService.instance.setFallbackApiKey(apiKey);
}
@@ -73,7 +71,9 @@ void main() {
model: model,
explicitApiKey: apiKey,
);
print('Responses API result: ok=${resResponses.ok}, msg=${resResponses.message}');
print(
'Responses API result: ok=${resResponses.ok}, msg=${resResponses.message}',
);
} catch (e) {
print('Network test skipped: $e');
}
@@ -87,27 +87,36 @@ void main() {
model: model,
explicitApiKey: apiKey,
);
print('Chat Completions API result: ok=${resChat.ok}, msg=${resChat.message}');
print(
'Chat Completions API result: ok=${resChat.ok}, msg=${resChat.message}',
);
} catch (e) {
print('Network test skipped: $e');
}
}, skip: skipReason);
test('Live test: /v1/responses dialogueReply', timeout: const Timeout(Duration(seconds: 60)), () async {
try {
final reply = await AiService.instance.dialogueReply(
provider: AiProviderType.compatible,
endpoint: '$baseUrl/v1/responses',
model: model,
history: [
{'role': 'user', 'content': 'Hello, my name is Alex.'}
],
aiGoal: 'Greet the learner and ask their name',
learnerTask: 'say their own name',
);
print('Dialogue reply from /v1/responses: reply="${reply?.reply}", translation="${reply?.translation}", feedback="${reply?.feedback}"');
} catch (e) {
print('Network test skipped: $e');
}
}, skip: skipReason);
test(
'Live test: /v1/responses dialogueReply',
timeout: const Timeout(Duration(seconds: 60)),
() async {
try {
final reply = await AiService.instance.dialogueReply(
provider: AiProviderType.compatible,
endpoint: '$baseUrl/v1/responses',
model: model,
history: [
{'role': 'user', 'content': 'Hello, my name is Alex.'},
],
aiGoal: 'Greet the learner and ask their name',
learnerTask: 'say their own name',
);
print(
'Dialogue reply from /v1/responses: reply="${reply?.reply}", translation="${reply?.translation}", feedback="${reply?.feedback}"',
);
} catch (e) {
print('Network test skipped: $e');
}
},
skip: skipReason,
);
}