Files
GC-XH/GC-UI/backend/GC.UI.Server/ApiModels.cs
T
Frontend Developer 9ca99a1fe1 GC-UI:前后端分离,前端改用 Flutter(Windows/macOS)
- 新增 GC-UI/:backend(.NET 8 本地 HTTP API + 模型窗口宿主)与 frontend(Flutter 桌面应用)
- 前端一套 Dart 代码 + windows/macos 两个原生 runner,共享全部界面逻辑
- 「关于」页新增「源码语言:C#」「前端:Flutter」两行,字段由 /api/about 下发
- 截图脚本覆盖首页/下载/设置/关于/外壳,需要真实后端时用 runAsync 等待请求
- README 补充平台选型理由、接口列表与截图用法
2026-11-17 13:48:17 +00:00

141 lines
3.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Collections.Generic;
namespace GC.UI.Server;
// ---------------------------------------------------------------------------
// 前后端之间的数据契约(HTTP + JSON,camelCase)。
// 前端(Flutter)只认这些字段,不认 .NET 类型;后端换实现不影响前端。
// ---------------------------------------------------------------------------
public sealed record HealthDto(
bool Ok,
string Version,
string Platform,
bool UiAvailable,
string? UiError);
public sealed record ModelDto(
string Id,
string Name,
string Description,
string Version,
string Author,
long SizeBytes,
string SizeText,
IReadOnlyList<string> Tags,
bool HasPreview,
string PreviewUrl,
string Directory,
string DataDirectory);
public sealed record SourceDto(
string Id,
string Name,
string Url,
bool Enabled,
bool BuiltIn,
string Host);
public sealed record RemoteModelDto(
string Id,
string Name,
string Description,
string Version,
long SizeBytes,
string SizeText,
string SourceId,
bool Installed,
string? InstalledVersion);
public sealed record SourceIndexDto(
string SourceId,
string Root,
bool FromCache,
string? Error,
string ResolvedFrom,
IReadOnlyList<RemoteModelDto> Models);
public sealed record JobDto(
string Id,
string ModelId,
string Name,
string Version,
string State,
double Progress,
string StatusText,
string DetailText,
string? Error,
bool IsActive,
bool CanRetry,
bool IsDone);
public sealed record LanguageDto(string Code, string Label);
public sealed record SettingsDto(
string Language,
string Theme,
int RenderFps,
int MemoryMb,
bool MemoryAuto,
bool AutoUpdateOnStartup,
bool RequireSignedManifest,
string UpdateRepository,
string? UpdateLocalRoot,
string? ModelRootOverride,
int MemoryBudgetMb,
string MemoryUsageText,
string ModelRoot,
string DataRoot,
string SettingsFile,
string Version,
string Platform,
IReadOnlyList<SourceDto> Sources,
IReadOnlyList<LanguageDto> Languages);
/// <summary>设置补丁:只改传进来的字段,null 表示不动。</summary>
public sealed record SettingsPatch(
string? Language,
string? Theme,
int? RenderFps,
int? MemoryMb,
bool? MemoryAuto,
bool? AutoUpdateOnStartup,
bool? RequireSignedManifest,
string? UpdateRepository,
string? UpdateLocalRoot,
string? ModelRootOverride);
public sealed record LatencyDto(string Id, string Name, long Milliseconds);
public sealed record UpdateCheckDto(
string Outcome,
string Message,
int UpdatedModels,
IReadOnlyList<string> ModelNames,
string? LauncherMessage,
string? Error,
string? LauncherLatest,
string SourceName,
IReadOnlyList<LatencyDto> Latency);
public sealed record ContributorDto(string Name, int Contributions, string? AvatarUrl);
public sealed record AboutDto(
string AppName,
string Version,
string Platform,
string Repository,
IReadOnlyList<ContributorDto> Contributors,
string SourceLanguage,
string Frontend);
public sealed record LaunchResultDto(bool Ok, string Message);
public sealed record DownloadRequest(string SourceId, string ModelId);
public sealed record PathRequest(string Path);
public sealed record UrlRequest(string Url);
public sealed record ForceRequest(bool Force);