@galaxycore/ai-chat 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +1 -1
- package/dist/{appearance-BUtKwRL5.d.ts → appearance-Bcj6SrBr.d.ts} +2 -2
- package/dist/appearance.d.ts +1 -1
- package/dist/appearance.js +1 -1
- package/dist/{labels-a_-_yLBi.d.ts → branches-4UjruXJV.d.ts} +97 -2
- package/dist/branches-MrtWHEkd.js +332 -0
- package/dist/branches-MrtWHEkd.js.map +1 -0
- package/dist/context.js +1 -1
- package/dist/headless.d.ts +2 -2
- package/dist/headless.js +2 -2
- package/dist/index.d.ts +24 -3
- package/dist/index.js +239 -82
- package/dist/index.js.map +1 -1
- package/dist/styles.css +9 -0
- package/dist/{ui-primitives-BCbe9Ds8.js → ui-primitives-BJFXxysT.js} +5 -2
- package/dist/{ui-primitives-BCbe9Ds8.js.map → ui-primitives-BJFXxysT.js.map} +1 -1
- package/package.json +1 -1
- package/dist/labels-BM5o9a9K.js +0 -116
- package/dist/labels-BM5o9a9K.js.map +0 -1
package/dist/labels-BM5o9a9K.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useChat } from "@ai-sdk/react";
|
|
3
|
-
//#region src/use-ai-chat.ts
|
|
4
|
-
/** Preserves the SDK's typed contract and throttles visual stream updates to 25 fps. */
|
|
5
|
-
function useAiChat(options = {}) {
|
|
6
|
-
const chat = useChat({
|
|
7
|
-
throttle: 40,
|
|
8
|
-
...options
|
|
9
|
-
});
|
|
10
|
-
return {
|
|
11
|
-
...chat,
|
|
12
|
-
isBusy: chat.status === "submitted" || chat.status === "streaming"
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/labels.ts
|
|
17
|
-
const zhCN = {
|
|
18
|
-
title: "AI 助手",
|
|
19
|
-
assistant: "助手",
|
|
20
|
-
user: "你",
|
|
21
|
-
placeholder: "输入消息,与 AI 一起探索",
|
|
22
|
-
send: "发送消息",
|
|
23
|
-
stop: "停止生成",
|
|
24
|
-
attach: "添加附件",
|
|
25
|
-
removeAttachment: "移除附件",
|
|
26
|
-
uploading: "上传中",
|
|
27
|
-
uploadFailed: "附件上传失败,请重新添加",
|
|
28
|
-
tooManyFiles: "附件数量超过限制",
|
|
29
|
-
fileTooLarge: "文件大小超过限制",
|
|
30
|
-
fileNotAccepted: "不支持此文件类型",
|
|
31
|
-
emptyTitle: "有什么可以帮你?",
|
|
32
|
-
emptyDescription: "整理思路、理解资料,或从一个问题开始。",
|
|
33
|
-
thinking: "正在思考",
|
|
34
|
-
reasoning: "思考过程",
|
|
35
|
-
sources: "参考来源",
|
|
36
|
-
copy: "复制回答",
|
|
37
|
-
copied: "已复制",
|
|
38
|
-
regenerate: "重新生成",
|
|
39
|
-
retry: "重试",
|
|
40
|
-
error: "暂时无法完成回答,请重试。",
|
|
41
|
-
dismiss: "关闭提示",
|
|
42
|
-
jumpToLatest: "回到最新消息",
|
|
43
|
-
approve: "允许",
|
|
44
|
-
reject: "拒绝",
|
|
45
|
-
tool: "工具调用",
|
|
46
|
-
toolInput: "输入",
|
|
47
|
-
toolOutput: "结果",
|
|
48
|
-
toolPending: "准备中",
|
|
49
|
-
toolRunning: "执行中",
|
|
50
|
-
toolComplete: "已完成",
|
|
51
|
-
toolFailed: "执行失败",
|
|
52
|
-
toolDenied: "已拒绝",
|
|
53
|
-
toolApproval: "等待你的确认",
|
|
54
|
-
toolWaiting: "等待结果",
|
|
55
|
-
toolDetails: "展开详情",
|
|
56
|
-
toolHideDetails: "收起详情",
|
|
57
|
-
suggestions: "接下来可以",
|
|
58
|
-
composerHint: "Enter 发送 · Shift + Enter 换行",
|
|
59
|
-
unsupportedPart: "此内容需要自定义渲染器",
|
|
60
|
-
disclaimer: "AI 生成的内容可能不准确,请核实重要信息。"
|
|
61
|
-
};
|
|
62
|
-
const enUS = {
|
|
63
|
-
title: "AI assistant",
|
|
64
|
-
assistant: "Assistant",
|
|
65
|
-
user: "You",
|
|
66
|
-
placeholder: "Ask a question or explore an idea",
|
|
67
|
-
send: "Send message",
|
|
68
|
-
stop: "Stop generating",
|
|
69
|
-
attach: "Attach files",
|
|
70
|
-
removeAttachment: "Remove attachment",
|
|
71
|
-
uploading: "Uploading",
|
|
72
|
-
uploadFailed: "Upload failed. Please attach the file again.",
|
|
73
|
-
tooManyFiles: "Too many attachments",
|
|
74
|
-
fileTooLarge: "File exceeds the size limit",
|
|
75
|
-
fileNotAccepted: "File type is not supported",
|
|
76
|
-
emptyTitle: "How can I help?",
|
|
77
|
-
emptyDescription: "Make sense of your documents, explore ideas, or start with a question.",
|
|
78
|
-
thinking: "Thinking",
|
|
79
|
-
reasoning: "Reasoning",
|
|
80
|
-
sources: "Sources",
|
|
81
|
-
copy: "Copy response",
|
|
82
|
-
copied: "Copied",
|
|
83
|
-
regenerate: "Regenerate",
|
|
84
|
-
retry: "Retry",
|
|
85
|
-
error: "Unable to complete the response. Please try again.",
|
|
86
|
-
dismiss: "Dismiss",
|
|
87
|
-
jumpToLatest: "Jump to latest",
|
|
88
|
-
approve: "Approve",
|
|
89
|
-
reject: "Deny",
|
|
90
|
-
tool: "Tool call",
|
|
91
|
-
toolInput: "Input",
|
|
92
|
-
toolOutput: "Result",
|
|
93
|
-
toolPending: "Preparing",
|
|
94
|
-
toolRunning: "Running",
|
|
95
|
-
toolComplete: "Completed",
|
|
96
|
-
toolFailed: "Failed",
|
|
97
|
-
toolDenied: "Denied",
|
|
98
|
-
toolApproval: "Waiting for your approval",
|
|
99
|
-
toolWaiting: "Awaiting result",
|
|
100
|
-
toolDetails: "Show details",
|
|
101
|
-
toolHideDetails: "Hide details",
|
|
102
|
-
suggestions: "Suggested next steps",
|
|
103
|
-
composerHint: "Enter to send · Shift + Enter for a new line",
|
|
104
|
-
unsupportedPart: "This content requires a custom renderer",
|
|
105
|
-
disclaimer: "AI can make mistakes. Verify important information."
|
|
106
|
-
};
|
|
107
|
-
function resolveLabels(overrides) {
|
|
108
|
-
return {
|
|
109
|
-
...zhCN,
|
|
110
|
-
...overrides
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
//#endregion
|
|
114
|
-
export { useAiChat as i, resolveLabels as n, zhCN as r, enUS as t };
|
|
115
|
-
|
|
116
|
-
//# sourceMappingURL=labels-BM5o9a9K.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"labels-BM5o9a9K.js","names":[],"sources":["../src/use-ai-chat.ts","../src/labels.ts"],"sourcesContent":["\"use client\";\n\nimport { useChat } from '@ai-sdk/react';\nimport type { UIMessage } from 'ai';\nimport type { AiChatController, AiChatOptions } from './types';\n\n/** Preserves the SDK's typed contract and throttles visual stream updates to 25 fps. */\nexport function useAiChat<M extends UIMessage = UIMessage>(options: AiChatOptions<M> = {}): AiChatController<M> {\n const chat = useChat<M>({ throttle: 40, ...options });\n return { ...chat, isBusy: chat.status === 'submitted' || chat.status === 'streaming' };\n}\n","import type { ChatLabels } from './types';\n\nexport const zhCN: Required<ChatLabels> = {\n title: 'AI 助手', assistant: '助手', user: '你', placeholder: '输入消息,与 AI 一起探索',\n send: '发送消息', stop: '停止生成', attach: '添加附件', removeAttachment: '移除附件',\n uploading: '上传中', uploadFailed: '附件上传失败,请重新添加', tooManyFiles: '附件数量超过限制',\n fileTooLarge: '文件大小超过限制', fileNotAccepted: '不支持此文件类型',\n emptyTitle: '有什么可以帮你?', emptyDescription: '整理思路、理解资料,或从一个问题开始。',\n thinking: '正在思考', reasoning: '思考过程', sources: '参考来源', copy: '复制回答', copied: '已复制',\n regenerate: '重新生成', retry: '重试', error: '暂时无法完成回答,请重试。', dismiss: '关闭提示',\n jumpToLatest: '回到最新消息', approve: '允许', reject: '拒绝', tool: '工具调用', toolInput: '输入',\n toolOutput: '结果', toolPending: '准备中', toolRunning: '执行中', toolComplete: '已完成',\n toolFailed: '执行失败', toolDenied: '已拒绝', toolApproval: '等待你的确认',\n toolWaiting: '等待结果', toolDetails: '展开详情', toolHideDetails: '收起详情',\n suggestions: '接下来可以', composerHint: 'Enter 发送 · Shift + Enter 换行',\n unsupportedPart: '此内容需要自定义渲染器', disclaimer: 'AI 生成的内容可能不准确,请核实重要信息。',\n};\n\nexport const enUS: Required<ChatLabels> = {\n title: 'AI assistant', assistant: 'Assistant', user: 'You', placeholder: 'Ask a question or explore an idea',\n send: 'Send message', stop: 'Stop generating', attach: 'Attach files', removeAttachment: 'Remove attachment',\n uploading: 'Uploading', uploadFailed: 'Upload failed. Please attach the file again.', tooManyFiles: 'Too many attachments',\n fileTooLarge: 'File exceeds the size limit', fileNotAccepted: 'File type is not supported',\n emptyTitle: 'How can I help?', emptyDescription: 'Make sense of your documents, explore ideas, or start with a question.',\n thinking: 'Thinking', reasoning: 'Reasoning', sources: 'Sources', copy: 'Copy response', copied: 'Copied',\n regenerate: 'Regenerate', retry: 'Retry', error: 'Unable to complete the response. Please try again.', dismiss: 'Dismiss',\n jumpToLatest: 'Jump to latest', approve: 'Approve', reject: 'Deny', tool: 'Tool call', toolInput: 'Input',\n toolOutput: 'Result', toolPending: 'Preparing', toolRunning: 'Running', toolComplete: 'Completed',\n toolFailed: 'Failed', toolDenied: 'Denied', toolApproval: 'Waiting for your approval',\n toolWaiting: 'Awaiting result', toolDetails: 'Show details', toolHideDetails: 'Hide details',\n suggestions: 'Suggested next steps', composerHint: 'Enter to send · Shift + Enter for a new line',\n unsupportedPart: 'This content requires a custom renderer', disclaimer: 'AI can make mistakes. Verify important information.',\n};\n\nexport function resolveLabels(overrides?: Partial<ChatLabels>): Required<ChatLabels> {\n return { ...zhCN, ...overrides };\n}\n"],"mappings":";;;;AAOA,SAAgB,UAA2C,UAA4B,CAAC,GAAwB;CAC9G,MAAM,OAAO,QAAW;EAAE,UAAU;EAAI,GAAG;CAAQ,CAAC;CACpD,OAAO;EAAE,GAAG;EAAM,QAAQ,KAAK,WAAW,eAAe,KAA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