Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: api balance #197

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,12 @@ android {

debug {
applicationIdSuffix '.debug'
resValue "string", "app_name", "GPTBox-dbg"
resValue "string", "app_name", "GPTBoxD"
}

profile {
applicationIdSuffix '.debug'
resValue "string", "app_name", "GPTBox-dbg"
}

release {
resValue "string", "app_name", "GPT Box"
resValue "string", "app_name", "GPTBoxP"
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">GPT Box</string>
</resources>
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 = 332;
CURRENT_PROJECT_VERSION = 341;
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 = 332;
CURRENT_PROJECT_VERSION = 341;
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 = 332;
CURRENT_PROJECT_VERSION = 341;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
Expand Down
8 changes: 6 additions & 2 deletions lib/core/util/api_balance.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ enum ApiBalanceProvider {
// "success": true
// }
Future<String> _refreshOneapi() async {
final uri = Uri.parse(OpenAICfg.current.url);
const path = '/api/user/self';
final resp = await myDio.get(
'${OpenAICfg.current.url}/api/user/self',
'${uri.scheme}://${uri.host}$path',
options: Options(
headers: {'Authorization': 'Bearer ${OpenAICfg.current.key}'}),
);
Expand All @@ -137,7 +139,9 @@ enum ApiBalanceProvider {
// "status": 1
// }
Future<String> _refreshChatanywhere() async {
final endpoint = '${OpenAICfg.current.url}/v1/query/balance';
final uri = Uri.parse(OpenAICfg.current.url);
const path = '/v1/query/balance';
final endpoint = 'https://${uri.host}$path';
final resp = await myDio.post(
endpoint,
options: Options(headers: {'Authorization': OpenAICfg.current.key}),
Expand Down
2 changes: 1 addition & 1 deletion lib/core/util/tool_func/func/js.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// final scripts = Stores.tool.jsScripts;
// final names = scripts.keys.join('\n');
// return '''
// This tool has a quickjs runtime, you can generate some JS code to run,
// This tool has a quickjs runtime, you can generate some JS code to run,
// like calculation and etc.

// ${names.isEmpty ? '' : "Also, there are some users' scripts that can be run in this tool:\n$names"}
Expand Down
2 changes: 1 addition & 1 deletion lib/data/model/chat/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ final class ChatConfig {
Map<String, dynamic> toJson() => _$ChatConfigToJson(this);

/// Get share url.
///
///
/// eg.: lpkt.cn://gptbox/profile?params=...
String get shareUrl {
final jsonStr = json.encode(toJson());
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 = 332;
static const int build = 341;
}
12 changes: 8 additions & 4 deletions lib/data/store/setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ class SettingStore extends HiveStore {
/// Webdav sync
late final webdavSync =
propertyDefault('webdavSync', false, updateLastModified: false);
late final webdavUrl = propertyDefault('webdavUrl', '', updateLastModified: false);
late final webdavUser = propertyDefault('webdavUser', '', updateLastModified: false);
late final webdavPwd = propertyDefault('webdavPwd', '', updateLastModified: false);
late final webdavUrl =
propertyDefault('webdavUrl', '', updateLastModified: false);
late final webdavUser =
propertyDefault('webdavUser', '', updateLastModified: false);
late final webdavPwd =
propertyDefault('webdavPwd', '', updateLastModified: false);

/// Only valid on iOS and macOS
late final icloudSync =
Expand All @@ -41,7 +44,8 @@ class SettingStore extends HiveStore {

// late final replay = property('replay', true);

late final cupertinoRoute = propertyDefault('cupertinoRoute', isIOS || isMacOS);
late final cupertinoRoute =
propertyDefault('cupertinoRoute', isIOS || isMacOS);

late final hideTitleBar = propertyDefault('hideTitleBar', isDesktop);

Expand Down
1 change: 0 additions & 1 deletion lib/view/page/home/url_scheme.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
part of 'home.dart';


extension _AppLink on AppLink {
/// example: lpkt.cn://gptbox/PATH?KEY=VAL
static bool? handle(Uri uri, [BuildContext? context]) {
Expand Down
22 changes: 11 additions & 11 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ packages:
dependency: transitive
description:
name: camera_android_camerax
sha256: abcfa1ac32bd03116b4cfda7e8223ab391f01966e65823c064afe388550d1b3d
sha256: "2bb0724371bae3c0889d7e0b1665357e4aa6ba6c8d32ffa3e178098ba81ed3df"
url: "https://pub.dev"
source: hosted
version: "0.6.10+3"
version: "0.6.11"
camera_avfoundation:
dependency: transitive
description:
Expand All @@ -194,10 +194,10 @@ packages:
dependency: transitive
description:
name: camera_platform_interface
sha256: b3ede1f171532e0d83111fe0980b46d17f1aa9788a07a2fbed07366bbdbb9061
sha256: "953e7baed3a7c8fae92f7200afeb2be503ff1a17c3b4e4ed7b76f008c2810a31"
url: "https://pub.dev"
source: hosted
version: "2.8.0"
version: "2.9.0"
camera_web:
dependency: transitive
description:
Expand Down Expand Up @@ -818,10 +818,10 @@ packages:
dependency: transitive
description:
name: image_picker_platform_interface
sha256: "9ec26d410ff46f483c5519c29c02ef0e02e13a543f882b152d4bfd2f06802f80"
sha256: "886d57f0be73c4b140004e78b9f28a8914a09e50c2d816bdd0520051a71236a0"
url: "https://pub.dev"
source: hosted
version: "2.10.0"
version: "2.10.1"
image_picker_windows:
dependency: transitive
description:
Expand Down Expand Up @@ -1170,10 +1170,10 @@ packages:
dependency: transitive
description:
name: pubspec_parse
sha256: "81876843eb50dc2e1e5b151792c9a985c5ed2536914115ed04e9c8528f6647b0"
sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082"
url: "https://pub.dev"
source: hosted
version: "1.4.0"
version: "1.5.0"
qr:
dependency: transitive
description:
Expand Down Expand Up @@ -1535,10 +1535,10 @@ packages:
dependency: transitive
description:
name: vector_graphics_codec
sha256: "2430b973a4ca3c4dbc9999b62b8c719a160100dcbae5c819bae0cacce32c9cdb"
sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146"
url: "https://pub.dev"
source: hosted
version: "1.1.12"
version: "1.1.13"
vector_graphics_compiler:
dependency: transitive
description:
Expand Down Expand Up @@ -1654,4 +1654,4 @@ packages:
version: "1.1.2"
sdks:
dart: ">=3.6.0 <4.0.0"
flutter: ">=3.24.0"
flutter: ">=3.27.0"
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.332+332
version: 1.0.341+341

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