Skip to content

Commit 77e45ef

Browse files
authored
Move some lightweight deps from submodule to direct header (#15)
* Move some lightweight deps from submodule to direct header * fix
1 parent d9fd33a commit 77e45ef

File tree

10 files changed

+14922
-16
lines changed

10 files changed

+14922
-16
lines changed

.gitmodules

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
[submodule "third_party/concurrentqueue"]
2-
path = third_party/concurrentqueue
3-
url = https://github.com/cameron314/concurrentqueue.git
41
[submodule "third_party/zlib"]
52
path = third_party/zlib
63
url = https://github.com/madler/zlib.git
74
[submodule "third_party/brotli"]
85
path = third_party/brotli
96
url = https://github.com/google/brotli.git
10-
[submodule "third_party/httplib"]
11-
path = third_party/httplib
12-
url = https://github.com/yhirose/cpp-httplib.git
137
[submodule "third_party/googletest"]
148
path = third_party/googletest
159
url = https://github.com/google/googletest.git

src/providers/openai/openai_response_parser.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ GenerateResult OpenAIResponseParser::parse_success_response(
1616
result.id = response.value("id", "");
1717
result.model = response.value("model", "");
1818
result.created = response.value("created", 0);
19-
result.system_fingerprint = response.value("system_fingerprint", "");
19+
20+
// Handle system_fingerprint which can be null or string
21+
if (auto it = response.find("system_fingerprint");
22+
it != response.end() && !it->is_null()) {
23+
result.system_fingerprint = it->get<std::string>();
24+
}
2025

2126
ai::logger::log_debug("Response ID: {}, Model: {}",
2227
result.id.value_or("none"),

third_party/concurrentqueue

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
1-
# Add concurrentqueue as subdirectory
2-
add_subdirectory(
3-
${AI_SDK_THIRD_PARTY_DIR}/concurrentqueue
4-
${CMAKE_CURRENT_BINARY_DIR}/concurrentqueue
5-
)
1+
cmake_minimum_required(VERSION 3.16)
2+
project(concurrentqueue_wrapper)
3+
4+
# concurrentqueue is a header-only library, so we create an INTERFACE target
5+
add_library(concurrentqueue INTERFACE)
6+
add_library(concurrentqueue::concurrentqueue ALIAS concurrentqueue)
7+
8+
# Set the header-only directory path
9+
set(CONCURRENTQUEUE_HEADER_DIR ${AI_SDK_THIRD_PARTY_DIR}/concurrentqueue-header-only)
10+
11+
# Add include directory
12+
target_include_directories(concurrentqueue INTERFACE
13+
$<BUILD_INTERFACE:${CONCURRENTQUEUE_HEADER_DIR}>
14+
$<INSTALL_INTERFACE:include>
15+
)
16+
17+
# Require C++11 minimum (concurrentqueue's requirement)
18+
target_compile_features(concurrentqueue INTERFACE cxx_std_11)
19+
20+
# Find and link required dependencies
21+
find_package(Threads REQUIRED)
22+
target_link_libraries(concurrentqueue INTERFACE Threads::Threads)
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
This license file applies to everything in this repository except that which
2+
is explicitly annotated as being written by other authors, i.e. the Boost
3+
queue (included in the benchmarks for comparison), Intel's TBB library (ditto),
4+
dlib::pipe (ditto),
5+
the CDSChecker tool (used for verification), the Relacy model checker (ditto),
6+
and Jeff Preshing's semaphore implementation (used in the blocking queue) which
7+
has a zlib license (embedded in lightweightsempahore.h).
8+
9+
---
10+
11+
Simplified BSD License:
12+
13+
Copyright (c) 2013-2016, Cameron Desrochers.
14+
All rights reserved.
15+
16+
Redistribution and use in source and binary forms, with or without modification,
17+
are permitted provided that the following conditions are met:
18+
19+
- Redistributions of source code must retain the above copyright notice, this list of
20+
conditions and the following disclaimer.
21+
- Redistributions in binary form must reproduce the above copyright notice, this list of
22+
conditions and the following disclaimer in the documentation and/or other materials
23+
provided with the distribution.
24+
25+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
26+
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
28+
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
30+
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
32+
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
33+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34+
35+
---
36+
37+
I have also chosen to dual-license under the Boost Software License as an alternative to
38+
the Simplified BSD license above:
39+
40+
Boost Software License - Version 1.0 - August 17th, 2003
41+
42+
Permission is hereby granted, free of charge, to any person or organization
43+
obtaining a copy of the software and accompanying documentation covered by
44+
this license (the "Software") to use, reproduce, display, distribute,
45+
execute, and transmit the Software, and to prepare derivative works of the
46+
Software, and to permit third-parties to whom the Software is furnished to
47+
do so, all subject to the following:
48+
49+
The copyright notices in the Software and this entire statement, including
50+
the above license grant, this restriction and the following disclaimer,
51+
must be included in all copies of the Software, in whole or in part, and
52+
all derivative works of the Software, unless such copies or derivative
53+
works are solely in the form of machine-executable object code generated by
54+
a source language processor.
55+
56+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
57+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
58+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
59+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
60+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
61+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
62+
DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)