2026-04-19-02-26-05 集成AI撰写功能:Kimi-2.5多模态API、AI可编辑区域、Diff确认弹窗、语音与图片输入、快捷指令

This commit is contained in:
2026-04-19 02:36:20 +08:00
parent 96b295f919
commit 221daf61a5
10 changed files with 1468 additions and 9 deletions

View File

@@ -13,6 +13,8 @@ export default function SystemSettings() {
framePositions: [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60],
apiEndpoint: '',
apiKey: '',
kimiApiKey: '',
kimiApiEndpoint: '',
defaultTemplate: '',
frameMode: 'uniform'
});
@@ -79,11 +81,31 @@ export default function SystemSettings() {
};
const testApi = async () => {
if (!settings.apiEndpoint) {
alert('请先输入 API 接口地址');
const endpoint = settings.kimiApiEndpoint || 'https://api.moonshot.cn/v1';
const apiKey = settings.kimiApiKey;
if (!apiKey) {
alert('请先输入 Kimi API Key');
return;
}
alert(`正在测试连接到: ${settings.apiEndpoint}\n(模拟测试: 连接成功)`);
try {
const res = await fetch(`${endpoint.replace(/\/$/, '')}/models`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
}
});
if (res.ok) {
const data = await res.json();
const modelCount = data?.data?.length || 0;
alert(`Kimi API 连接成功!\nEndpoint: ${endpoint}\n可用模型数: ${modelCount}`);
} else {
const text = await res.text();
alert(`Kimi API 连接失败 (HTTP ${res.status})\n${text}`);
}
} catch (err: any) {
alert(`Kimi API 连接异常: ${err?.message || String(err)}`);
}
};
const resetToDefault = () => {
@@ -93,6 +115,8 @@ export default function SystemSettings() {
framePositions: [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60],
apiEndpoint: '',
apiKey: '',
kimiApiKey: '',
kimiApiEndpoint: '',
defaultTemplate: templates[0]?.id || '',
frameMode: 'uniform',
autoInsertFrames: true,
@@ -308,6 +332,28 @@ export default function SystemSettings() {
className="input-minimal"
/>
</div>
<div className="space-y-1.5">
<label className="block text-xs font-bold text-text-main uppercase tracking-wider">Kimi API Endpoint</label>
<input
type="url"
value={settings.kimiApiEndpoint}
onChange={(e) => setSettings({ ...settings, kimiApiEndpoint: e.target.value })}
placeholder="https://api.moonshot.cn/v1"
className="input-minimal"
/>
</div>
<div className="space-y-1.5">
<label className="block text-xs font-bold text-text-main uppercase tracking-wider">Kimi API Key</label>
<input
type="password"
value={settings.kimiApiKey}
onChange={(e) => setSettings({ ...settings, kimiApiKey: e.target.value })}
placeholder="sk-..."
className="input-minimal"
/>
</div>
</div>
</div>
)}