Showing preview only (406K chars total). Download the full file or copy to clipboard to get everything.
Repository: fanenr/flutter-chatbot
Branch: master
Commit: b2508200fc4c
Files: 77
Total size: 378.0 KB
Directory structure:
gitextract_khs2npmo/
├── .github/
│ └── workflows/
│ └── build.yaml
├── .gitignore
├── .metadata
├── CHANGELOG
├── COPYING
├── README
├── analysis_options.yaml
├── android/
│ ├── .gitignore
│ ├── app/
│ │ ├── build.gradle
│ │ └── src/
│ │ ├── debug/
│ │ │ └── AndroidManifest.xml
│ │ ├── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin/
│ │ │ │ └── cc/
│ │ │ │ └── arthur63/
│ │ │ │ └── chatbot/
│ │ │ │ └── MainActivity.kt
│ │ │ └── res/
│ │ │ ├── drawable-v21/
│ │ │ │ └── launch_background.xml
│ │ │ ├── values/
│ │ │ │ └── styles.xml
│ │ │ └── values-night/
│ │ │ └── styles.xml
│ │ └── profile/
│ │ └── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle/
│ │ └── wrapper/
│ │ └── gradle-wrapper.properties
│ ├── gradle.properties
│ └── settings.gradle
├── lib/
│ ├── chat/
│ │ ├── chat.dart
│ │ ├── current.dart
│ │ ├── input.dart
│ │ ├── message.dart
│ │ └── settings.dart
│ ├── config.dart
│ ├── gen/
│ │ ├── intl/
│ │ │ ├── messages_all.dart
│ │ │ ├── messages_en.dart
│ │ │ └── messages_zh_CN.dart
│ │ └── l10n.dart
│ ├── image/
│ │ ├── config.dart
│ │ ├── generate.dart
│ │ └── image.dart
│ ├── l10n/
│ │ ├── intl_en.arb
│ │ └── intl_zh_CN.arb
│ ├── llm/
│ │ ├── llm.dart
│ │ └── web.dart
│ ├── main.dart
│ ├── markdown/
│ │ ├── code.dart
│ │ ├── latex.dart
│ │ └── util.dart
│ ├── settings/
│ │ ├── api.dart
│ │ ├── bot.dart
│ │ ├── config.dart
│ │ └── settings.dart
│ ├── util.dart
│ └── workspace/
│ ├── document.dart
│ ├── model.dart
│ ├── task.dart
│ └── workspace.dart
├── linux/
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── flutter/
│ │ ├── CMakeLists.txt
│ │ ├── generated_plugin_registrant.cc
│ │ ├── generated_plugin_registrant.h
│ │ └── generated_plugins.cmake
│ ├── main.cc
│ ├── my_application.cc
│ └── my_application.h
├── pubspec.yaml
└── windows/
├── .gitignore
├── CMakeLists.txt
├── flutter/
│ ├── CMakeLists.txt
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
└── runner/
├── CMakeLists.txt
├── Runner.rc
├── flutter_window.cpp
├── flutter_window.h
├── main.cpp
├── resource.h
├── runner.exe.manifest
├── utils.cpp
├── utils.h
├── win32_window.cpp
└── win32_window.h
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/build.yaml
================================================
name: Build and Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build-apk:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup JDK17
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "17"
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: 3.24.5
- name: Setup signing
run: |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > android/app/keystore.jks
echo "storePassword=${{ secrets.KEYSTORE_PASSWORD }}" > android/key.properties
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties
echo "storeFile=keystore.jks" >> android/key.properties
- name: Build
run: |
flutter pub get
flutter build apk --split-per-abi
- name: ChangeLog
id: changelog
run: |
echo "latest<<EOF" >> $GITHUB_OUTPUT
awk '/^[0-9]/{i++}i==1' CHANGELOG | sed '${/^$/d}' >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
build/app/outputs/flutter-apk/app-arm64-v8a-release.apk.sha1
build/app/outputs/flutter-apk/app-x86_64-release.apk
build/app/outputs/flutter-apk/app-x86_64-release.apk.sha1
body: ${{ steps.changelog.outputs.latest }}
================================================
FILE: .gitignore
================================================
# Miscellaneous
*.log
*.pyc
*.swp
*.class
.history
.DS_Store
.svn/
.atom/
.buildlog/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.flutter-plugins
devtools_options.yaml
.flutter-plugins-dependencies
.pub/
/build/
.pub-cache/
.dart_tool/
# Obfuscation related
app.*.map.json
# Symbolication related
app.*.symbols
# Android Studio related
/android/app/debug
/android/app/profile
/android/app/release
================================================
FILE: .metadata
================================================
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: "dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668"
channel: "stable"
project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668
base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668
- platform: linux
create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668
base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668
- platform: windows
create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668
base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
================================================
FILE: CHANGELOG
================================================
0.3.5 (2025-01-10)
* Add: General Web Search.
* Improve: Additional page details.
* 增加:通用联网搜索
* 改进:更多页面细节
0.3.4 (2025-01-02)
* Improve: Chat Settings.
* Improve: Model Settings.
* Add: Data Clearing.
* 改进:对话设置页面
* 改进:模型设置功能
* 增加:清除数据功能
0.3.3 (2024-12-27)
* Improve: Chat Settings Page.
* Improve: Input Widget.
* 改进:对话设置页面
* 改进:输入组件
0.3.2 (2024-12-25)
* Add: Title Generation.
* Improve: Input Widget.
* Fix: Google Gemini API proxy not working.
* 增加:标题生成
* 改进:输入组件
* 修复:Google Gemini 接口代理无效。
0.3.1 (2024-12-17)
* Add: Workspace.
* Improve: Input Widget.
* 增加:工作空间
* 改进:输入组件
0.2.10 (2024-12-13)
* Add: Checking for updates.
* Improve: Images display.
* 增加:检查更新
* 改进:图片显示
0.2.9 (2024-12-13)
* Add: Google Search support (gemini-2.0-flash-exp only)
* Add: Support for sending multiple images.
* 增加:支持 GoogleSearch(仅 gemini-2.0-flash-exp)
* 增加:支持发送多张图片
0.2.8 (2024-12-09)
* Add: Support Google Gemini API.
* Improve: Chat Response.
* 增加:支持 Google Gemini 接口
* 改进:对话响应
0.2.7 (2024-12-06)
* Add: Export chat as image.
* Improve: Refine UI details.
* 增加:将对话导出为图片
* 改进:调整了界面细节
0.2.6 (2024-12-04)
* Improve: LaTeX Rendering.
* 改进:LaTeX 渲染
0.2.5 (2024-12-04)
* Add: Image Generation.
* Improve: Message List.
* Improve: Configuration Loading and Export.
* 增加:图像生成
* 改进:消息列表
* 改进:配置加载及导出
0.2.4 (2024-11-29)
* Add: Image compression controls.
* Improve: Redesigned settings page.
* 增加:图片压缩控制
* 改进:重新设计的设置页
0.2.3 (2024-11-27)
* Add: A new app icon.
* Improve: Remove unnecessary animations.
* 增加:新的应用图标
* 改进:删除不必要的动画
0.2.2 (2024-11-25)
* Add: Chat clone and clear functionality.
* Improve: More animations.
* 增加:对话复制和清空
* 改进:更多动画
0.2.1 (2024-11-23)
* Improve: The Reanswering can be stopped.
* 改进:可以终止重新回答
0.2.0 (2024-11-23)
* Add: Reanswer.
* Improve: TTS button.
* 增加:重新回答
* 改进:文本转语音按钮
0.1.11 (2024-11-22)
* Add: More informative error messages.
* Improve: Style of the Message Widget.
* 增加:更多错误提示
* 改进:消息卡片组件样式
================================================
FILE: COPYING
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
================================================
FILE: README
================================================
This project is no longer maintained.
ChatBot is licensed under the GNU General Public License v3.0 - see the COPYING file for details.
================================================
FILE: analysis_options.yaml
================================================
include: package:flutter_lints/flutter.yaml
linter:
rules:
analyzer:
plugins:
================================================
FILE: android/.gitignore
================================================
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/to/reference-keystore
key.properties
**/*.keystore
**/*.jks
================================================
FILE: android/app/build.gradle
================================================
plugins {
id "kotlin-android"
id "com.android.application"
id "dev.flutter.flutter-gradle-plugin"
}
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file("key.properties")
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
namespace = "cc.arthur63.chatbot"
compileSdk = flutter.compileSdkVersion
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
}
defaultConfig {
minSdk = flutter.minSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
targetSdk = flutter.targetSdkVersion
applicationId = "cc.arthur63.chatbot"
}
signingConfigs {
release {
keyAlias keystoreProperties["keyAlias"]
keyPassword keystoreProperties["keyPassword"]
storePassword keystoreProperties["storePassword"]
storeFile keystoreProperties["storeFile"] ? file(keystoreProperties["storeFile"]) : null
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
signingConfig signingConfigs.release
}
}
}
flutter {
source = "../.."
}
================================================
FILE: android/app/src/debug/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
================================================
FILE: android/app/src/main/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="ChatBot"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:taskAffinity=""
android:exported="true"
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode">
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"/>
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
<intent-filter>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="android.intent.action.VIEW"/>
<data android:scheme="https"/>
</intent-filter>
<intent-filter>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="android.intent.action.VIEW"/>
<data android:scheme="http"/>
</intent-filter>
</activity>
<meta-data
android:name="flutterEmbedding"
android:value="2"/>
</application>
<queries>
<intent>
<category android:name="android.intent.category.BROWSABLE"/>
<action android:name="android.intent.action.VIEW"/>
<data android:scheme="https"/>
</intent>
<intent>
<category android:name="android.intent.category.BROWSABLE"/>
<action android:name="android.intent.action.VIEW"/>
<data android:scheme="http"/>
</intent>
</queries>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
================================================
FILE: android/app/src/main/kotlin/cc/arthur63/chatbot/MainActivity.kt
================================================
package cc.arthur63.chatbot
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity()
================================================
FILE: android/app/src/main/res/drawable-v21/launch_background.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
</layer-list>
================================================
FILE: android/app/src/main/res/values/styles.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
================================================
FILE: android/app/src/main/res/values-night/styles.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
================================================
FILE: android/app/src/profile/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
================================================
FILE: android/build.gradle
================================================
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = "../build"
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(":app")
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
================================================
FILE: android/gradle/wrapper/gradle-wrapper.properties
================================================
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
================================================
FILE: android/gradle.properties
================================================
android.useAndroidX=true
android.enableJetifier=true
org.gradle.daemon=false
org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G
================================================
FILE: android/settings.gradle
================================================
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.3.2" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
}
include ":app"
================================================
FILE: lib/chat/chat.dart
================================================
// This file is part of ChatBot.
//
// ChatBot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ChatBot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with ChatBot. If not, see <https://www.gnu.org/licenses/>.
import "input.dart";
import "message.dart";
import "current.dart";
import "settings.dart";
import "../util.dart";
import "../config.dart";
import "../gen/l10n.dart";
import "../settings/api.dart";
import "dart:io";
import "package:flutter/material.dart";
import "package:screenshot/screenshot.dart";
import "package:animate_do/animate_do.dart";
import "package:flutter_riverpod/flutter_riverpod.dart";
final chatProvider =
NotifierProvider.autoDispose<ChatNotifier, void>(ChatNotifier.new);
final chatsProvider =
NotifierProvider.autoDispose<ChatsNotifier, void>(ChatsNotifier.new);
final messagesProvider =
NotifierProvider.autoDispose<MessagesNotifier, void>(MessagesNotifier.new);
class ChatNotifier extends AutoDisposeNotifier<void> {
@override
void build() => ref.listen(apisProvider, (p, n) => notify());
void notify() => ref.notifyListeners();
}
class ChatsNotifier extends AutoDisposeNotifier<void> {
@override
void build() {}
void notify() => ref.notifyListeners();
}
class MessagesNotifier extends AutoDisposeNotifier<void> {
@override
void build() {}
void notify() => ref.notifyListeners();
}
class ChatPage extends ConsumerStatefulWidget {
const ChatPage({super.key});
@override
ConsumerState<ChatPage> createState() => _ChatPageState();
}
class _ChatPageState extends ConsumerState<ChatPage> {
final List<ChatConfig> _chats = Config.chats;
final List<Message> _messages = Current.messages;
final ScrollController _scrollCtrl = ScrollController();
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
Util.checkUpdate(context: context, notify: false);
});
_scrollCtrl.addListener(() {
final show = ref.read(_toBottomProvider);
if (_scrollCtrl.position.pixels < 200) {
if (show) ref.read(_toBottomProvider.notifier).hide();
} else {
if (!show) ref.read(_toBottomProvider.notifier).show();
}
});
}
@override
void dispose() {
_scrollCtrl.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: _buildAppBar(),
drawer: Drawer(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.zero,
),
child: SafeArea(child: _buildDrawer()),
),
body: _buildBody(),
);
}
AppBar _buildAppBar() {
return AppBar(
title: Row(
children: [
Flexible(
child: Consumer(
builder: (context, ref, child) {
ref.watch(chatProvider);
final id = Current.model;
final config = Config.models[id];
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
Current.title ?? S.of(context).new_chat,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.titleMedium,
),
Text(
config?.name ?? id ?? S.of(context).no_model,
overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.labelSmall,
)
],
);
},
),
),
const SizedBox(width: 8),
SizedBox.square(
dimension: 32,
child: IconButton(
icon: const Icon(Icons.edit, size: 16),
padding: EdgeInsets.zero,
onPressed: () {
InputWidget.unFocus();
showModalBottomSheet(
context: context,
useSafeArea: true,
isScrollControlled: true,
builder: (context) => Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
child: ChatSettings(),
),
);
},
),
),
],
),
leading: Builder(
builder: (context) => IconButton(
icon: const Icon(Icons.menu),
onPressed: () {
InputWidget.unFocus();
Scaffold.of(context).openDrawer();
},
),
),
actions: [
PopupMenuButton(
icon: const Icon(Icons.more_horiz),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(8)),
),
onOpened: () => InputWidget.unFocus(),
color: Theme.of(context).colorScheme.surfaceContainerLow,
itemBuilder: (context) => <PopupMenuItem>[
PopupMenuItem(
padding: EdgeInsets.zero,
child: ListTile(
contentPadding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 0),
leading: const Icon(Icons.file_copy, size: 20),
title: Text(S.of(context).clone_chat),
minTileHeight: 0,
),
onTap: () {
InputWidget.unFocus();
if (!Current.hasChat) return;
Current.newChat(Current.title!);
Current.save();
Util.showSnackBar(
context: context,
content: Text(S.of(context).cloned_successfully),
);
ref.read(chatsProvider.notifier).notify();
},
),
PopupMenuItem(
padding: EdgeInsets.zero,
child: ListTile(
contentPadding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 0),
leading: const Icon(Icons.delete, size: 24),
title: Text(S.of(context).clear_chat),
minTileHeight: 0,
),
onTap: () async {
InputWidget.unFocus();
if (_messages.isEmpty) return;
final result = await showDialog<bool>(
context: context,
builder: (context) => AlertDialog(
title: Text(S.of(context).clear_chat),
content: Text(S.of(context).ensure_clear_chat),
actions: [
TextButton(
onPressed: Navigator.of(context).pop,
child: Text(S.of(context).cancel),
),
TextButton(
onPressed: () => Navigator.of(context).pop(true),
child: Text(S.of(context).clear),
),
],
),
);
if (!(result ?? false)) return;
_messages.clear();
Current.save();
ref.read(messagesProvider.notifier).notify();
},
),
PopupMenuItem(
height: 1,
padding: EdgeInsets.zero,
child: const Divider(height: 1),
),
PopupMenuItem(
padding: EdgeInsets.zero,
onTap: _exportChatAsImage,
child: ListTile(
contentPadding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 0),
leading: const Icon(Icons.photo_library, size: 20),
title: Text(S.of(context).export_chat_as_image),
minTileHeight: 0,
),
),
],
),
],
);
}
Widget _buildDrawer() {
return Column(
children: [
ListTile(
title: Text(
"ChatBot",
style: Theme.of(context).textTheme.titleLarge,
),
trailing: IconButton(
icon: const Icon(Icons.settings),
onPressed: () => Navigator.of(context).pushNamed("/settings"),
),
contentPadding: const EdgeInsets.only(left: 16, right: 8),
),
Divider(),
ListView(
shrinkWrap: true,
padding: EdgeInsets.only(left: 8, right: 8),
children: [
ListTile(
minTileHeight: 48,
shape: const StadiumBorder(),
title: Text(S.of(context).new_chat),
leading: const Icon(Icons.article_outlined),
onTap: () {
if (Current.chatStatus.isResponding) return;
Current.clear();
ref.read(chatProvider.notifier).notify();
ref.read(chatsProvider.notifier).notify();
ref.read(messagesProvider.notifier).notify();
},
),
ListTile(
minTileHeight: 48,
shape: const StadiumBorder(),
title: Text(S.of(context).workspace),
leading: const Icon(Icons.workspaces_outlined),
onTap: () => Navigator.of(context).pushNamed("/workspace"),
),
ListTile(
minTileHeight: 48,
shape: const StadiumBorder(),
title: Text(S.of(context).image_generation),
leading: const Icon(Icons.image_outlined),
onTap: () => Navigator.of(context).pushNamed("/image"),
),
],
),
Container(
alignment: Alignment.topLeft,
padding: const EdgeInsets.only(left: 16, top: 8, bottom: 4),
child: Text(
S.of(context).all_chats,
style: Theme.of(context).textTheme.labelSmall,
),
),
Expanded(
child: Consumer(
builder: (context, ref, child) {
ref.watch(chatsProvider);
return ListView.builder(
itemCount: _chats.length,
itemBuilder: (context, index) => _buildChatItem(index),
padding: EdgeInsets.only(left: 8, right: 8, bottom: 8),
);
},
),
),
],
);
}
Widget _buildChatItem(int index) {
final chat = _chats[index];
return Container(
margin: EdgeInsets.only(top: 4),
child: ListTile(
dense: true,
minTileHeight: 48,
shape: const StadiumBorder(),
leading: const Icon(Icons.article),
selected: Current.chat == chat,
contentPadding: const EdgeInsets.only(left: 16, right: 8),
title: Text(
chat.title,
maxLines: 1,
softWrap: false,
overflow: TextOverflow.ellipsis,
),
subtitle: Text(chat.time),
onTap: () async {
if (Current.chat == chat) return;
Current.chat = chat;
ref.read(chatsProvider.notifier).notify();
await Current.load(chat);
ref.read(chatProvider.notifier).notify();
ref.read(messagesProvider.notifier).notify();
},
trailing: IconButton(
icon: const Icon(Icons.delete),
onPressed: () {
_chats.removeAt(index);
ref.read(chatsProvider.notifier).notify();
Config.save();
File(Config.chatFilePath(chat.fileName)).delete();
if (Current.chat == chat) {
Current.clear();
ref.read(chatProvider.notifier).notify();
ref.read(messagesProvider.notifier).notify();
}
},
),
),
);
}
Widget _buildBody() {
return Column(
children: [
Expanded(
child: Stack(
alignment: Alignment.topCenter,
children: [
Consumer(
builder: (context, ref, child) {
ref.watch(messagesProvider);
final length = _messages.length;
return ListView.separated(
reverse: true,
shrinkWrap: true,
controller: _scrollCtrl,
padding: const EdgeInsets.all(16),
separatorBuilder: (context, index) =>
const SizedBox(height: 16),
itemCount: length,
itemBuilder: (context, index) {
final message = _messages[length - index - 1];
return MessageWidget(
key: ValueKey(message),
message: message,
);
},
);
},
),
Positioned(
bottom: 8,
child: Consumer(
builder: (context, ref, child) {
final show = ref.watch(_toBottomProvider);
final child = ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 2,
shape: const CircleBorder(),
padding: const EdgeInsets.all(8),
),
onPressed: () => _scrollCtrl.jumpTo(0),
child: Icon(Icons.arrow_downward_rounded, size: 20),
);
return show ? ZoomIn(child: child) : ZoomOut(child: child);
},
),
),
],
),
),
Padding(
padding: const EdgeInsets.only(top: 0, left: 8, right: 8, bottom: 8),
child: const InputWidget(),
),
],
);
}
Future<void> _exportChatAsImage() async {
InputWidget.unFocus();
if (Current.messages.isEmpty) return;
try {
Dialogs.loading(
context: context,
hint: S.of(context).exporting,
);
final width = MediaQuery.of(context).size.width;
final page = Container(
padding: const EdgeInsets.only(top: 16, left: 16, right: 16, bottom: 0),
constraints: BoxConstraints(maxWidth: width),
child: MediaQuery(
data: MediaQueryData.fromView(View.of(context)).copyWith(
size: Size(width, double.infinity),
),
child: Column(
children: [
for (final message in _messages) ...[
MessageView(message: message),
const SizedBox(height: 16),
]
],
),
),
);
final png = await ScreenshotController().captureFromLongWidget(
InheritedTheme.captureAll(
context,
Material(child: page),
),
context: context,
pixelRatio: MediaQuery.of(context).devicePixelRatio,
);
final time = DateTime.now().millisecondsSinceEpoch.toString();
final path = Config.cacheFilePath("$time.png");
final file = File(path);
await file.writeAsBytes(png.toList());
if (!mounted) return;
Navigator.of(context).pop();
Dialogs.handleImage(context: context, path: path);
} catch (e) {
Navigator.of(context).pop();
Dialogs.error(context: context, error: e);
}
}
}
final _toBottomProvider =
AutoDisposeNotifierProvider<_ToBottomNotifier, bool>(_ToBottomNotifier.new);
class _ToBottomNotifier extends AutoDisposeNotifier<bool> {
@override
bool build() {
ref.listen(messagesProvider, (prev, next) {
if (state) hide();
});
return false;
}
void show() => state = true;
void hide() => state = false;
}
================================================
FILE: lib/chat/current.dart
================================================
// This file is part of ChatBot.
//
// ChatBot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ChatBot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with ChatBot. If not, see <https://www.gnu.org/licenses/>.
import "message.dart";
import "../util.dart";
import "../config.dart";
import "dart:io";
import "dart:isolate";
import "dart:convert";
class Current {
static File? _file;
static ChatConfig? _chat;
static CoreConfig core = Config.core;
static final List<Message> messages = [];
static TtsStatus ttsStatus = TtsStatus.nothing;
static ChatStatus chatStatus = ChatStatus.nothing;
static Future<void> load(ChatConfig chat) async {
_file = File(Config.chatFilePath(chat.fileName));
final from = _file;
final json = await Isolate.run(() async {
return jsonDecode(await from!.readAsString());
});
final messagesJson = json["messages"] ?? [];
final coreJson = json["core"];
messages.clear();
for (final message in messagesJson) {
messages.add(Message.fromJson(message));
}
core = coreJson != null ? CoreConfig.fromJson(coreJson) : Config.core;
}
static Future<void> save() async {
await _file!.writeAsString(jsonEncode({
"core": core,
"messages": messages,
}));
}
static void clear() {
_chat = null;
_file = null;
messages.clear();
core = Config.core;
}
static void newChat(String title) {
final now = DateTime.now();
final timestamp = now.millisecondsSinceEpoch.toString();
final time = Util.formatDateTime(now);
final fileName = "$timestamp.json";
_chat = ChatConfig(
time: time,
title: title,
fileName: fileName,
);
_file = File(Config.chatFilePath(fileName));
Config.chats.insert(0, _chat!);
Config.save();
}
static String? get bot => core.bot;
static String? get api => core.api;
static String? get model => core.model;
static ApiConfig? get _api => Config.apis[api];
static BotConfig? get _bot => Config.bots[bot];
static String? get apiUrl => _api?.url;
static String? get apiKey => _api?.key;
static String? get apiType => _api?.type;
static bool? get stream => _bot?.stream;
static int? get maxTokens => _bot?.maxTokens;
static double? get temperature => _bot?.temperature;
static String? get systemPrompts => _bot?.systemPrompts;
static ChatConfig? get chat => _chat;
static set chat(ChatConfig? chat) => _chat = chat!;
static String? get title => _chat?.title;
static set title(String? title) => _chat?.title = title!;
static bool get hasChat => _chat != null;
}
enum TtsStatus {
nothing,
loading,
playing;
bool get isNothing => this == TtsStatus.nothing;
bool get isLoading => this == TtsStatus.loading;
bool get isPlaying => this == TtsStatus.playing;
}
enum ChatStatus {
nothing,
responding;
bool get isNothing => this == ChatStatus.nothing;
bool get isResponding => this == ChatStatus.responding;
}
================================================
FILE: lib/chat/input.dart
================================================
// This file is part of ChatBot.
//
// ChatBot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ChatBot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with ChatBot. If not, see <https://www.gnu.org/licenses/>.
import "chat.dart";
import "message.dart";
import "current.dart";
import "../util.dart";
import "../config.dart";
import "../llm/llm.dart";
import "../gen/l10n.dart";
import "dart:convert";
import "package:flutter/material.dart";
import "package:flutter/services.dart";
import "package:image_picker/image_picker.dart";
import "package:flutter_riverpod/flutter_riverpod.dart";
import "package:flutter_image_compress/flutter_image_compress.dart";
class InputWidget extends ConsumerStatefulWidget {
static final FocusNode focusNode = FocusNode();
const InputWidget({super.key});
@override
ConsumerState<InputWidget> createState() => _InputWidgetState();
static void unFocus() => focusNode.unfocus();
}
typedef _Image = ({String name, MessageImage image});
class _InputWidgetState extends ConsumerState<InputWidget> {
String _lastText = "";
static final List<_Image> _images = [];
final TextEditingController _inputCtrl = TextEditingController();
@override
void initState() {
super.initState();
_inputCtrl.addListener(() {
final text = _inputCtrl.text;
if (_lastText.isEmpty ^ text.isEmpty) {
setState(() {});
}
_lastText = text;
});
}
@override
void dispose() {
_inputCtrl.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
ref.watch(llmProvider);
return Container(
constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height / 4,
),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceContainerHigh,
borderRadius: const BorderRadius.all(Radius.circular(12)),
border: Border.all(
color: Theme.of(context).colorScheme.outlineVariant,
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Flexible(
child: TextField(
maxLines: null,
autofocus: false,
controller: _inputCtrl,
focusNode: InputWidget.focusNode,
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
border: InputBorder.none,
constraints: const BoxConstraints(),
hintText: S.of(context).enter_message,
contentPadding: const EdgeInsets.only(
top: 8, left: 16, right: 16, bottom: 8),
),
),
),
Row(
children: [
const SizedBox(width: 8),
SizedBox.square(
dimension: 36,
child: IconButton(
icon: const Icon(Icons.upload_file),
padding: EdgeInsets.zero,
onPressed: _addFile,
),
),
const SizedBox(width: 8),
SizedBox.square(
dimension: 36,
child: GestureDetector(
onLongPress: () {
final old = Preferences.googleSearch;
Util.showSnackBar(
context: context,
content: Text(old
? S.of(context).search_general_mode
: S.of(context).search_gemini_mode),
);
setState(() => Preferences.googleSearch = !old);
},
child: IconButton(
icon: const Icon(Icons.language),
isSelected: Preferences.search,
selectedIcon: Badge(
label: const Text("G"),
isLabelVisible: Preferences.googleSearch,
child: const Icon(Icons.language),
),
padding: EdgeInsets.zero,
onPressed: () => setState(
() => Preferences.search = !Preferences.search),
),
),
),
if (_images.isNotEmpty) ...[
const SizedBox(width: 8),
SizedBox.square(
dimension: 36,
child: IconButton(
icon: const Icon(Icons.image_outlined),
isSelected: true,
padding: EdgeInsets.zero,
onPressed: _editImages,
),
),
],
const Expanded(child: SizedBox()),
const SizedBox(width: 8),
SizedBox.square(
dimension: 36,
child: _buildSendButton(),
),
const SizedBox(width: 8),
],
),
const SizedBox(height: 8),
],
),
);
}
Widget _buildSendButton() {
IconData icon;
Color background;
Color? foreground;
if (Current.chatStatus.isResponding) {
icon = Icons.pause;
background = Theme.of(context).colorScheme.primaryContainer;
foreground = Theme.of(context).colorScheme.onPrimaryContainer;
} else {
icon = Icons.arrow_upward;
if (_inputCtrl.text.isEmpty) {
background = Colors.grey.withOpacity(0.2);
} else {
background = Theme.of(context).colorScheme.primaryContainer;
foreground = Theme.of(context).colorScheme.onPrimaryContainer;
}
}
return IconButton(
icon: Icon(icon),
onPressed: _sendMessage,
padding: EdgeInsets.zero,
style: IconButton.styleFrom(
foregroundColor: foreground,
backgroundColor: background,
),
);
}
Future<void> _addFile() async {
InputWidget.unFocus();
final result = await showModalBottomSheet<int>(
context: context,
builder: (context) => Padding(
padding: const EdgeInsets.only(left: 8, right: 8, bottom: 8),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const DragHandle(),
ListTile(
minTileHeight: 48,
shape: const StadiumBorder(),
title: Text(S.of(context).camera),
leading: const Icon(Icons.camera_outlined),
onTap: () => Navigator.of(context).pop(1),
),
ListTile(
minTileHeight: 48,
shape: const StadiumBorder(),
title: Text(S.of(context).gallery),
leading: const Icon(Icons.photo_library_outlined),
onTap: () => Navigator.of(context).pop(2),
),
],
),
),
);
switch (result) {
case 1:
await _addImage(ImageSource.camera);
break;
case 2:
await _addImage(ImageSource.gallery);
break;
}
}
Future<void> _addImage(ImageSource source) async {
XFile? result;
Uint8List? compressed;
final picker = ImagePicker();
try {
result = await picker.pickImage(source: source);
if (result == null) return;
} catch (e) {
return;
}
if (Config.cic.enable ?? true) {
try {
compressed = await FlutterImageCompress.compressWithFile(
result.path,
quality: Config.cic.quality ?? 95,
minWidth: Config.cic.minWidth ?? 1920,
minHeight: Config.cic.minHeight ?? 1080,
);
if (compressed == null) throw false;
} catch (e) {
if (mounted) {
Util.showSnackBar(
context: context,
content: Text(S.of(context).image_compress_failed),
);
}
}
}
final bytes = compressed ?? await result.readAsBytes();
final image = (
name: result.name,
image: (bytes: bytes, base64: base64Encode(bytes)),
);
setState(() => _images.add(image));
}
void _editImages() async {
InputWidget.unFocus();
showModalBottomSheet<String>(
context: context,
scrollControlDisabledMaxHeightRatio: 0.7,
builder: (context) => StatefulBuilder(
builder: (context, setState2) => Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
DialogHeader(title: S.of(context).images),
const Divider(height: 1),
ListView.builder(
shrinkWrap: true,
itemCount: _images.length,
itemBuilder: (context, index) => ListTile(
title: Text(_images[index].name),
contentPadding: const EdgeInsets.only(left: 24, right: 12),
trailing: IconButton(
icon: const Icon(Icons.delete),
onPressed: () {
setState(() => _images.removeAt(index));
if (_images.isEmpty) {
Navigator.of(context).pop();
} else {
setState2(() {});
}
},
),
),
),
const Divider(height: 1),
DialogFooter(
children: [
TextButton(
onPressed: Navigator.of(context).pop,
child: Text(S.of(context).cancel),
),
TextButton(
onPressed: () {
setState(() => _images.clear());
Navigator.of(context).pop();
},
child: Text(S.of(context).clear),
),
],
),
],
),
),
);
}
Future<void> _sendMessage() async {
if (!Current.chatStatus.isNothing) {
ref.read(llmProvider.notifier).stopChat();
return;
}
if (!Util.checkChat(context)) return;
final text = _inputCtrl.text;
if (text.isEmpty) return;
final messages = Current.messages;
final user = MessageItem(
text: text,
role: MessageRole.user,
);
for (final image in _images) {
user.images.add(image.image);
}
messages.add(Message.fromItem(user));
final assistant = Message.fromItem(MessageItem(
text: "",
model: Current.model,
role: MessageRole.assistant,
time: Util.formatDateTime(DateTime.now()),
));
messages.add(assistant);
ref.read(messagesProvider.notifier).notify();
_images.clear();
_inputCtrl.clear();
final results = await Future.wait([
_generateTitle(text).catchError((e) => text),
ref.read(llmProvider.notifier).chat(assistant),
]);
final title = results[0];
final error = results[1];
if (error != null && mounted) {
_inputCtrl.text = text;
Dialogs.error(context: context, error: error);
}
if (title != null) {
Current.newChat(title);
ref.read(chatProvider.notifier).notify();
ref.read(chatsProvider.notifier).notify();
}
Current.save();
}
Future<String?> _generateTitle(String text) async {
if (Current.hasChat) return null;
return await generateTitle(text);
}
}
================================================
FILE: lib/chat/message.dart
================================================
// This file is part of ChatBot.
//
// ChatBot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ChatBot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with ChatBot. If not, see <https://www.gnu.org/licenses/>.
import "chat.dart";
import "input.dart";
import "current.dart";
import "../util.dart";
import "../config.dart";
import "../llm/llm.dart";
import "../gen/l10n.dart";
import "../markdown/util.dart";
import "../markdown/code.dart";
import "../markdown/latex.dart";
import "dart:async";
import "dart:convert";
import "dart:typed_data";
import "package:flutter/material.dart";
import "package:animate_do/animate_do.dart";
import "package:flutter_spinkit/flutter_spinkit.dart";
import "package:flutter_riverpod/flutter_riverpod.dart";
import "package:flutter_markdown/flutter_markdown.dart";
final messageProvider = NotifierProvider.autoDispose
.family<MessageNotifier, void, Message>(MessageNotifier.new);
class MessageNotifier extends AutoDisposeFamilyNotifier<void, Message> {
@override
void build(Message arg) {}
void notify() => ref.notifyListeners();
}
enum MessageRole {
user,
assistant;
bool get isUser => this == MessageRole.user;
bool get isAssistant => this == MessageRole.assistant;
}
enum CitationType {
web,
}
typedef MessageImage = ({
Uint8List bytes,
String base64,
});
typedef MessageCitation = ({
CitationType type,
String content,
String source,
});
class MessageItem {
String text;
String? time;
String? model;
MessageRole role;
List<MessageImage> images = [];
List<MessageCitation> citations = [];
MessageItem({
required this.role,
required this.text,
this.model,
this.time,
});
factory MessageItem.fromJson(Map json) {
final item = switch (json["role"]) {
"assistant" => MessageItem(
time: json["time"],
text: json["text"],
model: json["model"],
role: MessageRole.assistant,
),
"user" => MessageItem(
text: json["text"],
role: MessageRole.user,
),
_ => throw "bad role",
};
final image = json["image"];
final images = json["images"] ?? [];
if (image != null) {
item.images.add((
bytes: base64Decode(image),
base64: image,
));
}
for (final base64 in images) {
item.images.add((
bytes: base64Decode(base64),
base64: base64,
));
}
return item;
}
Map toJson() => switch (role) {
MessageRole.assistant => {
"time": time,
"text": text,
"model": model,
"role": "assistant",
},
MessageRole.user => {
"text": text,
"role": "user",
"images": [
for (final image in images) image.base64,
],
},
};
}
class Message {
int index;
List<MessageItem> list;
Message({
required this.index,
required this.list,
});
factory Message.fromItem(MessageItem item) => Message(
index: 0,
list: [item],
);
factory Message.fromJson(Map json) =>
json["index"] == null && json["list"] == null
? Message.fromItem(MessageItem.fromJson(json))
: Message(
index: json["index"],
list: [
for (final item in json["list"]) MessageItem.fromJson(item),
],
);
Map toJson() => {
"index": index,
"list": list,
};
MessageItem get item => list[index];
}
class MessageWidget extends ConsumerStatefulWidget {
final Message message;
const MessageWidget({
required this.message,
super.key,
});
@override
ConsumerState<MessageWidget> createState() => _MessageWidgetState();
}
class _MessageWidgetState extends ConsumerState<MessageWidget> {
@override
Widget build(BuildContext context) {
final message = widget.message;
ref.watch(messageProvider(message));
final item = message.item;
final role = item.role;
return Container(
alignment: role.isUser ? Alignment.topRight : Alignment.topLeft,
child: Column(
crossAxisAlignment: role.isAssistant
? CrossAxisAlignment.start
: CrossAxisAlignment.end,
children: [
if (item.images.isNotEmpty) ...[
_buildImages(),
const SizedBox(height: 8),
],
if (role.isAssistant) ...[
_buildHeader(),
SizedBox(height: 8),
],
_buildBody(),
if (Current.messages.lastOrNull == message &&
Current.chatStatus.isNothing) ...[
const SizedBox(height: 4),
FadeIn(child: _buildToolBar()),
],
],
),
);
}
Widget _buildImages() {
final item = widget.message.item;
return LayoutBuilder(builder: (context, constraints) {
final n = (constraints.maxWidth / 120).ceil();
final width = (constraints.maxWidth - 8 * (n - 1)) / n;
return Wrap(
spacing: 8,
runSpacing: 8,
children: [
for (final image in item.images)
Ink(
width: width,
height: width,
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(12)),
image: DecorationImage(
image: MemoryImage(image.bytes),
fit: BoxFit.cover,
),
),
child: InkWell(
borderRadius: const BorderRadius.all(Radius.circular(12)),
onTap: () async {
InputWidget.unFocus();
final result = await showDialog<bool>(
context: context,
builder: (context) => AlertDialog(
title: Text(S.of(context).delete_image),
content: Text(S.of(context).ensure_delete_image),
actions: [
TextButton(
onPressed: Navigator.of(context).pop,
child: Text(S.of(context).cancel),
),
TextButton(
onPressed: () => Navigator.of(context).pop(true),
child: Text(S.of(context).delete),
),
],
),
);
if (!(result ?? false)) return;
setState(() => item.images.remove(image));
Current.save();
},
),
),
],
);
});
}
Widget _buildHeader() {
final message = widget.message;
final item = message.item;
final id = item.model;
return Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
ModelAvatar(id: id),
const SizedBox(width: 12),
Flexible(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 1),
Text(
Config.models[id]?.name ?? id ?? S.of(context).no_model,
style: Theme.of(context).textTheme.titleMedium,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 1),
Text(
item.time ?? Util.formatDateTime(DateTime.now()),
style: Theme.of(context).textTheme.bodySmall,
),
const SizedBox(height: 2),
],
),
),
if (message.list.length > 1 &&
(Current.chatStatus.isNothing ||
message != Current.messages.lastOrNull)) ...[
const SizedBox(width: 8),
SizedBox(
width: 32,
height: 32,
child: IconButton(
icon: const Icon(Icons.arrow_back_ios_rounded),
iconSize: 16,
onPressed: () {
if (item == message.list.first) return;
setState(() => message.index--);
Current.save();
},
),
),
Text("${message.index + 1}/${message.list.length}"),
SizedBox(
width: 32,
height: 32,
child: IconButton(
icon: const Icon(Icons.arrow_forward_ios_rounded),
iconSize: 16,
onPressed: () {
if (item == message.list.last) return;
setState(() => message.index++);
Current.save();
},
),
),
],
],
);
}
Widget _buildBody() {
final item = widget.message.item;
final text = item.text;
final role = item.role;
final colorScheme = Theme.of(context).colorScheme;
final markdownStyleSheet = MarkdownStyleSheet(
codeblockPadding: EdgeInsets.all(0),
codeblockDecoration: BoxDecoration(
color: colorScheme.surfaceContainerHighest,
borderRadius: const BorderRadius.all(Radius.circular(12)),
),
blockquoteDecoration: BoxDecoration(
color: colorScheme.brightness == Brightness.light
? Colors.blueGrey.withOpacity(0.3)
: Colors.black.withOpacity(0.3),
borderRadius: const BorderRadius.all(Radius.circular(12)),
),
);
final radius = BorderRadius.only(
topLeft: const Radius.circular(12),
bottomLeft: const Radius.circular(12),
bottomRight: const Radius.circular(12),
topRight: Radius.circular(role.isUser ? 2 : 12),
);
return LayoutBuilder(
key: UniqueKey(),
builder: (context, constraints) => Ink(
decoration: BoxDecoration(
color: role.isAssistant
? colorScheme.surfaceContainer
: colorScheme.secondaryContainer,
borderRadius: radius,
),
child: InkWell(
borderRadius: radius,
onLongPress: _longPress,
child: Container(
padding: const EdgeInsets.all(12),
constraints: BoxConstraints(
maxWidth: constraints.maxWidth * (role.isUser ? 0.9 : 1),
),
child: switch (text.isNotEmpty) {
true => MarkdownBody(
data: text,
extensionSet: mdExtensionSet,
onTapLink: (text, href, title) =>
Dialogs.openLink(context: context, link: href),
builders: {
"pre": CodeBlockBuilder(context: context),
"latex": LatexElementBuilder(textScaleFactor: 1.2),
},
styleSheet: markdownStyleSheet,
styleSheetTheme: MarkdownStyleSheetBaseTheme.material,
),
false => SizedBox(
width: 36,
height: 18,
child: SpinKitWave(
size: 18,
color: colorScheme.onSurfaceVariant,
),
),
},
),
),
),
);
}
Widget _buildToolBar() {
final item = widget.message.item;
final role = item.role;
return Row(
mainAxisAlignment:
role.isUser ? MainAxisAlignment.end : MainAxisAlignment.start,
children: [
if (role.isAssistant) ...[
SizedBox(
width: 36,
height: 26,
child: IconButton(
icon: Icon(switch (Current.ttsStatus) {
TtsStatus.loading => Icons.cancel_outlined,
TtsStatus.nothing => Icons.volume_up_outlined,
TtsStatus.playing => Icons.pause_circle_outlined,
}),
iconSize: 18,
onPressed: _tts,
padding: EdgeInsets.zero,
),
),
SizedBox(
width: 36,
height: 26,
child: IconButton(
icon: const Icon(Icons.sync_outlined),
iconSize: 18,
onPressed: _reanswer,
padding: EdgeInsets.zero,
),
),
if (item.citations.isNotEmpty)
SizedBox(
width: 36,
height: 26,
child: IconButton(
icon: const Icon(Icons.find_in_page_outlined),
iconSize: 18,
onPressed: _citations,
padding: EdgeInsets.zero,
),
),
],
SizedBox(
width: 36,
height: 26,
child: IconButton(
icon: const Icon(Icons.paste_outlined),
iconSize: 16,
onPressed: _copy,
padding: EdgeInsets.zero,
),
),
SizedBox(
width: 36,
height: 26,
child: IconButton(
icon: const Icon(Icons.edit_outlined),
iconSize: 18,
onPressed: _edit,
padding: EdgeInsets.zero,
),
),
SizedBox(
width: 36,
height: 26,
child: IconButton(
icon: const Icon(Icons.delete_outlined),
iconSize: 18,
onPressed: _delete,
padding: EdgeInsets.zero,
),
),
],
);
}
void _edit() {
InputWidget.unFocus();
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => _MessageEditor(message: widget.message),
));
}
void _copy() {
Util.copyText(
context: context,
text: widget.message.item.text,
);
}
void _delete() {
if (!Current.chatStatus.isNothing) return;
if (!Current.ttsStatus.isNothing) return;
final message = widget.message;
final list = message.list;
final item = message.item;
if (list.length == 1) {
Current.messages.remove(message);
ref.read(messagesProvider.notifier).notify();
} else {
if (item == list.last) message.index--;
setState(() => list.remove(item));
}
Current.save();
}
void _source() {
InputWidget.unFocus();
showModalBottomSheet(
context: context,
useSafeArea: true,
showDragHandle: true,
scrollControlDisabledMaxHeightRatio: 1,
builder: (context) => ConstrainedBox(
constraints: BoxConstraints(
minWidth: double.infinity,
minHeight: MediaQuery.of(context).size.height * 0.6,
),
child: SingleChildScrollView(
padding: const EdgeInsets.only(left: 24, right: 24),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SelectableText(
widget.message.item.text,
style: Theme.of(context).textTheme.bodyLarge,
),
const SizedBox(height: 48),
],
),
),
),
);
}
void _citations() {
InputWidget.unFocus();
final citations = widget.message.item.citations;
void onTap(MessageCitation citation) {
switch (citation.type) {
case CitationType.web:
Dialogs.openLink(
context: context,
link: citation.source,
);
break;
}
}
showModalBottomSheet(
context: context,
useSafeArea: true,
scrollControlDisabledMaxHeightRatio: 0.7,
builder: (context) => Column(
mainAxisSize: MainAxisSize.min,
children: [
DialogHeader(title: S.of(context).citations),
const Divider(height: 1),
Flexible(
child: ListView.separated(
itemCount: citations.length,
itemBuilder: (context, index) {
final citation = citations[index];
final content = citation.content;
final source = citation.source;
return Card.filled(
margin: EdgeInsets.zero,
color: Theme.of(context).colorScheme.surfaceContainer,
child: ListTile(
title: Text(
source,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
subtitle: Text(
content,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
onTap: () => onTap(citation),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(12)),
),
contentPadding: const EdgeInsets.symmetric(horizontal: 12),
),
);
},
padding: const EdgeInsets.all(12),
separatorBuilder: (context, index) => const SizedBox(height: 12),
),
),
],
),
);
}
void _longPress() {
InputWidget.unFocus();
void invoke(VoidCallback func) {
Navigator.of(context).pop();
func();
}
showModalBottomSheet(
context: context,
builder: (context) => Padding(
padding: const EdgeInsets.only(left: 8, right: 8, bottom: 8),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const DragHandle(),
ListTile(
minTileHeight: 48,
shape: const StadiumBorder(),
title: Text(S.of(context).edit),
leading: const Icon(Icons.edit_outlined),
onTap: () => invoke(_edit),
),
ListTile(
minTileHeight: 48,
shape: StadiumBorder(),
title: Text(S.of(context).copy),
leading: const Icon(Icons.copy_all),
onTap: () => invoke(_copy),
),
ListTile(
minTileHeight: 48,
shape: const StadiumBorder(),
title: Text(S.of(context).delete),
leading: const Icon(Icons.delete_outlined),
onTap: () => invoke(_delete),
),
ListTile(
minTileHeight: 48,
shape: const StadiumBorder(),
title: Text(S.of(context).source),
leading: const Icon(Icons.code_outlined),
onTap: () => invoke(_source),
),
if (widget.message.item.citations.isNotEmpty)
ListTile(
minTileHeight: 48,
shape: const StadiumBorder(),
title: Text(S.of(context).citations),
leading: const Icon(Icons.find_in_page_outlined),
onTap: () => invoke(_citations),
),
],
),
),
);
}
Future<void> _tts() async {
if (!Current.ttsStatus.isNothing) {
ref.read(llmProvider.notifier).stopTts();
return;
}
final message = widget.message;
final text = message.item.text;
if (text.isEmpty) return;
final tts = Config.tts;
final ttsOk = tts.api != null && tts.model != null && tts.voice != null;
if (!ttsOk) {
Util.showSnackBar(
context: context,
content: Text(S.of(context).setup_tts_first),
);
return;
}
final error = await ref.read(llmProvider.notifier).tts(message);
if (error != null && mounted) {
Dialogs.error(context: context, error: error);
}
}
Future<void> _reanswer() async {
if (!Current.chatStatus.isNothing) {
ref.read(llmProvider.notifier).stopChat();
return;
}
if (!Util.checkChat(context)) return;
final message = widget.message;
message.list.add(MessageItem(
text: "",
model: Current.model,
role: MessageRole.assistant,
time: Util.formatDateTime(DateTime.now()),
));
message.index = message.list.length - 1;
final error = await ref.read(llmProvider.notifier).chat(message);
if (error != null && mounted) {
Dialogs.error(context: context, error: error);
}
Current.save();
}
}
class MessageView extends StatelessWidget {
final Message message;
final MessageItem item;
MessageView({
required this.message,
super.key,
}) : item = message.item;
@override
Widget build(BuildContext context) {
final role = item.role;
return Container(
alignment: role.isUser ? Alignment.topRight : Alignment.topLeft,
child: Column(
crossAxisAlignment: role.isAssistant
? CrossAxisAlignment.start
: CrossAxisAlignment.end,
children: [
if (item.images.isNotEmpty) ...[
_buildImages(context),
const SizedBox(height: 8),
],
if (role.isAssistant) ...[
_buildHeader(context),
const SizedBox(height: 8),
],
_buildBody(context),
],
),
);
}
Widget _buildImages(BuildContext context) {
return LayoutBuilder(builder: (context, constraints) {
final n = (constraints.maxWidth / 120).ceil();
final width = (constraints.maxWidth - 8 * (n - 1)) / n;
return Wrap(
spacing: 8,
runSpacing: 8,
children: [
for (final image in item.images)
ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(8)),
child: Image.memory(
image.bytes,
width: width,
height: width,
fit: BoxFit.cover,
),
),
],
);
});
}
Widget _buildHeader(BuildContext context) {
final id = item.model;
return Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
ModelAvatar(id: id),
const SizedBox(width: 12),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 1),
Text(
Config.models[id]?.name ?? id ?? S.current.no_model,
style: Theme.of(context).textTheme.titleMedium,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 1),
Text(
item.time ?? Util.formatDateTime(DateTime.now()),
style: Theme.of(context).textTheme.bodySmall,
),
const SizedBox(height: 2),
],
),
],
);
}
Widget _buildBody(BuildContext context) {
final text = item.text;
final role = item.role;
final colorScheme = Theme.of(context).colorScheme;
final markdownStyleSheet = MarkdownStyleSheet(
codeblockPadding: EdgeInsets.all(0),
codeblockDecoration: BoxDecoration(
color: colorScheme.surfaceContainerHighest,
borderRadius: const BorderRadius.all(Radius.circular(12)),
),
blockquoteDecoration: BoxDecoration(
color: colorScheme.brightness == Brightness.light
? Colors.blueGrey.withOpacity(0.3)
: Colors.black.withOpacity(0.3),
borderRadius: const BorderRadius.all(Radius.circular(12)),
),
);
final radius = BorderRadius.only(
topLeft: const Radius.circular(12),
bottomLeft: const Radius.circular(12),
bottomRight: const Radius.circular(12),
topRight: Radius.circular(role.isUser ? 2 : 12),
);
return Container(
padding: const EdgeInsets.all(12),
constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width * (role.isUser ? 0.9 : 1),
),
decoration: BoxDecoration(
borderRadius: radius,
color: role.isAssistant
? colorScheme.surfaceContainer
: colorScheme.secondaryContainer,
),
child: MarkdownBody(
data: text,
extensionSet: mdExtensionSet,
onTapLink: (text, href, title) =>
Dialogs.openLink(context: context, link: href),
builders: {
"pre": CodeBlockBuilder2(context: context),
"latex": LatexElementBuilder2(textScaleFactor: 1.2),
},
styleSheet: markdownStyleSheet,
styleSheetTheme: MarkdownStyleSheetBaseTheme.material,
),
);
}
}
class _MessageEditor extends ConsumerStatefulWidget {
final Message message;
const _MessageEditor({
required this.message,
});
@override
ConsumerState<_MessageEditor> createState() => _MessageEditorState();
}
class _MessageEditorState extends ConsumerState<_MessageEditor> {
late final Message message;
late final UndoHistoryController _undoCtrl;
late final TextEditingController _editCtrl;
@override
void initState() {
super.initState();
message = widget.message;
_undoCtrl = UndoHistoryController();
final text = widget.message.item.text;
_editCtrl = TextEditingController(text: text);
}
@override
void dispose() {
_editCtrl.dispose();
_undoCtrl.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(S.of(context).edit),
actions: [
IconButton(
icon: const Icon(Icons.undo),
onPressed: () => _undoCtrl.undo(),
),
IconButton(
icon: const Icon(Icons.redo),
onPressed: () => _undoCtrl.redo(),
),
IconButton(
icon: const Icon(Icons.done),
onPressed: () {
message.item.text = _editCtrl.text;
ref.read(messageProvider(message).notifier).notify();
Current.save();
Navigator.of(context).pop();
},
),
],
),
body: TextField(
expands: true,
maxLines: null,
controller: _editCtrl,
undoController: _undoCtrl,
textAlign: TextAlign.start,
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
border: InputBorder.none,
hintText: S.of(context).enter_message,
contentPadding:
const EdgeInsets.only(top: 12, left: 16, right: 16, bottom: 12),
),
),
);
}
}
================================================
FILE: lib/chat/settings.dart
================================================
// This file is part of ChatBot.
//
// ChatBot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ChatBot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with ChatBot. If not, see <https://www.gnu.org/licenses/>.
import "chat.dart";
import "current.dart";
import "../util.dart";
import "../config.dart";
import "../gen/l10n.dart";
import "../settings/api.dart";
import "../settings/bot.dart";
import "../workspace/model.dart";
import "package:flutter/material.dart";
import "package:flutter_riverpod/flutter_riverpod.dart";
class ChatSettings extends ConsumerStatefulWidget {
const ChatSettings({super.key});
@override
ConsumerState<ChatSettings> createState() => _ChatSettingsState();
}
class _ChatSettingsState extends ConsumerState<ChatSettings> {
String? _error;
String? _bot = Current.bot;
String? _api = Current.api;
String? _model = Current.model;
final TextEditingController _ctrl =
TextEditingController(text: Current.title);
@override
void dispose() {
_ctrl.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
ref.watch(chatProvider);
ref.watch(botsProvider);
ref.watch(apisProvider);
return Column(
mainAxisSize: MainAxisSize.min,
children: [
DialogHeader(title: S.of(context).chat_settings),
const Divider(height: 1),
const SizedBox(height: 4),
Row(
children: [
const SizedBox(width: 24),
Expanded(
child: TextField(
controller: _ctrl,
decoration: InputDecoration(
errorText: _error,
labelText: S.of(context).chat_title,
border: const UnderlineInputBorder(),
),
),
),
IconButton(
icon: const Icon(Icons.subdirectory_arrow_left),
onPressed: _saveTitle,
),
const SizedBox(width: 12),
],
),
const SizedBox(height: 12),
Flexible(
child: SingleChildScrollView(
padding: const EdgeInsets.only(left: 12, right: 12),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
_buildBots(),
const SizedBox(height: 8),
ConstrainedBox(
constraints: const BoxConstraints(maxHeight: 320),
child: IntrinsicHeight(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Flexible(
flex: 2,
child: _buildApis(),
),
const SizedBox(width: 8),
Flexible(
flex: 3,
child: _buildModels(),
),
],
),
),
),
const SizedBox(height: 12),
],
),
),
),
],
);
}
Widget _buildBots() {
final bots = Config.bots.keys.toList();
return Card.filled(
margin: EdgeInsets.zero,
color: Theme.of(context).colorScheme.surfaceContainer,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 12),
Row(
children: [
const SizedBox(width: 12),
Icon(
Icons.smart_toy,
color: Theme.of(context).colorScheme.primary,
),
const SizedBox(width: 16),
Text(
S.of(context).bot,
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
),
),
],
),
const SizedBox(height: 12),
if (bots.isNotEmpty) ...[
const Divider(height: 1),
const SizedBox(height: 8),
Stack(
children: [
const IgnorePointer(
child: Opacity(
opacity: 0,
child: ChoiceChip(
label: Text("bot"),
padding: EdgeInsets.all(4),
selected: true,
),
),
),
const SizedBox(width: double.infinity),
Positioned.fill(
child: ListView.separated(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
padding: const EdgeInsets.only(left: 12, right: 12),
itemCount: bots.length,
itemBuilder: (context, index) {
final bot = bots[index];
return GestureDetector(
onLongPress: () =>
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => BotSettings(bot: bot),
)),
child: ChoiceChip(
label: Text(bot),
padding: const EdgeInsets.all(4),
selected: _bot == bot,
onSelected: (value) {
setState(() => _bot = value ? bot : null);
_saveCore();
},
),
);
},
separatorBuilder: (context, index) =>
const SizedBox(width: 8),
),
),
],
),
const SizedBox(height: 8),
],
],
),
);
}
Widget _buildApis() {
final apis = Config.apis.keys.toList();
return Card.filled(
margin: EdgeInsets.zero,
color: Theme.of(context).colorScheme.surfaceContainer,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 12),
Row(
children: [
const SizedBox(width: 12),
Icon(
Icons.api,
color: Theme.of(context).colorScheme.primary,
),
const SizedBox(width: 16),
Text(
S.of(context).api,
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
),
),
],
),
const SizedBox(height: 12),
if (apis.isNotEmpty) ...[
const Divider(height: 1),
Flexible(
child: SingleChildScrollView(
child: Column(
children: [
for (final api in apis)
ListTile(
title: Text(api),
minTileHeight: 48,
selected: _api == api,
contentPadding:
const EdgeInsets.only(left: 16, right: 16),
onTap: () => setState(() => _api = api),
onLongPress: () =>
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => ApiSettings(api: api),
)),
),
],
),
),
),
const SizedBox(height: 12),
],
],
),
);
}
Widget _buildModels() {
final ids = Config.apis[_api]?.models ?? [];
final models = <({String id, String name})>[];
for (final it in ids) {
final config = Config.models[it];
if (config == null) {
models.add((id: it, name: it));
} else if (config.chat) {
models.add((id: it, name: config.name));
}
}
return Card.filled(
margin: EdgeInsets.zero,
color: Theme.of(context).colorScheme.surfaceContainer,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 12),
Row(
children: [
const SizedBox(width: 12),
Icon(
Icons.face,
color: Theme.of(context).colorScheme.primary,
),
const SizedBox(width: 16),
Text(
S.of(context).model,
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
),
),
],
),
const SizedBox(height: 12),
if (ids.isNotEmpty) ...[
const Divider(height: 1),
Flexible(
child: SingleChildScrollView(
child: Column(
children: [
for (final model in models)
ListTile(
title: Text(model.name),
minTileHeight: 48,
selected: _model == model.id,
contentPadding:
const EdgeInsets.only(left: 16, right: 16),
onTap: () {
setState(() => _model = model.id);
_saveCore();
},
onLongPress: () => showModalBottomSheet(
context: context,
useSafeArea: true,
isScrollControlled: true,
builder: (context) => Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
child: ModelSettings(id: model.id),
),
),
),
],
),
),
),
const SizedBox(height: 12),
],
],
),
);
}
void _saveCore() {
final oldModel = Current.model;
Current.core = CoreConfig(
bot: _bot,
api: _api,
model: _model,
);
if (_model != oldModel) {
ref.read(chatProvider.notifier).notify();
}
if (Current.hasChat) Current.save();
}
void _saveTitle() {
final title = _ctrl.text;
final hasChat = Current.hasChat;
final oldTitle = Current.title ?? "";
if (title.isEmpty && hasChat) {
final error = S.of(context).enter_a_title;
setState(() => _error = error);
return;
}
if (title != oldTitle) {
if (hasChat) {
Current.title = title;
} else {
Current.newChat(title);
}
ref.read(chatProvider.notifier).notify();
ref.read(chatsProvider.notifier).notify();
}
setState(() => _error = null);
if (Current.hasChat) Current.save();
}
}
================================================
FILE: lib/config.dart
================================================
// This file is part of ChatBot.
//
// ChatBot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ChatBot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with ChatBot. If not, see <https://www.gnu.org/licenses/>.
import "dart:io";
import "dart:convert";
import "dart:isolate";
import "package:http/http.dart";
import "package:flutter/material.dart";
import "package:archive/archive_io.dart";
import "package:path_provider/path_provider.dart";
import "package:package_info_plus/package_info_plus.dart";
import "package:shared_preferences/shared_preferences.dart";
class Config {
static late final TtsConfig tts;
static late final CicConfig cic;
static late final CoreConfig core;
static late final ImageConfig image;
static late final TitleConfig title;
static late final SearchConfig search;
static late final VectorConfig vector;
static late final DocumentConfig document;
static final List<ChatConfig> chats = [];
static final Map<String, BotConfig> bots = {};
static final Map<String, ApiConfig> apis = {};
static final Map<String, ModelConfig> models = {};
static late final File _file;
static late final String _dir;
static late final String _sep;
static late final String _cache;
static const String _chatDir = "chat";
static const String _audioDir = "audio";
static const String _imageDir = "image";
static const String _settingsFile = "settings.json";
static Future<void> init() async {
_sep = Platform.pathSeparator;
_cache = (await getTemporaryDirectory()).path;
if (Platform.isAndroid) {
_dir = (await getExternalStorageDirectory())!.path;
} else {
_dir = (await getApplicationSupportDirectory()).path;
}
_initDir();
_initFile();
_fixChatFile();
await Preferences.init();
}
static Future<void> save() async {
await _file.writeAsString(jsonEncode(toJson()));
}
static String chatFilePath(String fileName) =>
"$_dir$_sep$_chatDir$_sep$fileName";
static String audioFilePath(String fileName) =>
"$_dir$_sep$_audioDir$_sep$fileName";
static String imageFilePath(String fileName) =>
"$_dir$_sep$_imageDir$_sep$fileName";
static String cacheFilePath(String fileName) => "$_cache$_sep$fileName";
static Map toJson() => {
"tts": tts,
"cic": cic,
"core": core,
"bots": bots,
"apis": apis,
"chats": chats,
"image": image,
"title": title,
"search": search,
"vector": vector,
"models": models,
"document": document,
};
static void fromJson(Map json) {
final ttsJson = json["tts"] ?? {};
final imgJson = json["cic"] ?? {};
final coreJson = json["core"] ?? {};
final botsJson = json["bots"] ?? {};
final apisJson = json["apis"] ?? {};
final chatsJson = json["chats"] ?? [];
final imageJson = json["image"] ?? {};
final titleJson = json["title"] ?? {};
final searchJson = json["search"] ?? {};
final vectorJson = json["vector"] ?? {};
final modelsJson = json["models"] ?? {};
final documentJson = json["document"] ?? {};
tts = TtsConfig.fromJson(ttsJson);
cic = CicConfig.fromJson(imgJson);
core = CoreConfig.fromJson(coreJson);
image = ImageConfig.fromJson(imageJson);
title = TitleConfig.fromJson(titleJson);
search = SearchConfig.fromJson(searchJson);
vector = VectorConfig.fromJson(vectorJson);
document = DocumentConfig.fromJson(documentJson);
for (final chat in chatsJson) {
chats.add(ChatConfig.fromJson(chat));
}
for (final pair in botsJson.entries) {
bots[pair.key] = BotConfig.fromJson(pair.value);
}
for (final pair in apisJson.entries) {
apis[pair.key] = ApiConfig.fromJson(pair.value);
}
for (final pair in modelsJson.entries) {
models[pair.key] = ModelConfig.fromJson(pair.value);
}
}
static void _initDir() {
final chatPath = "$_dir$_sep$_chatDir";
final chatDir = Directory(chatPath);
if (!(chatDir.existsSync())) {
chatDir.createSync();
}
final imagePath = "$_dir$_sep$_imageDir";
final imageDir = Directory(imagePath);
if (!(imageDir.existsSync())) {
imageDir.createSync();
}
final audioPath = "$_dir$_sep$_audioDir";
final audioDir = Directory(audioPath);
if (!(audioDir.existsSync())) {
audioDir.createSync();
}
}
static void _initFile() {
final path = "$_dir$_sep$_settingsFile";
_file = File(path);
if (_file.existsSync()) {
final data = _file.readAsStringSync();
fromJson(jsonDecode(data));
} else {
fromJson({});
}
}
static void _fixChatFile() {
for (final chat in chats) {
final fileName = chat.fileName;
final oldPath = "$_dir$_sep$fileName";
final newPath = chatFilePath(fileName);
final file = File(oldPath);
if (file.existsSync()) {
file.renameSync(newPath);
}
}
}
}
class Backup {
static Future<void> exportConfig(String to) async {
final time = DateTime.now().millisecondsSinceEpoch.toString();
final path = "$to${Config._sep}chatbot-backup-$time.zip";
final root = Directory(Config._dir);
await Isolate.run(() async {
final encoder = ZipFileEncoder();
encoder.create(path);
await for (final entity in root.list()) {
if (entity is File) {
encoder.addFile(entity);
} else if (entity is Directory) {
encoder.addDirectory(entity);
}
}
await encoder.close();
});
}
static Future<void> importConfig(String from) async {
final root = Config._dir;
await Isolate.run(() async {
await extractFileToDisk(from, root);
});
}
static Future<void> clearData(List<String> dirs) async {
final root = Config._dir;
final sep = Config._sep;
await Isolate.run(() async {
for (final dir in dirs) {
final directory = Directory("$root$sep$dir");
if (!directory.existsSync()) continue;
directory.deleteSync(recursive: true);
}
});
Config._initDir();
}
}
class Updater {
static List<int>? versionCode;
static const String latestUrl =
"https://github.com/fanenr/flutter-chatbot/releases/latest";
static const String apiEndPoint =
"https://api.github.com/repos/fanenr/flutter-chatbot/releases/latest";
static Future<Map?> check() async {
if (versionCode == null) {
final version = (await PackageInfo.fromPlatform()).version;
versionCode = version.split('.').map(int.parse).toList();
}
final client = Client();
final response = await client.get(Uri.parse(apiEndPoint));
if (response.statusCode != 200) {
throw "${response.statusCode} ${response.body}";
}
final json = jsonDecode(response.body);
return _isNewer(json["tag_name"]) ? json : null;
}
static bool _isNewer(String latest) {
final latestCode = latest.substring(1).split('.').map(int.parse).toList();
for (int i = 0; i < 3; i++) {
if (latestCode[i] < versionCode![i]) return false;
if (latestCode[i] > versionCode![i]) return true;
}
return false;
}
}
class Preferences {
static late bool _search;
static late bool _googleSearch;
static late SharedPreferencesAsync _prefs;
static Future<void> init() async {
SharedPreferences.setPrefix("chatbot");
_prefs = SharedPreferencesAsync();
await _init();
}
static bool get search => _search;
static bool get googleSearch => _googleSearch;
static set search(bool value) {
_search = value;
_prefs.setBool("search", value);
}
static set googleSearch(bool value) {
_googleSearch = value;
_prefs.setBool("googleSearch", value);
}
static Future<void> _init() async {
_search = await _prefs.getBool("search") ?? false;
_googleSearch = await _prefs.getBool("googleSearch") ?? false;
}
}
class BotConfig {
bool? stream;
int? maxTokens;
double? temperature;
String? systemPrompts;
BotConfig({
this.stream,
this.maxTokens,
this.temperature,
this.systemPrompts,
});
Map toJson() => {
"stream": stream,
"maxTokens": maxTokens,
"temperature": temperature,
"systemPrompts": systemPrompts,
};
factory BotConfig.fromJson(Map json) => BotConfig(
stream: json["stream"],
maxTokens: json["maxTokens"],
temperature: json["temperature"],
systemPrompts: json["systemPrompts"],
);
}
class ApiConfig {
String url;
String key;
String? type;
List<String> models;
ApiConfig({
required this.url,
required this.key,
required this.models,
this.type,
});
Map toJson() => {
"url": url,
"key": key,
"type": type,
"models": models,
};
factory ApiConfig.fromJson(Map json) => ApiConfig(
url: json["url"],
key: json["key"],
type: json["type"],
models: json["models"].cast<String>(),
);
}
class CoreConfig {
String? _bot;
String? _api;
String? _model;
CoreConfig({
String? bot,
String? api,
String? model,
}) : _bot = bot,
_api = api,
_model = model;
String? get bot => Config.bots.containsKey(_bot) ? _bot : null;
String? get api => Config.apis.containsKey(_api) ? _api : null;
String? get model =>
(Config.apis[_api]?.models.contains(_model) ?? false) ? _model : null;
set bot(String? value) => _bot = value;
set api(String? value) => _api = value;
set model(String? value) => _model = value;
Map toJson() => {
"bot": bot,
"api": api,
"model": model,
};
factory CoreConfig.fromJson(Map json) => CoreConfig(
bot: json["bot"],
api: json["api"],
model: json["model"],
);
}
class ChatConfig {
String time;
String title;
String fileName;
ChatConfig({
required this.time,
required this.title,
required this.fileName,
});
Map toJson() => {
"time": time,
"title": title,
"fileName": fileName,
};
factory ChatConfig.fromJson(Map json) => ChatConfig(
time: json["time"],
title: json["title"],
fileName: json["fileName"],
);
}
class TtsConfig {
String? _api;
String? _model;
String? voice;
TtsConfig({
String? api,
String? model,
this.voice,
}) : _api = api,
_model = model;
String? get api => Config.apis.containsKey(_api) ? _api : null;
String? get model =>
(Config.apis[_api]?.models.contains(_model) ?? false) ? _model : null;
set api(String? value) => _api = value;
set model(String? value) => _model = value;
Map toJson() => {
"api": api,
"model": model,
"voice": voice,
};
factory TtsConfig.fromJson(Map json) => TtsConfig(
api: json["api"],
model: json["model"],
voice: json["voice"],
);
}
class CicConfig {
bool? enable;
int? quality;
int? minWidth;
int? minHeight;
CicConfig({
this.enable,
this.quality,
this.minWidth,
this.minHeight,
});
Map toJson() => {
"enable": enable,
"quality": quality,
"minWidth": minWidth,
"minHeight": minHeight,
};
factory CicConfig.fromJson(Map json) => CicConfig(
enable: json["enable"],
quality: json["quality"],
minWidth: json["minWidth"],
minHeight: json["minHeight"],
);
}
class ImageConfig {
String? _api;
String? _model;
String? size;
String? style;
String? quality;
ImageConfig({
String? api,
String? model,
this.size,
this.style,
this.quality,
}) : _api = api,
_model = model;
String? get api => Config.apis.containsKey(_api) ? _api : null;
String? get model =>
(Config.apis[_api]?.models.contains(_model) ?? false) ? _model : null;
set api(String? value) => _api = value;
set model(String? value) => _model = value;
Map toJson() => {
"api": api,
"model": model,
"size": size,
"style": style,
"quality": quality,
};
factory ImageConfig.fromJson(Map json) => ImageConfig(
api: json["api"],
size: json["size"],
model: json["model"],
style: json["style"],
quality: json["quality"],
);
}
class ModelConfig {
bool chat;
String name;
ModelConfig({
required this.chat,
required this.name,
});
Map toJson() => {
"chat": chat,
"name": name,
};
factory ModelConfig.fromJson(Map json) => ModelConfig(
chat: json["chat"],
name: json["name"],
);
}
class TitleConfig {
bool? enable;
String? _api;
String? _model;
String? prompt;
TitleConfig({
String? api,
String? model,
this.enable,
this.prompt,
}) : _api = api,
_model = model;
String? get api => Config.apis.containsKey(_api) ? _api : null;
String? get model =>
(Config.apis[_api]?.models.contains(_model) ?? false) ? _model : null;
set api(String? value) => _api = value;
set model(String? value) => _model = value;
Map toJson() => {
"api": api,
"model": model,
"prompt": prompt,
"enable": enable,
};
factory TitleConfig.fromJson(Map json) => TitleConfig(
api: json["api"],
model: json["model"],
prompt: json["prompt"],
enable: json["enable"],
);
}
class SearchConfig {
int? n;
bool? vector;
int? queryTime;
int? fetchTime;
String? prompt;
String? searxng;
SearchConfig({
this.n,
this.vector,
this.prompt,
this.searxng,
this.queryTime,
this.fetchTime,
});
Map toJson() => {
"n": n,
"vector": vector,
"prompt": prompt,
"query": queryTime,
"fetch": fetchTime,
"searxng": searxng,
};
factory SearchConfig.fromJson(Map json) => SearchConfig(
n: json["n"],
vector: json["vector"],
prompt: json["prompt"],
queryTime: json["query"],
fetchTime: json["fetch"],
searxng: json["searxng"],
);
}
class VectorConfig {
String? _api;
String? _model;
int? batchSize;
int? dimensions;
VectorConfig({
String? api,
String? model,
this.batchSize,
this.dimensions,
}) : _api = api,
_model = model;
String? get api => Config.apis.containsKey(_api) ? _api : null;
String? get model =>
(Config.apis[_api]?.models.contains(_model) ?? false) ? _model : null;
set api(String? value) => _api = value;
set model(String? value) => _model = value;
factory VectorConfig.fromJson(Map json) => VectorConfig(
api: json["api"],
model: json["model"],
batchSize: json["batchSize"],
dimensions: json["dimensions"],
);
Map toJson() => {
"api": api,
"model": model,
"batchSize": batchSize,
"dimensions": dimensions,
};
}
class DocumentConfig {
int? n;
int? size;
int? overlap;
DocumentConfig({
this.n,
this.size,
this.overlap,
});
Map toJson() => {
"n": n,
"size": size,
"overlap": overlap,
};
factory DocumentConfig.fromJson(Map json) => DocumentConfig(
n: json["n"],
size: json["size"],
overlap: json["overlap"],
);
}
const _baseColor = Colors.indigo;
final ColorScheme darkColorScheme = ColorScheme.fromSeed(
brightness: Brightness.dark,
seedColor: _baseColor,
);
final ColorScheme lightColorScheme = ColorScheme.fromSeed(
brightness: Brightness.light,
seedColor: _baseColor,
);
final darkTheme = ThemeData.dark(useMaterial3: true).copyWith(
colorScheme: darkColorScheme,
bottomSheetTheme: BottomSheetThemeData(
backgroundColor: darkColorScheme.surface,
),
appBarTheme: AppBarTheme(color: darkColorScheme.primaryContainer),
);
final lightTheme = ThemeData.light(useMaterial3: true).copyWith(
colorScheme: lightColorScheme,
bottomSheetTheme: BottomSheetThemeData(
backgroundColor: lightColorScheme.surface,
),
appBarTheme: AppBarTheme(color: lightColorScheme.primaryContainer),
);
================================================
FILE: lib/gen/intl/messages_all.dart
================================================
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that looks up messages for specific locales by
// delegating to the appropriate library.
// Ignore issues from commonly used lints in this file.
// ignore_for_file:implementation_imports, file_names, unnecessary_new
// ignore_for_file:unnecessary_brace_in_string_interps, directives_ordering
// ignore_for_file:argument_type_not_assignable, invalid_assignment
// ignore_for_file:prefer_single_quotes, prefer_generic_function_type_aliases
// ignore_for_file:comment_references
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
import 'package:intl/src/intl_helpers.dart';
import 'messages_en.dart' as messages_en;
import 'messages_zh_CN.dart' as messages_zh_cn;
typedef Future<dynamic> LibraryLoader();
Map<String, LibraryLoader> _deferredLibraries = {
'en': () => new SynchronousFuture(null),
'zh_CN': () => new SynchronousFuture(null),
};
MessageLookupByLibrary? _findExact(String localeName) {
switch (localeName) {
case 'en':
return messages_en.messages;
case 'zh_CN':
return messages_zh_cn.messages;
default:
return null;
}
}
/// User programs should call this before using [localeName] for messages.
Future<bool> initializeMessages(String localeName) {
var availableLocale = Intl.verifiedLocale(
localeName, (locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null);
if (availableLocale == null) {
return new SynchronousFuture(false);
}
var lib = _deferredLibraries[availableLocale];
lib == null ? new SynchronousFuture(false) : lib();
initializeInternalMessageLookup(() => new CompositeMessageLookup());
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
return new SynchronousFuture(true);
}
bool _messagesExistFor(String locale) {
try {
return _findExact(locale) != null;
} catch (e) {
return false;
}
}
MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) {
var actualLocale =
Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null);
if (actualLocale == null) return null;
return _findExact(actualLocale);
}
================================================
FILE: lib/gen/intl/messages_en.dart
================================================
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that provides messages for a en locale. All the
// messages from the main program should be duplicated here with the same
// function name.
// Ignore issues from commonly used lints in this file.
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
final messages = new MessageLookup();
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'en';
static String m0(pages, text) =>
"In the prompt template, the ${pages} placeholder will be replaced with web page content, and the ${text} placeholder will be replaced with the user message. If unsure, leave it empty to use the built-in template.";
static String m1(text) =>
"In the prompt template, The ${text} placeholder will be replaced with the user\'s message. If unsure, leave empty to use the built-in template.";
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"all_chats": MessageLookupByLibrary.simpleMessage("All Chats"),
"api": MessageLookupByLibrary.simpleMessage("API"),
"api_key": MessageLookupByLibrary.simpleMessage("API Key"),
"api_type": MessageLookupByLibrary.simpleMessage("API Type"),
"api_url": MessageLookupByLibrary.simpleMessage("API Url"),
"apis": MessageLookupByLibrary.simpleMessage("APIs"),
"base_config": MessageLookupByLibrary.simpleMessage("Base Config"),
"bot": MessageLookupByLibrary.simpleMessage("Bot"),
"bots": MessageLookupByLibrary.simpleMessage("Bots"),
"camera": MessageLookupByLibrary.simpleMessage("Camera"),
"cancel": MessageLookupByLibrary.simpleMessage("Cancel"),
"cannot_open": MessageLookupByLibrary.simpleMessage("Cannot Open"),
"chat_image_compress":
MessageLookupByLibrary.simpleMessage("Chat Image Compress"),
"chat_model": MessageLookupByLibrary.simpleMessage("Chat Model"),
"chat_model_hint":
MessageLookupByLibrary.simpleMessage("Is it a Chat Model?"),
"chat_settings": MessageLookupByLibrary.simpleMessage("Chat Settings"),
"chat_title": MessageLookupByLibrary.simpleMessage("Chat Title"),
"check_for_updates":
MessageLookupByLibrary.simpleMessage("Check for Updates"),
"choose_api": MessageLookupByLibrary.simpleMessage("Choose API"),
"choose_bot": MessageLookupByLibrary.simpleMessage("Choose Bot"),
"choose_model": MessageLookupByLibrary.simpleMessage("Choose Model"),
"chunk_n": MessageLookupByLibrary.simpleMessage("Number of Chunks"),
"chunk_n_hint": MessageLookupByLibrary.simpleMessage(
"Number of chunks to be integrated into the context"),
"chunk_overlap": MessageLookupByLibrary.simpleMessage("Chunk Overlap"),
"chunk_overlap_hint": MessageLookupByLibrary.simpleMessage(
"Size of the overlapping portion with the previous chunk"),
"chunk_size": MessageLookupByLibrary.simpleMessage("Chunk Size"),
"chunk_size_hint": MessageLookupByLibrary.simpleMessage(
"Maximum number of characters a single chunk can contain"),
"citations": MessageLookupByLibrary.simpleMessage("Citations"),
"clear": MessageLookupByLibrary.simpleMessage("Clear"),
"clear_chat": MessageLookupByLibrary.simpleMessage("Clear Chat"),
"clear_data": MessageLookupByLibrary.simpleMessage("Clear Data"),
"clear_data_audio":
MessageLookupByLibrary.simpleMessage("All TTS cache files"),
"clear_data_chat":
MessageLookupByLibrary.simpleMessage("All chat history"),
"clear_data_image":
MessageLookupByLibrary.simpleMessage("All generated images"),
"cleared_successfully":
MessageLookupByLibrary.simpleMessage("Cleared Successfully"),
"clearing": MessageLookupByLibrary.simpleMessage("Clearing..."),
"clone_chat": MessageLookupByLibrary.simpleMessage("Clone Chat"),
"cloned_successfully":
MessageLookupByLibrary.simpleMessage("Cloned Successfully"),
"complete_all_fields":
MessageLookupByLibrary.simpleMessage("Please complete all fields"),
"config": MessageLookupByLibrary.simpleMessage("Config"),
"config_hint": MessageLookupByLibrary.simpleMessage(
"To avoid export failures, it\'s recommended to export the configuration to the Documents directory, or create a ChatBot subdirectory within your Downloads folder."),
"config_import_export":
MessageLookupByLibrary.simpleMessage("Config Import and Export"),
"copied_successfully":
MessageLookupByLibrary.simpleMessage("Copied Successfully"),
"copy": MessageLookupByLibrary.simpleMessage("Copy"),
"default_config":
MessageLookupByLibrary.simpleMessage("Default Config"),
"delete": MessageLookupByLibrary.simpleMessage("Delete"),
"delete_image": MessageLookupByLibrary.simpleMessage("Delete image"),
"document": MessageLookupByLibrary.simpleMessage("Document"),
"document_config":
MessageLookupByLibrary.simpleMessage("Document Config"),
"document_config_hint": MessageLookupByLibrary.simpleMessage(
"Documents are divided into multiple chunks. After search and comparison, the most relevant chunks will be added to the context."),
"download": MessageLookupByLibrary.simpleMessage("Download"),
"duplicate_api_name":
MessageLookupByLibrary.simpleMessage("Duplicate API name"),
"duplicate_bot_name":
MessageLookupByLibrary.simpleMessage("Duplicate Bot name"),
"edit": MessageLookupByLibrary.simpleMessage("Edit"),
"embedding_vector":
MessageLookupByLibrary.simpleMessage("Embedding Vector"),
"embedding_vector_info": MessageLookupByLibrary.simpleMessage(
"Batch size is limited by the API service provider. It\'s recommended to check and modify accordingly. Vector dimension is an advanced option and should only be filled if necessary."),
"empty": MessageLookupByLibrary.simpleMessage("Empty"),
"empty_link": MessageLookupByLibrary.simpleMessage("Empty Link"),
"enable": MessageLookupByLibrary.simpleMessage("Enable"),
"ensure_clear_chat": MessageLookupByLibrary.simpleMessage(
"Are you sure to clear the chat?"),
"ensure_delete_image": MessageLookupByLibrary.simpleMessage(
"Are you sure to delete the image?"),
"enter_a_name":
MessageLookupByLibrary.simpleMessage("Please enter a name"),
"enter_a_title":
MessageLookupByLibrary.simpleMessage("Please enter a title"),
"enter_message":
MessageLookupByLibrary.simpleMessage("Enter your message"),
"enter_prompts":
MessageLookupByLibrary.simpleMessage("Enter your prompts"),
"error": MessageLookupByLibrary.simpleMessage("Error"),
"export_chat_as_image":
MessageLookupByLibrary.simpleMessage("Export Image"),
"export_config": MessageLookupByLibrary.simpleMessage("Export Config"),
"exported_successfully":
MessageLookupByLibrary.simpleMessage("Exported Successfully"),
"exporting": MessageLookupByLibrary.simpleMessage("Exporting..."),
"failed_to_export": MessageLookupByLibrary.simpleMessage(
"Can\'t write to that directory."),
"gallery": MessageLookupByLibrary.simpleMessage("Gallery"),
"generate": MessageLookupByLibrary.simpleMessage("Generate"),
"image_compress_failed":
MessageLookupByLibrary.simpleMessage("Failed to comprese image"),
"image_enable_hint": MessageLookupByLibrary.simpleMessage(
"The original image will be used if compression fails"),
"image_generation":
MessageLookupByLibrary.simpleMessage("Image Generation"),
"image_hint": MessageLookupByLibrary.simpleMessage(
"The Quality should be between 1 and 100, with lower values resulting in higher compression. Minimum Width and Minimum Height restrict image resizing. Leave these fields empty if you\'re unsure."),
"image_quality": MessageLookupByLibrary.simpleMessage("Image Quality"),
"image_size": MessageLookupByLibrary.simpleMessage("Image Size"),
"image_style": MessageLookupByLibrary.simpleMessage("Image Style"),
"images": MessageLookupByLibrary.simpleMessage("Images"),
"import_config": MessageLookupByLibrary.simpleMessage("Import Config"),
"imported_successfully":
MessageLookupByLibrary.simpleMessage("Imported Successfully"),
"importing": MessageLookupByLibrary.simpleMessage("Importing..."),
"invalid_max_tokens":
MessageLookupByLibrary.simpleMessage("Invalid Max Tokens"),
"invalid_temperature":
MessageLookupByLibrary.simpleMessage("Invalid Temperature"),
"link": MessageLookupByLibrary.simpleMessage("Link"),
"max_tokens": MessageLookupByLibrary.simpleMessage("Max Tokens"),
"min_height": MessageLookupByLibrary.simpleMessage("Minimal Height"),
"min_width": MessageLookupByLibrary.simpleMessage("Minimal Width"),
"min_width_height":
MessageLookupByLibrary.simpleMessage("Minimal Size"),
"model": MessageLookupByLibrary.simpleMessage("Model"),
"model_avatar": MessageLookupByLibrary.simpleMessage("Model Avatar"),
"model_list": MessageLookupByLibrary.simpleMessage("Model List"),
"model_name": MessageLookupByLibrary.simpleMessage("Model Name"),
"name": MessageLookupByLibrary.simpleMessage("Name"),
"new_api": MessageLookupByLibrary.simpleMessage("New API"),
"new_bot": MessageLookupByLibrary.simpleMessage("New Bot"),
"new_chat": MessageLookupByLibrary.simpleMessage("New Chat"),
"no_model": MessageLookupByLibrary.simpleMessage("no model"),
"not_implemented_yet":
MessageLookupByLibrary.simpleMessage("Not implemented yet"),
"ok": MessageLookupByLibrary.simpleMessage("Ok"),
"open": MessageLookupByLibrary.simpleMessage("Open"),
"optional_config":
MessageLookupByLibrary.simpleMessage("Optional Config"),
"other": MessageLookupByLibrary.simpleMessage("Other"),
"play": MessageLookupByLibrary.simpleMessage("Play"),
"please_input": MessageLookupByLibrary.simpleMessage("Please Input"),
"quality": MessageLookupByLibrary.simpleMessage("Quality"),
"reanswer": MessageLookupByLibrary.simpleMessage("Reanswer"),
"reset": MessageLookupByLibrary.simpleMessage("Reset"),
"restart_app": MessageLookupByLibrary.simpleMessage(
"Please restart App to load the new settings."),
"save": MessageLookupByLibrary.simpleMessage("Save"),
"saved_successfully":
MessageLookupByLibrary.simpleMessage("Saved Successfully"),
"search_gemini_mode":
MessageLookupByLibrary.simpleMessage("Google Search Mode"),
"search_general_mode":
MessageLookupByLibrary.simpleMessage("General Mode"),
"search_n": MessageLookupByLibrary.simpleMessage("Number of Pages"),
"search_n_hint": MessageLookupByLibrary.simpleMessage(
"Maximum number of web pages to retrieve"),
"search_prompt": MessageLookupByLibrary.simpleMessage("Prompt"),
"search_prompt_hint": MessageLookupByLibrary.simpleMessage(
"Template for context synthesis"),
"search_prompt_info": m0,
"search_searxng": MessageLookupByLibrary.simpleMessage("SearXNG"),
"search_searxng_base": MessageLookupByLibrary.simpleMessage("Base URL"),
"search_searxng_extra":
MessageLookupByLibrary.simpleMessage("Additional Parameters"),
"search_searxng_extra_help": MessageLookupByLibrary.simpleMessage(
"For example: engines=google&language=en"),
"search_searxng_hint":
MessageLookupByLibrary.simpleMessage("SearXNG instance"),
"search_timeout": MessageLookupByLibrary.simpleMessage("Timeout"),
"search_timeout_fetch":
MessageLookupByLibrary.simpleMessage("Fetch Timeout"),
"search_timeout_fetch_help": MessageLookupByLibrary.simpleMessage(
"Timeout duration for fetching web page content"),
"search_timeout_hint": MessageLookupByLibrary.simpleMessage(
"Retrieval timeout in milliseconds"),
"search_timeout_query":
MessageLookupByLibrary.simpleMessage("Query Timeout"),
"search_timeout_query_help": MessageLookupByLibrary.simpleMessage(
"Timeout duration for SearXNG requests"),
"search_vector":
MessageLookupByLibrary.simpleMessage("Embedding Vector"),
"search_vector_hint":
MessageLookupByLibrary.simpleMessage("Recommended to enable"),
"select_models": MessageLookupByLibrary.simpleMessage("Select Models"),
"settings": MessageLookupByLibrary.simpleMessage("Settings"),
"setup_api_model_first": MessageLookupByLibrary.simpleMessage(
"Set up the API and Model first"),
"setup_searxng_first":
MessageLookupByLibrary.simpleMessage("Set up the SearXNG first"),
"setup_tts_first":
MessageLookupByLibrary.simpleMessage("Set up the TTS first"),
"setup_vector_first": MessageLookupByLibrary.simpleMessage(
"Set up the embedding vector API and model first"),
"share": MessageLookupByLibrary.simpleMessage("Share"),
"source": MessageLookupByLibrary.simpleMessage("Source"),
"streaming_response":
MessageLookupByLibrary.simpleMessage("Streaming Response"),
"system_prompts":
MessageLookupByLibrary.simpleMessage("System Prompts"),
"task": MessageLookupByLibrary.simpleMessage("Task"),
"temperature": MessageLookupByLibrary.simpleMessage("Temperature"),
"text_to_speech":
MessageLookupByLibrary.simpleMessage("Text To Speech"),
"title": MessageLookupByLibrary.simpleMessage("ChatBot"),
"title_enable_hint": MessageLookupByLibrary.simpleMessage(
"If disabled, the user\'s message will be used as the title"),
"title_generation":
MessageLookupByLibrary.simpleMessage("Title Generation"),
"title_generation_hint": m1,
"title_prompt": MessageLookupByLibrary.simpleMessage("Prompt"),
"title_prompt_hint": MessageLookupByLibrary.simpleMessage(
"Template for the title generation prompt"),
"up_to_date":
MessageLookupByLibrary.simpleMessage("You are up to date"),
"vector_batch_size": MessageLookupByLibrary.simpleMessage("Batch Size"),
"vector_batch_size_hint": MessageLookupByLibrary.simpleMessage(
"Maximum number of chunks that can be submitted in a single request"),
"vector_dimensions":
MessageLookupByLibrary.simpleMessage("Vector Dimensions"),
"vector_dimensions_hint": MessageLookupByLibrary.simpleMessage(
"Output dimension of the embedding vector model"),
"voice": MessageLookupByLibrary.simpleMessage("Voice"),
"web_search": MessageLookupByLibrary.simpleMessage("Web Search"),
"workspace": MessageLookupByLibrary.simpleMessage("Workspace")
};
}
================================================
FILE: lib/gen/intl/messages_zh_CN.dart
================================================
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that provides messages for a zh_CN locale. All the
// messages from the main program should be duplicated here with the same
// function name.
// Ignore issues from commonly used lints in this file.
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
final messages = new MessageLookup();
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'zh_CN';
static String m0(pages, text) =>
"提示词模板中的 ${pages} 占位变量会被网页内容替换,${text} 占位变量会被用户消息替换。如不清楚,可留空以使用内置模板。";
static String m1(text) => "提示词模板中的 ${text} 占位变量会被用户消息替换。如不清楚,可留空以使用内置模板。";
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"all_chats": MessageLookupByLibrary.simpleMessage("所有对话"),
"api": MessageLookupByLibrary.simpleMessage("接口"),
"api_key": MessageLookupByLibrary.simpleMessage("接口密钥"),
"api_type": MessageLookupByLibrary.simpleMessage("接口类型"),
"api_url": MessageLookupByLibrary.simpleMessage("接口地址"),
"apis": MessageLookupByLibrary.simpleMessage("接口"),
"base_config": MessageLookupByLibrary.simpleMessage("基本配置"),
"bot": MessageLookupByLibrary.simpleMessage("角色"),
"bots": MessageLookupByLibrary.simpleMessage("角色"),
"camera": MessageLookupByLibrary.simpleMessage("相机"),
"cancel": MessageLookupByLibrary.simpleMessage("取消"),
"cannot_open": MessageLookupByLibrary.simpleMessage("无法打开"),
"chat_image_compress": MessageLookupByLibrary.simpleMessage("对话图片压缩"),
"chat_model": MessageLookupByLibrary.simpleMessage("对话模型"),
"chat_model_hint": MessageLookupByLibrary.simpleMessage("是否是对话模型?"),
"chat_settings": MessageLookupByLibrary.simpleMessage("对话设置"),
"chat_title": MessageLookupByLibrary.simpleMessage("对话标题"),
"check_for_updates": MessageLookupByLibrary.simpleMessage("检查更新"),
"choose_api": MessageLookupByLibrary.simpleMessage("选择接口"),
"choose_bot": MessageLookupByLibrary.simpleMessage("选择角色"),
"choose_model": MessageLookupByLibrary.simpleMessage("选择模型"),
"chunk_n": MessageLookupByLibrary.simpleMessage("块数量"),
"chunk_n_hint": MessageLookupByLibrary.simpleMessage("集成到上下文中的块数量"),
"chunk_overlap": MessageLookupByLibrary.simpleMessage("块重叠"),
"chunk_overlap_hint":
MessageLookupByLibrary.simpleMessage("与上一块重叠部分的大小"),
"chunk_size": MessageLookupByLibrary.simpleMessage("块大小"),
"chunk_size_hint": MessageLookupByLibrary.simpleMessage("单块能包含的最大字符数"),
"citations": MessageLookupByLibrary.simpleMessage("引用"),
"clear": MessageLookupByLibrary.simpleMessage("清空"),
"clear_chat": MessageLookupByLibrary.simpleMessage("清空对话"),
"clear_data": MessageLookupByLibrary.simpleMessage("清理数据"),
"clear_data_audio": MessageLookupByLibrary.simpleMessage("所有的 TTS 缓存"),
"clear_data_chat": MessageLookupByLibrary.simpleMessage("所有的对话数据"),
"clear_data_image": MessageLookupByLibrary.simpleMessage("所有的图片生成结果"),
"cleared_successfully": MessageLookupByLibrary.simpleMessage("清理成功"),
"clearing": MessageLookupByLibrary.simpleMessage("清理中..."),
"clone_chat": MessageLookupByLibrary.simpleMessage("复制对话"),
"cloned_successfully": MessageLookupByLibrary.simpleMessage("复制成功"),
"complete_all_fields": MessageLookupByLibrary.simpleMessage("请填写所有字段"),
"config": MessageLookupByLibrary.simpleMessage("配置"),
"config_hint": MessageLookupByLibrary.simpleMessage(
"为避免导出失败,建议将配置导出到 Documents 目录,或在 Download 下创建 ChatBot 子目录。"),
"config_import_export": MessageLookupByLibrary.simpleMessage("配置导入导出"),
"copied_successfully": MessageLookupByLibrary.simpleMessage("拷贝成功"),
"copy": MessageLookupByLibrary.simpleMessage("拷贝"),
"default_config": MessageLookupByLibrary.simpleMessage("默认配置"),
"delete": MessageLookupByLibrary.simpleMessage("删除"),
"delete_image": MessageLookupByLibrary.simpleMessage("删除图片"),
"document": MessageLookupByLibrary.simpleMessage("文档"),
"document_config": MessageLookupByLibrary.simpleMessage("文档配置"),
"document_config_hint": MessageLookupByLibrary.simpleMessage(
"文档会被划分为若干块,经过搜索比较后,最合适的几个块会被补充进上下文。"),
"download": MessageLookupByLibrary.simpleMessage("下载"),
"duplicate_api_name": MessageLookupByLibrary.simpleMessage("接口名重复"),
"duplicate_bot_name": MessageLookupByLibrary.simpleMessage("角色名重复"),
"edit": MessageLookupByLibrary.simpleMessage("编辑"),
"embedding_vector": MessageLookupByLibrary.simpleMessage("嵌入向量"),
"embedding_vector_info": MessageLookupByLibrary.simpleMessage(
"批大小受限于接口服务商,建议查询后修改。向量维度为专业选项,非必要请勿填写。"),
"empty": MessageLookupByLibrary.simpleMessage("空"),
"empty_link": MessageLookupByLibrary.simpleMessage("空链接"),
"enable": MessageLookupByLibrary.simpleMessage("启用"),
"ensure_clear_chat": MessageLookupByLibrary.simpleMessage("确定要清空对话?"),
"ensure_delete_image": MessageLookupByLibrary.simpleMessage("确定要删除图片?"),
"enter_a_name": MessageLookupByLibrary.simpleMessage("请输入名称"),
"enter_a_title": MessageLookupByLibrary.simpleMessage("请输入标题"),
"enter_message": MessageLookupByLibrary.simpleMessage("输入你的消息"),
"enter_prompts": MessageLookupByLibrary.simpleMessage("请输入提示词"),
"error": MessageLookupByLibrary.simpleMessage("错误"),
"export_chat_as_image": MessageLookupByLibrary.simpleMessage("导出图片"),
"export_config": MessageLookupByLibrary.simpleMessage("导出配置"),
"exported_successfully": MessageLookupByLibrary.simpleMessage("导出成功"),
"exporting": MessageLookupByLibrary.simpleMessage("正在导出..."),
"failed_to_export":
MessageLookupByLibrary.simpleMessage("无法在该目录下写入文件。"),
"gallery": MessageLookupByLibrary.simpleMessage("图库"),
"generate": MessageLookupByLibrary.simpleMessage("生成"),
"image_compress_failed": MessageLookupByLibrary.simpleMessage("图片压缩失败"),
"image_enable_hint": MessageLookupByLibrary.simpleMessage("压缩失败则将使用原图"),
"image_generation": MessageLookupByLibrary.simpleMessage("图像生成"),
"image_hint": MessageLookupByLibrary.simpleMessage(
"质量范围应在 1-100,质量越低压缩率越高。最小宽度与最小高度用于限制图片缩放,如不清楚,请留空。"),
"image_quality": MessageLookupByLibrary.simpleMessage("图像质量"),
"image_size": MessageLookupByLibrary.simpleMessage("图像尺寸"),
"image_style": MessageLookupByLibrary.simpleMessage("图像风格"),
"images": MessageLookupByLibrary.simpleMessage("图片"),
"import_config": MessageLookupByLibrary.simpleMessage("导入配置"),
"imported_successfully": MessageLookupByLibrary.simpleMessage("导入成功"),
"importing": MessageLookupByLibrary.simpleMessage("正在导入..."),
"invalid_max_tokens": MessageLookupByLibrary.simpleMessage("非法的最大输出"),
"invalid_temperature": MessageLookupByLibrary.simpleMessage("非法的温度"),
"link": MessageLookupByLibrary.simpleMessage("链接"),
"max_tokens": MessageLookupByLibrary.simpleMessage("最大输出"),
"min_height": MessageLookupByLibrary.simpleMessage("最小高度"),
"min_width": MessageLookupByLibrary.simpleMessage("最小宽度"),
"min_width_height": MessageLookupByLibrary.simpleMessage("最小宽高"),
"model": MessageLookupByLibrary.simpleMessage("模型"),
"model_avatar": MessageLookupByLibrary.simpleMessage("模型头像"),
"model_list": MessageLookupByLibrary.simpleMessage("模型列表"),
"model_name": MessageLookupByLibrary.simpleMessage("模型名称"),
"name": MessageLookupByLibrary.simpleMessage("名称"),
"new_api": MessageLookupByLibrary.simpleMessage("新接口"),
"new_bot": MessageLookupByLibrary.simpleMessage("新角色"),
"new_chat": MessageLookupByLibrary.simpleMessage("新对话"),
"no_model": MessageLookupByLibrary.simpleMessage("无模型"),
"not_implemented_yet": MessageLookupByLibrary.simpleMessage("还未实现"),
"ok": MessageLookupByLibrary.simpleMessage("确定"),
"open": MessageLookupByLibrary.simpleMessage("打开"),
"optional_config": MessageLookupByLibrary.simpleMessage("可选配置"),
"other": MessageLookupByLibrary.simpleMessage("其他"),
"play": MessageLookupByLibrary.simpleMessage("播放"),
"please_input": MessageLookupByLibrary.simpleMessage("请输入"),
"quality": MessageLookupByLibrary.simpleMessage("质量"),
"reanswer": MessageLookupByLibrary.simpleMessage("重答"),
"reset": MessageLookupByLibrary.simpleMessage("重置"),
"restart_app": MessageLookupByLibrary.simpleMessage("请重启应用以加载新配置。"),
"save": MessageLookupByLibrary.simpleMessage("保存"),
"saved_successfully": MessageLookupByLibrary.simpleMessage("保存成功"),
"search_gemini_mode":
MessageLookupByLibrary.simpleMessage("Google Search 模式"),
"search_general_mode": MessageLookupByLibrary.simpleMessage("通用模式"),
"search_n": MessageLookupByLibrary.simpleMessage("网页数量"),
"search_n_hint": MessageLookupByLibrary.simpleMessage("检索的网页数量上限"),
"search_prompt": MessageLookupByLibrary.simpleMessage("提示词"),
"search_prompt_hint":
MessageLookupByLibrary.simpleMessage("用于合成上下文的提示词模板"),
"search_prompt_info": m0,
"search_searxng": MessageLookupByLibrary.simpleMessage("SearXNG"),
"search_searxng_base": MessageLookupByLibrary.simpleMessage("根地址"),
"search_searxng_extra": MessageLookupByLibrary.simpleMessage("附加参数"),
"search_searxng_extra_help": MessageLookupByLibrary.simpleMessage(
"例如:engines=google&language=zh"),
"search_searxng_hint":
MessageLookupByLibrary.simpleMessage("SearXNG 实例"),
"search_timeout": MessageLookupByLibrary.simpleMessage("超时时间"),
"search_timeout_fetch": MessageLookupByLibrary.simpleMessage("抓取超时"),
"search_timeout_fetch_help":
MessageLookupByLibrary.simpleMessage("抓取网页内容的超时时间"),
"search_timeout_hint": MessageLookupByLibrary.simpleMessage("检索的超时毫秒数"),
"search_timeout_query": MessageLookupByLibrary.simpleMessage("检索超时"),
"search_timeout_query_help":
MessageLookupByLibrary.simpleMessage("请求 SearXNG 的超时时间"),
"search_vector": MessageLookupByLibrary.simpleMessage("嵌入向量"),
"search_vector_hint": MessageLookupByLibrary.simpleMessage("建议开启"),
"select_models": MessageLookupByLibrary.simpleMessage("选择模型"),
"settings": MessageLookupByLibrary.simpleMessage("设置"),
"setup_api_model_first":
MessageLookupByLibrary.simpleMessage("请先配置接口和模型"),
"setup_searxng_first":
MessageLookupByLibrary.simpleMessage("请先配置 SearXNG 实例"),
"setup_tts_first": MessageLookupByLibrary.simpleMessage("请先配置文本转语音"),
"setup_vector_first":
MessageLookupByLibrary.simpleMessage("请先配置嵌入向量接口和模型"),
"share": MessageLookupByLibrary.simpleMessage("分享"),
"source": MessageLookupByLibrary.simpleMessage("源码"),
"streaming_response": MessageLookupByLibrary.simpleMessage("流式响应"),
"system_prompts": MessageLookupByLibrary.simpleMessage("系统提示词"),
"task": MessageLookupByLibrary.simpleMessage("任务"),
"temperature": MessageLookupByLibrary.simpleMessage("温度"),
"text_to_speech": MessageLookupByLibrary.simpleMessage("文本转语音"),
"title": MessageLookupByLibrary.simpleMessage("ChatBot"),
"title_enable_hint":
MessageLookupByLibrary.simpleMessage("禁用则将以用户消息为标题"),
"title_generation": MessageLookupByLibrary.simpleMessage("标题生成"),
"title_generation_hint": m1,
"title_prompt": MessageLookupByLibrary.simpleMessage("提示词"),
"title_prompt_hint":
MessageLookupByLibrary.simpleMessage("用于生成标题的提示词模板"),
"up_to_date": MessageLookupByLibrary.simpleMessage("已是最新版本"),
"vector_batch_size": MessageLookupByLibrary.simpleMessage("批大小"),
"vector_batch_size_hint":
MessageLookupByLibrary.simpleMessage("单次请求能提交的最大块数量"),
"vector_dimensions": MessageLookupByLibrary.simpleMessage("向量维度"),
"vector_dimensions_hint":
MessageLookupByLibrary.simpleMessage("嵌入向量模型输出向量的维度"),
"voice": MessageLookupByLibrary.simpleMessage("音色"),
"web_search": MessageLookupByLibrary.simpleMessage("联网搜索"),
"workspace": MessageLookupByLibrary.simpleMessage("工作空间")
};
}
================================================
FILE: lib/gen/l10n.dart
================================================
// GENERATED CODE - DO NOT MODIFY BY HAND
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'intl/messages_all.dart';
// **************************************************************************
// Generator: Flutter Intl IDE plugin
// Made by Localizely
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, lines_longer_than_80_chars
// ignore_for_file: join_return_with_assignment, prefer_final_in_for_each
// ignore_for_file: avoid_redundant_argument_values, avoid_escaping_inner_quotes
class S {
S();
static S? _current;
static S get current {
assert(_current != null,
'No instance of S was loaded. Try to initialize the S delegate before accessing S.current.');
return _current!;
}
static const AppLocalizationDelegate delegate = AppLocalizationDelegate();
static Future<S> load(Locale locale) {
final name = (locale.countryCode?.isEmpty ?? false)
? locale.languageCode
: locale.toString();
final localeName = Intl.canonicalizedLocale(name);
return initializeMessages(localeName).then((_) {
Intl.defaultLocale = localeName;
final instance = S();
S._current = instance;
return instance;
});
}
static S of(BuildContext context) {
final instance = S.maybeOf(context);
assert(instance != null,
'No instance of S present in the widget tree. Did you add S.delegate in localizationsDelegates?');
return instance!;
}
static S? maybeOf(BuildContext context) {
return Localizations.of<S>(context, S);
}
/// `ChatBot`
String get title {
return Intl.message(
'ChatBot',
name: 'title',
desc: '',
args: [],
);
}
/// `Ok`
String get ok {
return Intl.message(
'Ok',
name: 'ok',
desc: '',
args: [],
);
}
/// `Copy`
String get copy {
return Intl.message(
'Copy',
name: 'copy',
desc: '',
args: [],
);
}
/// `Edit`
String get edit {
return Intl.message(
'Edit',
name: 'edit',
desc: '',
args: [],
);
}
/// `Play`
String get play {
return Intl.message(
'Play',
name: 'play',
desc: '',
args: [],
);
}
/// `Source`
String get source {
return Intl.message(
'Source',
name: 'source',
desc: '',
args: [],
);
}
/// `Delete`
String get delete {
return Intl.message(
'Delete',
name: 'delete',
desc: '',
args: [],
);
}
/// `Images`
String get images {
return Intl.message(
'Images',
name: 'images',
desc: '',
args: [],
);
}
/// `Camera`
String get camera {
return Intl.message(
'Camera',
name: 'camera',
desc: '',
args: [],
);
}
/// `Gallery`
String get gallery {
return Intl.message(
'Gallery',
name: 'gallery',
desc: '',
args: [],
);
}
/// `Settings`
String get settings {
return Intl.message(
'Settings',
name: 'settings',
desc: '',
args: [],
);
}
/// `Bot`
String get bot {
return Intl.message(
'Bot',
name: 'bot',
desc: '',
args: [],
);
}
/// `Bots`
String get bots {
return Intl.message(
'Bots',
name: 'bots',
desc: '',
args: [],
);
}
/// `APIs`
String get apis {
return Intl.message(
'APIs',
name: 'apis',
desc: '',
args: [],
);
}
/// `Config`
String get config {
return Intl.message(
'Config',
name: 'config',
desc: '',
args: [],
);
}
/// `Open`
String get open {
return Intl.message(
'Open',
name: 'open',
desc: '',
args: [],
);
}
/// `Save`
String get save {
return Intl.message(
'Save',
name: 'save',
desc: '',
args: [],
);
}
/// `Reset`
String get reset {
return Intl.message(
'Reset',
name: 'reset',
desc: '',
args: [],
);
}
/// `Error`
String get error {
return Intl.message(
'Error',
name: 'error',
desc: '',
args: [],
);
}
/// `Share`
String get share {
return Intl.message(
'Share',
name: 'share',
desc: '',
args: [],
);
}
/// `Clear`
String get clear {
return Intl.message(
'Clear',
name: 'clear',
desc: '',
args: [],
);
}
/// `Cancel`
String get cancel {
return Intl.message(
'Cancel',
name: 'cancel',
desc: '',
args: [],
);
}
/// `Reanswer`
String get reanswer {
return Intl.message(
'Reanswer',
name: 'reanswer',
desc: '',
args: [],
);
}
/// `Citations`
String get citations {
return Intl.message(
'Citations',
name: 'citations',
desc: '',
args: [],
);
}
/// `API`
String get api {
return Intl.message(
'API',
name: 'api',
desc: '',
args: [],
);
}
/// `Model`
String get model {
return Intl.message(
'Model',
name: 'model',
desc: '',
args: [],
);
}
/// `Voice`
String get voice {
return Intl.message(
'Voice',
name: 'voice',
desc: '',
args: [],
);
}
/// `Max Tokens`
String get max_tokens {
return Intl.message(
'Max Tokens',
name: 'max_tokens',
desc: '',
args: [],
);
}
/// `Temperature`
String get temperature {
return Intl.message(
'Temperature',
name: 'temperature',
desc: '',
args: [],
);
}
/// `System Prompts`
String get system_prompts {
return Intl.message(
'System Prompts',
name: 'system_prompts',
desc: '',
args: [],
);
}
/// `Streaming Response`
String get streaming_response {
return Intl.message(
'Streaming Response',
name: 'streaming_response',
desc: '',
args: [],
);
}
/// `Link`
String get link {
return Intl.message(
'Link',
name: 'link',
desc: '',
args: [],
);
}
/// `Name`
String get name {
return Intl.message(
'Name',
name: 'name',
desc: '',
args: [],
);
}
/// `New Bot`
String get new_bot {
return Intl.message(
'New Bot',
name: 'new_bot',
desc: '',
args: [],
);
}
/// `New API`
String get new_api {
return Intl.message(
'New API',
name: 'new_api',
desc: '',
args: [],
);
}
/// `New Chat`
String get new_chat {
return Intl.message(
'New Chat',
name: 'new_chat',
desc: '',
args: [],
);
}
/// `API Url`
String get api_url {
return Intl.message(
'API Url',
name: 'api_url',
desc: '',
args: [],
);
}
/// `API Key`
String get api_key {
return Intl.message(
'API Key',
name: 'api_key',
desc: '',
args: [],
);
}
/// `API Type`
String get api_type {
return Intl.message(
'API Type',
name: 'api_type',
desc: '',
args: [],
);
}
/// `Model List`
String get model_list {
return Intl.message(
'Model List',
name: 'model_list',
desc: '',
args: [],
);
}
/// `Select Models`
String get select_models {
return Intl.message(
'Select Models',
name: 'select_models',
desc: '',
args: [],
);
}
/// `Please enter a name`
String get enter_a_name {
return Intl.message(
'Please enter a name',
name: 'enter_a_name',
desc: '',
args: [],
);
}
/// `Please enter a title`
String get enter_a_title {
return Intl.message(
'Please enter a title',
name: 'enter_a_title',
desc: '',
args: [],
);
}
/// `Duplicate Bot name`
String get duplicate_bot_name {
return Intl.message(
'Duplicate Bot name',
name: 'duplicate_bot_name',
desc: '',
args: [],
);
}
/// `Duplicate API name`
String get duplicate_api_name {
return Intl.message(
'Duplicate API name',
name: 'duplicate_api_name',
desc: '',
args: [],
);
}
/// `Please complete all fields`
String get complete_all_fields {
return Intl.message(
'Please complete all fields',
name: 'complete_all_fields',
desc: '',
args: [],
);
}
/// `no model`
String get no_model {
return Intl.message(
'no model',
name: 'no_model',
desc: '',
args: [],
);
}
/// `All Chats`
String get all_chats {
return Intl.message(
'All Chats',
name: 'all_chats',
desc: '',
args: [],
);
}
/// `Chat Title`
String get chat_title {
return Intl.message(
'Chat Title',
name: 'chat_title',
desc: '',
args: [],
);
}
/// `Default Config`
String get default_config {
return Intl.message(
'Default Config',
name: 'default_config',
desc: '',
args: [],
);
}
/// `Text To Speech`
String get text_to_speech {
return Intl.message(
'Text To Speech',
name: 'text_to_speech',
desc: '',
args: [],
);
}
/// `Chat Image Compress`
String get chat_image_compress {
return Intl.message(
'Chat Image Compress',
name: 'chat_image_compress',
desc: '',
args: [],
);
}
/// `Config Import and Export`
String get config_import_export {
return Intl.message(
'Config Import and Export',
name: 'config_import_export',
desc: '',
args: [],
);
}
/// `Choose Bot`
String get choose_bot {
return Intl.message(
'Choose Bot',
name: 'choose_bot',
desc: '',
args: [],
);
}
/// `Choose API`
String get choose_api {
return Intl.message(
'Choose API',
name: 'choose_api',
desc: '',
args: [],
);
}
/// `Choose Model`
String get choose_model {
return Intl.message(
'Choose Model',
name: 'choose_model',
desc: '',
args: [],
);
}
/// `Quality`
String get quality {
return Intl.message(
'Quality',
name: 'quality',
desc: '',
args: [],
);
}
/// `Minimal Width`
String get min_width {
return Intl.message(
'Minimal Width',
name: 'min_width',
desc: '',
args: [],
);
}
/// `Minimal Height`
String get min_height {
return Intl.message(
'Minimal Height',
name: 'min_height',
desc: '',
args: [],
);
}
/// `Minimal Size`
String get min_width_height {
return Intl.message(
'Minimal Size',
name: 'min_width_height',
desc: '',
args: [],
);
}
/// `Export Config`
String get export_config {
return Intl.message(
'Export Config',
name: 'export_config',
desc: '',
args: [],
);
}
/// `Import Config`
String get import_config {
return Intl.message(
'Import Config',
name: 'import_config',
desc: '',
args: [],
);
}
/// `Exporting...`
String get exporting {
return Intl.message(
'Exporting...',
name: 'exporting',
desc: '',
args: [],
);
}
/// `Importing...`
String get importing {
return Intl.message(
'Importing...',
name: 'importing',
desc: '',
args: [],
);
}
/// `Empty`
String get empty {
return Intl.message(
'Empty',
name: 'empty',
desc: '',
args: [],
);
}
/// `Enable`
String get enable {
return Intl.message(
'Enable',
name: 'enable',
desc: '',
args: [],
);
}
/// `Please Input`
String get please_input {
return Intl.message(
'Please Input',
name: 'please_input',
desc: '',
args: [],
);
}
/// `The original image will be used if compression fails`
String get image_enable_hint {
return Intl.message(
'The original image will be used if compression fails',
name: 'image_enable_hint',
desc: '',
args: [],
);
}
/// `The Quality should be between 1 and 100, with lower values resulting in higher compression. Minimum Width and Minimum Height restrict image resizing. Leave these fields empty if you're unsure.`
String get image_hint {
return Intl.message(
'The Quality should be between 1 and 100, with lower values resulting in higher compression. Minimum Width and Minimum Height restrict image resizing. Leave these fields empty if you\'re unsure.',
name: 'image_hint',
desc: '',
args: [],
);
}
/// `To avoid export failures, it's recommended to export the configuration to the Documents directory, or create a ChatBot subdirectory within your Downloads folder.`
String get config_hint {
return Intl.message(
'To avoid export failures, it\'s recommended to export the configuration to the Documents directory, or create a ChatBot subdirectory within your Downloads folder.',
name: 'config_hint',
desc: '',
args: [],
);
}
/// `Exported Successfully`
String get exported_successfully {
return Intl.message(
'Exported Successfully',
name: 'exported_successfully',
desc: '',
args: [],
);
}
/// `Imported Successfully`
String get imported_successfully {
return Intl.message(
'Imported Successfully',
name: 'imported_successfully',
desc: '',
args: [],
);
}
/// `Please restart App to load the new settings.`
String get restart_app {
return Intl.message(
'Please restart App to load the new settings.',
name: 'restart_app',
desc: '',
args: [],
);
}
/// `Can't write to that directory.`
String get failed_to_export {
return Intl.message(
'Can\'t write to that directory.',
name: 'failed_to_export',
desc: '',
args: [],
);
}
/// `Generate`
String get generate {
return Intl.message(
'Generate',
name: 'generate',
desc: '',
args: [],
);
}
/// `Image Size`
String get image_size {
return Intl.message(
'Image Size',
name: 'image_size',
desc: '',
args: [],
);
}
/// `Image Style`
String get image_style {
return Intl.message(
'Image Style',
name: 'image_style',
desc: '',
args: [],
);
}
/// `Image Quality`
String get image_quality {
return Intl.message(
'Image Quality',
name: 'image_quality',
desc: '',
args: [],
);
}
/// `Base Config`
String get base_config {
return Intl.message(
'Base Config',
name: 'base_config',
desc: '',
args: [],
);
}
/// `Optional Config`
String get optional_config {
return Intl.message(
'Optional Config',
name: 'optional_config',
desc: '',
args: [],
);
}
/// `Image Generation`
String get image_generation {
return Intl.message(
'Image Generation',
name: 'image_generation',
desc: '',
args: [],
);
}
/// `Enter your prompts`
String get enter_prompts {
return Intl.message(
'Enter your prompts',
name: 'enter_prompts',
desc: '',
args: [],
);
}
/// `Clone Chat`
String get clone_chat {
return Intl.message(
'Clone Chat',
name: 'clone_chat',
desc: '',
args: [],
);
}
/// `Clear Chat`
String get clear_chat {
return Intl.message(
'Clear Chat',
name: 'clear_chat',
desc: '',
args: [],
);
}
/// `Chat Settings`
String get chat_settings {
return Intl.message(
'Chat Settings',
name: 'chat_settings',
desc: '',
args: [],
);
}
/// `Export Image`
String get export_chat_as_image {
return Intl.message(
'Export Image',
name: 'export_chat_as_image',
desc: '',
args: [],
);
}
/// `Cloned Successfully`
String get cloned_successfully {
return Intl.message(
'Cloned Successfully',
name: 'cloned_successfully',
desc: '',
args: [],
);
}
/// `Are you sure to clear the chat?`
String get ensure_clear_chat {
return Intl.message(
'Are you sure to clear the chat?',
name: 'ensure_clear_chat',
desc: '',
args: [],
);
}
/// `Saved Successfully`
String get saved_successfully {
return Intl.message(
'Saved Successfully',
name: 'saved_successfully',
desc: '',
args: [],
);
}
/// `Copied Successfully`
String get copied_successfully {
return Intl.message(
'Copied Successfully',
name: 'copied_successfully',
desc: '',
args: [],
);
}
/// `Not implemented yet`
String get not_implemented_yet {
return Intl.message(
'Not implemented yet',
name: 'not_implemented_yet',
desc: '',
args: [],
);
}
/// `Empty Link`
String get empty_link {
return Intl.message(
'Empty Link',
name: 'empty_link',
desc: '',
args: [],
);
}
/// `Cannot Open`
String get cannot_open {
return Intl.message(
'Cannot Open',
name: 'cannot_open',
desc: '',
args: [],
);
}
/// `Invalid Max Tokens`
String get invalid_max_tokens {
return Intl.message(
'Invalid Max Tokens',
name: 'invalid_max_tokens',
desc: '',
args: [],
);
}
/// `Invalid Temperature`
String get invalid_temperature {
return Intl.message(
'Invalid Temperature',
name: 'invalid_temperature',
desc: '',
args: [],
);
}
/// `Enter your message`
String get enter_message {
return Intl.message(
'Enter your message',
name: 'enter_message',
desc: '',
args: [],
);
}
/// `Failed to comprese image`
String get image_compress_failed {
return Intl.message(
'Failed to comprese image',
name: 'image_compress_failed',
desc: '',
args: [],
);
}
/// `Set up the TTS first`
String get setup_tts_first {
return Intl.message(
'Set up the TTS first',
name: 'setup_tts_first',
desc: '',
args: [],
);
}
/// `Set up the API and Model first`
String get setup_api_model_first {
return Intl.message(
'Set up the API and Model first',
name: 'setup_api_model_first',
desc: '',
args: [],
);
}
/// `Other`
String get other {
return Intl.message(
'Other',
name: 'other',
desc: '',
args: [],
);
}
/// `Download`
String get download {
return Intl.message(
'Download',
name: 'download',
desc: '',
args: [],
);
}
/// `You are up to date`
String get up_to_date {
return Intl.message(
'You are up to date',
name: 'up_to_date',
desc: '',
args: [],
);
}
/// `Check for Updates`
String get check_for_updates {
return Intl.message(
'Check for Updates',
name: 'check_for_updates',
desc: '',
args: [],
);
}
/// `Delete image`
String get delete_image {
return Intl.message(
'Delete image',
name: 'delete_image',
desc: '',
args: [],
);
}
/// `Are you sure to delete the image?`
String get ensure_delete_image {
return Intl.message(
'Are you sure to delete the image?',
name: 'ensure_delete_image',
desc: '',
args: [],
);
}
/// `Task`
String get task {
return Intl.message(
'Task',
name: 'task',
desc: '',
args: [],
);
}
/// `Document`
String get document {
return Intl.message(
'Document',
name: 'document',
desc: '',
args: [],
);
}
/// `Workspace`
String get workspace {
return Intl.message(
'Workspace',
name: 'workspace',
desc: '',
args: [],
);
}
/// `Chat Model`
String get chat_model {
return Intl.message(
'Chat Model',
name: 'chat_model',
desc: '',
args: [],
);
}
/// `Model Name`
String get model_name {
return Intl.message(
'Model Name',
name: 'model_name',
desc: '',
args: [],
);
}
/// `Model Avatar`
String get model_avatar {
return Intl.message(
'Model Avatar',
name: 'model_avatar',
desc: '',
args: [],
);
}
/// `Is it a Chat Model?`
String get chat_model_hint {
return Intl.message(
'Is it a Chat Model?',
name: 'chat_model_hint',
desc: '',
args: [],
);
}
/// `Title Generation`
String get title_generation {
return Intl.message(
'Title Generation',
name: 'title_generation',
desc: '',
args: [],
);
}
/// `If disabled, the user's message will be used as the title`
String get title_enable_hint {
return Intl.message(
'If disabled, the user\'s message will be used as the title',
name: 'title_enable_hint',
desc: '',
args: [],
);
}
/// `Prompt`
String get title_prompt {
return Intl.message(
'Prompt',
name: 'title_prompt',
desc: '',
args: [],
);
}
/// `Template for the title generation prompt`
String get title_prompt_hint {
return Intl.message(
'Template for the title generation prompt',
name: 'title_prompt_hint',
desc: '',
args: [],
);
}
/// `In the prompt template, The {text} placeholder will be replaced with the user's message. If unsure, leave empty to use the built-in template.`
String title_generation_hint(Object text) {
return Intl.message(
'In the prompt template, The $text placeholder will be replaced with the user\'s message. If unsure, leave empty to use the built-in template.',
name: 'title_generation_hint',
desc: '',
args: [text],
);
}
/// `Clearing...`
String get clearing {
return Intl.message(
'Clearing...',
name: 'clearing',
desc: '',
args: [],
);
}
/// `Clear Data`
String get clear_data {
return Intl.message(
'Clear Data',
name: 'clear_data',
desc: '',
args: [],
);
}
/// `Cleared Successfully`
String get cleared_successfully {
return Intl.message(
'Cleared Successfully',
name: 'cleared_successfully',
desc: '',
args: [],
);
}
/// `All chat history`
String get clear_data_chat {
return Intl.message(
'All chat history',
name: 'clear_data_chat',
desc: '',
args: [],
);
}
/// `All TTS cache files`
String get clear_data_audio {
return Intl.message(
'All TTS cache files',
name: 'clear_data_audio',
desc: '',
args: [],
);
}
/// `All generated images`
String get clear_data_image {
return Intl.message(
'All generated images',
name: 'clear_data_image',
desc: '',
args: [],
);
}
/// `Set up the embedding vector API and model first`
String get setup_vector_first {
return Intl.message(
'Set up the embedding vector API and model first',
name: 'setup_vector_first',
desc: '',
args: [],
);
}
/// `Embedding Vector`
String get search_vector {
return Intl.message(
'Embedding Vector',
name: 'search_vector',
desc: '',
args: [],
);
}
/// `Recommended to enable`
String get search_vector_hint {
return Intl.message(
'Recommended to enable',
name: 'search_vector_hint',
desc: '',
args: [],
);
}
/// `Timeout`
String get search_timeout {
return Intl.message(
'Timeout',
name: 'search_timeout',
desc: '',
args: [],
);
}
/// `Retrieval timeout in milliseconds`
String get search_timeout_hint {
return Intl.message(
'Retrieval timeout in milliseconds',
name: 'search_timeout_hint',
desc: '',
args: [],
);
}
/// `Base URL`
String get search_searxng_base {
return Intl.message(
'Base URL',
name: 'search_searxng_base',
desc: '',
args: [],
);
}
/// `Additional Parameters`
String get search_searxng_extra {
return Intl.message(
'Additional Parameters',
name: 'search_searxng_extra',
desc: '',
args: [],
);
}
/// `For example: engines=google&language=en`
String get search_searxng_extra_help {
return Intl.message(
'For example: engines=google&language=en',
name: 'search_searxng_extra_help',
desc: '',
args: [],
);
}
/// `Query Timeout`
String get search_timeout_query {
return Intl.message(
'Query Timeout',
name: 'search_timeout_query',
desc: '',
args: [],
);
}
/// `Timeout duration for SearXNG requests`
String get search_timeout_query_help {
return Intl.message(
'Timeout duration for SearXNG requests',
name: 'search_timeout_query_help',
desc: '',
args: [],
);
}
/// `Fetch Timeout`
String get search_timeout_fetch {
return Intl.message(
'Fetch Timeout',
name: 'search_timeout_fetch',
desc: '',
args: [],
);
}
/// `Timeout duration for fetching web page content`
String get search_timeout_fetch_help {
return Intl.message(
'Timeout duration for fetching web page content',
name: 'search_timeout_fetch_help',
desc: '',
args: [],
);
}
/// `Embedding Vector`
String get embedding_vector {
return Intl.message(
'Embedding Vector',
name: 'embedding_vector',
desc: '',
args: [],
);
}
/// `Batch Size`
String get vector_batch_size {
return Intl.message(
'Batch Size',
name: 'vector_batch_size',
desc: '',
args: [],
);
}
/// `Maximum number of chunks that can be submitted in a single request`
String get vector_batch_size_hint {
return Intl.message(
'Maximum number of chunks that can be submitted in a single request',
name: 'vector_batch_size_hint',
desc: '',
args: [],
);
}
/// `Vector Dimensions`
String get vector_dimensions {
return Intl.message(
'Vector Dimensions',
name: 'vector_dimensions',
desc: '',
args: [],
);
}
/// `Output dimension of the embedding vector model`
String get vector_dimensions_hint {
return Intl.message(
'Output dimension of the embedding vector model',
name: 'vector_dimensions_hint',
desc: '',
args: [],
);
}
/// `Batch size is limited by the API service provider. It's recommended to check and modify accordingly. Vector dimension is an advanced option and should only be filled if necessary.`
String get embedding_vector_info {
return Intl.message(
'Batch size is limited by the API service provider. It\'s recommended to check and modify accordingly. Vector dimension is an advanced option and should only be filled if necessary.',
name: 'embedding_vector_info',
desc: '',
args: [],
);
}
/// `Document Config`
String get document_config {
return Intl.message(
'Document Config',
name: 'document_config',
desc: '',
args: [],
);
}
/// `Number of Chunks`
String get chunk_n {
return Intl.message(
'Number of Chunks',
name: 'chunk_n',
desc: '',
args: [],
);
}
/// `Number of chunks to be integrated into the context`
String get chunk_n_hint {
return Intl.message(
'Number of chunks to be integrated into the context',
name: 'chunk_n_hint',
desc: '',
args: [],
);
}
/// `Chunk Size`
String get chunk_size {
return Intl.message(
'Chunk Size',
name: 'chunk_size',
desc: '',
args: [],
);
}
/// `Maximum number of characters a single chunk can contain`
String get chunk_size_hint {
return Intl.message(
'Maximum number of characters a single chunk can contain',
name: 'chunk_size_hint',
desc: '',
args: [],
);
}
/// `Chunk Overlap`
String get chunk_overlap {
return Intl.message(
'Chunk Overlap',
name: 'chunk_overlap',
desc: '',
args: [],
);
}
/// `Size of the overlapping portion with the previous chunk`
String get chunk_overlap_hint {
return Intl.message(
'Size of the overlapping portion with the previous chunk',
name: 'chunk_overlap_hint',
desc: '',
args: [],
);
}
/// `Documents are divided into multiple chunks. After search and comparison, the most relevant chunks will be added to the context.`
String get document_config_hint {
return Intl.message(
'Documents are divided into multiple chunks. After search and comparison, the most relevant chunks will be added to the context.',
name: 'document_config_hint',
desc: '',
args: [],
);
}
/// `Set up the SearXNG first`
String get setup_searxng_first {
return Intl.message(
'Set up the SearXNG first',
name: 'setup_searxng_first',
desc: '',
args: [],
);
}
/// `Google Search Mode`
String get search_gemini_mode {
return Intl.message(
'Google Search Mode',
name: 'search_gemini_mode',
desc: '',
args: [],
);
}
/// `General Mode`
String get search_general_mode {
return Intl.message(
'General Mode',
name: 'search_general_mode',
desc: '',
args: [],
);
}
/// `Web Search`
String get web_search {
return Intl.message(
'Web Search',
name: 'web_search',
desc: '',
args: [],
);
}
/// `SearXNG`
String get search_searxng {
return Intl.message(
'SearXNG',
name: 'search_searxng',
desc: '',
args: [],
);
}
/// `SearXNG instance`
String get search_searxng_hint {
return Intl.message(
'SearXNG instance',
name: 'search_searxng_hint',
desc: '',
args: [],
);
}
/// `Number of Pages`
String get search_n {
return Intl
gitextract_khs2npmo/
├── .github/
│ └── workflows/
│ └── build.yaml
├── .gitignore
├── .metadata
├── CHANGELOG
├── COPYING
├── README
├── analysis_options.yaml
├── android/
│ ├── .gitignore
│ ├── app/
│ │ ├── build.gradle
│ │ └── src/
│ │ ├── debug/
│ │ │ └── AndroidManifest.xml
│ │ ├── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin/
│ │ │ │ └── cc/
│ │ │ │ └── arthur63/
│ │ │ │ └── chatbot/
│ │ │ │ └── MainActivity.kt
│ │ │ └── res/
│ │ │ ├── drawable-v21/
│ │ │ │ └── launch_background.xml
│ │ │ ├── values/
│ │ │ │ └── styles.xml
│ │ │ └── values-night/
│ │ │ └── styles.xml
│ │ └── profile/
│ │ └── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle/
│ │ └── wrapper/
│ │ └── gradle-wrapper.properties
│ ├── gradle.properties
│ └── settings.gradle
├── lib/
│ ├── chat/
│ │ ├── chat.dart
│ │ ├── current.dart
│ │ ├── input.dart
│ │ ├── message.dart
│ │ └── settings.dart
│ ├── config.dart
│ ├── gen/
│ │ ├── intl/
│ │ │ ├── messages_all.dart
│ │ │ ├── messages_en.dart
│ │ │ └── messages_zh_CN.dart
│ │ └── l10n.dart
│ ├── image/
│ │ ├── config.dart
│ │ ├── generate.dart
│ │ └── image.dart
│ ├── l10n/
│ │ ├── intl_en.arb
│ │ └── intl_zh_CN.arb
│ ├── llm/
│ │ ├── llm.dart
│ │ └── web.dart
│ ├── main.dart
│ ├── markdown/
│ │ ├── code.dart
│ │ ├── latex.dart
│ │ └── util.dart
│ ├── settings/
│ │ ├── api.dart
│ │ ├── bot.dart
│ │ ├── config.dart
│ │ └── settings.dart
│ ├── util.dart
│ └── workspace/
│ ├── document.dart
│ ├── model.dart
│ ├── task.dart
│ └── workspace.dart
├── linux/
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── flutter/
│ │ ├── CMakeLists.txt
│ │ ├── generated_plugin_registrant.cc
│ │ ├── generated_plugin_registrant.h
│ │ └── generated_plugins.cmake
│ ├── main.cc
│ ├── my_application.cc
│ └── my_application.h
├── pubspec.yaml
└── windows/
├── .gitignore
├── CMakeLists.txt
├── flutter/
│ ├── CMakeLists.txt
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
└── runner/
├── CMakeLists.txt
├── Runner.rc
├── flutter_window.cpp
├── flutter_window.h
├── main.cpp
├── resource.h
├── runner.exe.manifest
├── utils.cpp
├── utils.h
├── win32_window.cpp
└── win32_window.h
SYMBOL INDEX (343 symbols across 38 files)
FILE: lib/chat/chat.dart
class ChatNotifier (line 40) | class ChatNotifier extends AutoDisposeNotifier<void> {
method build (line 42) | void build()
method notify (line 43) | void notify()
class ChatsNotifier (line 46) | class ChatsNotifier extends AutoDisposeNotifier<void> {
method build (line 48) | void build()
method notify (line 49) | void notify()
class MessagesNotifier (line 52) | class MessagesNotifier extends AutoDisposeNotifier<void> {
method build (line 54) | void build()
method notify (line 55) | void notify()
class ChatPage (line 58) | class ChatPage extends ConsumerStatefulWidget {
method createState (line 62) | ConsumerState<ChatPage> createState()
class _ChatPageState (line 65) | class _ChatPageState extends ConsumerState<ChatPage> {
method initState (line 71) | void initState()
method dispose (line 89) | void dispose()
method build (line 95) | Widget build(BuildContext context)
method _buildAppBar (line 108) | AppBar _buildAppBar()
method _buildDrawer (line 263) | Widget _buildDrawer()
method _buildChatItem (line 336) | Widget _buildChatItem(int index)
method _buildBody (line 385) | Widget _buildBody()
method _exportChatAsImage (line 446) | Future<void> _exportChatAsImage()
class _ToBottomNotifier (line 504) | class _ToBottomNotifier extends AutoDisposeNotifier<bool> {
method build (line 506) | bool build()
method show (line 513) | void show()
method hide (line 514) | void hide()
FILE: lib/chat/current.dart
class Current (line 24) | class Current {
method load (line 33) | Future<void> load(ChatConfig chat)
method save (line 52) | Future<void> save()
method clear (line 59) | void clear()
method newChat (line 66) | void newChat(String title)
type TtsStatus (line 109) | enum TtsStatus {
type ChatStatus (line 119) | enum ChatStatus {
FILE: lib/chat/input.dart
class InputWidget (line 31) | class InputWidget extends ConsumerStatefulWidget {
method createState (line 37) | ConsumerState<InputWidget> createState()
method unFocus (line 39) | void unFocus()
type _Image (line 42) | typedef _Image = ({String name, MessageImage image});
class _InputWidgetState (line 44) | class _InputWidgetState extends ConsumerState<InputWidget> {
method initState (line 50) | void initState()
method dispose (line 62) | void dispose()
method build (line 68) | Widget build(BuildContext context)
method _buildSendButton (line 167) | Widget _buildSendButton()
method _addFile (line 197) | Future<void> _addFile()
method _addImage (line 238) | Future<void> _addImage(ImageSource source)
method _editImages (line 277) | void _editImages()
method _sendMessage (line 331) | Future<void> _sendMessage()
method _generateTitle (line 384) | Future<String?> _generateTitle(String text)
FILE: lib/chat/message.dart
class MessageNotifier (line 39) | class MessageNotifier extends AutoDisposeFamilyNotifier<void, Message> {
method build (line 41) | void build(Message arg)
method notify (line 43) | void notify()
type MessageRole (line 46) | enum MessageRole {
type CitationType (line 54) | enum CitationType {
type MessageImage (line 58) | typedef MessageImage = ({
type MessageCitation (line 63) | typedef MessageCitation = ({
class MessageItem (line 69) | class MessageItem {
method toJson (line 118) | Map toJson()
class Message (line 135) | class Message {
method toJson (line 159) | Map toJson()
class MessageWidget (line 167) | class MessageWidget extends ConsumerStatefulWidget {
method createState (line 176) | ConsumerState<MessageWidget> createState()
class _MessageWidgetState (line 179) | class _MessageWidgetState extends ConsumerState<MessageWidget> {
method build (line 181) | Widget build(BuildContext context)
method _buildImages (line 214) | Widget _buildImages()
method _buildHeader (line 269) | Widget _buildHeader()
method _buildBody (line 335) | Widget _buildBody()
method _buildToolBar (line 407) | Widget _buildToolBar()
method _edit (line 486) | void _edit()
method _copy (line 493) | void _copy()
method _delete (line 500) | void _delete()
method _source (line 519) | void _source()
method _citations (line 550) | void _citations()
method onTap (line 554) | void onTap(MessageCitation citation)
method _longPress (line 613) | void _longPress()
method invoke (line 616) | void invoke(VoidCallback func)
method _tts (line 671) | Future<void> _tts()
method _reanswer (line 698) | Future<void> _reanswer()
class MessageView (line 724) | class MessageView extends StatelessWidget {
method build (line 734) | Widget build(BuildContext context)
method _buildImages (line 758) | Widget _buildImages(BuildContext context)
method _buildHeader (line 782) | Widget _buildHeader(BuildContext context)
method _buildBody (line 812) | Widget _buildBody(BuildContext context)
class _MessageEditor (line 865) | class _MessageEditor extends ConsumerStatefulWidget {
method createState (line 873) | ConsumerState<_MessageEditor> createState()
class _MessageEditorState (line 876) | class _MessageEditorState extends ConsumerState<_MessageEditor> {
method initState (line 882) | void initState()
method dispose (line 891) | void dispose()
method build (line 898) | Widget build(BuildContext context)
FILE: lib/chat/settings.dart
class ChatSettings (line 28) | class ChatSettings extends ConsumerStatefulWidget {
method createState (line 32) | ConsumerState<ChatSettings> createState()
class _ChatSettingsState (line 35) | class _ChatSettingsState extends ConsumerState<ChatSettings> {
method dispose (line 44) | void dispose()
method build (line 50) | Widget build(BuildContext context)
method _buildBots (line 118) | Widget _buildBots()
method _buildApis (line 198) | Widget _buildApis()
method _buildModels (line 255) | Widget _buildModels()
method _saveCore (line 332) | void _saveCore()
method _saveTitle (line 348) | void _saveTitle()
FILE: lib/config.dart
class Config (line 26) | class Config {
method init (line 51) | Future<void> init()
method save (line 67) | Future<void> save()
method chatFilePath (line 71) | String chatFilePath(String fileName)
method audioFilePath (line 73) | String audioFilePath(String fileName)
method imageFilePath (line 75) | String imageFilePath(String fileName)
method cacheFilePath (line 77) | String cacheFilePath(String fileName)
method toJson (line 79) | Map toJson()
method fromJson (line 94) | void fromJson(Map json)
method _initDir (line 131) | void _initDir()
method _initFile (line 151) | void _initFile()
method _fixChatFile (line 163) | void _fixChatFile()
class Backup (line 177) | class Backup {
method exportConfig (line 178) | Future<void> exportConfig(String to)
method importConfig (line 198) | Future<void> importConfig(String from)
method clearData (line 206) | Future<void> clearData(List<String> dirs)
class Updater (line 222) | class Updater {
method check (line 229) | Future<Map?> check()
method _isNewer (line 246) | bool _isNewer(String latest)
class Preferences (line 256) | class Preferences {
method init (line 261) | Future<void> init()
method _init (line 280) | Future<void> _init()
class BotConfig (line 286) | class BotConfig {
method toJson (line 299) | Map toJson()
class ApiConfig (line 314) | class ApiConfig {
method toJson (line 327) | Map toJson()
class CoreConfig (line 342) | class CoreConfig {
method toJson (line 364) | Map toJson()
class ChatConfig (line 377) | class ChatConfig {
method toJson (line 388) | Map toJson()
class TtsConfig (line 401) | class TtsConfig {
method toJson (line 420) | Map toJson()
class CicConfig (line 433) | class CicConfig {
method toJson (line 446) | Map toJson()
class ImageConfig (line 461) | class ImageConfig {
method toJson (line 484) | Map toJson()
class ModelConfig (line 501) | class ModelConfig {
method toJson (line 510) | Map toJson()
class TitleConfig (line 521) | class TitleConfig {
method toJson (line 542) | Map toJson()
class SearchConfig (line 557) | class SearchConfig {
method toJson (line 574) | Map toJson()
class VectorConfig (line 593) | class VectorConfig {
method toJson (line 621) | Map toJson()
class DocumentConfig (line 629) | class DocumentConfig {
method toJson (line 640) | Map toJson()
FILE: lib/gen/intl/messages_all.dart
type Future (line 22) | typedef Future<dynamic> LibraryLoader();
function _findExact (line 28) | MessageLookupByLibrary? _findExact(String localeName)
function initializeMessages (line 40) | Future<bool> initializeMessages(String localeName)
function _messagesExistFor (line 54) | bool _messagesExistFor(String locale)
function _findGeneratedMessagesFor (line 62) | MessageLookupByLibrary? _findGeneratedMessagesFor(String locale)
FILE: lib/gen/intl/messages_en.dart
type String (line 18) | typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup (line 20) | class MessageLookup extends MessageLookupByLibrary {
method m0 (line 23) | String m0(pages, text)
method m1 (line 26) | String m1(text)
method _notInlinedMessages (line 30) | Map<String, Function> _notInlinedMessages(_)
FILE: lib/gen/intl/messages_zh_CN.dart
type String (line 18) | typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup (line 20) | class MessageLookup extends MessageLookupByLibrary {
method m0 (line 23) | String m0(pages, text)
method m1 (line 26) | String m1(text)
method _notInlinedMessages (line 29) | Map<String, Function> _notInlinedMessages(_)
FILE: lib/gen/l10n.dart
class S (line 15) | class S {
method load (line 28) | Future<S> load(Locale locale)
method of (line 42) | S of(BuildContext context)
method maybeOf (line 49) | S? maybeOf(BuildContext context)
method title_generation_hint (line 1214) | String title_generation_hint(Object text)
method search_prompt_info (line 1644) | String search_prompt_info(Object pages, Object text)
class AppLocalizationDelegate (line 1654) | class AppLocalizationDelegate extends LocalizationsDelegate<S> {
method isSupported (line 1665) | bool isSupported(Locale locale)
method load (line 1667) | Future<S> load(Locale locale)
method shouldReload (line 1669) | bool shouldReload(AppLocalizationDelegate old)
method _isSupported (line 1671) | bool _isSupported(Locale locale)
FILE: lib/image/config.dart
class ConfigTab (line 24) | class ConfigTab extends ConsumerStatefulWidget {
method createState (line 28) | ConsumerState<ConfigTab> createState()
class _ConfigTabState (line 31) | class _ConfigTabState extends ConsumerState<ConfigTab> {
method build (line 33) | Widget build(BuildContext context)
FILE: lib/image/generate.dart
type _Status (line 26) | enum _Status {
class GenerateTab (line 36) | class GenerateTab extends ConsumerStatefulWidget {
method createState (line 40) | ConsumerState<GenerateTab> createState()
class _GenerateTabState (line 43) | class _GenerateTabState extends ConsumerState<GenerateTab>
method dispose (line 52) | void dispose()
method build (line 62) | Widget build(BuildContext context)
method _generate (line 121) | Future<void> _generate()
method _getAspectRatio (line 209) | double _getAspectRatio()
FILE: lib/image/image.dart
class ImagePage (line 23) | class ImagePage extends ConsumerWidget {
method build (line 27) | Widget build(BuildContext context, WidgetRef ref)
FILE: lib/llm/llm.dart
class LlmNotifier (line 37) | class LlmNotifier extends AutoDisposeNotifier<void> {
method build (line 43) | void build()
method notify (line 44) | void notify()
method updateMessage (line 46) | void updateMessage(Message message)
method tts (line 49) | Future<dynamic> tts(Message message)
method stopTts (line 105) | void stopTts()
method chat (line 112) | Future<dynamic> chat(Message message)
method stopChat (line 188) | void stopChat()
method _buildContext (line 194) | Future<PromptValue> _buildContext(List<Message> messages)
method _buildWebContext (line 235) | Future<MessageItem> _buildWebContext(MessageItem origin)
method _getWebPageUrls (line 350) | Future<List<String>> _getWebPageUrls(String query, int n)
method uriOf (line 357) | Uri uriOf(int i)
function generateTitle (line 382) | Future<String> generateTitle(String text)
class _GoogleClient (line 440) | class _GoogleClient extends BaseClient {
method _hook (line 451) | BaseRequest _hook(BaseRequest origin)
method send (line 477) | Future<StreamedResponse> send(BaseRequest request)
method close (line 483) | void close()
FILE: lib/llm/web.dart
class WebLoader (line 21) | class WebLoader extends BaseDocumentLoader {
method load (line 35) | Future<List<Document>> load()
method lazyLoad (line 46) | Stream<Document> lazyLoad()
method _scrape (line 53) | Future<Document> _scrape(final String url)
method _fetchUrl (line 68) | Future<String> _fetchUrl(final String url)
method _buildMetadata (line 77) | Map<String, dynamic> _buildMetadata(
FILE: lib/main.dart
function main (line 27) | void main()
class App (line 32) | class App extends StatelessWidget {
method build (line 36) | Widget build(BuildContext context)
FILE: lib/markdown/code.dart
class CodeBlockBuilder (line 36) | class CodeBlockBuilder extends MarkdownElementBuilder {
method visitElementBefore (line 43) | void visitElementBefore(md.Element element)
method visitText (line 53) | Widget? visitText(md.Text text, TextStyle? preferredStyle)
class CodeBlockBuilder2 (line 112) | class CodeBlockBuilder2 extends MarkdownElementBuilder {
method visitElementBefore (line 119) | void visitElementBefore(md.Element element)
method visitText (line 129) | Widget? visitText(md.Text text, TextStyle? preferredStyle)
FILE: lib/markdown/latex.dart
class LatexElementBuilder (line 21) | class LatexElementBuilder extends MarkdownElementBuilder {
method visitElementAfterWithContext (line 31) | Widget visitElementAfterWithContext(
class LatexElementBuilder2 (line 58) | class LatexElementBuilder2 extends MarkdownElementBuilder {
method visitElementAfterWithContext (line 68) | Widget visitElementAfterWithContext(
class _LatexDelimiter (line 95) | class _LatexDelimiter {
class LatexInlineSyntax (line 107) | class LatexInlineSyntax extends InlineSyntax {
method _buildPattern (line 117) | String _buildPattern()
method onMatch (line 126) | bool onMatch(InlineParser parser, Match match)
class LatexBlockSyntax (line 147) | class LatexBlockSyntax extends BlockSyntax {
method canParse (line 157) | bool canParse(BlockParser parser)
method parse (line 163) | Node parse(BlockParser parser)
FILE: lib/markdown/util.dart
function markdownToText (line 37) | String markdownToText(String markdown)
function _elementToText (line 53) | String _elementToText(Element element)
FILE: lib/settings/api.dart
class ApisNotifier (line 29) | class ApisNotifier extends AutoDisposeNotifier<void> {
method build (line 31) | void build()
method notify (line 32) | void notify()
class ApisTab (line 35) | class ApisTab extends ConsumerWidget {
method build (line 39) | Widget build(BuildContext context, WidgetRef ref)
class ApiSettings (line 84) | class ApiSettings extends ConsumerStatefulWidget {
method createState (line 93) | ConsumerState<ApiSettings> createState()
class _ApiSettingsState (line 96) | class _ApiSettingsState extends ConsumerState<ApiSettings> {
method initState (line 106) | void initState()
method dispose (line 120) | void dispose()
method build (line 129) | Widget build(BuildContext context)
method _fetchModels (line 276) | Future<void> _fetchModels()
method _editModels (line 333) | Future<void> _editModels()
method _save (line 396) | void _save()
FILE: lib/settings/bot.dart
class BotsNotifier (line 26) | class BotsNotifier extends AutoDisposeNotifier<void> {
method build (line 28) | void build()
method notify (line 29) | void notify()
class BotsTab (line 32) | class BotsTab extends ConsumerWidget {
method build (line 36) | Widget build(BuildContext context, WidgetRef ref)
class BotSettings (line 81) | class BotSettings extends ConsumerStatefulWidget {
method createState (line 90) | ConsumerState<BotSettings> createState()
class _BotSettingsState (line 93) | class _BotSettingsState extends ConsumerState<BotSettings> {
method initState (line 101) | void initState()
method dispose (line 116) | void dispose()
method build (line 125) | Widget build(BuildContext context)
method _save (line 242) | void _save()
FILE: lib/settings/config.dart
class ConfigTab (line 30) | class ConfigTab extends ConsumerStatefulWidget {
method createState (line 34) | ConsumerState<ConfigTab> createState()
class _ConfigTabState (line 37) | class _ConfigTabState extends ConsumerState<ConfigTab> {
method build (line 39) | Widget build(BuildContext context)
method _clearData (line 396) | Future<void> _clearData()
FILE: lib/settings/settings.dart
class SettingsPage (line 23) | class SettingsPage extends StatefulWidget {
method createState (line 27) | State<SettingsPage> createState()
class _SettingsPageState (line 30) | class _SettingsPageState extends State<SettingsPage> {
method build (line 32) | Widget build(BuildContext context)
FILE: lib/util.dart
class Util (line 28) | class Util {
method copyText (line 29) | Future<void> copyText({
method checkUpdate (line 41) | Future<void> checkUpdate({
method checkChat (line 87) | bool checkChat(BuildContext context)
method showSnackBar (line 125) | void showSnackBar({
method formatDateTime (line 141) | String formatDateTime(DateTime time)
method two (line 142) | String two(int n)
class Dialogs (line 149) | class Dialogs {
method input (line 150) | Future<List<String>?> input({
method error (line 171) | void error({
method select (line 198) | Future<String?> select({
method loading (line 247) | void loading({
method openLink (line 271) | Future<void> openLink({
method handleImage (line 322) | Future<void> handleImage({
class InputDialogField (line 379) | class InputDialogField {
class InputDialog (line 395) | class InputDialog extends StatefulWidget {
method createState (line 406) | State<InputDialog> createState()
class _InputDialogState (line 409) | class _InputDialogState extends State<InputDialog> {
method initState (line 413) | void initState()
method dispose (line 422) | void dispose()
method build (line 430) | Widget build(BuildContext context)
class InfoCard (line 479) | class InfoCard extends StatelessWidget {
method build (line 488) | Widget build(BuildContext context)
class ModelAvatar (line 514) | class ModelAvatar extends StatelessWidget {
method build (line 535) | Widget build(BuildContext context)
method _getImage (line 549) | SvgPicture? _getImage(BuildContext context)
class DragHandle (line 579) | class DragHandle extends StatelessWidget {
method build (line 593) | Widget build(BuildContext context)
class DialogHeader (line 609) | class DialogHeader extends StatelessWidget {
method build (line 623) | Widget build(BuildContext context)
class DialogFooter (line 646) | class DialogFooter extends StatelessWidget {
method build (line 660) | Widget build(BuildContext context)
FILE: lib/workspace/document.dart
class DocumentTab (line 23) | class DocumentTab extends ConsumerStatefulWidget {
method createState (line 27) | ConsumerState<DocumentTab> createState()
class _DocumentTabState (line 30) | class _DocumentTabState extends ConsumerState<DocumentTab> {
method build (line 32) | Widget build(BuildContext context)
FILE: lib/workspace/model.dart
class ModelTab (line 24) | class ModelTab extends ConsumerWidget {
method build (line 28) | Widget build(BuildContext context, WidgetRef ref)
class ModelSettings (line 81) | class ModelSettings extends ConsumerStatefulWidget {
method createState (line 90) | ConsumerState<ModelSettings> createState()
class _ModelEditorState (line 93) | class _ModelEditorState extends ConsumerState<ModelSettings> {
method initState (line 100) | void initState()
method dispose (line 111) | void dispose()
method build (line 117) | Widget build(BuildContext context)
method _idToName (line 169) | void _idToName()
method _save (line 182) | Future<void> _save()
FILE: lib/workspace/task.dart
class TaskTab (line 23) | class TaskTab extends ConsumerStatefulWidget {
method createState (line 27) | ConsumerState<TaskTab> createState()
class _TaskTabState (line 30) | class _TaskTabState extends ConsumerState<TaskTab> {
method build (line 32) | Widget build(BuildContext context)
FILE: lib/workspace/workspace.dart
class WorkspacePage (line 24) | class WorkspacePage extends ConsumerWidget {
method build (line 28) | Widget build(BuildContext context, WidgetRef ref)
FILE: linux/flutter/generated_plugin_registrant.cc
function fl_register_plugins (line 14) | void fl_register_plugins(FlPluginRegistry* registry) {
FILE: linux/main.cc
function main (line 3) | int main(int argc, char** argv) {
FILE: linux/my_application.cc
type _MyApplication (line 10) | struct _MyApplication {
function my_application_activate (line 18) | static void my_application_activate(GApplication* application) {
function gboolean (line 66) | static gboolean my_application_local_command_line(GApplication* applicat...
function my_application_startup (line 85) | static void my_application_startup(GApplication* application) {
function my_application_shutdown (line 94) | static void my_application_shutdown(GApplication* application) {
function my_application_dispose (line 103) | static void my_application_dispose(GObject* object) {
function my_application_class_init (line 109) | static void my_application_class_init(MyApplicationClass* klass) {
function my_application_init (line 117) | static void my_application_init(MyApplication* self) {}
function MyApplication (line 119) | MyApplication* my_application_new() {
FILE: windows/flutter/generated_plugin_registrant.cc
function RegisterPlugins (line 15) | void RegisterPlugins(flutter::PluginRegistry* registry) {
FILE: windows/runner/flutter_window.cpp
function LRESULT (line 50) | LRESULT
FILE: windows/runner/flutter_window.h
function class (line 12) | class FlutterWindow : public Win32Window {
FILE: windows/runner/main.cpp
function wWinMain (line 8) | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
FILE: windows/runner/utils.cpp
function CreateAndAttachConsole (line 10) | void CreateAndAttachConsole() {
function GetCommandLineArguments (line 24) | std::vector<std::string> GetCommandLineArguments() {
function Utf8FromUtf16 (line 44) | std::string Utf8FromUtf16(const wchar_t* utf16_string) {
FILE: windows/runner/win32_window.cpp
function Scale (line 36) | int Scale(int source, double scale_factor) {
function EnableFullDpiSupportIfAvailable (line 42) | void EnableFullDpiSupportIfAvailable(HWND hwnd) {
class WindowClassRegistrar (line 59) | class WindowClassRegistrar {
method WindowClassRegistrar (line 64) | static WindowClassRegistrar* GetInstance() {
method WindowClassRegistrar (line 80) | WindowClassRegistrar() = default;
function wchar_t (line 89) | const wchar_t* WindowClassRegistrar::GetWindowClass() {
function LRESULT (line 157) | LRESULT CALLBACK Win32Window::WndProc(HWND const window,
function LRESULT (line 176) | LRESULT
function Win32Window (line 236) | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept {
function RECT (line 252) | RECT Win32Window::GetClientArea() {
function HWND (line 258) | HWND Win32Window::GetHandle() {
FILE: windows/runner/win32_window.h
type Size (line 21) | struct Size {
Condensed preview — 77 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (413K chars).
[
{
"path": ".github/workflows/build.yaml",
"chars": 1725,
"preview": "name: Build and Release\n\non:\n push:\n tags:\n - \"v*\"\n\npermissions:\n contents: write\n\njobs:\n build-apk:\n runs"
},
{
"path": ".gitignore",
"chars": 493,
"preview": "# Miscellaneous\n*.log\n*.pyc\n*.swp\n*.class\n.history\n.DS_Store\n.svn/\n.atom/\n.buildlog/\nmigrate_working_dir/\n\n# IntelliJ re"
},
{
"path": ".metadata",
"chars": 1116,
"preview": "# This file tracks properties of this Flutter project.\n# Used by Flutter tool to assess capabilities and perform upgrade"
},
{
"path": "CHANGELOG",
"chars": 2231,
"preview": "0.3.5 (2025-01-10)\n\n * Add: General Web Search.\n * Improve: Additional page details.\n\n * 增加:通用联网搜索\n * 改进:更多页"
},
{
"path": "COPYING",
"chars": 35149,
"preview": " GNU GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
},
{
"path": "README",
"chars": 137,
"preview": "This project is no longer maintained.\n\nChatBot is licensed under the GNU General Public License v3.0 - see the COPYING f"
},
{
"path": "analysis_options.yaml",
"chars": 84,
"preview": "include: package:flutter_lints/flutter.yaml\n\nlinter:\n rules:\n\nanalyzer:\n plugins:\n"
},
{
"path": "android/.gitignore",
"chars": 247,
"preview": "gradle-wrapper.jar\n/.gradle\n/captures/\n/gradlew\n/gradlew.bat\n/local.properties\nGeneratedPluginRegistrant.java\n\n# Remembe"
},
{
"path": "android/app/build.gradle",
"chars": 1400,
"preview": "plugins {\n id \"kotlin-android\"\n id \"com.android.application\"\n id \"dev.flutter.flutter-gradle-plugin\"\n}\n\ndef key"
},
{
"path": "android/app/src/debug/AndroidManifest.xml",
"chars": 148,
"preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <uses-permission android:name=\"android.permiss"
},
{
"path": "android/app/src/main/AndroidManifest.xml",
"chars": 2363,
"preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <application\n android:label=\"ChatBot\"\n "
},
{
"path": "android/app/src/main/kotlin/cc/arthur63/chatbot/MainActivity.kt",
"chars": 120,
"preview": "package cc.arthur63.chatbot\n\nimport io.flutter.embedding.android.FlutterActivity\n\nclass MainActivity: FlutterActivity()\n"
},
{
"path": "android/app/src/main/res/drawable-v21/launch_background.xml",
"chars": 182,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <item"
},
{
"path": "android/app/src/main/res/values/styles.xml",
"chars": 406,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <style name=\"LaunchTheme\" parent=\"@android:style/Theme.Light.NoTi"
},
{
"path": "android/app/src/main/res/values-night/styles.xml",
"chars": 406,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <style name=\"LaunchTheme\" parent=\"@android:style/Theme.Black.NoTi"
},
{
"path": "android/app/src/profile/AndroidManifest.xml",
"chars": 148,
"preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <uses-permission android:name=\"android.permiss"
},
{
"path": "android/build.gradle",
"chars": 324,
"preview": "allprojects {\n repositories {\n google()\n mavenCentral()\n }\n}\n\nrootProject.buildDir = \"../build\"\n\nsub"
},
{
"path": "android/gradle/wrapper/gradle-wrapper.properties",
"chars": 200,
"preview": "zipStorePath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionBase=GRADLE_USER_HOM"
},
{
"path": "android/gradle.properties",
"chars": 127,
"preview": "android.useAndroidX=true\nandroid.enableJetifier=true\norg.gradle.daemon=false\norg.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceS"
},
{
"path": "android/settings.gradle",
"chars": 727,
"preview": "pluginManagement {\n def flutterSdkPath = {\n def properties = new Properties()\n file(\"local.properties\")"
},
{
"path": "lib/chat/chat.dart",
"chars": 16245,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/chat/current.dart",
"chars": 3421,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/chat/input.dart",
"chars": 11723,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/chat/message.dart",
"chars": 26834,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/chat/settings.dart",
"chars": 11575,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/config.dart",
"chars": 16612,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/gen/intl/messages_all.dart",
"chars": 2282,
"preview": "// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart\n// This is a library that looks up messa"
},
{
"path": "lib/gen/intl/messages_en.dart",
"chars": 16072,
"preview": "// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart\n// This is a library that provides messa"
},
{
"path": "lib/gen/intl/messages_zh_CN.dart",
"chars": 13066,
"preview": "// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart\n// This is a library that provides messa"
},
{
"path": "lib/gen/l10n.dart",
"chars": 32440,
"preview": "// GENERATED CODE - DO NOT MODIFY BY HAND\nimport 'package:flutter/material.dart';\nimport 'package:intl/intl.dart';\nimpor"
},
{
"path": "lib/image/config.dart",
"chars": 5276,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/image/generate.dart",
"chars": 6291,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/image/image.dart",
"chars": 1470,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/l10n/intl_en.arb",
"chars": 7392,
"preview": "{\n \"@@locale\": \"en\",\n \"title\": \"ChatBot\",\n\n \"ok\": \"Ok\",\n \"copy\": \"Copy\",\n \"edit\": \"Edit\",\n \"play\": \"Pl"
},
{
"path": "lib/l10n/intl_zh_CN.arb",
"chars": 5038,
"preview": "{\n \"@@locale\": \"zh_CN\",\n \"title\": \"ChatBot\",\n\n \"ok\": \"确定\",\n \"copy\": \"拷贝\",\n \"edit\": \"编辑\",\n \"play\": \"播放\""
},
{
"path": "lib/llm/llm.dart",
"chars": 13193,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/llm/web.dart",
"chars": 2754,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/main.dart",
"chars": 1863,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/markdown/code.dart",
"chars": 5509,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/markdown/latex.dart",
"chars": 5247,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/markdown/util.dart",
"chars": 2335,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/settings/api.dart",
"chars": 13199,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/settings/bot.dart",
"chars": 9009,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/settings/config.dart",
"chars": 14765,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/settings/settings.dart",
"chars": 1607,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/util.dart",
"chars": 17501,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/workspace/document.dart",
"chars": 7617,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/workspace/model.dart",
"chars": 5665,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/workspace/task.dart",
"chars": 9748,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "lib/workspace/workspace.dart",
"chars": 1562,
"preview": "// This file is part of ChatBot.\n//\n// ChatBot is free software: you can redistribute it and/or modify\n// it under the t"
},
{
"path": "linux/.gitignore",
"chars": 18,
"preview": "flutter/ephemeral\n"
},
{
"path": "linux/CMakeLists.txt",
"chars": 5427,
"preview": "# Project-level configuration.\ncmake_minimum_required(VERSION 3.10)\nproject(runner LANGUAGES CXX)\n\n# The name of the exe"
},
{
"path": "linux/flutter/CMakeLists.txt",
"chars": 2815,
"preview": "# This file controls Flutter-level build steps. It should not be edited.\ncmake_minimum_required(VERSION 3.10)\n\nset(EPHEM"
},
{
"path": "linux/flutter/generated_plugin_registrant.cc",
"chars": 1318,
"preview": "//\n// Generated file. Do not edit.\n//\n\n// clang-format off\n\n#include \"generated_plugin_registrant.h\"\n\n#include <audiopl"
},
{
"path": "linux/flutter/generated_plugin_registrant.h",
"chars": 303,
"preview": "//\n// Generated file. Do not edit.\n//\n\n// clang-format off\n\n#ifndef GENERATED_PLUGIN_REGISTRANT_\n#define GENERATED_PLUG"
},
{
"path": "linux/flutter/generated_plugins.cmake",
"chars": 828,
"preview": "#\n# Generated file, do not edit.\n#\n\nlist(APPEND FLUTTER_PLUGIN_LIST\n audioplayers_linux\n file_selector_linux\n objectb"
},
{
"path": "linux/main.cc",
"chars": 180,
"preview": "#include \"my_application.h\"\n\nint main(int argc, char** argv) {\n g_autoptr(MyApplication) app = my_application_new();\n "
},
{
"path": "linux/my_application.cc",
"chars": 4422,
"preview": "#include \"my_application.h\"\n\n#include <flutter_linux/flutter_linux.h>\n#ifdef GDK_WINDOWING_X11\n#include <gdk/gdkx.h>\n#en"
},
{
"path": "linux/my_application.h",
"chars": 388,
"preview": "#ifndef FLUTTER_MY_APPLICATION_H_\n#define FLUTTER_MY_APPLICATION_H_\n\n#include <gtk/gtk.h>\n\nG_DECLARE_FINAL_TYPE(MyApplic"
},
{
"path": "pubspec.yaml",
"chars": 1258,
"preview": "name: chatbot\nversion: 0.3.5+15\ndescription: ChatBot\n\nenvironment:\n sdk: ^3.5.4\n\ndependencies:\n flutter:\n sdk: flut"
},
{
"path": "windows/.gitignore",
"chars": 291,
"preview": "flutter/ephemeral/\n\n# Visual Studio user-specific files.\n*.suo\n*.user\n*.userosscache\n*.sln.docstates\n\n# Visual Studio bu"
},
{
"path": "windows/CMakeLists.txt",
"chars": 4150,
"preview": "# Project-level configuration.\ncmake_minimum_required(VERSION 3.14)\nproject(chatbot LANGUAGES CXX)\n\n# The name of the ex"
},
{
"path": "windows/flutter/CMakeLists.txt",
"chars": 3742,
"preview": "# This file controls Flutter-level build steps. It should not be edited.\ncmake_minimum_required(VERSION 3.14)\n\nset(EPHEM"
},
{
"path": "windows/flutter/generated_plugin_registrant.cc",
"chars": 1033,
"preview": "//\n// Generated file. Do not edit.\n//\n\n// clang-format off\n\n#include \"generated_plugin_registrant.h\"\n\n#include <audiopl"
},
{
"path": "windows/flutter/generated_plugin_registrant.h",
"chars": 302,
"preview": "//\n// Generated file. Do not edit.\n//\n\n// clang-format off\n\n#ifndef GENERATED_PLUGIN_REGISTRANT_\n#define GENERATED_PLUG"
},
{
"path": "windows/flutter/generated_plugins.cmake",
"chars": 851,
"preview": "#\n# Generated file, do not edit.\n#\n\nlist(APPEND FLUTTER_PLUGIN_LIST\n audioplayers_windows\n file_selector_windows\n obj"
},
{
"path": "windows/runner/CMakeLists.txt",
"chars": 1796,
"preview": "cmake_minimum_required(VERSION 3.14)\nproject(runner LANGUAGES CXX)\n\n# Define the application target. To change its name,"
},
{
"path": "windows/runner/Runner.rc",
"chars": 3025,
"preview": "// Microsoft Visual C++ generated resource script.\n//\n#pragma code_page(65001)\n#include \"resource.h\"\n\n#define APSTUDIO_R"
},
{
"path": "windows/runner/flutter_window.cpp",
"chars": 2122,
"preview": "#include \"flutter_window.h\"\n\n#include <optional>\n\n#include \"flutter/generated_plugin_registrant.h\"\n\nFlutterWindow::Flutt"
},
{
"path": "windows/runner/flutter_window.h",
"chars": 928,
"preview": "#ifndef RUNNER_FLUTTER_WINDOW_H_\n#define RUNNER_FLUTTER_WINDOW_H_\n\n#include <flutter/dart_project.h>\n#include <flutter/f"
},
{
"path": "windows/runner/main.cpp",
"chars": 1260,
"preview": "#include <flutter/dart_project.h>\n#include <flutter/flutter_view_controller.h>\n#include <windows.h>\n\n#include \"flutter_w"
},
{
"path": "windows/runner/resource.h",
"chars": 432,
"preview": "//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ generated include file.\n// Used by Runner.rc\n//\n#define IDI_APP_ICON "
},
{
"path": "windows/runner/runner.exe.manifest",
"chars": 602,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersi"
},
{
"path": "windows/runner/utils.cpp",
"chars": 1797,
"preview": "#include \"utils.h\"\n\n#include <flutter_windows.h>\n#include <io.h>\n#include <stdio.h>\n#include <windows.h>\n\n#include <iost"
},
{
"path": "windows/runner/utils.h",
"chars": 672,
"preview": "#ifndef RUNNER_UTILS_H_\n#define RUNNER_UTILS_H_\n\n#include <string>\n#include <vector>\n\n// Creates a console for the proce"
},
{
"path": "windows/runner/win32_window.cpp",
"chars": 8534,
"preview": "#include \"win32_window.h\"\n\n#include <dwmapi.h>\n#include <flutter_windows.h>\n\n#include \"resource.h\"\n\nnamespace {\n\n/// Win"
},
{
"path": "windows/runner/win32_window.h",
"chars": 3522,
"preview": "#ifndef RUNNER_WIN32_WINDOW_H_\n#define RUNNER_WIN32_WINDOW_H_\n\n#include <windows.h>\n\n#include <functional>\n#include <mem"
}
]
About this extraction
This page contains the full source code of the fanenr/flutter-chatbot GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 77 files (378.0 KB), approximately 88.9k tokens, and a symbol index with 343 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.