Skip to content

Commit 4f032cd

Browse files
committed
fix: decouple desktop usage from Kimi OAuth
1 parent ae93c0d commit 4f032cd

1 file changed

Lines changed: 12 additions & 40 deletions

File tree

‎apps/kimi-code/src/App.tsx‎

Lines changed: 12 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1952,7 +1952,7 @@ export default function App() {
19521952
try {
19531953
const nextModels = await invoke<Model[]>("list_models");
19541954
setModels(nextModels);
1955-
if (nextModels.length === 0) showNotice("当前账号没有可用模型");
1955+
if (nextModels.length === 0) showNotice("配置中没有可用模型");
19561956
} catch (error) {
19571957
showNotice(conciseError(error));
19581958
} finally {
@@ -2117,12 +2117,7 @@ export default function App() {
21172117

21182118
useEffect(() => {
21192119
setActiveAgentScope(undefined);
2120-
if (
2121-
!auth.loggedIn ||
2122-
!activeProject ||
2123-
!activeConversation ||
2124-
!selectedModel
2125-
) {
2120+
if (!activeProject || !activeConversation || !selectedModel) {
21262121
return;
21272122
}
21282123
let disposed = false;
@@ -2182,7 +2177,6 @@ export default function App() {
21822177
}, [
21832178
activeConversation?.id,
21842179
activeProject?.path,
2185-
auth.loggedIn,
21862180
models.length,
21872181
refreshBackgroundTasks,
21882182
]);
@@ -2525,7 +2519,7 @@ export default function App() {
25252519

25262520
useEffect(() => {
25272521
const conversationId = activeConversation?.id;
2528-
if (!conversationId || !auth.loggedIn) return;
2522+
if (!conversationId) return;
25292523
let active = true;
25302524
invoke<ContextUsage | null>("conversation_context_usage", {
25312525
sessionId: conversationId,
@@ -2543,7 +2537,7 @@ export default function App() {
25432537
return () => {
25442538
active = false;
25452539
};
2546-
}, [activeConversation?.id, auth.loggedIn]);
2540+
}, [activeConversation?.id]);
25472541

25482542
const updateActiveOutlineTurn = useCallback((): void => {
25492543
const scroll = scrollRef.current;
@@ -2879,13 +2873,9 @@ export default function App() {
28792873
event?: MouseEvent<HTMLButtonElement>,
28802874
): Promise<void> => {
28812875
event?.stopPropagation();
2882-
if (!auth.loggedIn) {
2883-
void startLogin();
2884-
return;
2885-
}
28862876
const model = selectedModel ?? models[0];
28872877
if (!model) {
2888-
showNotice("请先同步并选择一个模型");
2878+
showNotice("请先配置并选择一个模型");
28892879
return;
28902880
}
28912881
try {
@@ -3111,23 +3101,12 @@ export default function App() {
31113101
try {
31123102
const status = await invoke<AuthStatus>("logout");
31133103
setAuth(status);
3114-
releaseAllAgentSubscriptions();
3115-
setModels([]);
31163104
accountUsageRequest.current += 1;
31173105
setAccountUsage(undefined);
31183106
setAccountUsageBusy(false);
31193107
setAccountUsageError(undefined);
3120-
setContextUsages({});
3121-
setCompactionHistoryReady({});
3122-
setAgentUsages({});
3123-
setSessionTodos({});
3124-
setSubagentRuns({});
3125-
setSubagentLiveTurns({});
3126-
setQueuedPrompts({});
3127-
setMessageDurations({});
31283108
setProfileOpen(false);
3129-
closeSideChat();
3130-
showNotice("已退出登录");
3109+
showNotice("已退出 Kimi Code 登录");
31313110
} catch (error) {
31323111
showNotice(conciseError(error));
31333112
}
@@ -3376,12 +3355,8 @@ export default function App() {
33763355
) {
33773356
return;
33783357
}
3379-
if (!auth.loggedIn) {
3380-
void startLogin();
3381-
return;
3382-
}
33833358
if (!selectedModel) {
3384-
showNotice("请先同步并选择一个模型");
3359+
showNotice("请先配置并选择一个模型");
33853360
return;
33863361
}
33873362
if (
@@ -4371,8 +4346,8 @@ export default function App() {
43714346
</div>
43724347
<div className="header-actions">
43734348
<span className="connection-pill">
4374-
<i className={auth.loggedIn ? "online" : ""} />
4375-
{auth.loggedIn ? "Core v2 已连接" : "等待登录"}
4349+
<i className="online" />
4350+
Core v2 已连接
43764351
</span>
43774352
<button className="icon-button" title="新建对话" onClick={() => void createConversation(activeProject)}>
43784353
<SquarePen size={17} />
@@ -4767,9 +4742,7 @@ export default function App() {
47674742
? "计划模式:描述需要分析和规划的任务…"
47684743
: isStreaming
47694744
? "继续输入;发送后将加入队列…"
4770-
: auth.loggedIn
4771-
? "告诉 Kimi 你想完成什么…"
4772-
: "登录后开始与 Kimi Code 对话…"
4745+
: "告诉模型你想完成什么…"
47734746
}
47744747
rows={1}
47754748
disabled={modelBusy || hasBlockingInteraction}
@@ -4905,8 +4878,7 @@ export default function App() {
49054878
label={
49064879
modelsBusy
49074880
? "同步模型中…"
4908-
: selectedModel?.displayName ??
4909-
(auth.loggedIn ? "暂无模型" : "登录后选择模型")
4881+
: selectedModel?.displayName ?? "暂无可用模型"
49104882
}
49114883
disabled={
49124884
modelsBusy ||
@@ -5023,7 +4995,7 @@ export default function App() {
50234995
</div>
50244996
</form>
50254997
<p className="composer-caption">
5026-
Kimi 可能会犯错,请检查生成的代码和重要信息。
4998+
模型可能会犯错,请检查生成的代码和重要信息。
50274999
</p>
50285000
</div>
50295001
</>

0 commit comments

Comments
 (0)