mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-05-12 02:09:42 +08:00
- AI 兼容性:为 Anthropic Provider 补齐 tools/tool_use/tool_result 协议转换,支持工具调用与流式工具结果解析 - 降级策略:OpenAI 兼容接口在 tools 请求返回 400/422/404 时自动回退为纯文本模式 - 配置修复:调整 MiniMax 预设为 Anthropic 兼容端点并更新默认模型列表 - 状态隔离:AI 聊天面板停止将动态模型列表写回供应商配置,避免污染静态 models 数据 - 编辑器修复:QueryEditor 在 runImmediately 场景下避免重复追加 SQL,改为直接选中并执行 - 交互优化:修复 macOS 原生窗口控制切换与标题栏点击行为,避免窗口按钮状态异常
74 lines
2.1 KiB
Go
74 lines
2.1 KiB
Go
//go:build darwin
|
|
|
|
package app
|
|
|
|
/*
|
|
#cgo CFLAGS: -x objective-c -fblocks
|
|
#cgo LDFLAGS: -framework Cocoa
|
|
#import <Cocoa/Cocoa.h>
|
|
#import <dispatch/dispatch.h>
|
|
|
|
static inline BOOL gonaviBoolYES() { return YES; }
|
|
static inline BOOL gonaviBoolNO() { return NO; }
|
|
|
|
static void gonaviSetWindowButtonsVisible(NSWindow *window, BOOL visible) {
|
|
if (window == nil) {
|
|
return;
|
|
}
|
|
for (NSWindowButton buttonType = NSWindowCloseButton; buttonType <= NSWindowZoomButton; buttonType++) {
|
|
NSButton *button = [window standardWindowButton:buttonType];
|
|
if (button != nil) {
|
|
[button setHidden:!visible];
|
|
[button setEnabled:visible];
|
|
}
|
|
}
|
|
}
|
|
|
|
static void gonaviApplyMacWindowStyle(BOOL enabled) {
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
for (NSWindow *window in [NSApp windows]) {
|
|
if (window == nil) {
|
|
continue;
|
|
}
|
|
|
|
NSUInteger styleMask = [window styleMask];
|
|
styleMask |= NSWindowStyleMaskClosable;
|
|
styleMask |= NSWindowStyleMaskMiniaturizable;
|
|
styleMask |= NSWindowStyleMaskResizable;
|
|
|
|
if (enabled) {
|
|
styleMask |= NSWindowStyleMaskTitled;
|
|
styleMask |= NSWindowStyleMaskFullSizeContentView;
|
|
[window setStyleMask:styleMask];
|
|
[window setTitleVisibility:NSWindowTitleHidden];
|
|
[window setTitlebarAppearsTransparent:YES];
|
|
[window setMovableByWindowBackground:YES];
|
|
[window setCollectionBehavior:[window collectionBehavior] | NSWindowCollectionBehaviorFullScreenPrimary];
|
|
gonaviSetWindowButtonsVisible(window, YES);
|
|
} else {
|
|
styleMask &= ~NSWindowStyleMaskTitled;
|
|
styleMask &= ~NSWindowStyleMaskFullSizeContentView;
|
|
[window setStyleMask:styleMask];
|
|
[window setTitleVisibility:NSWindowTitleVisible];
|
|
[window setTitlebarAppearsTransparent:NO];
|
|
[window setMovableByWindowBackground:YES];
|
|
gonaviSetWindowButtonsVisible(window, NO);
|
|
}
|
|
|
|
[[window contentView] setNeedsDisplay:YES];
|
|
[window invalidateShadow];
|
|
}
|
|
});
|
|
}
|
|
*/
|
|
import "C"
|
|
|
|
func setMacNativeWindowControls(enabled bool) {
|
|
state := resolveMacNativeWindowControlState(enabled)
|
|
if state.ShowNativeButtons {
|
|
C.gonaviApplyMacWindowStyle(C.gonaviBoolYES())
|
|
} else {
|
|
C.gonaviApplyMacWindowStyle(C.gonaviBoolNO())
|
|
}
|
|
}
|