Merge branch 'main' into ci/release-build-once
This commit is contained in:
commit
c9a8e21759
4 files changed
+42
-17
No files matched your search
@@ -81,18 +81,19 @@ func ProviderHost(class, baseURL string) (string, error) {
|
||||
// classBaseURL mirrors the default base URL each ai-sdk provider class uses
|
||||
// when a provider sets none.
|
||||
var classBaseURL = map[string]string{
|
||||
"openai": "https://api.openai.com",
|
||||
"openaiobject": "https://api.openai.com",
|
||||
"anthropic": "https://api.anthropic.com",
|
||||
"cohere": "https://api.cohere.com",
|
||||
"deepseek": "https://api.deepseek.com",
|
||||
"gemini": "https://generativelanguage.googleapis.com",
|
||||
"groq": "https://api.groq.com",
|
||||
"minimax": "https://api.minimax.io",
|
||||
"mistral": "https://api.mistral.ai",
|
||||
"perplexity": "https://api.perplexity.ai",
|
||||
"xai": "https://api.x.ai",
|
||||
"togetherai": "https://api.together.xyz",
|
||||
"openai": "https://api.openai.com",
|
||||
"openaiobject": "https://api.openai.com",
|
||||
"anthropic": "https://api.anthropic.com",
|
||||
"cohere": "https://api.cohere.com",
|
||||
"deepseek": "https://api.deepseek.com",
|
||||
"gemini": "https://generativelanguage.googleapis.com",
|
||||
"gemini-interactions": "https://generativelanguage.googleapis.com",
|
||||
"groq": "https://api.groq.com",
|
||||
"minimax": "https://api.minimax.io",
|
||||
"mistral": "https://api.mistral.ai",
|
||||
"perplexity": "https://api.perplexity.ai",
|
||||
"xai": "https://api.x.ai",
|
||||
"togetherai": "https://api.together.xyz",
|
||||
}
|
||||
|
||||
// ModelProxyEnvFor is the environment entry list naming the proxy, its hosts
|
||||
|
||||
@@ -120,6 +120,7 @@ type chatUpdateRequest struct {
|
||||
|
||||
type chatTurnView struct {
|
||||
TurnID string `json:"turn_id"`
|
||||
InputMessageID string `json:"input_message_id,omitempty"`
|
||||
AssistantMessageID string `json:"assistant_message_id,omitempty"`
|
||||
Status messaging.TurnStatus `json:"status"`
|
||||
Error string `json:"error,omitempty"`
|
||||
@@ -263,7 +264,7 @@ func (a *chatAPI) handleChatTurns(w http.ResponseWriter, r *http.Request) {
|
||||
views := make([]chatTurnView, 0, len(turns))
|
||||
for _, turn := range turns {
|
||||
view := chatTurnView{
|
||||
TurnID: turn.TurnID, AssistantMessageID: turn.AssistantMessageID,
|
||||
TurnID: turn.TurnID, InputMessageID: turn.InputMessageID, AssistantMessageID: turn.AssistantMessageID,
|
||||
Status: turn.Status, Error: turn.Error,
|
||||
ToolCalls: make([]chatToolView, 0, len(turn.ToolCalls)),
|
||||
}
|
||||
|
||||
@@ -65,12 +65,18 @@ const create = () =>
|
||||
|
||||
const copy = () => navigator.clipboard.writeText(created.value);
|
||||
|
||||
// The token is kept until the next Revoke: Reka closes the dialog before the
|
||||
// action's click runs, so clearing it on close would drop the revoke.
|
||||
const pending = ref<PersonalToken | null>(null);
|
||||
const dialogOpen = ref(false);
|
||||
const revoke = (id: string) =>
|
||||
run(async () => {
|
||||
await api.revokeToken(id);
|
||||
await load();
|
||||
});
|
||||
const confirmRevoke = () => {
|
||||
if (pending.value) revoke(pending.value.id);
|
||||
};
|
||||
|
||||
onMounted(load);
|
||||
</script>
|
||||
@@ -106,11 +112,11 @@ onMounted(load);
|
||||
<span class="text-caption text-fg-subtle">Created <Timestamp :at="token.created_at" /></span>
|
||||
<span class="text-caption text-fg-subtle">Expires <Timestamp v-if="token.expires_at" :at="token.expires_at" /><template v-else>Never</template></span>
|
||||
<span class="text-caption text-fg-subtle">Last used <Timestamp v-if="token.last_used_at" :at="token.last_used_at" /><template v-else>Never</template></span>
|
||||
<Button variant="ghost" size="sm" class="text-danger" :disabled="busy" @click="pending = token">Revoke</Button>
|
||||
<Button variant="ghost" size="sm" class="text-danger" :disabled="busy" @click="pending = token; dialogOpen = true">Revoke</Button>
|
||||
</Item>
|
||||
</ItemGroup>
|
||||
</Section>
|
||||
<AlertDialog :open="pending !== null" @update:open="(v: boolean) => { if (!v) pending = null; }">
|
||||
<AlertDialog :open="dialogOpen" @update:open="(v: boolean) => { dialogOpen = v; }">
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>Revoke token?</AlertDialogTitle>
|
||||
@@ -118,7 +124,7 @@ onMounted(load);
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogAction @click="if (pending) { const t = pending; pending = null; revoke(t.id); }">Revoke token</AlertDialogAction>
|
||||
<AlertDialogAction @click="confirmRevoke">Revoke token</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
|
||||
+18
-1
@@ -353,13 +353,27 @@ async function readTranscript(id: string): Promise<ChatMessage[]> {
|
||||
api.chatTurns<ChatTurnView[]>(id),
|
||||
]);
|
||||
const byAssistantMessage = new Map<string, ChatTurnView>();
|
||||
// A failed turn records no reply, so its error follows the message it failed on.
|
||||
const failedByInput = new Map<string, ChatTurnView>();
|
||||
for (const turn of turns || []) {
|
||||
const assistantID = turn.assistant_message_id || turn.AssistantMessageID;
|
||||
if (assistantID) byAssistantMessage.set(assistantID, turn);
|
||||
else if (turn.status === "failed" && turn.input_message_id)
|
||||
failedByInput.set(turn.input_message_id, turn);
|
||||
}
|
||||
return (msgs || []).map((message) => {
|
||||
return (msgs || []).flatMap((message) => {
|
||||
const messageID = message.message_id || message.MessageID;
|
||||
const turn = messageID ? byAssistantMessage.get(messageID) : undefined;
|
||||
const failed = messageID ? failedByInput.get(messageID) : undefined;
|
||||
if (failed)
|
||||
return [
|
||||
message,
|
||||
{
|
||||
from: "assistant",
|
||||
text: `Unable to complete that turn: ${failed.error || "unknown error"}`,
|
||||
tool_calls: failed.tool_calls || [],
|
||||
},
|
||||
];
|
||||
return turn
|
||||
? { ...message, tool_calls: turn.tool_calls || turn.ToolCalls || [] }
|
||||
: message;
|
||||
@@ -395,6 +409,9 @@ function isCurrentSession(id: string): boolean {
|
||||
|
||||
/** One recorded turn, as GET /api/chat/sessions/{id}/turns returns it. */
|
||||
interface ChatTurnView {
|
||||
input_message_id?: string;
|
||||
status?: string;
|
||||
error?: string;
|
||||
assistant_message_id?: string;
|
||||
AssistantMessageID?: string;
|
||||
tool_calls?: ChatToolCall[];
|
||||
|
||||
Reference in new issue
Block a user