Skip to content

Commit 24acfea

Browse files
committed
Thinking indicator under chat
1 parent 5d748c5 commit 24acfea

File tree

10 files changed

+872
-224
lines changed

10 files changed

+872
-224
lines changed

src/ifcchat/app.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ const apiKeyLabelEl = $("apiKeyLabel");
110110
const baseUrlRowEl = $("baseUrlRow");
111111
const baseUrlLabelEl = $("baseUrlLabel");
112112
const baseUrlEl = $("baseUrl");
113+
const thinkingIndicatorEl = $("thinkingIndicator");
113114
const modelEl = $("model");
114115
const providerEl = $("provider");
115116
const ifcFileEl = $("ifcFile");
@@ -180,12 +181,14 @@ function addMessage(role, text) {
180181
wrap.querySelector(".chevron").style.transform = expanded ? '' : 'rotate(90deg)';
181182
}
182183
}
183-
msgsEl.appendChild(wrap);
184+
msgsEl.insertBefore(wrap, thinkingIndicatorEl);
184185
msgsEl.scrollTop = msgsEl.scrollHeight;
185186
}
186187

187188
function setStatus(text) {
188189
statusEl.textContent = text;
190+
thinkingIndicatorEl.hidden = text !== "Thinking…";
191+
msgsEl.scrollTop = msgsEl.scrollHeight;
189192
}
190193

191194
const worker = new Worker("./ifc_worker.js", { type: "module" });

src/ifcchat/index.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@
9696
</div>
9797
</header>
9898

99-
<div class="msgs" id="msgs"></div>
99+
<div class="msgs" id="msgs">
100+
<div class="thinking-indicator" id="thinkingIndicator" hidden>
101+
<span class="spinner"></span>
102+
<span>thinking...</span>
103+
</div>
104+
</div>
100105
<div class="composer">
101106
<div class="inner">
102107
<textarea id="input" placeholder="Ask or instruct about the IFC model…"></textarea>

src/ifcchat/style.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,23 @@ main {
5353
margin: 10px 0;
5454
}
5555

56+
.thinking-indicator {
57+
display: inline-flex;
58+
align-items: center;
59+
gap: 10px;
60+
color: #555;
61+
font-size: 80%;
62+
}
63+
64+
.thinking-indicator[hidden] {
65+
display: none;
66+
}
67+
68+
.thinking-indicator .spinner {
69+
width: 14px;
70+
height: 14px;
71+
}
72+
5673
.msg .role {
5774
font-size: 12px;
5875
opacity: 0.7;

src/ifcgeom/mapping/IfcPointByDistanceExpression.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPointByDistanceExpression* i
5252
if (inst->OffsetVertical().has_value()) {
5353
auto offset_vertical = inst->OffsetVertical().get() * length_unit_;
5454
o += offset_vertical * z;
55+
56+
auto tmp1 = (z * offset_vertical).eval();
57+
auto tmp2 = (Eigen::Vector3d(0, 0, 1) * offset_vertical).eval();
58+
auto tmp3 = (tmp1 - tmp2).eval();
59+
60+
std::ostringstream oss;
61+
oss << "local z: " << z.x() << "," << z.y() << "," << z.z() << "; delta: " << tmp3.x() << "," << tmp3.y() << "," << tmp3.z();
62+
auto osss = oss.str();
63+
std::wcout << osss.c_str() << std::endl;
5564
}
5665

5766
if (inst->OffsetLongitudinal().has_value()) {

src/ifcopenshell-python/ifcopenshell/draw.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343
DO_NOTHING = lambda *args: None
4444

45+
ARRANGE_POLYGON_SETTINGS = W.arrange_polygon_settings() if hasattr(W, 'arrange_polygon_settings') else None
4546

4647
@dataclass
4748
class draw_settings:
@@ -536,7 +537,7 @@ def has_relevant_zone(i):
536537
*(tup for i, tup in enumerate(zip(path_objects, section_polies, polies)) if has_relevant_zone(i))
537538
)
538539

539-
arranged = W.arrange_polygons(polies)
540+
arranged = W.arrange_polygons(*filter(None, (ARRANGE_POLYGON_SETTINGS,)), polies)
540541
svg_data_3 = W.polygons_to_svg(arranged, False)
541542
dom3 = parseString(svg_data_3)
542543
svg3 = dom3.childNodes[0]

src/ifcparse/IfcSchema.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ class IFC_PARSE_API entity : public declaration {
358358

359359
const std::vector<const entity*>& subtypes() const { return subtypes_; }
360360
const std::vector<const attribute*>& attributes() const { return attributes_; }
361+
const std::vector<const inverse_attribute*>& inverse_attributes() const { return inverse_attributes_; }
361362
const std::vector<bool>& derived() const { return derived_; }
362363

363364
const std::vector<const attribute*> all_attributes() const {

src/ifcwrap/IfcGeomWrapper.i

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,7 @@ ifcopenshell::geometry::taxonomy::item::ptr try_upcast(PyObject* obj0, swig_type
11661166
%ignore svgfill::line_segments_to_polygons;
11671167
%ignore svgfill::svg_to_polygons;
11681168
%ignore svgfill::arrange_polygons;
1169+
%ignore svgfill::abstract_arrangement;
11691170

11701171
%template(svg_line_segments) std::vector<std::array<svgfill::point_2, 2>>;
11711172
%template(svg_groups_of_line_segments) std::vector<std::vector<std::array<svgfill::point_2, 2>>>;
@@ -1287,9 +1288,9 @@ ifcopenshell::geometry::taxonomy::item::ptr try_upcast(PyObject* obj0, swig_type
12871288
}
12881289
}
12891290

1290-
std::vector<svgfill::polygon_2> arrange_polygons(const std::vector<svgfill::polygon_2>& polygons) {
1291+
std::vector<svgfill::polygon_2> arrange_polygons(svgfill::arrange_polygon_settings settings, const std::vector<svgfill::polygon_2>& polygons) {
12911292
std::vector<svgfill::polygon_2> r;
1292-
if (svgfill::arrange_polygons(polygons, r)) {
1293+
if (svgfill::arrange_polygons(settings, polygons, r)) {
12931294
return r;
12941295
} else {
12951296
throw std::runtime_error("Failed to arrange polygons");

0 commit comments

Comments
 (0)