diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 645a13d..59fb98c 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -381,7 +381,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 267; + CURRENT_PROJECT_VERSION = 268; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -512,7 +512,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 267; + CURRENT_PROJECT_VERSION = 268; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -537,7 +537,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 267; + CURRENT_PROJECT_VERSION = 268; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; diff --git a/lib/data/res/build.dart b/lib/data/res/build.dart index 4ba24cd..acbabdb 100644 --- a/lib/data/res/build.dart +++ b/lib/data/res/build.dart @@ -2,5 +2,5 @@ class Build { static const String name = "GPTBox"; - static const int build = 267; + static const int build = 268; } diff --git a/lib/view/page/home/req.dart b/lib/view/page/home/req.dart index 9a0766c..c357b04 100644 --- a/lib/view/page/home/req.dart +++ b/lib/view/page/home/req.dart @@ -134,14 +134,18 @@ Future _onCreateText( _loadingChatIds.add(chatId); _autoScroll(chatId); - final useTools = OpenAICfg.canUseToolNow; + final useTools = Stores.tool.enabled.fetch() && OpenAICfg.canUseToolNow; // #104 final singleChatScopeUseTools = workingChat.settings?.useTools != false; + // #111 + final availableTools = OpenAIFuncCalls.tools; + final isToolsEmpty = availableTools.isEmpty; + /// TODO: after switching to http img url, remove this condition. /// To save tokens, we don't use tools for image prompt - if (useTools && !hasImg && singleChatScopeUseTools) { + if (useTools && !hasImg && singleChatScopeUseTools && !isToolsEmpty) { final toolReply = ChatHistoryItem.single(role: ChatRole.tool, raw: ''); workingChat.items.add(toolReply); _loadingChatIds.add(toolReply.id); @@ -160,7 +164,7 @@ Future _onCreateText( ).toOpenAI, ...msgs, ], - tools: OpenAIFuncCalls.tools, + tools: availableTools, ); } catch (e, s) { _onErr(e, s, chatId, 'Tool'); diff --git a/pubspec.yaml b/pubspec.yaml index 39688e6..a2cf701 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: gpt_box description: "A third-party GPT Client for OpenAI API." publish_to: 'none' -version: 1.0.267+267 +version: 1.0.268+268 environment: sdk: '>=3.3.0 <4.0.0'