Skip to content

Commit

Permalink
opt.
Browse files Browse the repository at this point in the history
  • Loading branch information
lollipopkit committed Jan 9, 2025
1 parent 58a3b8a commit bbbf4d0
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 39 deletions.
6 changes: 3 additions & 3 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 341;
CURRENT_PROJECT_VERSION = 350;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
Expand Down Expand Up @@ -494,7 +494,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 341;
CURRENT_PROJECT_VERSION = 350;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
Expand All @@ -519,7 +519,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 341;
CURRENT_PROJECT_VERSION = 350;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
Expand Down
3 changes: 1 addition & 2 deletions lib/core/util/api_balance.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ enum ApiBalanceProvider {
const path = '/api/user/self';
final resp = await myDio.get(
'${uri.scheme}://${uri.host}$path',
options: Options(
headers: {'Authorization': 'Bearer ${Cfg.current.key}'}),
options: Options(headers: {'Authorization': 'Bearer ${Cfg.current.key}'}),
);
final data = resp.data as Map<String, dynamic>;
final quota = data['data']['quota'] as int? ?? 0;
Expand Down
2 changes: 1 addition & 1 deletion lib/data/res/build_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

abstract class BuildData {
static const String name = "GPTBox";
static const int build = 341;
static const int build = 350;
}
12 changes: 6 additions & 6 deletions lib/data/res/openai.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ abstract final class Cfg {
}

/// Show the dialog to pick the model.
///
///
/// - [context] the context to show the dialog.
///
///
/// Return the model name if any model is picked, otherwise return null.
static Future<void> showPickModelDialog(BuildContext context) async {
if (Cfg.current.key.isEmpty) {
Expand All @@ -108,7 +108,8 @@ abstract final class Cfg {
onPressed: () async {
context.pop();
await context.showLoadingDialog(
fn: () => Cfg.updateModels(force: true),);
fn: () => Cfg.updateModels(force: true),
);
await showPickModelDialog(context);
},
child: Text(l10n.refresh),
Expand Down Expand Up @@ -138,10 +139,8 @@ abstract final class Cfg {
);
if (model == null) return;
Cfg.setTo(Cfg.current.copyWith(model: model));

}


static void switchToDefault(BuildContext context) {
final cfg = _store.fetch(ChatConfig.defaultId);
if (cfg != null) return setTo(cfg);
Expand Down Expand Up @@ -186,7 +185,8 @@ abstract final class _ModelsCacher {
final endpoint = Cfg.current.url;
// For most compatibility, use dio instead of openai_dart
final url = switch (endpoint) {
_ when endpoint.startsWith('https://api.deepseek.com/beta') => 'https://api.deepseek.com/v1/models',
_ when endpoint.startsWith('https://api.deepseek.com/beta') =>
'https://api.deepseek.com/v1/models',
_ => '$endpoint/models',
};
final val = await myDio.get(
Expand Down
46 changes: 22 additions & 24 deletions lib/view/page/home/chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,17 @@ class _ChatPageState extends State<_ChatPage>
),
if (replayEnabled)
_loadingChatIds.listenVal((chats) {
final isWorking = chats.contains(_curChatId.value);
if (isWorking) return UIs.placeholder;
return Btn.icon(
onTap: () {
context.pop();
_onTapReplay(context, _curChatId.value, chatItem);
},
text: l10n.replay,
icon: Icon(MingCute.refresh_4_line, size: size, color: color),
);
},
),
final isWorking = chats.contains(_curChatId.value);
if (isWorking) return UIs.placeholder;
return Btn.icon(
onTap: () {
context.pop();
_onTapReplay(context, _curChatId.value, chatItem);
},
text: l10n.replay,
icon: Icon(MingCute.refresh_4_line, size: size, color: color),
);
}),
if (replayEnabled)
Btn.icon(
onTap: () {
Expand Down Expand Up @@ -290,18 +289,17 @@ class _ChatPageState extends State<_ChatPage>
),
if (replayEnabled)
_loadingChatIds.listenVal((chats) {
final isWorking = chats.contains(_curChatId.value);
if (isWorking) return UIs.placeholder;
return Btn.tile(
onTap: () {
context.pop();
_onTapReplay(context, _curChatId.value, chatItem);
},
text: l10n.replay,
icon: const Icon(MingCute.refresh_4_line),
);
},
),
final isWorking = chats.contains(_curChatId.value);
if (isWorking) return UIs.placeholder;
return Btn.tile(
onTap: () {
context.pop();
_onTapReplay(context, _curChatId.value, chatItem);
},
text: l10n.replay,
icon: const Icon(MingCute.refresh_4_line),
);
}),
if (replayEnabled)
Btn.tile(
onTap: () {
Expand Down
2 changes: 1 addition & 1 deletion lib/view/page/home/req.dart
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ void _onReplay({
context.showSnackBar('${libL10n.fail}: $msg');
return;
}

_inputCtrl.text = text;
_filePicked.value = img != null ? await _FilePicked.fromUrl(img) : null;

Expand Down
1 change: 0 additions & 1 deletion lib/view/page/settings/profile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ final class _ProfilePageState extends State<ProfilePage>
);
}


Widget _buildOpenAIChatModel() {
final cfg = Cfg.current;
final val = cfg.model;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: gpt_box
description: "A third-party GPT Client for OpenAI API."
publish_to: 'none'
version: 1.0.341+341
version: 1.0.350+350

environment:
sdk: '>=3.3.0 <4.0.0'
Expand Down

0 comments on commit bbbf4d0

Please sign in to comment.